@marimo-team/frontend 0.23.16-dev31 → 0.23.16-dev35
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/dist/assets/{chat-panel-00V3uFDx.js → chat-panel-CMOZp5xW.js} +1 -1
- package/dist/assets/{command-palette-DZ2rNzzf.js → command-palette-Dx6AkiPd.js} +1 -1
- package/dist/assets/{edit-page-D80ascX2.js → edit-page-Jtp6Qqjl.js} +4 -4
- package/dist/assets/{index-4k5eCUzO.js → index-CiJmYQBT.js} +2 -2
- package/dist/assets/pair-with-agent-modal-BCRSACei.js +4 -0
- package/dist/assets/{useNotebookActions-DG8f4m8p.js → useNotebookActions-4vw_NiRs.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +99 -18
- package/src/components/editor/actions/pair-with-agent-commands.ts +21 -10
- package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
- package/dist/assets/pair-with-agent-modal-BUtnUuiE.js +0 -4
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{s as B}from"./chunk-LvLJmgfZ.js";import{t as ee}from"./react-Bj1aDYRI.js";import{t as te}from"./compiler-runtime-B3qBwwSJ.js";import{r as oe}from"./constants-CDyU_g2F.js";import{n as ne,o as ae}from"./config-B-Q7J_6d.js";import{n as re}from"./switch-OVajJBPR.js";import{t as le}from"./jsx-runtime-Blw4afVn.js";import{a as se,c as ie,o as G,s as ce}from"./popover-Bcz1Zikb.js";import{t as H}from"./tooltip-4bZlU7jl.js";import{r as me,t as q}from"./button-DDGiD1NW.js";import{r as de}from"./strings--BknHX9C.js";import{t as J}from"./check-rzLRd0j9.js";import{t as K}from"./copy-3iHFdt22.js";import{n as pe}from"./copy-Bxb1_Gtw.js";import{a as he,c as ue,i as xe,n as fe,r as je}from"./dialog-BCVepWLJ.js";const ge=["claude","codex","opencode"],ke=["claude","codex","opencode","prompt"],ye={claude:"Claude",codex:"Codex",opencode:"OpenCode",prompt:"Prompt"},Q="npx skills add marimo-team/marimo-pair";function ve(){return"uvx marimo@latest"}function M(o){return o===""?"''":/^[\w@%+=:,./-]+$/.test(o)?o:`'${o.replaceAll("'",`'"'"'`)}'`}function $e(o){let e=new URL(o).searchParams.get(oe.filePath);return e===null||e===""?void 0:e}function X(o){return o?` --file ${M(o)}`:""}function we(o,{url:e,file:a},r){let l=X(a),s=r?" --with-token":"",n=`${ve()} pair prompt --url ${M(e)}${l}${s}`;switch(o){case"claude":return`claude "$(${n} --claude)"`;case"codex":return`codex "$(${n} --codex)"`;case"opencode":return`opencode --prompt "$(${n} --opencode)"`;default:de(o)}}function Y({url:o,file:e},a){let r=X(e),l=e?` (file ${e})`:"",s=`execute-code.sh --url ${M(o)}${r}`,n=a?`
|
|
2
|
+
|
|
3
|
+
Use this auth token when calling \`execute-code.sh\`: \`${s} --token ${M(a)}\`.`:"";return["Use the /marimo-pair skill to pair-program on a running marimo notebook.","",`Connect to the notebook at: ${o}${l}`,"",`Use \`${s}\` from the marimo-pair skill to execute code in the notebook.${n}`,"","Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."].join(`
|
|
4
|
+
`)}function Z(o){return o.length<=4?"****":`${"*".repeat(Math.min(o.length-4,8))}${o.slice(-4)}`}var F=te(),T=B(ee(),1),t=B(le(),1);function be(){let o=(0,F.c)(2),[e,a]=(0,T.useState)(null),r,l;return o[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{fetch(ne("/auth/token").href,{headers:re.headers()}).then(Ne).then(s=>a((s==null?void 0:s.token)??null)).catch(()=>a(null))},l=[],o[0]=r,o[1]=l):(r=o[0],l=o[1]),(0,T.useEffect)(r,l),e}function Ne(o){return o.ok?o.json():null}const _e=o=>{let e=(0,F.c)(63),{onClose:a}=o,[r,l]=(0,T.useState)("claude"),s=ae(),n=be(),m=!!n,i,c,$,h,u,x,d,f,y,j,g,p,k,v,b,N,_,C,w,S;if(e[0]!==r||e[1]!==n||e[2]!==m||e[3]!==s.httpURL){let V={url:s.httpURL.toString(),file:$e(window.location.href)};u=fe,g="sm:max-w-2xl";let E;e[24]===Symbol.for("react.memo_cache_sentinel")?(E=(0,t.jsx)(ue,{children:"Pair with an agent"}),e[24]=E):E=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)(he,{children:[E,(0,t.jsxs)(je,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,t.jsxs)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:["Learn more",(0,t.jsx)("span",{className:"sr-only",children:" about pairing marimo with an agent"})]}),"."]})]}),e[25]=p):p=e[25],j="flex flex-col gap-4 py-2",h=se,S=r,e[26]===Symbol.for("react.memo_cache_sentinel")?(d=W=>l(W),e[26]=d):d=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(ce,{className:"w-full",children:ke.map(Ce)}),e[27]=f):f=e[27],y=ge.map(W=>(0,t.jsxs)(G,{value:W,className:"mt-4 flex flex-col gap-4",children:[(0,t.jsx)(O,{index:1,title:"Install the skill",hint:"Run once per machine.",children:(0,t.jsx)(A,{command:Q})}),(0,t.jsx)(O,{index:2,title:"Run in your terminal",children:(0,t.jsx)(A,{command:we(W,V,m)})}),m&&n&&(0,t.jsx)(O,{index:3,title:"Paste when prompted for a token",children:(0,t.jsx)(A,{command:n,display:Z(n)})})]},W)),$=G,_="prompt",C="mt-4 flex flex-col gap-4",e[28]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)(O,{index:1,title:"Make sure the marimo-pair skill is available to your agent",hint:"Skip if your agent already has it.",children:(0,t.jsx)(A,{command:Q})}),e[28]=w):w=e[28],c=O,v=2,b="Copy this prompt into your agent",N=m?"Includes your auth token \u2014 keep it private.":void 0,i=A,x=Y(V,n),k=Y(V,n?Z(n):null),e[0]=r,e[1]=n,e[2]=m,e[3]=s.httpURL,e[4]=i,e[5]=c,e[6]=$,e[7]=h,e[8]=u,e[9]=x,e[10]=d,e[11]=f,e[12]=y,e[13]=j,e[14]=g,e[15]=p,e[16]=k,e[17]=v,e[18]=b,e[19]=N,e[20]=_,e[21]=C,e[22]=w,e[23]=S}else i=e[4],c=e[5],$=e[6],h=e[7],u=e[8],x=e[9],d=e[10],f=e[11],y=e[12],j=e[13],g=e[14],p=e[15],k=e[16],v=e[17],b=e[18],N=e[19],_=e[20],C=e[21],w=e[22],S=e[23];let U;e[29]!==i||e[30]!==x||e[31]!==k?(U=(0,t.jsx)(i,{command:x,display:k,multiline:!0}),e[29]=i,e[30]=x,e[31]=k,e[32]=U):U=e[32];let z;e[33]!==c||e[34]!==U||e[35]!==v||e[36]!==b||e[37]!==N?(z=(0,t.jsx)(c,{index:v,title:b,hint:N,children:U}),e[33]=c,e[34]=U,e[35]=v,e[36]=b,e[37]=N,e[38]=z):z=e[38];let P;e[39]!==$||e[40]!==z||e[41]!==_||e[42]!==C||e[43]!==w?(P=(0,t.jsxs)($,{value:_,className:C,children:[w,z]}),e[39]=$,e[40]=z,e[41]=_,e[42]=C,e[43]=w,e[44]=P):P=e[44];let R;e[45]!==h||e[46]!==d||e[47]!==f||e[48]!==y||e[49]!==P||e[50]!==S?(R=(0,t.jsxs)(h,{value:S,onValueChange:d,children:[f,y,P]}),e[45]=h,e[46]=d,e[47]=f,e[48]=y,e[49]=P,e[50]=S,e[51]=R):R=e[51];let L;e[52]!==j||e[53]!==R?(L=(0,t.jsx)("div",{className:j,children:R}),e[52]=j,e[53]=R,e[54]=L):L=e[54];let I;e[55]===a?I=e[56]:(I=(0,t.jsx)(xe,{children:(0,t.jsx)(q,{variant:"secondary",onClick:a,children:"Close"})}),e[55]=a,e[56]=I);let D;return e[57]!==u||e[58]!==g||e[59]!==p||e[60]!==L||e[61]!==I?(D=(0,t.jsxs)(u,{className:g,children:[p,L,I]}),e[57]=u,e[58]=g,e[59]=p,e[60]=L,e[61]=I,e[62]=D):D=e[62],D};var O=o=>{let e=(0,F.c)(11),{index:a,title:r,hint:l,children:s}=o,n;e[0]!==a||e[1]!==r?(n=(0,t.jsxs)("span",{className:"text-sm font-medium",children:[a,". ",r]}),e[0]=a,e[1]=r,e[2]=n):n=e[2];let m;e[3]===l?m=e[4]:(m=l&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=m);let i;e[5]!==n||e[6]!==m?(i=(0,t.jsxs)("div",{className:"flex items-baseline gap-2",children:[n,m]}),e[5]=n,e[6]=m,e[7]=i):i=e[7];let c;return e[8]!==s||e[9]!==i?(c=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[i,s]}),e[8]=s,e[9]=i,e[10]=c):c=e[10],c},A=o=>{let e=(0,F.c)(28),{command:a,display:r,multiline:l}=o,s=l===void 0?!1:l,[n,m]=(0,T.useState)(!1),i;e[0]===a?i=e[1]:(i=me.stopPropagation(async y=>{y.preventDefault(),await pe(a),m(!0),setTimeout(()=>m(!1),2e3)}),e[0]=a,e[1]=i);let c=i;if(s){let y=r??a,j;e[2]===y?j=e[3]:(j=(0,t.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap wrap-break-word px-3 py-2 pr-10 font-mono text-xs select-all",children:y}),e[2]=y,e[3]=j);let g;e[4]===n?g=e[5]:(g=n?(0,t.jsx)(J,{size:14,strokeWidth:1.5}):(0,t.jsx)(K,{size:14,strokeWidth:1.5}),e[4]=n,e[5]=g);let p;e[6]!==c||e[7]!==g?(p=(0,t.jsx)(q,{onClick:c,size:"xs",variant:"ghost",className:"absolute right-1 top-1",children:g}),e[6]=c,e[7]=g,e[8]=p):p=e[8];let k;e[9]!==n||e[10]!==p?(k=(0,t.jsx)(H,{content:"Copied!",open:n,children:p}),e[9]=n,e[10]=p,e[11]=k):k=e[11];let v;return e[12]!==j||e[13]!==k?(v=(0,t.jsxs)("div",{className:"relative rounded-md bg-muted",children:[j,k]}),e[12]=j,e[13]=k,e[14]=v):v=e[14],v}let $=r??a,h;e[15]===$?h=e[16]:(h=(0,t.jsx)("code",{className:"flex-1 select-all wrap-break-word",children:$}),e[15]=$,e[16]=h);let u;e[17]===n?u=e[18]:(u=n?(0,t.jsx)(J,{size:14,strokeWidth:1.5}):(0,t.jsx)(K,{size:14,strokeWidth:1.5}),e[17]=n,e[18]=u);let x;e[19]!==c||e[20]!==u?(x=(0,t.jsx)(q,{onClick:c,size:"xs",variant:"ghost",children:u}),e[19]=c,e[20]=u,e[21]=x):x=e[21];let d;e[22]!==n||e[23]!==x?(d=(0,t.jsx)(H,{content:"Copied!",open:n,children:x}),e[22]=n,e[23]=x,e[24]=d):d=e[24];let f;return e[25]!==h||e[26]!==d?(f=(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[h,d]}),e[25]=h,e[26]=d,e[27]=f):f=e[27],f};function Ce(o){return(0,t.jsx)(ie,{value:o,className:"flex-1",children:ye[o]},o)}export{_e as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as Se}from"./chunk-LvLJmgfZ.js";import{d as R,i as Wt,l as St,p as At,u as N}from"./useEvent-D91BmmQi.js";import{t as _t}from"./react-Bj1aDYRI.js";import{An as Dt,Cr as Et,E as Ae,Ht as It,Li as Pt,Mi as Lt,Mn as Tt,On as Ot,Or as Ht,T as Rt,Tn as $t,Vn as qt,Yi as ke,br as Bt,g as Ft,jt as _e,kn as Yt,m as De,ni as Ut,t as Vt,vr as Kt,y as Gt,yr as Ee}from"./cells-6yd8nOAu.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as Jt,r as Xt,x as Qt}from"./ai-model-dropdown-BpVBUZnz.js";import{g as $,n as Zt}from"./useEventListener-C0195JsF.js";import{t as Ie}from"./objects-BlG0ZrO0.js";import{C as ea,r as ta}from"./utils-BWBBpCkT.js";import{n as v,t as Pe}from"./constants-CDyU_g2F.js";import{M as ee,O as aa,T as Le,j as Te,k as na,v as Oe}from"./config-B-Q7J_6d.js";import{c as oa}from"./readonly-python-code-n_TrLmsR.js";import{t as sa}from"./cn-DYvqRARy.js";import{t as ra}from"./jsx-runtime-Blw4afVn.js";import{o as la}from"./alert-dialog-Bb8Lz8ko.js";import{a as ia,c as da,i as ca,n as ha,r as ma,s as ua,t as pa}from"./select-BP75_5jJ.js";import{Lt as fa}from"./JsonOutput-BwwRpByA.js";import{f as xa,l as He,n as ba,o as Re,r as ya,s as ka,t as wa}from"./download-HKgqJX4l.js";import{t as ga}from"./tooltip-4bZlU7jl.js";import{r as ja,t as P}from"./button-DDGiD1NW.js";import{i as va,t as we}from"./strings--BknHX9C.js";import{r as L}from"./requests-9-v2bhoi.js";import{t as k}from"./createLucideIcon-w-Qo9n0R.js";import{F as Ca,I as Na,L as za,R as $e,a as qe,d as Ma,i as Be,u as Fe}from"./layout-Dtql_o_T.js";import{t as Ye}from"./check-rzLRd0j9.js";import{r as Wa}from"./useCellActionButton-CJknR0XY.js";import{t as Sa}from"./code-B2aKtXoe.js";import{t as Aa}from"./copy-3iHFdt22.js";import{t as Ue}from"./eye-off-BOZA7gbn.js";import{t as Ve}from"./external-link-BOlXZUla.js";import{t as te}from"./file-CJH9JNGH.js";import{u as _a}from"./form-Ca3yd_Od.js";import{n as Da,r as Ea,t as Ia}from"./youtube-OwaksuQt.js";import{i as Pa,n as Ke}from"./add-connection-dialog-CECJ8507.js";import{t as La}from"./house-DS0r7dNZ.js";import{t as Ta}from"./image-5XI2VU-q.js";import{t as Oa}from"./link-CHdiBDr5.js";import{r as Ha}from"./input-JxFwu-3G.js";import{t as Ra}from"./settings-D_PiwXwo.js";import{t as $a}from"./sparkles-DUCpRFlS.js";import{y as qa}from"./textarea-DuEtSOCl.js";import{t as Ba}from"./square-DFICx2Qv.js";import{t as Ge}from"./triangle-alert-BL4YVsPy.js";import{t as W}from"./use-toast-BwJoaaDM.js";import{n as Je,t as Fa}from"./paths-BKO-pHK6.js";import{o as Ya}from"./session-BmukRjSi.js";import{n as ae}from"./copy-Bxb1_Gtw.js";import{t as Xe}from"./copy-icon-neDQUo4Q.js";import{r as Ua}from"./useRunCells-DHsd7HGL.js";import{a as Qe,c as Ze,i as Va,n as et,r as tt}from"./dialog-BCVepWLJ.js";import{n as ne}from"./ImperativeModal-fY-ZfT0b.js";import{r as Ka,t as at}from"./share-852X_cqy.js";import{a as Ga}from"./cell-link-C5gpAn3R.js";import{n as nt}from"./useAsyncData-Bg5iAViP.js";import{a as Ja}from"./renderShortcut-Bl8_FVn8.js";import{t as Xa}from"./icons-CIPE8AIY.js";import{i as Qa,n as ot}from"./error-entries-CxyvaxEM.js";import{t as Za}from"./pair-with-agent-modal-
|
|
1
|
+
import{s as Se}from"./chunk-LvLJmgfZ.js";import{d as R,i as Wt,l as St,p as At,u as N}from"./useEvent-D91BmmQi.js";import{t as _t}from"./react-Bj1aDYRI.js";import{An as Dt,Cr as Et,E as Ae,Ht as It,Li as Pt,Mi as Lt,Mn as Tt,On as Ot,Or as Ht,T as Rt,Tn as $t,Vn as qt,Yi as ke,br as Bt,g as Ft,jt as _e,kn as Yt,m as De,ni as Ut,t as Vt,vr as Kt,y as Gt,yr as Ee}from"./cells-6yd8nOAu.js";import{t as z}from"./compiler-runtime-B3qBwwSJ.js";import{n as Jt,r as Xt,x as Qt}from"./ai-model-dropdown-BpVBUZnz.js";import{g as $,n as Zt}from"./useEventListener-C0195JsF.js";import{t as Ie}from"./objects-BlG0ZrO0.js";import{C as ea,r as ta}from"./utils-BWBBpCkT.js";import{n as v,t as Pe}from"./constants-CDyU_g2F.js";import{M as ee,O as aa,T as Le,j as Te,k as na,v as Oe}from"./config-B-Q7J_6d.js";import{c as oa}from"./readonly-python-code-n_TrLmsR.js";import{t as sa}from"./cn-DYvqRARy.js";import{t as ra}from"./jsx-runtime-Blw4afVn.js";import{o as la}from"./alert-dialog-Bb8Lz8ko.js";import{a as ia,c as da,i as ca,n as ha,r as ma,s as ua,t as pa}from"./select-BP75_5jJ.js";import{Lt as fa}from"./JsonOutput-BwwRpByA.js";import{f as xa,l as He,n as ba,o as Re,r as ya,s as ka,t as wa}from"./download-HKgqJX4l.js";import{t as ga}from"./tooltip-4bZlU7jl.js";import{r as ja,t as P}from"./button-DDGiD1NW.js";import{i as va,t as we}from"./strings--BknHX9C.js";import{r as L}from"./requests-9-v2bhoi.js";import{t as k}from"./createLucideIcon-w-Qo9n0R.js";import{F as Ca,I as Na,L as za,R as $e,a as qe,d as Ma,i as Be,u as Fe}from"./layout-Dtql_o_T.js";import{t as Ye}from"./check-rzLRd0j9.js";import{r as Wa}from"./useCellActionButton-CJknR0XY.js";import{t as Sa}from"./code-B2aKtXoe.js";import{t as Aa}from"./copy-3iHFdt22.js";import{t as Ue}from"./eye-off-BOZA7gbn.js";import{t as Ve}from"./external-link-BOlXZUla.js";import{t as te}from"./file-CJH9JNGH.js";import{u as _a}from"./form-Ca3yd_Od.js";import{n as Da,r as Ea,t as Ia}from"./youtube-OwaksuQt.js";import{i as Pa,n as Ke}from"./add-connection-dialog-CECJ8507.js";import{t as La}from"./house-DS0r7dNZ.js";import{t as Ta}from"./image-5XI2VU-q.js";import{t as Oa}from"./link-CHdiBDr5.js";import{r as Ha}from"./input-JxFwu-3G.js";import{t as Ra}from"./settings-D_PiwXwo.js";import{t as $a}from"./sparkles-DUCpRFlS.js";import{y as qa}from"./textarea-DuEtSOCl.js";import{t as Ba}from"./square-DFICx2Qv.js";import{t as Ge}from"./triangle-alert-BL4YVsPy.js";import{t as W}from"./use-toast-BwJoaaDM.js";import{n as Je,t as Fa}from"./paths-BKO-pHK6.js";import{o as Ya}from"./session-BmukRjSi.js";import{n as ae}from"./copy-Bxb1_Gtw.js";import{t as Xe}from"./copy-icon-neDQUo4Q.js";import{r as Ua}from"./useRunCells-DHsd7HGL.js";import{a as Qe,c as Ze,i as Va,n as et,r as tt}from"./dialog-BCVepWLJ.js";import{n as ne}from"./ImperativeModal-fY-ZfT0b.js";import{r as Ka,t as at}from"./share-852X_cqy.js";import{a as Ga}from"./cell-link-C5gpAn3R.js";import{n as nt}from"./useAsyncData-Bg5iAViP.js";import{a as Ja}from"./renderShortcut-Bl8_FVn8.js";import{t as Xa}from"./icons-CIPE8AIY.js";import{i as Qa,n as ot}from"./error-entries-CxyvaxEM.js";import{t as Za}from"./pair-with-agent-modal-BCRSACei.js";import{t as en}from"./github-_JH-0hIO.js";import{n as st}from"./marimo-icons-C_nFooxr.js";import{t as tn}from"./links-CZr5bjvo.js";import{i as an,n as rt,t as ge}from"./skeleton-BzlKcq21.js";import{t as lt}from"./types-Da7lA5YC.js";var nn=k("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),on=k("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),it=k("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),dt=k("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),ct=k("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),sn=k("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),rn=k("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),ln=k("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),ht=k("message-circle-question-mark",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),dn=k("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),cn=k("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),mt=k("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),hn=k("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),mn=k("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),ut=k("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),un=z(),T=Se(_t(),1);function je(e,t){let n=(0,un.c)(11),o;n[0]===t?o=n[1]:(o=new Lt(t),n[0]=t,n[1]=o);let s=o,l;n[2]!==e||n[3]!==s?(l=()=>s.get(e),n[2]=e,n[3]=s,n[4]=l):l=n[4];let[r,d]=(0,T.useState)(l),i;n[5]!==e||n[6]!==s?(i=x=>{d(x),s.set(e,x)},n[5]=e,n[6]=s,n[7]=i):i=n[7];let c=i,h;return n[8]!==c||n[9]!==r?(h=[r,c],n[8]=c,n[9]=r,n[10]=h):h=n[10],h}function pn(e,t){return{...e,Binaries:{...e.Binaries,Browser:t}}}function fn(e,t,n,o){return{marimo:e,Locale:n||void 0,Binaries:{Browser:t},"Environment Collection Error":o}}function ve(e,t){let n=Math.max(2,...Array.from(t.matchAll(/`+/g),s=>s[0].length)),o="`".repeat(n+1);return`${o}${e}
|
|
2
2
|
${t}
|
|
3
3
|
${o}`}function xn(e,t){let n=e.includes("?")?"&":"?",o=[],s=e,l=0;for(let[r,d]of Object.entries(t)){if(d.length===0)continue;let i=`${r}=${encodeURIComponent(d)}`,c=`${s}${l===0?n:"&"}${i}`;if(c.length>6e3){o.push(r);continue}s=c,l+=1}return{url:s,omitted:o}}function Ce(e,t){return["<details>",`<summary>${we.htmlEscape(e)??""}</summary>`,"",t,"","</details>"].join(`
|
|
4
4
|
`)}function bn(e){return Ce("Environment",ve("json",JSON.stringify(e,null,2)))}function pt(e){return Ce("Errors",ve("text",e.map(ot).join(`
|
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-CiJmYQBT.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-TXkS1QI3.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/objects-BlG0ZrO0.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
4
|
import {
|
|
5
5
|
type ConnectionInfo,
|
|
6
|
+
getFileFromURL,
|
|
6
7
|
getMarimoCommand,
|
|
7
8
|
getRawPrompt,
|
|
8
9
|
getTerminalCommand,
|
|
@@ -12,7 +13,11 @@ import {
|
|
|
12
13
|
|
|
13
14
|
const CONNECTION: ConnectionInfo = {
|
|
14
15
|
url: "http://localhost:8000",
|
|
15
|
-
|
|
16
|
+
file: "notebooks/example.py",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const CONNECTION_WITHOUT_FILE: ConnectionInfo = {
|
|
20
|
+
url: "http://localhost:8000",
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
describe("shellQuote", () => {
|
|
@@ -22,7 +27,7 @@ describe("shellQuote", () => {
|
|
|
22
27
|
|
|
23
28
|
it("leaves shell-safe values untouched", () => {
|
|
24
29
|
expect(shellQuote("http://localhost:8000")).toBe("http://localhost:8000");
|
|
25
|
-
expect(shellQuote("
|
|
30
|
+
expect(shellQuote("notebooks/example.py")).toBe("notebooks/example.py");
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
it("quotes values with shell metacharacters", () => {
|
|
@@ -37,6 +42,49 @@ describe("shellQuote", () => {
|
|
|
37
42
|
// Closes the quote, emits a literal ' via "'", then reopens: '"'"'
|
|
38
43
|
expect(shellQuote("a'b")).toBe(`'a'"'"'b'`);
|
|
39
44
|
});
|
|
45
|
+
|
|
46
|
+
it.each([
|
|
47
|
+
["/tmp/my notebook.py", "'/tmp/my notebook.py'"],
|
|
48
|
+
[
|
|
49
|
+
String.raw`C:\Users\Jane Doe\notebook.py`,
|
|
50
|
+
String.raw`'C:\Users\Jane Doe\notebook.py'`,
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
String.raw`\\server\share\my notebook.py`,
|
|
54
|
+
String.raw`'\\server\share\my notebook.py'`,
|
|
55
|
+
],
|
|
56
|
+
])("quotes non-portable path %s as one argument", (path, expected) => {
|
|
57
|
+
expect(shellQuote(path)).toBe(expected);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe("getFileFromURL", () => {
|
|
62
|
+
it("returns undefined when the file query parameter is absent or empty", () => {
|
|
63
|
+
expect(getFileFromURL("http://localhost:8000")).toBeUndefined();
|
|
64
|
+
expect(getFileFromURL("http://localhost:8000?file=")).toBeUndefined();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("decodes spaces and literal plus signs", () => {
|
|
68
|
+
expect(
|
|
69
|
+
getFileFromURL(
|
|
70
|
+
"http://localhost:8000?file=relative%2Fmy%20notebook%2Bdata.py",
|
|
71
|
+
),
|
|
72
|
+
).toBe("relative/my notebook+data.py");
|
|
73
|
+
expect(getFileFromURL("http://localhost:8000?file=my+notebook.py")).toBe(
|
|
74
|
+
"my notebook.py",
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("preserves decoded Windows paths and uses the first duplicate value", () => {
|
|
79
|
+
expect(
|
|
80
|
+
getFileFromURL(
|
|
81
|
+
"http://localhost:8000?file=C%3A%5CUsers%5CJane%20Doe%5Cnotebook.py",
|
|
82
|
+
),
|
|
83
|
+
).toBe(String.raw`C:\Users\Jane Doe\notebook.py`);
|
|
84
|
+
expect(
|
|
85
|
+
getFileFromURL("http://localhost:8000?file=first.py&file=second.py"),
|
|
86
|
+
).toBe("first.py");
|
|
87
|
+
});
|
|
40
88
|
});
|
|
41
89
|
|
|
42
90
|
describe("getMarimoCommand", () => {
|
|
@@ -56,30 +104,56 @@ describe("getMarimoCommand", () => {
|
|
|
56
104
|
});
|
|
57
105
|
|
|
58
106
|
describe("getTerminalCommand", () => {
|
|
59
|
-
it("includes the url and
|
|
107
|
+
it("includes the url and file for each agent", () => {
|
|
60
108
|
expect(getTerminalCommand("claude", CONNECTION, false)).toBe(
|
|
61
|
-
`claude "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
109
|
+
`claude "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --claude)"`,
|
|
62
110
|
);
|
|
63
111
|
expect(getTerminalCommand("codex", CONNECTION, false)).toBe(
|
|
64
|
-
`codex "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
112
|
+
`codex "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --codex)"`,
|
|
65
113
|
);
|
|
66
114
|
expect(getTerminalCommand("opencode", CONNECTION, false)).toBe(
|
|
67
|
-
`opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --
|
|
115
|
+
`opencode --prompt "$(uv run marimo pair prompt --url http://localhost:8000 --file notebooks/example.py --opencode)"`,
|
|
68
116
|
);
|
|
69
117
|
});
|
|
70
118
|
|
|
71
|
-
it("
|
|
72
|
-
const command = getTerminalCommand(
|
|
73
|
-
|
|
119
|
+
it("omits the file flag when the page URL has no file", () => {
|
|
120
|
+
const command = getTerminalCommand(
|
|
121
|
+
"claude",
|
|
122
|
+
CONNECTION_WITHOUT_FILE,
|
|
123
|
+
false,
|
|
124
|
+
);
|
|
125
|
+
expect(command).not.toContain("--file");
|
|
126
|
+
expect(command).not.toContain("--session");
|
|
74
127
|
});
|
|
75
128
|
|
|
76
129
|
it("shell-escapes a url containing metacharacters", () => {
|
|
77
130
|
const command = getTerminalCommand(
|
|
78
131
|
"claude",
|
|
79
|
-
{ url: "http://host:8000?
|
|
132
|
+
{ url: "http://host:8000?auth=a&b", file: "notebook.py" },
|
|
80
133
|
false,
|
|
81
134
|
);
|
|
82
|
-
expect(command).toContain("--url 'http://host:8000?
|
|
135
|
+
expect(command).toContain("--url 'http://host:8000?auth=a&b'");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it.each([
|
|
139
|
+
["relative/my notebook.py", "--file 'relative/my notebook.py'"],
|
|
140
|
+
["/tmp/my notebook.py", "--file '/tmp/my notebook.py'"],
|
|
141
|
+
[
|
|
142
|
+
String.raw`C:\Users\Jane Doe\notebook.py`,
|
|
143
|
+
String.raw`--file 'C:\Users\Jane Doe\notebook.py'`,
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
String.raw`\\server\share\my notebook.py`,
|
|
147
|
+
String.raw`--file '\\server\share\my notebook.py'`,
|
|
148
|
+
],
|
|
149
|
+
["notebooks/it's.py", `--file 'notebooks/it'"'"'s.py'`],
|
|
150
|
+
])("shell-escapes file path %s", (file, expected) => {
|
|
151
|
+
const command = getTerminalCommand(
|
|
152
|
+
"claude",
|
|
153
|
+
{ url: CONNECTION.url, file },
|
|
154
|
+
false,
|
|
155
|
+
);
|
|
156
|
+
expect(command).toContain(expected);
|
|
83
157
|
});
|
|
84
158
|
|
|
85
159
|
it("adds --with-token before the agent flag when requested", () => {
|
|
@@ -95,26 +169,33 @@ describe("getTerminalCommand", () => {
|
|
|
95
169
|
});
|
|
96
170
|
|
|
97
171
|
describe("getRawPrompt", () => {
|
|
98
|
-
it("references the
|
|
172
|
+
it("references the file-scoped execute-code command", () => {
|
|
99
173
|
const prompt = getRawPrompt(CONNECTION, null);
|
|
100
174
|
expect(prompt).toContain(
|
|
101
|
-
"execute-code.sh --url http://localhost:8000 --
|
|
175
|
+
"execute-code.sh --url http://localhost:8000 --file notebooks/example.py",
|
|
102
176
|
);
|
|
103
177
|
expect(prompt).toContain(
|
|
104
|
-
"Connect to the notebook at: http://localhost:8000 (
|
|
178
|
+
"Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)",
|
|
105
179
|
);
|
|
106
180
|
});
|
|
107
181
|
|
|
182
|
+
it("omits file targeting when the page URL has no file", () => {
|
|
183
|
+
const prompt = getRawPrompt(CONNECTION_WITHOUT_FILE, null);
|
|
184
|
+
expect(prompt).toContain("execute-code.sh --url http://localhost:8000");
|
|
185
|
+
expect(prompt).not.toContain("--file");
|
|
186
|
+
expect(prompt).not.toContain("--session");
|
|
187
|
+
});
|
|
188
|
+
|
|
108
189
|
it("omits the token hint when there is no token", () => {
|
|
109
190
|
const prompt = getRawPrompt(CONNECTION, null);
|
|
110
191
|
expect(prompt).not.toContain("--token");
|
|
111
192
|
expect(prompt).not.toContain("auth token");
|
|
112
193
|
});
|
|
113
194
|
|
|
114
|
-
it("includes a
|
|
195
|
+
it("includes a file-scoped token hint when a token is present", () => {
|
|
115
196
|
const prompt = getRawPrompt(CONNECTION, "secret-token");
|
|
116
197
|
expect(prompt).toContain(
|
|
117
|
-
"execute-code.sh --url http://localhost:8000 --
|
|
198
|
+
"execute-code.sh --url http://localhost:8000 --file notebooks/example.py --token secret-token",
|
|
118
199
|
);
|
|
119
200
|
});
|
|
120
201
|
|
|
@@ -128,9 +209,9 @@ describe("getRawPrompt", () => {
|
|
|
128
209
|
expect(prompt).toMatchInlineSnapshot(`
|
|
129
210
|
"Use the /marimo-pair skill to pair-program on a running marimo notebook.
|
|
130
211
|
|
|
131
|
-
Connect to the notebook at: http://localhost:8000 (
|
|
212
|
+
Connect to the notebook at: http://localhost:8000 (file notebooks/example.py)
|
|
132
213
|
|
|
133
|
-
Use \`execute-code.sh --url http://localhost:8000 --
|
|
214
|
+
Use \`execute-code.sh --url http://localhost:8000 --file notebooks/example.py\` from the marimo-pair skill to execute code in the notebook.
|
|
134
215
|
|
|
135
216
|
Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."
|
|
136
217
|
`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { assertNever } from "@/utils/assertNever";
|
|
4
|
+
import { KnownQueryParams } from "@/core/constants";
|
|
4
5
|
|
|
5
6
|
export type AgentTab = "claude" | "codex" | "opencode" | "prompt";
|
|
6
7
|
|
|
@@ -43,14 +44,21 @@ export function shellQuote(value: string): string {
|
|
|
43
44
|
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/** Return the server file key from a page URL, preserving its decoded value. */
|
|
48
|
+
export function getFileFromURL(href: string): string | undefined {
|
|
49
|
+
const file = new URL(href).searchParams.get(KnownQueryParams.filePath);
|
|
50
|
+
return file === null || file === "" ? undefined : file;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getFileFlag(file: string | undefined): string {
|
|
54
|
+
return file ? ` --file ${shellQuote(file)}` : "";
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
/** Identifies the specific running notebook to pair on. */
|
|
47
58
|
export interface ConnectionInfo {
|
|
48
59
|
url: string;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
* guessing when multiple sessions are open on the same server.
|
|
52
|
-
*/
|
|
53
|
-
sessionId: string;
|
|
60
|
+
/** The server's file key, when the page URL identifies a notebook. */
|
|
61
|
+
file?: string;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -59,11 +67,12 @@ export interface ConnectionInfo {
|
|
|
59
67
|
*/
|
|
60
68
|
export function getTerminalCommand(
|
|
61
69
|
agent: Exclude<AgentTab, "prompt">,
|
|
62
|
-
{ url,
|
|
70
|
+
{ url, file }: ConnectionInfo,
|
|
63
71
|
withToken: boolean,
|
|
64
72
|
): string {
|
|
73
|
+
const fileFlag = getFileFlag(file);
|
|
65
74
|
const tokenFlag = withToken ? " --with-token" : "";
|
|
66
|
-
const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}
|
|
75
|
+
const base = `${getMarimoCommand()} pair prompt --url ${shellQuote(url)}${fileFlag}${tokenFlag}`;
|
|
67
76
|
switch (agent) {
|
|
68
77
|
case "claude":
|
|
69
78
|
return `claude "$(${base} --claude)"`;
|
|
@@ -82,17 +91,19 @@ export function getTerminalCommand(
|
|
|
82
91
|
* an agent behaves the same as the terminal commands.
|
|
83
92
|
*/
|
|
84
93
|
export function getRawPrompt(
|
|
85
|
-
{ url,
|
|
94
|
+
{ url, file }: ConnectionInfo,
|
|
86
95
|
token: string | null,
|
|
87
96
|
): string {
|
|
88
|
-
const
|
|
97
|
+
const fileFlag = getFileFlag(file);
|
|
98
|
+
const fileHint = file ? ` (file ${file})` : "";
|
|
99
|
+
const executeCmd = `execute-code.sh --url ${shellQuote(url)}${fileFlag}`;
|
|
89
100
|
const tokenHint = token
|
|
90
101
|
? `\n\nUse this auth token when calling \`execute-code.sh\`: \`${executeCmd} --token ${shellQuote(token)}\`.`
|
|
91
102
|
: "";
|
|
92
103
|
return [
|
|
93
104
|
"Use the /marimo-pair skill to pair-program on a running marimo notebook.",
|
|
94
105
|
"",
|
|
95
|
-
`Connect to the notebook at: ${url}
|
|
106
|
+
`Connect to the notebook at: ${url}${fileHint}`,
|
|
96
107
|
"",
|
|
97
108
|
`Use \`${executeCmd}\` from the marimo-pair skill to execute code in the notebook.${tokenHint}`,
|
|
98
109
|
"",
|
|
@@ -16,12 +16,12 @@ import { Events } from "@/utils/events";
|
|
|
16
16
|
import { Tooltip } from "@/components/ui/tooltip";
|
|
17
17
|
import { asRemoteURL, useRuntimeManager } from "@/core/runtime/config";
|
|
18
18
|
import { API } from "@/core/network/api";
|
|
19
|
-
import { getSessionId } from "@/core/kernel/session";
|
|
20
19
|
import {
|
|
21
20
|
AGENT_LABELS,
|
|
22
21
|
AGENT_TABS,
|
|
23
22
|
type AgentTab,
|
|
24
23
|
type ConnectionInfo,
|
|
24
|
+
getFileFromURL,
|
|
25
25
|
getRawPrompt,
|
|
26
26
|
getTerminalCommand,
|
|
27
27
|
maskToken,
|
|
@@ -53,7 +53,7 @@ export const PairWithAgentModal: React.FC<{
|
|
|
53
53
|
const hasToken = Boolean(authToken);
|
|
54
54
|
const connection: ConnectionInfo = {
|
|
55
55
|
url: runtimeManager.httpURL.toString(),
|
|
56
|
-
|
|
56
|
+
file: getFileFromURL(window.location.href),
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
return (
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{s as F}from"./chunk-LvLJmgfZ.js";import{t as Z}from"./react-Bj1aDYRI.js";import{t as ee}from"./compiler-runtime-B3qBwwSJ.js";import{n as te,o as oe}from"./config-B-Q7J_6d.js";import{n as se}from"./switch-OVajJBPR.js";import{t as ne}from"./jsx-runtime-Blw4afVn.js";import{a as ae,c as re,o as G,s as le}from"./popover-Bcz1Zikb.js";import{t as H}from"./tooltip-4bZlU7jl.js";import{r as ie,t as B}from"./button-DDGiD1NW.js";import{r as ce}from"./strings--BknHX9C.js";import{t as J}from"./check-rzLRd0j9.js";import{t as K}from"./copy-3iHFdt22.js";import{t as me}from"./session-BmukRjSi.js";import{n as de}from"./copy-Bxb1_Gtw.js";import{a as pe,c as he,i as ue,n as xe,r as fe}from"./dialog-BCVepWLJ.js";const je=["claude","codex","opencode"],ge=["claude","codex","opencode","prompt"],ke={claude:"Claude",codex:"Codex",opencode:"OpenCode",prompt:"Prompt"},Q="npx skills add marimo-team/marimo-pair";function ye(){return"uvx marimo@latest"}function A(o){return o===""?"''":/^[\w@%+=:,./-]+$/.test(o)?o:`'${o.replaceAll("'",`'"'"'`)}'`}function ve(o,{url:e,sessionId:n},a){let r=a?" --with-token":"",c=`${ye()} pair prompt --url ${A(e)} --session ${A(n)}${r}`;switch(o){case"claude":return`claude "$(${c} --claude)"`;case"codex":return`codex "$(${c} --codex)"`;case"opencode":return`opencode --prompt "$(${c} --opencode)"`;default:ce(o)}}function X({url:o,sessionId:e},n){let a=`execute-code.sh --url ${A(o)} --session ${A(e)}`,r=n?`
|
|
2
|
-
|
|
3
|
-
Use this auth token when calling \`execute-code.sh\`: \`${a} --token ${A(n)}\`.`:"";return["Use the /marimo-pair skill to pair-program on a running marimo notebook.","",`Connect to the notebook at: ${o} (session ${e})`,"",`Use \`${a}\` from the marimo-pair skill to execute code in the notebook.${r}`,"","Once you are connected, send a fun toast (mo.status.toast(...)) to the user inside marimo letting them know you're ready to pair."].join(`
|
|
4
|
-
`)}function Y(o){return o.length<=4?"****":`${"*".repeat(Math.min(o.length-4,8))}${o.slice(-4)}`}var D=ee(),V=F(Z(),1),t=F(ne(),1);function $e(){let o=(0,D.c)(2),[e,n]=(0,V.useState)(null),a,r;return o[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{fetch(te("/auth/token").href,{headers:se.headers()}).then(be).then(c=>n((c==null?void 0:c.token)??null)).catch(()=>n(null))},r=[],o[0]=a,o[1]=r):(a=o[0],r=o[1]),(0,V.useEffect)(a,r),e}function be(o){return o.ok?o.json():null}const we=o=>{let e=(0,D.c)(63),{onClose:n}=o,[a,r]=(0,V.useState)("claude"),c=oe(),s=$e(),m=!!s,l,i,$,h,u,x,d,f,y,j,g,p,k,v,w,N,C,_,b,S;if(e[0]!==a||e[1]!==s||e[2]!==m||e[3]!==c.httpURL){let q={url:c.httpURL.toString(),sessionId:me()};u=xe,g="sm:max-w-2xl";let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=(0,t.jsx)(he,{children:"Pair with an agent"}),e[24]=T):T=e[24],e[25]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsxs)(pe,{children:[T,(0,t.jsxs)(fe,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,t.jsxs)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:["Learn more",(0,t.jsx)("span",{className:"sr-only",children:" about pairing marimo with an agent"})]}),"."]})]}),e[25]=p):p=e[25],j="flex flex-col gap-4 py-2",h=ae,S=a,e[26]===Symbol.for("react.memo_cache_sentinel")?(d=W=>r(W),e[26]=d):d=e[26],e[27]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(le,{className:"w-full",children:ge.map(Ne)}),e[27]=f):f=e[27],y=je.map(W=>(0,t.jsxs)(G,{value:W,className:"mt-4 flex flex-col gap-4",children:[(0,t.jsx)(E,{index:1,title:"Install the skill",hint:"Run once per machine.",children:(0,t.jsx)(M,{command:Q})}),(0,t.jsx)(E,{index:2,title:"Run in your terminal",children:(0,t.jsx)(M,{command:ve(W,q,m)})}),m&&s&&(0,t.jsx)(E,{index:3,title:"Paste when prompted for a token",children:(0,t.jsx)(M,{command:s,display:Y(s)})})]},W)),$=G,C="prompt",_="mt-4 flex flex-col gap-4",e[28]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)(E,{index:1,title:"Make sure the marimo-pair skill is available to your agent",hint:"Skip if your agent already has it.",children:(0,t.jsx)(M,{command:Q})}),e[28]=b):b=e[28],i=E,v=2,w="Copy this prompt into your agent",N=m?"Includes your auth token \u2014 keep it private.":void 0,l=M,x=X(q,s),k=X(q,s?Y(s):null),e[0]=a,e[1]=s,e[2]=m,e[3]=c.httpURL,e[4]=l,e[5]=i,e[6]=$,e[7]=h,e[8]=u,e[9]=x,e[10]=d,e[11]=f,e[12]=y,e[13]=j,e[14]=g,e[15]=p,e[16]=k,e[17]=v,e[18]=w,e[19]=N,e[20]=C,e[21]=_,e[22]=b,e[23]=S}else l=e[4],i=e[5],$=e[6],h=e[7],u=e[8],x=e[9],d=e[10],f=e[11],y=e[12],j=e[13],g=e[14],p=e[15],k=e[16],v=e[17],w=e[18],N=e[19],C=e[20],_=e[21],b=e[22],S=e[23];let U;e[29]!==l||e[30]!==x||e[31]!==k?(U=(0,t.jsx)(l,{command:x,display:k,multiline:!0}),e[29]=l,e[30]=x,e[31]=k,e[32]=U):U=e[32];let z;e[33]!==i||e[34]!==U||e[35]!==v||e[36]!==w||e[37]!==N?(z=(0,t.jsx)(i,{index:v,title:w,hint:N,children:U}),e[33]=i,e[34]=U,e[35]=v,e[36]=w,e[37]=N,e[38]=z):z=e[38];let I;e[39]!==$||e[40]!==z||e[41]!==C||e[42]!==_||e[43]!==b?(I=(0,t.jsxs)($,{value:C,className:_,children:[b,z]}),e[39]=$,e[40]=z,e[41]=C,e[42]=_,e[43]=b,e[44]=I):I=e[44];let P;e[45]!==h||e[46]!==d||e[47]!==f||e[48]!==y||e[49]!==I||e[50]!==S?(P=(0,t.jsxs)(h,{value:S,onValueChange:d,children:[f,y,I]}),e[45]=h,e[46]=d,e[47]=f,e[48]=y,e[49]=I,e[50]=S,e[51]=P):P=e[51];let R;e[52]!==j||e[53]!==P?(R=(0,t.jsx)("div",{className:j,children:P}),e[52]=j,e[53]=P,e[54]=R):R=e[54];let L;e[55]===n?L=e[56]:(L=(0,t.jsx)(ue,{children:(0,t.jsx)(B,{variant:"secondary",onClick:n,children:"Close"})}),e[55]=n,e[56]=L);let O;return e[57]!==u||e[58]!==g||e[59]!==p||e[60]!==R||e[61]!==L?(O=(0,t.jsxs)(u,{className:g,children:[p,R,L]}),e[57]=u,e[58]=g,e[59]=p,e[60]=R,e[61]=L,e[62]=O):O=e[62],O};var E=o=>{let e=(0,D.c)(11),{index:n,title:a,hint:r,children:c}=o,s;e[0]!==n||e[1]!==a?(s=(0,t.jsxs)("span",{className:"text-sm font-medium",children:[n,". ",a]}),e[0]=n,e[1]=a,e[2]=s):s=e[2];let m;e[3]===r?m=e[4]:(m=r&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:r}),e[3]=r,e[4]=m);let l;e[5]!==s||e[6]!==m?(l=(0,t.jsxs)("div",{className:"flex items-baseline gap-2",children:[s,m]}),e[5]=s,e[6]=m,e[7]=l):l=e[7];let i;return e[8]!==c||e[9]!==l?(i=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[l,c]}),e[8]=c,e[9]=l,e[10]=i):i=e[10],i},M=o=>{let e=(0,D.c)(28),{command:n,display:a,multiline:r}=o,c=r===void 0?!1:r,[s,m]=(0,V.useState)(!1),l;e[0]===n?l=e[1]:(l=ie.stopPropagation(async y=>{y.preventDefault(),await de(n),m(!0),setTimeout(()=>m(!1),2e3)}),e[0]=n,e[1]=l);let i=l;if(c){let y=a??n,j;e[2]===y?j=e[3]:(j=(0,t.jsx)("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap wrap-break-word px-3 py-2 pr-10 font-mono text-xs select-all",children:y}),e[2]=y,e[3]=j);let g;e[4]===s?g=e[5]:(g=s?(0,t.jsx)(J,{size:14,strokeWidth:1.5}):(0,t.jsx)(K,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=g);let p;e[6]!==i||e[7]!==g?(p=(0,t.jsx)(B,{onClick:i,size:"xs",variant:"ghost",className:"absolute right-1 top-1",children:g}),e[6]=i,e[7]=g,e[8]=p):p=e[8];let k;e[9]!==s||e[10]!==p?(k=(0,t.jsx)(H,{content:"Copied!",open:s,children:p}),e[9]=s,e[10]=p,e[11]=k):k=e[11];let v;return e[12]!==j||e[13]!==k?(v=(0,t.jsxs)("div",{className:"relative rounded-md bg-muted",children:[j,k]}),e[12]=j,e[13]=k,e[14]=v):v=e[14],v}let $=a??n,h;e[15]===$?h=e[16]:(h=(0,t.jsx)("code",{className:"flex-1 select-all wrap-break-word",children:$}),e[15]=$,e[16]=h);let u;e[17]===s?u=e[18]:(u=s?(0,t.jsx)(J,{size:14,strokeWidth:1.5}):(0,t.jsx)(K,{size:14,strokeWidth:1.5}),e[17]=s,e[18]=u);let x;e[19]!==i||e[20]!==u?(x=(0,t.jsx)(B,{onClick:i,size:"xs",variant:"ghost",children:u}),e[19]=i,e[20]=u,e[21]=x):x=e[21];let d;e[22]!==s||e[23]!==x?(d=(0,t.jsx)(H,{content:"Copied!",open:s,children:x}),e[22]=s,e[23]=x,e[24]=d):d=e[24];let f;return e[25]!==h||e[26]!==d?(f=(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[h,d]}),e[25]=h,e[26]=d,e[27]=f):f=e[27],f};function Ne(o){return(0,t.jsx)(re,{value:o,className:"flex-1",children:ke[o]},o)}export{we as t};
|