@popmelt.com/core 0.32.1 → 0.33.0
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 +24 -1
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/dist/ExploreAttachment-CLFSAWKM.mjs +260 -0
- package/dist/ParticipantRuntime-HW3MOZI5.mjs +139 -0
- package/dist/PopmeltTasteConnectedPane-FKIJM3C7.mjs +215 -0
- package/dist/PreviewRuntime-LFPK56NW.mjs +2 -0
- package/dist/SuppliedContext-RWN6UR3K.mjs +2 -0
- package/dist/{ThreadErrorCard-WZ2UBVWE.mjs → ThreadErrorCard-7J62GD5W.mjs} +1 -1
- package/dist/ThreadPanel-RJIHV3P6.mjs +197 -0
- package/dist/bridge-entry.mjs +1 -2
- package/dist/browser-runtime-JJHSKIKD.mjs +2 -0
- package/dist/browser.mjs +1 -1
- package/dist/checkFixture-TJDFGPQI.mjs +2 -0
- package/dist/{chunk-C3VWS5R6.mjs → chunk-27ADDVGC.mjs} +1 -1
- package/dist/chunk-2IASPT6L.mjs +2 -0
- package/dist/chunk-2VCHBI7Y.mjs +11 -0
- package/dist/chunk-2ZJ4FBTG.mjs +2 -0
- package/dist/chunk-5K7SACPW.mjs +2 -0
- package/dist/chunk-6V2VCKPG.mjs +53 -0
- package/dist/{chunk-MTQ5IWIK.mjs → chunk-75PQGTKX.mjs} +1 -1
- package/dist/chunk-7IJGE5AK.mjs +31 -0
- package/dist/chunk-BVTLSUQT.mjs +2 -0
- package/dist/chunk-C5WXW6VL.mjs +1 -0
- package/dist/chunk-DMWB3IRD.mjs +1 -0
- package/dist/chunk-DNOKP3JS.mjs +2 -0
- package/dist/chunk-EAV2VV2V.mjs +2 -0
- package/dist/chunk-F5XSNRGT.mjs +2 -0
- package/dist/{chunk-QTGE5KAA.mjs → chunk-GASEZICN.mjs} +1 -1
- package/dist/chunk-GL4I4MI6.mjs +1 -3
- package/dist/chunk-H2UYAUX3.mjs +2 -0
- package/dist/chunk-HNCV37XO.mjs +2 -0
- package/dist/chunk-I63OQTCF.mjs +347 -0
- package/dist/chunk-IKCHOC3U.mjs +1 -2
- package/dist/chunk-J5SC3R5L.mjs +2 -0
- package/dist/{chunk-IPR652AZ.mjs → chunk-JMMP5JSP.mjs} +1 -1
- package/dist/chunk-NOHXTT24.mjs +1 -1
- package/dist/{chunk-V44RIEET.mjs → chunk-ODIGT4YJ.mjs} +2 -2
- package/dist/chunk-PHKDIU3X.mjs +30 -0
- package/dist/chunk-PQT5FYN5.mjs +2 -0
- package/dist/chunk-PSSHCTJ2.mjs +8 -0
- package/dist/chunk-QXVMGZFP.mjs +1 -1
- package/dist/chunk-V2I7PSJW.mjs +2 -0
- package/dist/chunk-W5NIRROD.mjs +7 -0
- package/dist/chunk-WHJEKDNP.mjs +2 -0
- package/dist/chunk-XKD2ABCO.mjs +7 -0
- package/dist/chunk-XMKYGH62.mjs +142 -0
- package/dist/{chunk-D32YV5O6.mjs → chunk-ZHJZPC7U.mjs} +1 -1
- package/dist/cli.mjs +1 -69
- package/dist/codex-note-context-YHKPQ4WP.mjs +2 -0
- package/dist/codex-project-7VYHYTWO.mjs +2 -0
- package/dist/codex-session-registry-SPRWY2WW.mjs +1 -1
- package/dist/focus-inspection-VBS5656D.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/memory-legacy.mjs +1 -1
- package/dist/memory-store.mjs +1 -1
- package/dist/peer-client-MTWZG2FB.mjs +2 -0
- package/dist/plugin-astro.mjs +1 -31
- package/dist/plugin-nuxt.mjs +1 -30
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server.d.mts +2 -0
- package/dist/server.mjs +1 -14
- package/dist/{workspace-snapshot-O34KMJ2V.mjs → workspace-snapshot-RTTXNNUX.mjs} +1 -1
- package/package.json +24 -32
- package/dist/ParticipantRuntime-5KRRPLWL.mjs +0 -139
- package/dist/PopmeltTasteConnectedPane-7YIHIFPE.mjs +0 -221
- package/dist/PreviewRuntime-QDA4OF67.mjs +0 -2
- package/dist/SuppliedContext-NURVPZ4L.mjs +0 -2
- package/dist/browser-runtime-3EQH4ZUO.mjs +0 -2
- package/dist/chunk-4BQQAQ3P.mjs +0 -317
- package/dist/chunk-CGOQSIDR.mjs +0 -342
- package/dist/chunk-DIFC23QP.mjs +0 -1
- package/dist/chunk-EXDOFFFJ.mjs +0 -2
- package/dist/chunk-F6AMPRUB.mjs +0 -2
- package/dist/chunk-GDLI772N.mjs +0 -2
- package/dist/chunk-GNZ73T3H.mjs +0 -62
- package/dist/chunk-HGXCQKB6.mjs +0 -347
- package/dist/chunk-RCVAPQ7X.mjs +0 -2
- package/dist/chunk-ROIC72KJ.mjs +0 -1
- package/dist/chunk-U2MTWKH3.mjs +0 -2
- package/dist/chunk-XQV7EM46.mjs +0 -309
- package/dist/codex-note-context-OYDZYZXX.mjs +0 -2
- package/dist/codex-project-XLVIKWAE.mjs +0 -2
- package/dist/focus-inspection-G72JLJYG.mjs +0 -2
- package/dist/peer-client-5D6UOMB3.mjs +0 -2
package/dist/chunk-RCVAPQ7X.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function m(t){try{let e=t.defaultView?.frameElement;return e?.localName==="iframe"?e:null}catch{return null}}function w(t){if(t.localName!=="iframe"||t.closest("[data-devtools],[data-popmelt-peer-surface]"))return null;try{let e=t.contentDocument;return e?.documentElement?e:null}catch{return null}}function D(t){let e=t.getBoundingClientRect(),r=t.offsetWidth?e.width/t.offsetWidth:1,u=t.offsetHeight?e.height/t.offsetHeight:1;return{x:e.left+t.clientLeft*r,y:e.top+t.clientTop*u,sx:r,sy:u}}function v(t,e){let{left:r,top:u,width:o,height:n}=t,l=m(e);for(;l;){let a=D(l);r=a.x+r*a.sx,u=a.y+u*a.sy,o*=a.sx,n*=a.sy,l=m(l.ownerDocument)}return new DOMRect(r,u,o,n)}function V(t){return v(t.getBoundingClientRect(),t.ownerDocument)}function M(t,e,r){let u=[],o=m(r);for(;o;)u.unshift(o),o=m(o.ownerDocument);for(let n of u){let l=D(n);t=(t-l.x)/l.sx,e=(e-l.y)/l.sy}return{x:t,y:e}}function k(t){return t.ownerDocument.defaultView??window}function z(t){return!!(t&&t.namespaceURI==="http://www.w3.org/1999/xhtml")}function A(t,e=document){if(t===e)return!0;let r=m(t);return!!(r?.isConnected&&r.contentDocument===t&&A(r.ownerDocument,e))}function B(t,e){if(!A(e))return new DOMRect(0,0,0,0);let r=t.left,u=t.top,o=t.right,n=t.bottom;for(let l=m(e);l;l=m(l.ownerDocument)){let a=v({left:0,top:0,width:l.clientWidth,height:l.clientHeight},l.contentDocument);r=Math.max(r,a.left),u=Math.max(u,a.top),o=Math.min(o,a.right),n=Math.min(n,a.bottom)}return new DOMRect(r,u,Math.max(0,o-r),Math.max(0,n-u))}var g="@frame(";function I(t,e){return`${g}${encodeURIComponent(JSON.stringify({selector:t,url:e.URL}))}) `}function O(t){if(!t.startsWith(g))return null;let e=t.indexOf(") ");if(e<0)return null;try{let r=JSON.parse(decodeURIComponent(t.slice(g.length,e)));return typeof r.selector!="string"||typeof r.url!="string"?null:{...r,rest:t.slice(e+2)}}catch{return null}}var b=" >>> ";function N(t){return Array.from(t.querySelectorAll("*")).flatMap(e=>e.shadowRoot?[e.shadowRoot]:[])}function S(t=document){let e=[t];for(let r of e)e.push(...N(r));return e}function p(t,e=document){if(t.startsWith(g)){let o=O(t);if(!o)return null;let n=o.selector.startsWith(g)||o.selector.includes(b)?[p(o.selector,e)].filter(s=>!!s):S(e).flatMap(s=>Array.from(s.querySelectorAll(o.selector))),l=n.length===1?n[0]:null,a=l&&w(l);return!a||a.URL!==o.url?null:p(o.rest,a)}let r=t.split(b);if(r.length>1){let o=e,n=null;for(let l=0;l<r.length;l+=1){if(n=o.querySelector(r[l]),!n)return null;if(l<r.length-1){if(!n.shadowRoot)return null;o=n.shadowRoot}}return n}let u=[e];for(let o of u){let n=o.querySelector(t);if(n)return n;u.push(...N(o))}return null}function R(t){if(t.parentElement)return t.parentElement;let e=t.getRootNode();return"host"in e?e.host:null}function _(t,e){return e.startsWith(g)||e.includes(b)?p(e)===t:t.matches(e)}function $(t,e){let r=t;for(;r;){if(r.matches(e))return r;r=R(r)}return null}function H(t,e){let r=e;for(;r;){if(r===t)return!0;r=R(r)}return!1}var W=new WeakMap;function E(t){let e=t.getAttribute("style");return t.style.setProperty("pointer-events","auto","important"),()=>{e===null?t.removeAttribute("style"):t.setAttribute("style",e)}}function J(t){let e=t.nodeType===9?t:t.ownerDocument,r="* { pointer-events: auto !important; }",u=[];try{let o=e.defaultView?.CSSStyleSheet;if(o?.prototype.replaceSync&&"adoptedStyleSheets"in t){let n=W.get(e);n||(n=new o,n.replaceSync(r),W.set(e,n));let l=[...t.adoptedStyleSheets];t.adoptedStyleSheets=[...l,n],u.push(()=>{t.adoptedStyleSheets=l})}else{let n=e.createElement("style");n.textContent=r,(t.nodeType===9?e.head??e.documentElement:t).appendChild(n),u.push(()=>n.remove())}for(let n of t.querySelectorAll('[style*="pointer-events"]'))n.style.getPropertyValue("pointer-events")!=="none"||n.style.getPropertyPriority("pointer-events")!=="important"||u.push(E(n))}catch(o){throw u.reverse().forEach(n=>n()),o}return()=>u.reverse().forEach(o=>o())}function G(t,e,r,u=n=>[n],o){let n=[];for(let l of t.querySelectorAll("iframe")){if(!w(l))continue;let a=l.getBoundingClientRect();e<a.left||e>a.right||r<a.top||r>a.bottom||l.ownerDocument.defaultView?.getComputedStyle(l).pointerEvents==="none"&&n.push(E(l))}try{let l=()=>{let c=typeof t.elementsFromPoint=="function"?t.elementsFromPoint(e,r):[],i=t.elementFromPoint?.(e,r)??null;return(i&&!c.includes(i)?[i,...c]:c).filter(f=>t.nodeType===9||f.getRootNode()===t)},a=l(),s=a;if(o){let c=J(t);try{s=l()}finally{c()}s=s.filter(i=>a.includes(i)||o(i))}return s.flatMap(u)}finally{n.forEach(l=>l())}}function q(t,e,r=document,u){let o=[],n=new Set,l=r.nodeType===9?r:r.ownerDocument,a=M(t,e,l);for(let s of S(r).reverse())for(let c of G(s,a.x,a.y,i=>{let f=w(i);return f?[...q(t,e,f,u),i]:[i]},u))n.has(c)||(n.add(c),o.push(c));return o}function K(){return b}var Q=["id","data-testid","data-test","data-cy","data-popmelt-media-id","aria-label","name","href"],j=t=>t.replace(/\s+/g," ").trim();function y(t){return t==="id"||t==="data-popmelt-media-id"||/^data-(?:testid|test|cy)(?:-[a-z0-9_-]+)?$/.test(t)}function F(t,e){return!!(e&&e.length<=200&&!(t==="id"&&/^(radix-|:|_r_)/.test(e)))}function P(t){let e={},r=new Set([...Q,...t.getAttributeNames().filter(y)]);for(let n of r){let l=t.getAttribute(n);l&&F(n,l)&&(e[n]=l)}let u=j(t.querySelector("h1,h2,h3,h4,h5,h6")?.textContent??""),o=j(Array.from(t.childNodes).filter(n=>n.nodeType===3).map(n=>n.textContent).join(" "));return{tag:t.tagName.toLowerCase(),...Object.keys(e).length?{attributes:e}:{},...u&&u.length<=200?{heading:u}:{},...o&&o.length<=200?{text:o}:{}}}function L(t,e,r=document){let u=S(r),o=i=>{try{return u.flatMap(f=>Array.from(f.querySelectorAll(i)))}catch{return[]}},n=!!(e&&(e.heading||e.text||Object.keys(e.attributes??{}).length)),l=i=>{if(!e||!n)return!0;let f=P(i);return f.tag===e.tag&&(!e.heading||f.heading===e.heading)&&(!e.text||f.text===e.text)&&Object.entries(e.attributes??{}).every(([h,d])=>i.getAttribute(h)===d)};for(let i of t){if(i.includes(" >>> ")||i.startsWith("@frame(")){try{let h=p(i,r),d=O(i),C=Object.entries(e?.attributes??{}).filter(([x])=>y(x)),T=d&&h&&(d.rest.startsWith("[data-pm=")||C.length>0&&h.tagName.toLowerCase()===e?.tag&&C.every(([x,U])=>h.getAttribute(x)===U));if(h&&(T||l(h)))return{status:"matched",element:h}}catch{}continue}let f=o(i);if(f.length===1&&(/^\[data-pm=/.test(i)||!n))return{status:"matched",element:f[0]}}if(!n||t.some(i=>i.includes(" >>> ")||i.startsWith("@frame("))||!/^[a-z][a-z0-9-]*$/.test(e.tag))return{status:"missing"};let a=o(e.tag);if(a.length>500)return{status:"ambiguous"};let s=Object.entries(e.attributes??{}).filter(([i])=>y(i));if(s.length){let i=a.filter(f=>s.every(([h,d])=>f.getAttribute(h)===d));return i.length===1?{status:"matched",element:i[0]}:{status:i.length?"ambiguous":"missing"}}let c=a.filter(l);return c.length===1?{status:"matched",element:c[0]}:{status:c.length?"ambiguous":"missing"}}function X(t,e,r=document){let u={};if(e)for(let[a,s]of Object.entries({...e.dataAttributes,...e.id?{id:e.id}:{}}))y(a)&&F(a,s)&&(u[a]=s);let o=e?.targetFingerprint?.tag??e?.tagName?.toLowerCase(),n=e&&o?{...e.targetFingerprint,tag:o,attributes:{...u,...e.targetFingerprint?.attributes}}:e?.targetFingerprint,l=L([t,e?.selector].filter(a=>!!a),n,r);return l.status==="matched"?l.element:null}export{m as a,w as b,v as c,V as d,M as e,k as f,z as g,A as h,B as i,I as j,S as k,p as l,R as m,_ as n,$ as o,H as p,q,K as r,y as s,P as t,L as u,X as v};
|
package/dist/chunk-ROIC72KJ.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|
package/dist/chunk-U2MTWKH3.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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};
|