@popmelt.com/core 0.32.2 → 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.
Files changed (85) hide show
  1. package/README.md +23 -0
  2. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  3. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  4. package/dist/ExploreAttachment-CLFSAWKM.mjs +260 -0
  5. package/dist/ParticipantRuntime-HW3MOZI5.mjs +139 -0
  6. package/dist/PopmeltTasteConnectedPane-FKIJM3C7.mjs +215 -0
  7. package/dist/PreviewRuntime-LFPK56NW.mjs +2 -0
  8. package/dist/SuppliedContext-RWN6UR3K.mjs +2 -0
  9. package/dist/{ThreadErrorCard-OMXKVZY4.mjs → ThreadErrorCard-7J62GD5W.mjs} +1 -1
  10. package/dist/ThreadPanel-RJIHV3P6.mjs +197 -0
  11. package/dist/bridge-entry.mjs +1 -1
  12. package/dist/browser-runtime-JJHSKIKD.mjs +2 -0
  13. package/dist/browser.mjs +1 -1
  14. package/dist/checkFixture-TJDFGPQI.mjs +2 -0
  15. package/dist/{chunk-C3VWS5R6.mjs → chunk-27ADDVGC.mjs} +1 -1
  16. package/dist/chunk-2IASPT6L.mjs +2 -0
  17. package/dist/chunk-2VCHBI7Y.mjs +11 -0
  18. package/dist/chunk-2ZJ4FBTG.mjs +2 -0
  19. package/dist/chunk-5K7SACPW.mjs +2 -0
  20. package/dist/chunk-6V2VCKPG.mjs +53 -0
  21. package/dist/{chunk-MTQ5IWIK.mjs → chunk-75PQGTKX.mjs} +1 -1
  22. package/dist/chunk-7IJGE5AK.mjs +31 -0
  23. package/dist/chunk-BVTLSUQT.mjs +2 -0
  24. package/dist/chunk-C5WXW6VL.mjs +1 -0
  25. package/dist/chunk-DMWB3IRD.mjs +1 -0
  26. package/dist/chunk-DNOKP3JS.mjs +2 -0
  27. package/dist/chunk-EAV2VV2V.mjs +2 -0
  28. package/dist/chunk-F5XSNRGT.mjs +2 -0
  29. package/dist/{chunk-QTGE5KAA.mjs → chunk-GASEZICN.mjs} +1 -1
  30. package/dist/chunk-GL4I4MI6.mjs +1 -3
  31. package/dist/chunk-H2UYAUX3.mjs +2 -0
  32. package/dist/chunk-HNCV37XO.mjs +2 -0
  33. package/dist/chunk-I63OQTCF.mjs +347 -0
  34. package/dist/chunk-IKCHOC3U.mjs +1 -2
  35. package/dist/chunk-J5SC3R5L.mjs +2 -0
  36. package/dist/{chunk-K63SG2J5.mjs → chunk-JMMP5JSP.mjs} +1 -1
  37. package/dist/chunk-NOHXTT24.mjs +1 -1
  38. package/dist/{chunk-2RRYBN2J.mjs → chunk-ODIGT4YJ.mjs} +2 -2
  39. package/dist/chunk-PHKDIU3X.mjs +30 -0
  40. package/dist/chunk-PQT5FYN5.mjs +2 -0
  41. package/dist/chunk-PSSHCTJ2.mjs +8 -0
  42. package/dist/chunk-QXVMGZFP.mjs +1 -1
  43. package/dist/chunk-V2I7PSJW.mjs +2 -0
  44. package/dist/chunk-W5NIRROD.mjs +7 -0
  45. package/dist/chunk-WHJEKDNP.mjs +2 -0
  46. package/dist/chunk-XKD2ABCO.mjs +7 -0
  47. package/dist/chunk-XMKYGH62.mjs +142 -0
  48. package/dist/{chunk-MZNY6VXR.mjs → chunk-ZHJZPC7U.mjs} +1 -1
  49. package/dist/cli.mjs +1 -69
  50. package/dist/codex-note-context-YHKPQ4WP.mjs +2 -0
  51. package/dist/codex-project-7VYHYTWO.mjs +2 -0
  52. package/dist/codex-session-registry-SPRWY2WW.mjs +1 -1
  53. package/dist/focus-inspection-VBS5656D.mjs +2 -0
  54. package/dist/index.mjs +1 -1
  55. package/dist/memory-legacy.mjs +1 -1
  56. package/dist/memory-store.mjs +1 -1
  57. package/dist/peer-client-MTWZG2FB.mjs +2 -0
  58. package/dist/plugin-astro.mjs +1 -31
  59. package/dist/plugin-nuxt.mjs +1 -30
  60. package/dist/plugin-vite.mjs +1 -1
  61. package/dist/server.d.mts +2 -0
  62. package/dist/server.mjs +1 -14
  63. package/dist/{workspace-snapshot-O34KMJ2V.mjs → workspace-snapshot-RTTXNNUX.mjs} +1 -1
  64. package/package.json +4 -2
  65. package/dist/ParticipantRuntime-M762IJI2.mjs +0 -139
  66. package/dist/PopmeltTasteConnectedPane-ZW47K7VZ.mjs +0 -221
  67. package/dist/PreviewRuntime-QDA4OF67.mjs +0 -2
  68. package/dist/SuppliedContext-NURVPZ4L.mjs +0 -2
  69. package/dist/browser-runtime-VHGXBZA5.mjs +0 -2
  70. package/dist/chunk-3GHVZGWO.mjs +0 -347
  71. package/dist/chunk-45JUZT7H.mjs +0 -2
  72. package/dist/chunk-5HNQZ6TH.mjs +0 -2
  73. package/dist/chunk-ABX3VAYF.mjs +0 -317
  74. package/dist/chunk-B2MFT2SV.mjs +0 -62
  75. package/dist/chunk-EXDOFFFJ.mjs +0 -2
  76. package/dist/chunk-F6AMPRUB.mjs +0 -2
  77. package/dist/chunk-KAKYUYLC.mjs +0 -310
  78. package/dist/chunk-RCVAPQ7X.mjs +0 -2
  79. package/dist/chunk-VAPWW76T.mjs +0 -1
  80. package/dist/chunk-WL62X74S.mjs +0 -342
  81. package/dist/chunk-YHSHUWWI.mjs +0 -1
  82. package/dist/codex-note-context-NGOK23TK.mjs +0 -2
  83. package/dist/codex-project-EMYHOQCC.mjs +0 -2
  84. package/dist/focus-inspection-G72JLJYG.mjs +0 -2
  85. package/dist/peer-client-6FUDDS46.mjs +0 -2
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{B as k,D as l,e as b,n as I,o as w}from"./chunk-ABX3VAYF.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{c as f}from"./chunk-45JUZT7H.mjs";import{D as d,f as p}from"./chunk-ABX3VAYF.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};