@popmelt.com/core 0.31.3 → 0.32.1

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.
Files changed (35) hide show
  1. package/README.md +43 -0
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  4. package/dist/{ParticipantRuntime-X2ZI2GJF.mjs → ParticipantRuntime-5KRRPLWL.mjs} +1 -1
  5. package/dist/SuppliedContext-NURVPZ4L.mjs +2 -0
  6. package/dist/ThreadErrorCard-WZ2UBVWE.mjs +2 -0
  7. package/dist/bridge-entry.mjs +1 -1
  8. package/dist/{browser-runtime-6N65USFN.mjs → browser-runtime-3EQH4ZUO.mjs} +1 -1
  9. package/dist/browser.d.mts +2 -2
  10. package/dist/browser.mjs +1 -1
  11. package/dist/{chunk-SKOSDB5K.mjs → chunk-4BQQAQ3P.mjs} +94 -92
  12. package/dist/{chunk-JU7D4I76.mjs → chunk-C3VWS5R6.mjs} +2 -2
  13. package/dist/chunk-CGOQSIDR.mjs +342 -0
  14. package/dist/{chunk-JGNVTID4.mjs → chunk-GDLI772N.mjs} +1 -1
  15. package/dist/{chunk-ZGERZLB4.mjs → chunk-HGXCQKB6.mjs} +1 -1
  16. package/dist/{chunk-6C4FAOTC.mjs → chunk-ROIC72KJ.mjs} +1 -1
  17. package/dist/{chunk-X3UK5M3S.mjs → chunk-U2MTWKH3.mjs} +1 -1
  18. package/dist/{chunk-UJ5PA3SZ.mjs → chunk-XQV7EM46.mjs} +91 -89
  19. package/dist/cli.mjs +2 -2
  20. package/dist/codex-note-context-OYDZYZXX.mjs +2 -0
  21. package/dist/{codex-project-JYNETLSG.mjs → codex-project-XLVIKWAE.mjs} +1 -1
  22. package/dist/{focus-inspection-WPHGCN6Y.mjs → focus-inspection-G72JLJYG.mjs} +1 -1
  23. package/dist/index.d.mts +2 -2
  24. package/dist/index.mjs +1 -1
  25. package/dist/{participantBootstrap-B0lvfCwM.d.mts → participantBootstrap-ClKpD2qC.d.mts} +14 -1
  26. package/dist/{peer-client-STR2FWR4.mjs → peer-client-5D6UOMB3.mjs} +1 -1
  27. package/dist/plugin-astro.mjs +1 -1
  28. package/dist/plugin-nuxt.mjs +1 -1
  29. package/dist/plugin-vite.mjs +1 -1
  30. package/dist/server.mjs +1 -1
  31. package/package.json +2 -1
  32. package/dist/ThreadErrorCard-6QN2ECBT.mjs +0 -2
  33. package/dist/chunk-M6LCEEFH.mjs +0 -327
  34. package/dist/codex-note-context-KSRJRH3F.mjs +0 -2
  35. /package/dist/{chunk-WMHM647D.mjs → chunk-DIFC23QP.mjs} +0 -0
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{c as f}from"./chunk-X3UK5M3S.mjs";import{A as d,c as p}from"./chunk-SKOSDB5K.mjs";import{e as c}from"./chunk-IKCHOC3U.mjs";async function S(t,e){let r=await c(t);if(!r||!e)return[];let n=await p(t,e);return n.length?(await Promise.all([r,...r.mountedStores].map(async i=>{try{let o=await f(i,t);if(!o)return[];let{endpoint:u,request:m}=o,s=[];for(let l of n){let a=await d(u,"/participants/read-canvas-receipt",{...m,method:"POST",body:JSON.stringify({receiptId:l})});a.response.ok&&s.push({storeId:i.storeId,receipt:a.body})}return s}catch{return[]}}))).flat():[]}export{S as a};
2
+ import{c as f}from"./chunk-U2MTWKH3.mjs";import{A as d,c as p}from"./chunk-4BQQAQ3P.mjs";import{e as c}from"./chunk-IKCHOC3U.mjs";async function S(t,e){let r=await c(t);if(!r||!e)return[];let n=await p(t,e);return n.length?(await Promise.all([r,...r.mountedStores].map(async i=>{try{let o=await f(i,t);if(!o)return[];let{endpoint:u,request:m}=o,s=[];for(let l of n){let a=await d(u,"/participants/read-canvas-receipt",{...m,method:"POST",body:JSON.stringify({receiptId:l})});a.response.ok&&s.push({storeId:i.storeId,receipt:a.body})}return s}catch{return[]}}))).flat():[]}export{S as a};
@@ -22,7 +22,7 @@ ${t}`,[o,i]=A({linked:!1,error:"",key:""});return D(()=>{if(i({linked:!1,error:"
22
22
  [data-popmelt-session-connection] .lucide-loader-circle { animation: popmelt-connection-spin .8s linear infinite; }
23
23
  [data-popmelt-session-connection] > svg { flex-shrink: 0; }
24
24
  @media (prefers-reduced-motion: reduce) { [data-popmelt-session-connection] .lucide-loader-circle { animation: none; } }
25
- `}),y("button",{"data-popmelt-session-connection":!0,type:"button",disabled:v,title:Q,"aria-label":`${F}. ${Q}`,"aria-busy":v,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onFocus:()=>h(!0),onBlur:()=>h(!1),onClick:()=>{se()},style:{...pn(Ee[e],T),cursor:v?"default":"pointer",minWidth:0,maxWidth:"100%"},children:[v||n&&!T?l(Xn,{size:14,strokeWidth:1.5,"aria-hidden":"true"}):T||$?l(Co,{size:14,strokeWidth:1.5,"aria-hidden":"true"}):l(ca,{size:14,strokeWidth:1.5,"aria-hidden":"true"}),y("span",{style:{display:"inline-grid",textAlign:"left",whiteSpace:"nowrap",position:"relative",minWidth:0},children:[z.map(me=>l("span",{"aria-hidden":"true",style:{gridArea:"1 / 1",visibility:"hidden",pointerEvents:"none",overflow:"hidden"},children:me},me)),l("span",{"data-popmelt-connection-label":!0,title:F,style:{position:"absolute",inset:0,overflow:"hidden",textOverflow:"ellipsis"},children:F})]})]})]})}function $n(e){return e<=767}function fn(e){return $n(e)?8:16}function wt(e){let t=fn(e);return e<=480?Math.max(0,e-t*2):Math.min(360,Math.max(0,e-t*2))}var hn=16,Ke=40,Pt=8,va="popmelt-toolbar-snap-position";function mn(e){return e.startsWith("top-")}function An(e){return e.endsWith("-right")}function Yn(e){return e.endsWith("-center")}function xa(){try{let e=localStorage.getItem(va);if(e&&Bc(e))return e}catch{}return"bottom-right"}function wa(e){try{localStorage.setItem(va,e)}catch{}}function Bc(e){return["bottom-right","bottom-center","bottom-left","top-right","top-center","top-left"].includes(e)}function Dc(e,t,n){let r=$n(t),o=fn(t),i=mn(e)?r?`max(${o}px, env(safe-area-inset-top))`:o:r?"auto":n-o-Ke,a=!mn(e)&&r?`max(${o}px, env(safe-area-inset-bottom))`:void 0;return Yn(e)?{position:"fixed",top:i,bottom:a,left:"50%",transform:"translateX(-50%)"}:An(e)?{position:"fixed",top:i,bottom:a,right:r?`max(${o}px, env(safe-area-inset-right))`:o,left:"auto"}:{position:"fixed",top:i,bottom:a,left:r?`max(${o}px, env(safe-area-inset-left))`:o,right:"auto"}}function Wt(e,t,n,r=12){let o=mn(e),i=$n(t),a=fn(t),s=o?{top:i?`calc(max(${a}px, env(safe-area-inset-top)) + ${Ke+r}px)`:a+Ke+r}:{bottom:i?`calc(max(${a}px, env(safe-area-inset-bottom)) + ${Ke+r}px)`:a+Ke+r},c;return Yn(e)?c={left:"50%",transform:"translateX(-50%)"}:An(e)?c={right:i?`max(${a}px, env(safe-area-inset-right))`:a}:c={left:i?`max(${a}px, env(safe-area-inset-left))`:a},{position:"fixed",...s,...c}}function Fc(e,t,n){let r=mn(e),o=$n(t),i=fn(t),a=r?{top:o?`calc(max(${i}px, env(safe-area-inset-top)) + ${Ke+8}px)`:i+Ke+8}:{bottom:o?`calc(max(${i}px, env(safe-area-inset-bottom)) + ${Ke+8}px)`:i+Ke+8},s,c;return Yn(e)?(s={left:"50%",transform:"translateX(-50%)"},c="center"):An(e)?(s={right:o?`max(${i}px, env(safe-area-inset-right))`:i},c="flex-end"):(s={left:o?`max(${i}px, env(safe-area-inset-left))`:i},c="flex-start"),{position:"fixed",...a,...s,zIndex:9999,display:"flex",flexDirection:"column",alignItems:c}}function Vc(e,t=typeof window<"u"?window.innerWidth:1920){let n=mn(e),r=An(e)||Yn(e),o=$n(t),i=fn(t),a=n&&r?i+Ke+Pt:i,s=!n&&r?i+Ke+Pt:i;return{position:"fixed",top:o?`max(${a}px, env(safe-area-inset-top))`:a,right:o?`max(${i}px, env(safe-area-inset-right))`:i,bottom:o?`max(${s}px, env(safe-area-inset-bottom))`:s,width:wt(t)}}function Qc(e,t,n){let r=wt(t),o=fn(t),i=mn(e),a,s;An(e)||Yn(e)?(a=t-o,s=a-r):(s=o,a=s+r);let c=i?o+Ke+Pt:n-o-Ke-Pt;return{left:s,right:a,y:c}}var _c=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],Ca=100,St=200,Mr={surface:null,phase:"visible"};function So({openDelayMs:e=Ca,exitDurationMs:t=St,pinnedSurface:n=null}={}){let[r,o]=A(Mr),i=I(Mr),a=I(null),s=I(n);s.current=n;let c=I(null),d=I(null),u=ie(w=>{i.current.surface===w.surface&&i.current.phase===w.phase||(i.current=w,o(w))},[]),p=ie(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]),m=ie(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),h=ie(w=>{a.current=w,p(),m(),u({surface:w,phase:"visible"})},[m,p,u]),v=ie(w=>{if(!(s.current&&i.current.surface===s.current&&w!==s.current)){if(a.current=w,p(),m(),i.current.surface!==null){u({surface:w,phase:"visible"});return}c.current=setTimeout(()=>{c.current=null,a.current===w&&u({surface:w,phase:"visible"})},e)}},[m,p,e,u]),x=ie(w=>{w!==s.current&&(a.current===w&&(a.current=null),p(),i.current.surface===w&&(m(),u({surface:w,phase:"exiting"}),d.current=setTimeout(()=>{d.current=null,a.current===null&&u(Mr)},t)))},[m,p,t,u]),M=ie(w=>{w&&i.current.surface!==w||(a.current=null,p(),m(),u(Mr))},[m,p,u]);return Ze(()=>{n&&i.current.surface===n&&h(n)},[n,h]),D(()=>()=>{p(),m()},[m,p]),{surface:r.surface,phase:r.phase,enter:v,leave:x,show:h,dismiss:M}}var Zc={version:"0.31.3"},ka=Zc.version;function Io({theme:e,expanded:t,width:n,snapPosition:r,viewport:o,toolbarRef:i,style:a,...s}){let c=Ee[e];return l("div",{...s,ref:i,id:"devtools-toolbar",role:"toolbar","data-popmelt-theme":e,style:{...Dc(r,o.w,o.h),zIndex:9999,display:"flex",alignItems:"center",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",cursor:"pointer",overflow:"visible",transition:"none",backgroundColor:c.surface,color:c.primary,colorScheme:e,boxSizing:"border-box",border:t?0:`1px solid ${c.border}`,boxShadow:t?`0 0 0 1px ${c.border}`:void 0,borderRadius:20,padding:t?"4px 8px 4px 4px":0,width:t?n:40,height:40,gap:t?6:0,justifyContent:t?"flex-start":"center",...a}})}function Mo({expanded:e,active:t=!1,color:n,onSettlingChange:r,...o}){return l("button",{type:"button",title:e?"Collapse (\u2318\u2318)":"Open Popmelt (\u2318\u2318)",...o,style:{display:"flex",alignItems:"center",justifyContent:"center",width:e?24:40,height:e?32:40,flexShrink:0,border:"none",background:"none",padding:0,cursor:"pointer"},children:l(fa,{"data-popmelt-logo":!0,active:t,onSettlingChange:r,width:"24",height:"24",viewBox:"0 0 40 40",fill:e||t?n:"none",stroke:e||t?"none":n,strokeWidth:"1",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg"})})}function Sa({theme:e,active:t,busy:n,color:r,onSettlingChange:o,onOpen:i,onCrosshairHover:a,onMouseEnter:s,toolbarRef:c,...d}){let u=I(null);return D(()=>{let p=u.current;if(!p)return;let m=p.querySelector("[data-popmelt-logo]"),h=()=>{p.style.opacity="1",!n&&m&&(m.style.fill=Ee[e].primary,m.style.stroke="none")},v=()=>{p.style.opacity=n?"1":"0.2",!n&&m&&(m.style.fill="none",m.style.removeProperty("stroke"))};return p.addEventListener("mouseenter",h),p.addEventListener("mouseleave",v),()=>{p.removeEventListener("mouseenter",h),p.removeEventListener("mouseleave",v)}},[n,e]),l(Io,{...d,theme:e,expanded:!1,width:40,toolbarRef:p=>{u.current=p,typeof c=="function"?c(p):c&&(c.current=p)},onMouseEnter:s,style:{opacity:n?1:.2,...d.style},children:l(Mo,{expanded:!1,active:t,color:r,onSettlingChange:o,onClick:i,onMouseEnter:()=>a?.(!0),onMouseLeave:()=>a?.(!1)})})}function Ia(){let e=()=>typeof window>"u"?{w:1920,h:1080}:{w:window.visualViewport?.width??window.innerWidth,h:window.visualViewport?.height??window.innerHeight},[t,n]=A(e);return D(()=>{let r=()=>n(e());return window.addEventListener("resize",r),window.visualViewport?.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),window.visualViewport?.removeEventListener("resize",r)}},[]),t}function Ma(e){let t=I(e);t.current=e,D(()=>{let n=0,r=0,o=a=>{if(a.key!=="Meta"&&a.key!=="Control"){r=0;return}let s=Date.now();r=s-n<wr.toolbar.toggleWindowMs?r+1:1,r>=2&&(t.current(),r=0),n=s},i=a=>{a.key!=="Meta"&&a.key!=="Control"&&(r=0)};return window.addEventListener("keydown",o),window.addEventListener("keyup",i),()=>{window.removeEventListener("keydown",o),window.removeEventListener("keyup",i)}},[])}var qc=(e,t)=>({display:"flex",width:t,height:32,borderRadius:16,overflow:"hidden",background:Ee[e].control});function Jc({theme:e,icon:t,menuOpen:n=!1,interactive:r=!0,primaryLabel:o="Cycle annotations",primaryCursor:i=!1,dotColor:a,onPrimary:s,onMenu:c}){let d=Ee[e];return y("div",{"data-popmelt-compact-tool-control":!0,style:{...qc(e,46),pointerEvents:r?void 0:"none"},children:[y("button",{type:"button","aria-label":o,"aria-disabled":!r,tabIndex:r?void 0:-1,onClick:s,style:{width:26,height:32,display:"flex",alignItems:"center",justifyContent:"flex-end",position:"relative",padding:0,border:0,background:"transparent",color:d.primary,cursor:r&&i?"pointer":"default"},children:[t,a&&l("span",{"aria-hidden":"true",style:{position:"absolute",left:16,top:14,width:4,height:4,borderRadius:"50%",background:a,pointerEvents:"none"}})]}),l("button",{type:"button","aria-label":"Choose tool","aria-haspopup":"menu","aria-expanded":n,"aria-disabled":!r,tabIndex:r?void 0:-1,onClick:c,style:{width:20,height:32,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",padding:"0 6px 0 2px",border:0,background:"transparent",color:d.mutedStrong,cursor:r?"pointer":"default"},children:l(wo,{size:12,strokeWidth:2,style:{transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 120ms ease"}})})]})}function Kc({theme:e,themePreference:t=e,onThemePreferenceChange:n,action:r,logoOnly:o=!1,connection:i,panel:a,deemphasizeControls:s=!1,onCollapse:c,ariaLabel:d="Popmelt admission"}){let[u,p]=A(()=>!o),[m,h]=A(xa),v=I(null),x=So(),{leave:M,dismiss:w}=x,$=x.surface!==null&&x.phase==="visible",E=Ia(),z=()=>{if(u){w(),c?.(),p(!1);return}p(!0),o&&x.show("popmelt-guide")};return Ma(z),D(()=>{let C=v.current;if(!C)return;let L=H=>{H.relatedTarget instanceof Node&&C.contains(H.relatedTarget)||M("popmelt-guide")};return C.addEventListener("pointerout",L),()=>C.removeEventListener("pointerout",L)},[u,M]),u?y("div",{ref:v,style:{display:"contents"},onKeyDown:C=>{C.key==="Escape"&&w()},onBlur:C=>{C.relatedTarget instanceof Node&&v.current?.contains(C.relatedTarget)||M("popmelt-guide")},children:[l("style",{children:`
25
+ `}),y("button",{"data-popmelt-session-connection":!0,type:"button",disabled:v,title:Q,"aria-label":`${F}. ${Q}`,"aria-busy":v,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onFocus:()=>h(!0),onBlur:()=>h(!1),onClick:()=>{se()},style:{...pn(Ee[e],T),cursor:v?"default":"pointer",minWidth:0,maxWidth:"100%"},children:[v||n&&!T?l(Xn,{size:14,strokeWidth:1.5,"aria-hidden":"true"}):T||$?l(Co,{size:14,strokeWidth:1.5,"aria-hidden":"true"}):l(ca,{size:14,strokeWidth:1.5,"aria-hidden":"true"}),y("span",{style:{display:"inline-grid",textAlign:"left",whiteSpace:"nowrap",position:"relative",minWidth:0},children:[z.map(me=>l("span",{"aria-hidden":"true",style:{gridArea:"1 / 1",visibility:"hidden",pointerEvents:"none",overflow:"hidden"},children:me},me)),l("span",{"data-popmelt-connection-label":!0,title:F,style:{position:"absolute",inset:0,overflow:"hidden",textOverflow:"ellipsis"},children:F})]})]})]})}function $n(e){return e<=767}function fn(e){return $n(e)?8:16}function wt(e){let t=fn(e);return e<=480?Math.max(0,e-t*2):Math.min(360,Math.max(0,e-t*2))}var hn=16,Ke=40,Pt=8,va="popmelt-toolbar-snap-position";function mn(e){return e.startsWith("top-")}function An(e){return e.endsWith("-right")}function Yn(e){return e.endsWith("-center")}function xa(){try{let e=localStorage.getItem(va);if(e&&Bc(e))return e}catch{}return"bottom-right"}function wa(e){try{localStorage.setItem(va,e)}catch{}}function Bc(e){return["bottom-right","bottom-center","bottom-left","top-right","top-center","top-left"].includes(e)}function Dc(e,t,n){let r=$n(t),o=fn(t),i=mn(e)?r?`max(${o}px, env(safe-area-inset-top))`:o:r?"auto":n-o-Ke,a=!mn(e)&&r?`max(${o}px, env(safe-area-inset-bottom))`:void 0;return Yn(e)?{position:"fixed",top:i,bottom:a,left:"50%",transform:"translateX(-50%)"}:An(e)?{position:"fixed",top:i,bottom:a,right:r?`max(${o}px, env(safe-area-inset-right))`:o,left:"auto"}:{position:"fixed",top:i,bottom:a,left:r?`max(${o}px, env(safe-area-inset-left))`:o,right:"auto"}}function Wt(e,t,n,r=12){let o=mn(e),i=$n(t),a=fn(t),s=o?{top:i?`calc(max(${a}px, env(safe-area-inset-top)) + ${Ke+r}px)`:a+Ke+r}:{bottom:i?`calc(max(${a}px, env(safe-area-inset-bottom)) + ${Ke+r}px)`:a+Ke+r},c;return Yn(e)?c={left:"50%",transform:"translateX(-50%)"}:An(e)?c={right:i?`max(${a}px, env(safe-area-inset-right))`:a}:c={left:i?`max(${a}px, env(safe-area-inset-left))`:a},{position:"fixed",...s,...c}}function Fc(e,t,n){let r=mn(e),o=$n(t),i=fn(t),a=r?{top:o?`calc(max(${i}px, env(safe-area-inset-top)) + ${Ke+8}px)`:i+Ke+8}:{bottom:o?`calc(max(${i}px, env(safe-area-inset-bottom)) + ${Ke+8}px)`:i+Ke+8},s,c;return Yn(e)?(s={left:"50%",transform:"translateX(-50%)"},c="center"):An(e)?(s={right:o?`max(${i}px, env(safe-area-inset-right))`:i},c="flex-end"):(s={left:o?`max(${i}px, env(safe-area-inset-left))`:i},c="flex-start"),{position:"fixed",...a,...s,zIndex:9999,display:"flex",flexDirection:"column",alignItems:c}}function Vc(e,t=typeof window<"u"?window.innerWidth:1920){let n=mn(e),r=An(e)||Yn(e),o=$n(t),i=fn(t),a=n&&r?i+Ke+Pt:i,s=!n&&r?i+Ke+Pt:i;return{position:"fixed",top:o?`max(${a}px, env(safe-area-inset-top))`:a,right:o?`max(${i}px, env(safe-area-inset-right))`:i,bottom:o?`max(${s}px, env(safe-area-inset-bottom))`:s,width:wt(t)}}function Qc(e,t,n){let r=wt(t),o=fn(t),i=mn(e),a,s;An(e)||Yn(e)?(a=t-o,s=a-r):(s=o,a=s+r);let c=i?o+Ke+Pt:n-o-Ke-Pt;return{left:s,right:a,y:c}}var _c=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"],Ca=100,St=200,Mr={surface:null,phase:"visible"};function So({openDelayMs:e=Ca,exitDurationMs:t=St,pinnedSurface:n=null}={}){let[r,o]=A(Mr),i=I(Mr),a=I(null),s=I(n);s.current=n;let c=I(null),d=I(null),u=ie(w=>{i.current.surface===w.surface&&i.current.phase===w.phase||(i.current=w,o(w))},[]),p=ie(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]),m=ie(()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),h=ie(w=>{a.current=w,p(),m(),u({surface:w,phase:"visible"})},[m,p,u]),v=ie(w=>{if(!(s.current&&i.current.surface===s.current&&w!==s.current)){if(a.current=w,p(),m(),i.current.surface!==null){u({surface:w,phase:"visible"});return}c.current=setTimeout(()=>{c.current=null,a.current===w&&u({surface:w,phase:"visible"})},e)}},[m,p,e,u]),x=ie(w=>{w!==s.current&&(a.current===w&&(a.current=null),p(),i.current.surface===w&&(m(),u({surface:w,phase:"exiting"}),d.current=setTimeout(()=>{d.current=null,a.current===null&&u(Mr)},t)))},[m,p,t,u]),M=ie(w=>{w&&i.current.surface!==w||(a.current=null,p(),m(),u(Mr))},[m,p,u]);return Ze(()=>{n&&i.current.surface===n&&h(n)},[n,h]),D(()=>()=>{p(),m()},[m,p]),{surface:r.surface,phase:r.phase,enter:v,leave:x,show:h,dismiss:M}}var Zc={version:"0.32.1"},ka=Zc.version;function Io({theme:e,expanded:t,width:n,snapPosition:r,viewport:o,toolbarRef:i,style:a,...s}){let c=Ee[e];return l("div",{...s,ref:i,id:"devtools-toolbar",role:"toolbar","data-popmelt-theme":e,style:{...Dc(r,o.w,o.h),zIndex:9999,display:"flex",alignItems:"center",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",cursor:"pointer",overflow:"visible",transition:"none",backgroundColor:c.surface,color:c.primary,colorScheme:e,boxSizing:"border-box",border:t?0:`1px solid ${c.border}`,boxShadow:t?`0 0 0 1px ${c.border}`:void 0,borderRadius:20,padding:t?"4px 8px 4px 4px":0,width:t?n:40,height:40,gap:t?6:0,justifyContent:t?"flex-start":"center",...a}})}function Mo({expanded:e,active:t=!1,color:n,onSettlingChange:r,...o}){return l("button",{type:"button",title:e?"Collapse (\u2318\u2318)":"Open Popmelt (\u2318\u2318)",...o,style:{display:"flex",alignItems:"center",justifyContent:"center",width:e?24:40,height:e?32:40,flexShrink:0,border:"none",background:"none",padding:0,cursor:"pointer"},children:l(fa,{"data-popmelt-logo":!0,active:t,onSettlingChange:r,width:"24",height:"24",viewBox:"0 0 40 40",fill:e||t?n:"none",stroke:e||t?"none":n,strokeWidth:"1",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg"})})}function Sa({theme:e,active:t,busy:n,color:r,onSettlingChange:o,onOpen:i,onCrosshairHover:a,onMouseEnter:s,toolbarRef:c,...d}){let u=I(null);return D(()=>{let p=u.current;if(!p)return;let m=p.querySelector("[data-popmelt-logo]"),h=()=>{p.style.opacity="1",!n&&m&&(m.style.fill=Ee[e].primary,m.style.stroke="none")},v=()=>{p.style.opacity=n?"1":"0.2",!n&&m&&(m.style.fill="none",m.style.removeProperty("stroke"))};return p.addEventListener("mouseenter",h),p.addEventListener("mouseleave",v),()=>{p.removeEventListener("mouseenter",h),p.removeEventListener("mouseleave",v)}},[n,e]),l(Io,{...d,theme:e,expanded:!1,width:40,toolbarRef:p=>{u.current=p,typeof c=="function"?c(p):c&&(c.current=p)},onMouseEnter:s,style:{opacity:n?1:.2,...d.style},children:l(Mo,{expanded:!1,active:t,color:r,onSettlingChange:o,onClick:i,onMouseEnter:()=>a?.(!0),onMouseLeave:()=>a?.(!1)})})}function Ia(){let e=()=>typeof window>"u"?{w:1920,h:1080}:{w:window.visualViewport?.width??window.innerWidth,h:window.visualViewport?.height??window.innerHeight},[t,n]=A(e);return D(()=>{let r=()=>n(e());return window.addEventListener("resize",r),window.visualViewport?.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),window.visualViewport?.removeEventListener("resize",r)}},[]),t}function Ma(e){let t=I(e);t.current=e,D(()=>{let n=0,r=0,o=a=>{if(a.key!=="Meta"&&a.key!=="Control"){r=0;return}let s=Date.now();r=s-n<wr.toolbar.toggleWindowMs?r+1:1,r>=2&&(t.current(),r=0),n=s},i=a=>{a.key!=="Meta"&&a.key!=="Control"&&(r=0)};return window.addEventListener("keydown",o),window.addEventListener("keyup",i),()=>{window.removeEventListener("keydown",o),window.removeEventListener("keyup",i)}},[])}var qc=(e,t)=>({display:"flex",width:t,height:32,borderRadius:16,overflow:"hidden",background:Ee[e].control});function Jc({theme:e,icon:t,menuOpen:n=!1,interactive:r=!0,primaryLabel:o="Cycle annotations",primaryCursor:i=!1,dotColor:a,onPrimary:s,onMenu:c}){let d=Ee[e];return y("div",{"data-popmelt-compact-tool-control":!0,style:{...qc(e,46),pointerEvents:r?void 0:"none"},children:[y("button",{type:"button","aria-label":o,"aria-disabled":!r,tabIndex:r?void 0:-1,onClick:s,style:{width:26,height:32,display:"flex",alignItems:"center",justifyContent:"flex-end",position:"relative",padding:0,border:0,background:"transparent",color:d.primary,cursor:r&&i?"pointer":"default"},children:[t,a&&l("span",{"aria-hidden":"true",style:{position:"absolute",left:16,top:14,width:4,height:4,borderRadius:"50%",background:a,pointerEvents:"none"}})]}),l("button",{type:"button","aria-label":"Choose tool","aria-haspopup":"menu","aria-expanded":n,"aria-disabled":!r,tabIndex:r?void 0:-1,onClick:c,style:{width:20,height:32,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",padding:"0 6px 0 2px",border:0,background:"transparent",color:d.mutedStrong,cursor:r?"pointer":"default"},children:l(wo,{size:12,strokeWidth:2,style:{transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 120ms ease"}})})]})}function Kc({theme:e,themePreference:t=e,onThemePreferenceChange:n,action:r,logoOnly:o=!1,connection:i,panel:a,deemphasizeControls:s=!1,onCollapse:c,ariaLabel:d="Popmelt admission"}){let[u,p]=A(()=>!o),[m,h]=A(xa),v=I(null),x=So(),{leave:M,dismiss:w}=x,$=x.surface!==null&&x.phase==="visible",E=Ia(),z=()=>{if(u){w(),c?.(),p(!1);return}p(!0),o&&x.show("popmelt-guide")};return Ma(z),D(()=>{let C=v.current;if(!C)return;let L=H=>{H.relatedTarget instanceof Node&&C.contains(H.relatedTarget)||M("popmelt-guide")};return C.addEventListener("pointerout",L),()=>C.removeEventListener("pointerout",L)},[u,M]),u?y("div",{ref:v,style:{display:"contents"},onKeyDown:C=>{C.key==="Escape"&&w()},onBlur:C=>{C.relatedTarget instanceof Node&&v.current?.contains(C.relatedTarget)||M("popmelt-guide")},children:[l("style",{children:`
26
26
  [data-popmelt-entry-dimmed] [data-popmelt-entry-content],
27
27
  [data-popmelt-entry-dimmed] [data-popmelt-entry-control] > [data-popmelt-logo] {
28
28
  opacity: 1;
@@ -1 +1 @@
1
- import{a as o,b as d,c as l,d as s}from"./chunk-WMHM647D.mjs";function g(r){let p=r?.basePath??"/popmelt",e={port:null,projectId:null},n="virtual:popmelt/bridge",i=`\0${n}`;return{name:"popmelt",resolveId(t){if(t===n)return i},load(t){if(t===i)return`export const bridgeUrl = ${JSON.stringify(e.port===null?null:`http://localhost:${e.port}`)}; export const projectId = ${JSON.stringify(e.projectId)};`},async configureServer(t){e=await o(r,t,5173),await d(e,t),t.middlewares.use(l(p,()=>e))},transformIndexHtml(){if(e.port!==null)return[{tag:"script",attrs:{type:"text/javascript"},children:s(e),injectTo:"head-prepend"}]}}}export{g as a};
1
+ import{a as o,b as d,c as l,d as s}from"./chunk-DIFC23QP.mjs";function g(r){let p=r?.basePath??"/popmelt",e={port:null,projectId:null},n="virtual:popmelt/bridge",i=`\0${n}`;return{name:"popmelt",resolveId(t){if(t===n)return i},load(t){if(t===i)return`export const bridgeUrl = ${JSON.stringify(e.port===null?null:`http://localhost:${e.port}`)}; export const projectId = ${JSON.stringify(e.projectId)};`},async configureServer(t){e=await o(r,t,5173),await d(e,t),t.middlewares.use(l(p,()=>e))},transformIndexHtml(){if(e.port!==null)return[{tag:"script",attrs:{type:"text/javascript"},children:s(e),injectTo:"head-prepend"}]}}}export{g as a};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{A as l,b,l as I,m as w,y as k}from"./chunk-SKOSDB5K.mjs";import{readFile as h,realpath as P,mkdir as x,writeFile as E}from"fs/promises";import{createHash as S}from"crypto";import{join as m,resolve as O}from"path";function N(t,e){let r=S("sha256").update(e).digest("hex");return m(t,".popmelt","participant-agents",r+".json")}async function M(t,e){if(e.storeId!==t.storeId)return{ok:!1,body:{status:"writable_store_required"}};if(typeof e.threadId!="string"||!e.threadId||typeof e.text!="string"||!e.text.trim()||e.text.length>8e3)return{ok:!1,body:{status:"invalid_note"}};let r;try{r=await v(t,t.sessionId,!0)}catch(a){if(a.code!=="ENOENT")throw a;return{ok:!1,body:{status:"participant_invitation_required"}}}if(!r)return{ok:!1,body:{status:"enrolled_bridge_required"}};let o=await l(r.endpoint,"/participants/thread-note",{...r.request,method:"POST",signal:AbortSignal.timeout(3e4),body:JSON.stringify({storeId:t.storeId,threadId:e.threadId,reply:e.text,sessionId:t.sessionId,requestId:e.requestId})});return{ok:o.response.ok,body:o.body}}async function v(t,e,r=!1){let o=await h(m(t.projectRoot,".popmelt","participant-bridge.json"),"utf8").then(JSON.parse).catch(c=>{if(c.code!=="ENOENT"||!t.bridgePort)throw c;return{projectId:t.projectId,port:t.bridgePort}});if(o.projectId!==t.projectId||!Number.isInteger(o.port)||o.port<1||o.port>65535)return null;let a={redirect:"error",signal:AbortSignal.timeout(3e3)},p=await l(o,"/status",a);if(!p.response.ok||p.body?.projectId!==t.projectId)return null;let i=N(t.projectRoot,e),n;try{n=JSON.parse(await h(i,"utf8"))}catch(c){if(c.code!=="ENOENT"||!r)throw c;let d=await P(t.projectRoot),u=b(e);if(w(d)!==t.projectId||!u)return null;let s=JSON.parse(await h(m(d,".popmelt","participant-host.json"),"utf8"));if(!(await l(o,"/participants/agent-join",{...a,method:"POST",headers:{"X-Popmelt-Participant-Id":s.participantId,"X-Popmelt-Participant-Token":s.token},body:JSON.stringify({sessionId:e,name:u,headless:!0})})).response.ok)return null;n=JSON.parse(await h(i,"utf8"))}return{endpoint:o,request:{...a,headers:{"X-Popmelt-Participant-Id":n.participantId,"X-Popmelt-Participant-Token":n.token}}}}async function F(t,e,r){let o=[t,...t.mountedStores].find(c=>c.storeId===e.storeId);if(!o||r&&o!==t)return{ok:!1,body:{status:"store_unavailable"}};if(r&&(typeof e.threadId!="string"||!e.threadId))return{ok:!1,body:{status:"thread_required"}};let a=await v(o,t.sessionId,r).catch(c=>{if(c.code==="ENOENT")return null;throw c});if(!a)return{ok:!1,body:{status:"enrolled_bridge_required",message:"Join this project as a Popmelt peer and check that its bridge is running."}};let{endpoint:p,request:i}=a,n=await l(p,r?t.sessionId.startsWith("claude:")?"/participants/link-claude-chat":"/participants/link-codex-chat":"/participants/check-claude-notes",{...i,method:"POST",body:JSON.stringify({sessionId:t.sessionId,...r?{threadId:e.threadId}:{}})});return{ok:n.response.ok,body:n.body}}async function _(t,e,r){if(!r.projectRoot)throw new Error("Participant connections require the active project root");let o=await P(r.projectRoot);if(w(o)!==t.projectId)throw new Error("Participant project does not match");let a=m(o,".popmelt"),p=S("sha256").update(e).digest("hex"),i=async(s,f,g)=>{let j=await l(t,"/participants/"+s,{method:"POST",redirect:"error",headers:{"X-Popmelt-Participant-Id":f.participantId,"X-Popmelt-Participant-Token":f.token},body:JSON.stringify(g),signal:AbortSignal.timeout(9e4)}),y=j.body;if(!j.response.ok||y.error)throw new Error(y.error??"Participant connection unavailable");return y},n,c;try{n=JSON.parse(await h(N(o,e),"utf8"))}catch(s){if(s.code!=="ENOENT")throw s;if(!r.name)return{status:"participant_invitation_required"};let f=JSON.parse(await h(m(a,"participant-host.json"),"utf8")),g=await i("agent-join",f,{sessionId:e,name:r.name});n=g.credential,c=g.participant}if(!r.action){let s=await i("agent-connect",n,{});return{status:"participant_connected",participantId:n.participantId,participant:s.participant??c}}let d=await i("agent-act",n,{action:I(r.action)}),u=d.evidence;if(u?.frame?.image){let s=u.frame.image;if(!/^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(s)||s.length>7e5)throw new Error("Invalid participant preview");let f=m(a,"artifacts","participant-previews");await x(f,{recursive:!0,mode:448});let g=m(f,p+".jpg");return await E(g,Buffer.from(s.slice(s.indexOf(",")+1),"base64"),{mode:384}),{status:"participant_connected",participant:d.participant,evidence:{...u,frame:{imagePath:g,targets:u.frame.targets}}}}return{status:"participant_connected",participant:d.participant,evidence:d.evidence}}async function C(t,e,r={}){if(k())return{status:"already_managed_by_bridge"};if((await l(t,"/status",{redirect:"error",signal:AbortSignal.timeout(3e3)})).body?.participantSessions)return _(t,e,r);let a=async(c,d)=>{let u=await l(t,`/peers/${c}`,{method:"POST",body:JSON.stringify(d),signal:AbortSignal.timeout(5e4)}),s=u.body;if(!u.response.ok||s?.error)throw new Error(s?.error??"Peer connection unavailable");return s},p=await a("join",{sessionId:e,name:r.name}),i=r.action?await a("act",{token:p.token,clientId:r.clientId,action:I(r.action)}):p,n=i.peer;return{...i.status?{status:i.status}:{},...n?{peer:{...n,state:n.state?{annotations:n.state.annotations,styleModifications:n.state.styleModifications,textModifications:n.state.textModifications,undoDepth:n.state.undoStack.length,redoDepth:n.state.redoStack.length}:null}}:{},...i.evidence?{evidence:i.evidence}:{},clients:p.clients}}async function D(t){let e=c=>{let d=t.indexOf(c);return d>=0?t[d+1]:void 0},r=e("--session");if(!r)throw new Error("Usage: popmelt peer --session <stable-agent-session> [--project-root <active-project>] [--name <your-name>] [--client <canvas-id>] [--action <JSON>]");let o=await P(O(e("--project-root")??process.cwd())),a=JSON.parse(await h(m(o,".popmelt","bridge.lock"),"utf8")),p=w(o),i=await l({port:a.port,projectId:p},"/status",{signal:AbortSignal.timeout(3e3)});if(!i.response.ok||i.body.projectRoot!==o&&!(i.body.participantSessions&&i.body.projectId===p))throw new Error("No matching running project bridge");let n=e("--action");console.log(JSON.stringify(await C({port:a.port,projectId:p},r,{name:e("--name"),projectRoot:o,clientId:e("--client"),action:n?JSON.parse(n):void 0}),null,2))}export{N as a,M as b,v as c,F as d,C as e,D as f};
2
+ import{A as l,b,l as I,m as w,y as k}from"./chunk-4BQQAQ3P.mjs";import{readFile as h,realpath as P,mkdir as x,writeFile as E}from"fs/promises";import{createHash as S}from"crypto";import{join as m,resolve as O}from"path";function N(t,e){let r=S("sha256").update(e).digest("hex");return m(t,".popmelt","participant-agents",r+".json")}async function M(t,e){if(e.storeId!==t.storeId)return{ok:!1,body:{status:"writable_store_required"}};if(typeof e.threadId!="string"||!e.threadId||typeof e.text!="string"||!e.text.trim()||e.text.length>8e3)return{ok:!1,body:{status:"invalid_note"}};let r;try{r=await v(t,t.sessionId,!0)}catch(a){if(a.code!=="ENOENT")throw a;return{ok:!1,body:{status:"participant_invitation_required"}}}if(!r)return{ok:!1,body:{status:"enrolled_bridge_required"}};let o=await l(r.endpoint,"/participants/thread-note",{...r.request,method:"POST",signal:AbortSignal.timeout(3e4),body:JSON.stringify({storeId:t.storeId,threadId:e.threadId,reply:e.text,sessionId:t.sessionId,requestId:e.requestId})});return{ok:o.response.ok,body:o.body}}async function v(t,e,r=!1){let o=await h(m(t.projectRoot,".popmelt","participant-bridge.json"),"utf8").then(JSON.parse).catch(c=>{if(c.code!=="ENOENT"||!t.bridgePort)throw c;return{projectId:t.projectId,port:t.bridgePort}});if(o.projectId!==t.projectId||!Number.isInteger(o.port)||o.port<1||o.port>65535)return null;let a={redirect:"error",signal:AbortSignal.timeout(3e3)},p=await l(o,"/status",a);if(!p.response.ok||p.body?.projectId!==t.projectId)return null;let i=N(t.projectRoot,e),n;try{n=JSON.parse(await h(i,"utf8"))}catch(c){if(c.code!=="ENOENT"||!r)throw c;let d=await P(t.projectRoot),u=b(e);if(w(d)!==t.projectId||!u)return null;let s=JSON.parse(await h(m(d,".popmelt","participant-host.json"),"utf8"));if(!(await l(o,"/participants/agent-join",{...a,method:"POST",headers:{"X-Popmelt-Participant-Id":s.participantId,"X-Popmelt-Participant-Token":s.token},body:JSON.stringify({sessionId:e,name:u,headless:!0})})).response.ok)return null;n=JSON.parse(await h(i,"utf8"))}return{endpoint:o,request:{...a,headers:{"X-Popmelt-Participant-Id":n.participantId,"X-Popmelt-Participant-Token":n.token}}}}async function F(t,e,r){let o=[t,...t.mountedStores].find(c=>c.storeId===e.storeId);if(!o||r&&o!==t)return{ok:!1,body:{status:"store_unavailable"}};if(r&&(typeof e.threadId!="string"||!e.threadId))return{ok:!1,body:{status:"thread_required"}};let a=await v(o,t.sessionId,r).catch(c=>{if(c.code==="ENOENT")return null;throw c});if(!a)return{ok:!1,body:{status:"enrolled_bridge_required",message:"Join this project as a Popmelt peer and check that its bridge is running."}};let{endpoint:p,request:i}=a,n=await l(p,r?t.sessionId.startsWith("claude:")?"/participants/link-claude-chat":"/participants/link-codex-chat":"/participants/check-claude-notes",{...i,method:"POST",body:JSON.stringify({sessionId:t.sessionId,...r?{threadId:e.threadId}:{}})});return{ok:n.response.ok,body:n.body}}async function _(t,e,r){if(!r.projectRoot)throw new Error("Participant connections require the active project root");let o=await P(r.projectRoot);if(w(o)!==t.projectId)throw new Error("Participant project does not match");let a=m(o,".popmelt"),p=S("sha256").update(e).digest("hex"),i=async(s,f,g)=>{let j=await l(t,"/participants/"+s,{method:"POST",redirect:"error",headers:{"X-Popmelt-Participant-Id":f.participantId,"X-Popmelt-Participant-Token":f.token},body:JSON.stringify(g),signal:AbortSignal.timeout(9e4)}),y=j.body;if(!j.response.ok||y.error)throw new Error(y.error??"Participant connection unavailable");return y},n,c;try{n=JSON.parse(await h(N(o,e),"utf8"))}catch(s){if(s.code!=="ENOENT")throw s;if(!r.name)return{status:"participant_invitation_required"};let f=JSON.parse(await h(m(a,"participant-host.json"),"utf8")),g=await i("agent-join",f,{sessionId:e,name:r.name});n=g.credential,c=g.participant}if(!r.action){let s=await i("agent-connect",n,{});return{status:"participant_connected",participantId:n.participantId,participant:s.participant??c}}let d=await i("agent-act",n,{action:I(r.action)}),u=d.evidence;if(u?.frame?.image){let s=u.frame.image;if(!/^data:image\/jpeg;base64,[A-Za-z0-9+/=]+$/.test(s)||s.length>7e5)throw new Error("Invalid participant preview");let f=m(a,"artifacts","participant-previews");await x(f,{recursive:!0,mode:448});let g=m(f,p+".jpg");return await E(g,Buffer.from(s.slice(s.indexOf(",")+1),"base64"),{mode:384}),{status:"participant_connected",participant:d.participant,evidence:{...u,frame:{imagePath:g,targets:u.frame.targets}}}}return{status:"participant_connected",participant:d.participant,evidence:d.evidence}}async function C(t,e,r={}){if(k())return{status:"already_managed_by_bridge"};if((await l(t,"/status",{redirect:"error",signal:AbortSignal.timeout(3e3)})).body?.participantSessions)return _(t,e,r);let a=async(c,d)=>{let u=await l(t,`/peers/${c}`,{method:"POST",body:JSON.stringify(d),signal:AbortSignal.timeout(5e4)}),s=u.body;if(!u.response.ok||s?.error)throw new Error(s?.error??"Peer connection unavailable");return s},p=await a("join",{sessionId:e,name:r.name}),i=r.action?await a("act",{token:p.token,clientId:r.clientId,action:I(r.action)}):p,n=i.peer;return{...i.status?{status:i.status}:{},...n?{peer:{...n,state:n.state?{annotations:n.state.annotations,styleModifications:n.state.styleModifications,textModifications:n.state.textModifications,undoDepth:n.state.undoStack.length,redoDepth:n.state.redoStack.length}:null}}:{},...i.evidence?{evidence:i.evidence}:{},clients:p.clients}}async function D(t){let e=c=>{let d=t.indexOf(c);return d>=0?t[d+1]:void 0},r=e("--session");if(!r)throw new Error("Usage: popmelt peer --session <stable-agent-session> [--project-root <active-project>] [--name <your-name>] [--client <canvas-id>] [--action <JSON>]");let o=await P(O(e("--project-root")??process.cwd())),a=JSON.parse(await h(m(o,".popmelt","bridge.lock"),"utf8")),p=w(o),i=await l({port:a.port,projectId:p},"/status",{signal:AbortSignal.timeout(3e3)});if(!i.response.ok||i.body.projectRoot!==o&&!(i.body.participantSessions&&i.body.projectId===p))throw new Error("No matching running project bridge");let n=e("--action");console.log(JSON.stringify(await C({port:a.port,projectId:p},r,{name:e("--name"),projectRoot:o,clientId:e("--client"),action:n?JSON.parse(n):void 0}),null,2))}export{N as a,M as b,v as c,F as d,C as e,D as f};