@popmelt.com/core 0.32.1 → 0.32.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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  4. package/dist/{ParticipantRuntime-5KRRPLWL.mjs → ParticipantRuntime-M762IJI2.mjs} +1 -1
  5. package/dist/{PopmeltTasteConnectedPane-7YIHIFPE.mjs → PopmeltTasteConnectedPane-ZW47K7VZ.mjs} +1 -1
  6. package/dist/{ThreadErrorCard-WZ2UBVWE.mjs → ThreadErrorCard-OMXKVZY4.mjs} +1 -1
  7. package/dist/bridge-entry.mjs +1 -2
  8. package/dist/{browser-runtime-3EQH4ZUO.mjs → browser-runtime-VHGXBZA5.mjs} +1 -1
  9. package/dist/browser.mjs +1 -1
  10. package/dist/{chunk-HGXCQKB6.mjs → chunk-3GHVZGWO.mjs} +3 -3
  11. package/dist/chunk-45JUZT7H.mjs +2 -0
  12. package/dist/{chunk-GDLI772N.mjs → chunk-5HNQZ6TH.mjs} +1 -1
  13. package/dist/chunk-ABX3VAYF.mjs +317 -0
  14. package/dist/{chunk-GNZ73T3H.mjs → chunk-B2MFT2SV.mjs} +1 -1
  15. package/dist/chunk-IKCHOC3U.mjs +0 -0
  16. package/dist/{chunk-IPR652AZ.mjs → chunk-K63SG2J5.mjs} +1 -1
  17. package/dist/{chunk-XQV7EM46.mjs → chunk-KAKYUYLC.mjs} +87 -86
  18. package/dist/{chunk-D32YV5O6.mjs → chunk-MZNY6VXR.mjs} +1 -1
  19. package/dist/chunk-WL62X74S.mjs +342 -0
  20. package/dist/{chunk-ROIC72KJ.mjs → chunk-YHSHUWWI.mjs} +1 -1
  21. package/dist/cli.mjs +29 -29
  22. package/dist/codex-note-context-NGOK23TK.mjs +2 -0
  23. package/dist/{codex-project-XLVIKWAE.mjs → codex-project-EMYHOQCC.mjs} +1 -1
  24. package/dist/codex-session-registry-SPRWY2WW.mjs +0 -0
  25. package/dist/index.mjs +1 -1
  26. package/dist/{peer-client-5D6UOMB3.mjs → peer-client-6FUDDS46.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 +5 -5
  31. package/package.json +22 -32
  32. package/dist/chunk-4BQQAQ3P.mjs +0 -317
  33. package/dist/chunk-CGOQSIDR.mjs +0 -342
  34. package/dist/chunk-U2MTWKH3.mjs +0 -2
  35. package/dist/codex-note-context-OYDZYZXX.mjs +0 -2
  36. /package/dist/{chunk-V44RIEET.mjs → chunk-2RRYBN2J.mjs} +0 -0
  37. /package/dist/{chunk-DIFC23QP.mjs → chunk-VAPWW76T.mjs} +0 -0
@@ -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};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{a}from"./chunk-GDLI772N.mjs";import"./chunk-U2MTWKH3.mjs";import"./chunk-4BQQAQ3P.mjs";import"./chunk-IKCHOC3U.mjs";export{a as canvasReceiptsForTurn};
File without changes
File without changes