moi-computer 0.3.0 → 0.3.1-next.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.
- package/client/api/workspace-keys.ts +2 -2
- package/client/app/AppRouter.tsx +0 -2
- package/client/app/routes/WorkspaceRoute.tsx +3 -1
- package/client/app/shell/SidebarLayout.tsx +3 -16
- package/client/assets/openai.svg +1 -3
- package/client/components/shared/Composer.tsx +112 -0
- package/client/components/ui/button.tsx +1 -1
- package/client/components/ui/dropdown-menu.tsx +3 -3
- package/client/components/ui/tooltip.tsx +12 -15
- package/client/features/applets/WidgetErrorBoundary.tsx +19 -3
- package/client/features/applets/WidgetShell.tsx +8 -1
- package/client/features/applets/applet-log.ts +100 -0
- package/client/features/applets/useApplet.ts +21 -7
- package/client/features/chat/ChatComposer.tsx +33 -30
- package/client/features/chat/ChatPanel.tsx +5 -2
- package/client/features/chat/MarkdownContent.tsx +20 -2
- package/client/features/chat/ModelPicker.tsx +29 -41
- package/client/features/chat/TurnView.tsx +2 -2
- package/client/features/chat/chat-frames.ts +14 -6
- package/client/features/chat/chat-send.ts +1 -1
- package/client/features/chat/chat-store.ts +22 -17
- package/client/features/chat/model-order.ts +47 -0
- package/client/features/chat/tool-group/ToolOutput.tsx +4 -12
- package/client/features/chat/tool-group/format.ts +0 -6
- package/client/features/chat/useChat.ts +15 -2
- package/client/features/connectors/McpServerCards.tsx +95 -0
- package/client/features/connectors/api.ts +0 -11
- package/client/features/home/HomePage.tsx +45 -42
- package/client/features/home/WorkspacePreview.tsx +179 -38
- package/client/features/home/api.ts +24 -12
- package/client/features/home/workspace-presentation.tsx +17 -15
- package/client/features/home/workspace-setup/CreateWorkspaceDialog.tsx +243 -0
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +95 -0
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +230 -0
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +35 -0
- package/client/features/home/workspace-setup/useWorkspaceImport.ts +61 -0
- package/client/features/settings/ConnectorsSettings.tsx +89 -0
- package/client/features/settings/GeneralSettings.tsx +12 -0
- package/client/features/settings/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceSettings.tsx +8 -4
- package/client/features/views/ViewBuilderTab.tsx +28 -29
- package/client/features/views/useViewBuilderActions.ts +1 -1
- package/client/features/widgets/WidgetFrame.tsx +3 -0
- package/client/features/widgets/WidgetGrid.tsx +1 -0
- package/client/features/widgets/Widgets.tsx +12 -3
- package/client/features/widgets/api.ts +47 -0
- package/client/features/widgets/useWidgetThumbnails.ts +107 -0
- package/client/features/widgets/widget-snapshot.ts +71 -0
- package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -4
- package/client/features/workspace/WorkspaceScreen.tsx +19 -4
- package/client/features/workspace/api.ts +25 -3
- package/client/features/workspace/moi-context.ts +85 -0
- package/client/index.css +0 -5
- package/client/main.tsx +13 -4
- package/dist/{chunk-cs8vbert.js → chunk-1dfbr7n2.js} +2 -2
- package/dist/chunk-339jds4x.js +15 -0
- package/dist/chunk-3xsvsnhr.css +1 -0
- package/dist/{chunk-zpxrb1ce.js → chunk-anqmsbjt.js} +2 -2
- package/dist/chunk-hbvfb6sk.js +63 -0
- package/dist/chunk-jen6xcm1.js +14 -0
- package/dist/{chunk-kxmvv1ax.js → chunk-qwm5f6qk.js} +1 -1
- package/dist/{chunk-fjksw6xf.js → chunk-sxbfh73c.js} +1 -1
- package/dist/chunk-yp4srgqt.js +10 -0
- package/dist/index.html +1 -1
- package/dist/openai-ep9ht2pq.svg +1 -0
- package/lib/ids.ts +15 -0
- package/lib/moi-context.ts +170 -0
- package/lib/types.ts +95 -13
- package/lib/view-builder-directives.ts +16 -0
- package/lib/workspace-types.ts +12 -0
- package/package.json +4 -2
- package/server/api.ts +180 -34
- package/server/applet-log.ts +149 -0
- package/server/cli.ts +161 -7
- package/server/control.ts +81 -1
- package/server/functions.ts +44 -14
- package/server/harness/README.md +26 -9
- package/server/harness/claude-code/NOTES.md +20 -6
- package/server/harness/claude-code/adapter.ts +2 -2
- package/server/harness/claude-code/git-worktree.ts +32 -0
- package/server/harness/claude-code/index.ts +35 -13
- package/server/harness/claude-code/mcp.ts +16 -65
- package/server/harness/claude-code/models.ts +3 -0
- package/server/harness/claude-code/session.ts +196 -61
- package/server/harness/claude-code/sessions.ts +51 -0
- package/server/harness/codex/NOTES.md +41 -11
- package/server/harness/codex/adapter.ts +52 -6
- package/server/harness/codex/client.ts +69 -18
- package/server/harness/codex/discovery.ts +114 -0
- package/server/harness/codex/index.ts +12 -5
- package/server/harness/codex/probe.ts +4 -2
- package/server/harness/codex/session.ts +57 -5
- package/server/harness/executable.ts +82 -0
- package/server/harness/openclaw/adapter.ts +8 -1
- package/server/harness/openclaw/discovery.ts +139 -6
- package/server/harness/openclaw/gateway.ts +40 -18
- package/server/harness/openclaw/index.ts +12 -15
- package/server/harness/openclaw/session.ts +50 -10
- package/server/harness/openclaw/strip.ts +2 -2
- package/server/harness/shell-path.ts +79 -0
- package/server/harness/types.ts +37 -5
- package/server/layout.ts +81 -51
- package/server/registry.ts +57 -12
- package/server/scratchpad-assets.ts +41 -6
- package/server/scratchpad.ts +30 -0
- package/server/view-builders.ts +3 -2
- package/server/views.ts +5 -0
- package/server/web.ts +30 -8
- package/server/widgets.ts +23 -2
- package/server/workspace-import.ts +45 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +27 -3
- package/client/features/connectors/ConnectorsPage.tsx +0 -92
- package/client/features/connectors/McpMenu.tsx +0 -145
- package/client/features/home/CreateWorkspaceDialog.tsx +0 -130
- package/client/features/home/CreateWorkspaceDialogSteps.tsx +0 -234
- package/dist/chunk-4vf1t6v1.js +0 -10
- package/dist/chunk-4z52b2av.css +0 -1
- package/dist/chunk-b4b276wx.js +0 -15
- package/dist/chunk-y82s1jxm.js +0 -61
- package/dist/openai-h13pza4b.svg +0 -3
- package/lib/view-builder-meta.ts +0 -35
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import"/chunk-vkvb3hjm.js";function t(z,Q){return z[13]=1,z[14]=Q>>8,z[15]=Q&255,z[16]=Q>>8,z[17]=Q&255,z}var e=112,zz=72,Qz=89,Zz=115,p;function Nz(){let z=new Int32Array(256);for(let Q=0;Q<256;Q++){let Z=Q;for(let $=0;$<8;$++)Z=Z&1?3988292384^Z>>>1:Z>>>1;z[Q]=Z}return z}function Iz(z){let Q=-1;if(!p)p=Nz();for(let Z=0;Z<z.length;Z++)Q=p[(Q^z[Z])&255]^Q>>>8;return Q^-1}function Uz(z){let Q=z.length-1;for(let Z=Q;Z>=4;Z--)if(z[Z-4]===9&&z[Z-3]===e&&z[Z-2]===zz&&z[Z-1]===Qz&&z[Z]===Zz)return Z-3;return 0}function $z(z,Q,Z=!1){let $=new Uint8Array(13);Q*=39.3701,$[0]=e,$[1]=zz,$[2]=Qz,$[3]=Zz,$[4]=Q>>>24,$[5]=Q>>>16,$[6]=Q>>>8,$[7]=Q&255,$[8]=$[4],$[9]=$[5],$[10]=$[6],$[11]=$[7],$[12]=1;let Y=Iz($),K=new Uint8Array(4);if(K[0]=Y>>>24,K[1]=Y>>>16,K[2]=Y>>>8,K[3]=Y&255,Z){let X=Uz(z);return z.set($,X),z.set(K,X+13),z}else{let X=new Uint8Array(4);X[0]=0,X[1]=0,X[2]=0,X[3]=9;let J=new Uint8Array(54);return J.set(z,0),J.set(X,33),J.set($,37),J.set(K,50),J}}var Dz="AAlwSFlz",Fz="AAAJcEhZ",Rz="AAAACXBI";function wz(z){let Q=z.indexOf(Dz);if(Q===-1)Q=z.indexOf(Fz);if(Q===-1)Q=z.indexOf(Rz);return Q}var Jz="[modern-screenshot]",D=typeof window<"u",Ez=D&&"Worker"in window,Kz=D&&"atob"in window,Cz=D&&"btoa"in window,x=D?window.navigator?.userAgent:"",Yz=x.includes("Chrome"),S=x.includes("AppleWebKit")&&!Yz,u=x.includes("Firefox"),fz=(z)=>z&&("__CONTEXT__"in z),Tz=(z)=>z.constructor.name==="CSSFontFaceRule",bz=(z)=>z.constructor.name==="CSSImportRule",Sz=(z)=>z.constructor.name==="CSSLayerBlockRule",k=(z)=>z.nodeType===1,f=(z)=>typeof z.className==="object",Xz=(z)=>z.tagName==="image",hz=(z)=>z.tagName==="use",w=(z)=>k(z)&&typeof z.style<"u"&&!f(z),gz=(z)=>z.nodeType===8,vz=(z)=>z.nodeType===3,R=(z)=>z.tagName==="IMG",h=(z)=>z.tagName==="VIDEO",pz=(z)=>z.tagName==="CANVAS",yz=(z)=>z.tagName==="TEXTAREA",mz=(z)=>z.tagName==="INPUT",xz=(z)=>z.tagName==="STYLE",uz=(z)=>z.tagName==="SCRIPT",iz=(z)=>z.tagName==="SELECT",cz=(z)=>z.tagName==="SLOT",dz=(z)=>z.tagName==="IFRAME",az=(...z)=>console.warn(Jz,...z);function lz(z){let Q=z?.createElement?.("canvas");if(Q)Q.height=Q.width=1;return Boolean(Q)&&"toDataURL"in Q&&Boolean(Q.toDataURL("image/webp").includes("image/webp"))}var y=(z)=>z.startsWith("data:");function Gz(z,Q){if(z.match(/^[a-z]+:\/\//i))return z;if(D&&z.match(/^\/\//))return window.location.protocol+z;if(z.match(/^[a-z]+:/i))return z;if(!D)return z;let Z=g().implementation.createHTMLDocument(),$=Z.createElement("base"),Y=Z.createElement("a");if(Z.head.appendChild($),Z.body.appendChild(Y),Q)$.href=Q;return Y.href=z,Y.href}function g(z){return(z&&k(z)?z?.ownerDocument:z)??window.document}var v="http://www.w3.org/2000/svg";function jz(z,Q,Z){let $=g(Z).createElementNS(v,"svg");return $.setAttributeNS(null,"width",z.toString()),$.setAttributeNS(null,"height",Q.toString()),$.setAttributeNS(null,"viewBox",`0 0 ${z} ${Q}`),$}function Vz(z,Q){let Z=new XMLSerializer().serializeToString(z);if(Q)Z=Z.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"");return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Z)}`}async function sz(z,Q="image/png",Z=1){try{return await new Promise(($,Y)=>{z.toBlob((K)=>{if(K)$(K);else Y(Error("Blob is null"))},Q,Z)})}catch($){if(Kz)return rz(z.toDataURL(Q,Z));throw $}}function rz(z){let[Q,Z]=z.split(","),$=Q.match(/data:(.+);/)?.[1]??void 0,Y=window.atob(Z),K=Y.length,X=new Uint8Array(K);for(let J=0;J<K;J+=1)X[J]=Y.charCodeAt(J);return new Blob([X],{type:$})}function Hz(z,Q){return new Promise((Z,$)=>{let Y=new FileReader;if(Y.onload=()=>Z(Y.result),Y.onerror=()=>$(Y.error),Y.onabort=()=>$(Error(`Failed read blob to ${Q}`)),Q==="dataUrl")Y.readAsDataURL(z);else if(Q==="arrayBuffer")Y.readAsArrayBuffer(z)})}var nz=(z)=>Hz(z,"dataUrl"),oz=(z)=>Hz(z,"arrayBuffer");function F(z,Q){let Z=g(Q).createElement("img");return Z.decoding="sync",Z.loading="eager",Z.src=z,Z}function E(z,Q){return new Promise((Z)=>{let{timeout:$,ownerDocument:Y,onError:K,onWarn:X}=Q??{},J=typeof z==="string"?F(z,g(Y)):z,V=null,j=null;function G(){Z(J),V&&clearTimeout(V),j?.()}if($)V=setTimeout(G,$);if(h(J)){let M=J.currentSrc||J.src;if(!M){if(J.poster)return E(J.poster,Q).then(Z);return G()}if(J.readyState>=2)return G();let B=G,q=(W)=>{X?.("Failed video load",M,W),K?.(W),G()};j=()=>{J.removeEventListener("loadeddata",B),J.removeEventListener("error",q)},J.addEventListener("loadeddata",B,{once:!0}),J.addEventListener("error",q,{once:!0})}else{let M=Xz(J)?J.href.baseVal:J.currentSrc||J.src;if(!M)return G();let B=async()=>{if(R(J)&&"decode"in J)try{await J.decode()}catch(W){X?.("Failed to decode image, trying to render anyway",J.dataset.originalSrc||M,W)}G()},q=(W)=>{X?.("Failed image load",J.dataset.originalSrc||M,W),G()};if(R(J)&&J.complete)return B();j=()=>{J.removeEventListener("load",B),J.removeEventListener("error",q)},J.addEventListener("load",B,{once:!0}),J.addEventListener("error",q,{once:!0})}})}async function tz(z,Q){if(w(z))if(R(z)||h(z))await E(z,Q);else await Promise.all(["img","video"].flatMap((Z)=>{return Array.from(z.querySelectorAll(Z)).map(($)=>E($,Q))}))}var Bz=function(){let Q=0,Z=()=>`0000${(Math.random()*1679616<<0).toString(36)}`.slice(-4);return()=>{return Q+=1,`u${Z()}${Q}`}}();function Mz(z){return z?.split(",").map((Q)=>Q.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}var a=0;function ez(z){let Q=`${Jz}[#${a}]`;return a++,{time:(Z)=>z&&console.time(`${Q} ${Z}`),timeEnd:(Z)=>z&&console.timeEnd(`${Q} ${Z}`),warn:(...Z)=>z&&az(...Z)}}function zQ(z){return{cache:z?"no-cache":"force-cache"}}async function N(z,Q){return fz(z)?z:QQ(z,{...Q,autoDestruct:!0})}async function QQ(z,Q){let{scale:Z=1,workerUrl:$,workerNumber:Y=1}=Q||{},K=Boolean(Q?.debug),X=Q?.features??!0,J=z.ownerDocument??(D?window.document:void 0),V=z.ownerDocument?.defaultView??(D?window:void 0),j=new Map,G={width:0,height:0,quality:1,type:"image/png",scale:Z,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:30000,progress:null,debug:K,fetch:{requestInit:zQ(Q?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...Q?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:Y,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...Q,__CONTEXT__:!0,log:ez(K),node:z,ownerDocument:J,ownerWindow:V,dpi:Z===1?null:96*Z,svgStyleElement:qz(J),svgDefsElement:J?.createElementNS(v,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:Ez&&$&&Y?Y:0})].map(()=>{try{let q=new Worker($);return q.onmessage=async(W)=>{let{url:H,result:L}=W.data;if(L)j.get(H)?.resolve?.(L);else j.get(H)?.reject?.(Error(`Error receiving message from worker: ${H}`))},q.onmessageerror=(W)=>{let{url:H}=W.data;j.get(H)?.reject?.(Error(`Error receiving message from worker: ${H}`))},q}catch(q){return G.log.warn("Failed to new Worker",q),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[lz(J)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:j,drawImageCount:0,tasks:[],features:X,isEnable:(q)=>{if(q==="restoreScrollPosition")return typeof X==="boolean"?!1:X[q]??!1;if(typeof X==="boolean")return X;return X[q]??!0},shadowRoots:[]};G.log.time("wait until load"),await tz(z,{timeout:G.timeout,onWarn:G.log.warn}),G.log.timeEnd("wait until load");let{width:M,height:B}=ZQ(z,G);return G.width=M,G.height=B,G}function qz(z){if(!z)return;let Q=z.createElement("style"),Z=Q.ownerDocument.createTextNode(`
|
|
2
|
+
.______background-clip--text {
|
|
3
|
+
background-clip: text;
|
|
4
|
+
-webkit-background-clip: text;
|
|
5
|
+
}
|
|
6
|
+
`);return Q.appendChild(Z),Q}function ZQ(z,Q){let{width:Z,height:$}=Q;if(k(z)&&(!Z||!$)){let Y=z.getBoundingClientRect();Z=Z||Y.width||Number(z.getAttribute("width"))||0,$=$||Y.height||Number(z.getAttribute("height"))||0}return{width:Z,height:$}}async function $Q(z,Q){let{log:Z,timeout:$,drawImageCount:Y,drawImageInterval:K}=Q;Z.time("image to canvas");let X=await E(z,{timeout:$,onWarn:Q.log.warn}),{canvas:J,context2d:V}=JQ(z.ownerDocument,Q),j=()=>{try{V?.drawImage(X,0,0,J.width,J.height)}catch(G){Q.log.warn("Failed to drawImage",G)}};if(j(),Q.isEnable("fixSvgXmlDecode"))for(let G=0;G<Y;G++)await new Promise((M)=>{setTimeout(()=>{V?.clearRect(0,0,J.width,J.height),j(),M()},G+K)});return Q.drawImageCount=0,Z.timeEnd("image to canvas"),J}function JQ(z,Q){let{width:Z,height:$,scale:Y,backgroundColor:K,maximumCanvasSize:X}=Q,J=z.createElement("canvas");if(J.width=Math.floor(Z*Y),J.height=Math.floor($*Y),J.style.width=`${Z}px`,J.style.height=`${$}px`,X){if(J.width>X||J.height>X)if(J.width>X&&J.height>X)if(J.width>J.height)J.height*=X/J.width,J.width=X;else J.width*=X/J.height,J.height=X;else if(J.width>X)J.height*=X/J.width,J.width=X;else J.width*=X/J.height,J.height=X}let V=J.getContext("2d");if(V&&K)V.fillStyle=K,V.fillRect(0,0,J.width,J.height);return{canvas:J,context2d:V}}function Wz(z,Q){if(z.ownerDocument)try{let K=z.toDataURL();if(K!=="data:,")return F(K,z.ownerDocument)}catch(K){Q.log.warn("Failed to clone canvas",K)}let Z=z.cloneNode(!1),$=z.getContext("2d"),Y=Z.getContext("2d");try{if($&&Y)Y.putImageData($.getImageData(0,0,z.width,z.height),0,0);return Z}catch(K){Q.log.warn("Failed to clone canvas",K)}return Z}function KQ(z,Q){try{if(z?.contentDocument?.documentElement)return i(z.contentDocument.documentElement,Q)}catch(Z){Q.log.warn("Failed to clone iframe",Z)}return z.cloneNode(!1)}function YQ(z){let Q=z.cloneNode(!1);if(z.currentSrc&&z.currentSrc!==z.src)Q.src=z.currentSrc,Q.srcset="";if(Q.loading==="lazy")Q.loading="eager";return Q}async function XQ(z,Q){if(z.ownerDocument&&!z.currentSrc&&z.poster)return F(z.poster,z.ownerDocument);let Z=z.cloneNode(!1);if(Z.crossOrigin="anonymous",z.currentSrc&&z.currentSrc!==z.src)Z.src=z.currentSrc;let $=Z.ownerDocument;if($){let Y=!0;if(await E(Z,{onError:()=>Y=!1,onWarn:Q.log.warn}),!Y){if(z.poster)return F(z.poster,z.ownerDocument);return Z}Z.currentTime=z.currentTime,await new Promise((X)=>{Z.addEventListener("seeked",X,{once:!0})});let K=$.createElement("canvas");K.width=z.offsetWidth,K.height=z.offsetHeight;try{let X=K.getContext("2d");if(X)X.drawImage(Z,0,0,K.width,K.height)}catch(X){if(Q.log.warn("Failed to clone video",X),z.poster)return F(z.poster,z.ownerDocument);return Z}return Wz(K,Q)}return Z}function GQ(z,Q){if(pz(z))return Wz(z,Q);if(dz(z))return KQ(z,Q);if(R(z))return YQ(z);if(h(z))return XQ(z,Q);return z.cloneNode(!1)}function jQ(z){let Q=z.sandbox;if(!Q){let{ownerDocument:Z}=z;try{if(Z)Q=Z.createElement("iframe"),Q.id=`__SANDBOX__${Bz()}`,Q.width="0",Q.height="0",Q.style.visibility="hidden",Q.style.position="fixed",Z.body.appendChild(Q),Q.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',z.sandbox=Q}catch($){z.log.warn("Failed to getSandBox",$)}}return Q}var VQ=["width","height","-webkit-text-fill-color"],HQ=["stroke","fill"];function Lz(z,Q,Z){let{defaultComputedStyles:$}=Z,Y=z.nodeName.toLowerCase(),K=f(z)&&Y!=="svg",X=K?HQ.map((H)=>[H,z.getAttribute(H)]).filter(([,H])=>H!==null):[],J=[K&&"svg",Y,X.map((H,L)=>`${H}=${L}`).join(","),Q].filter(Boolean).join(":");if($.has(J))return $.get(J);let j=jQ(Z)?.contentWindow;if(!j)return new Map;let G=j?.document,M,B;if(K)M=G.createElementNS(v,"svg"),B=M.ownerDocument.createElementNS(M.namespaceURI,Y),X.forEach(([H,L])=>{B.setAttributeNS(null,H,L)}),M.appendChild(B);else M=B=G.createElement(Y);B.textContent=" ",G.body.appendChild(M);let q=j.getComputedStyle(B,Q),W=new Map;for(let H=q.length,L=0;L<H;L++){let P=q.item(L);if(VQ.includes(P))continue;W.set(P,q.getPropertyValue(P))}return G.body.removeChild(M),$.set(J,W),W}function Pz(z,Q,Z){let $=new Map,Y=[],K=new Map;if(Z)for(let J of Z)X(J);else for(let J=z.length,V=0;V<J;V++){let j=z.item(V);X(j)}for(let J=Y.length,V=0;V<J;V++)K.get(Y[V])?.forEach((j,G)=>$.set(G,j));function X(J){let V=z.getPropertyValue(J),j=z.getPropertyPriority(J),G=J.lastIndexOf("-"),M=G>-1?J.substring(0,G):void 0;if(M){let B=K.get(M);if(!B)B=new Map,K.set(M,B);B.set(J,[V,j])}if(Q.get(J)===V&&!j)return;if(M)Y.push(M);else $.set(J,[V,j])}return $}function BQ(z,Q,Z,$){let{ownerWindow:Y,includeStyleProperties:K,currentParentNodeStyle:X}=$,J=Q.style,V=Y.getComputedStyle(z),j=Lz(z,null,$);X?.forEach((M,B)=>{j.delete(B)});let G=Pz(V,j,K);if(G.delete("transition-property"),G.delete("all"),G.delete("d"),G.delete("content"),Z)G.delete("position"),G.delete("margin-top"),G.delete("margin-right"),G.delete("margin-bottom"),G.delete("margin-left"),G.delete("margin-block-start"),G.delete("margin-block-end"),G.delete("margin-inline-start"),G.delete("margin-inline-end"),G.set("box-sizing",["border-box",""]);if(G.get("background-clip")?.[0]==="text")Q.classList.add("______background-clip--text");if(Yz){if(!G.has("font-kerning"))G.set("font-kerning",["normal",""]);if((G.get("overflow-x")?.[0]==="hidden"||G.get("overflow-y")?.[0]==="hidden")&&G.get("text-overflow")?.[0]==="ellipsis"&&z.scrollWidth===z.clientWidth)G.set("text-overflow",["clip",""])}for(let M=J.length,B=0;B<M;B++)J.removeProperty(J.item(B));return G.forEach(([M,B],q)=>{J.setProperty(q,M,B)}),G}function MQ(z,Q){if(yz(z)||mz(z)||iz(z))Q.setAttribute("value",z.value)}var qQ=["::before","::after"],WQ=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function LQ(z,Q,Z,$,Y){let{ownerWindow:K,svgStyleElement:X,svgStyles:J,currentNodeStyle:V}=$;if(!X||!K)return;function j(G){let M=K.getComputedStyle(z,G),B=M.getPropertyValue("content");if(!B||B==="none")return;Y?.(B),B=B.replace(/(')|(")|(counter\(.+\))/g,"");let q=[Bz()],W=Lz(z,G,$);V?.forEach((O,A)=>{W.delete(A)});let H=Pz(M,W,$.includeStyleProperties);if(H.delete("content"),H.delete("-webkit-locale"),H.get("background-clip")?.[0]==="text")Q.classList.add("______background-clip--text");let L=[`content: '${B}';`];if(H.forEach(([O,A],U)=>{L.push(`${U}: ${O}${A?" !important":""};`)}),L.length===1)return;try{Q.className=[Q.className,...q].join(" ")}catch(O){$.log.warn("Failed to copyPseudoClass",O);return}let P=L.join(`
|
|
7
|
+
`),_=J.get(P);if(!_)_=[],J.set(P,_);_.push(`.${q[0]}${G}`)}if(qQ.forEach(j),Z)WQ.forEach(j)}var l=new Set(["symbol"]);async function s(z,Q,Z,$,Y){if(k(Z)&&(xz(Z)||uz(Z)))return;if($.filter&&!$.filter(Z))return;if(l.has(Q.nodeName)||l.has(Z.nodeName))$.currentParentNodeStyle=void 0;else $.currentParentNodeStyle=$.currentNodeStyle;let K=await i(Z,$,!1,Y);if($.isEnable("restoreScrollPosition"))PQ(z,K);Q.appendChild(K)}async function r(z,Q,Z,$){let Y=z.firstChild;if(k(z)){if(z.shadowRoot)Y=z.shadowRoot?.firstChild,Z.shadowRoots.push(z.shadowRoot)}for(let K=Y;K;K=K.nextSibling){if(gz(K))continue;if(k(K)&&cz(K)&&typeof K.assignedNodes==="function"){let X=K.assignedNodes();for(let J=0;J<X.length;J++)await s(z,Q,X[J],Z,$)}else await s(z,Q,K,Z,$)}}function PQ(z,Q){if(!w(z)||!w(Q))return;let{scrollTop:Z,scrollLeft:$}=z;if(!Z&&!$)return;let{transform:Y}=Q.style,K=new DOMMatrix(Y),{a:X,b:J,c:V,d:j}=K;K.a=1,K.b=0,K.c=0,K.d=1,K.translateSelf(-$,-Z),K.a=X,K.b=J,K.c=V,K.d=j,Q.style.transform=K.toString()}function OQ(z,Q){let{backgroundColor:Z,width:$,height:Y,style:K}=Q,X=z.style;if(Z)X.setProperty("background-color",Z,"important");if($)X.setProperty("width",`${$}px`,"important");if(Y)X.setProperty("height",`${Y}px`,"important");if(K)for(let J in K)X[J]=K[J]}var _Q=/^[\w-:]+$/;async function i(z,Q,Z=!1,$){let{ownerDocument:Y,ownerWindow:K,fontFamilies:X,onCloneEachNode:J}=Q;if(Y&&vz(z)){if($&&/\S/.test(z.data))$(z.data);return Y.createTextNode(z.data)}if(Y&&K&&k(z)&&(w(z)||f(z))){let j=await GQ(z,Q);if(Q.isEnable("removeAbnormalAttributes")){let H=j.getAttributeNames();for(let L=H.length,P=0;P<L;P++){let _=H[P];if(!_Q.test(_))j.removeAttribute(_)}}let G=Q.currentNodeStyle=BQ(z,j,Z,Q);if(Z)OQ(j,Q);let M=!1;if(Q.isEnable("copyScrollbar")){let H=[G.get("overflow-x")?.[0],G.get("overflow-y")?.[0]];M=H.includes("scroll")||(H.includes("auto")||H.includes("overlay"))&&(z.scrollHeight>z.clientHeight||z.scrollWidth>z.clientWidth)}let B=G.get("text-transform")?.[0],q=Mz(G.get("font-family")?.[0]),W=q?(H)=>{if(B==="uppercase")H=H.toUpperCase();else if(B==="lowercase")H=H.toLowerCase();else if(B==="capitalize")H=H[0].toUpperCase()+H.substring(1);q.forEach((L)=>{let P=X.get(L);if(!P)X.set(L,P=new Set);H.split("").forEach((_)=>P.add(_))})}:void 0;if(LQ(z,j,M,Q,W),MQ(z,j),!h(z))await r(z,j,Q,W);return await J?.(j),j}let V=z.cloneNode(!1);return await r(z,V,Q),await J?.(V),V}function AQ(z){if(z.ownerDocument=void 0,z.ownerWindow=void 0,z.svgStyleElement=void 0,z.svgDefsElement=void 0,z.svgStyles.clear(),z.defaultComputedStyles.clear(),z.sandbox){try{z.sandbox.remove()}catch(Q){z.log.warn("Failed to destroyContext",Q)}z.sandbox=void 0}z.workers=[],z.fontFamilies.clear(),z.fontCssTexts.clear(),z.requests.clear(),z.tasks=[],z.shadowRoots=[]}function kQ(z){let{url:Q,timeout:Z,responseType:$,...Y}=z,K=new AbortController,X=Z?setTimeout(()=>K.abort(),Z):void 0;return fetch(Q,{signal:K.signal,...Y}).then((J)=>{if(!J.ok)throw Error("Failed fetch, not 2xx response",{cause:J});switch($){case"arrayBuffer":return J.arrayBuffer();case"dataUrl":return J.blob().then(nz);case"text":default:return J.text()}}).finally(()=>clearTimeout(X))}function C(z,Q){let{url:Z,requestType:$="text",responseType:Y="text",imageDom:K}=Q,X=Z,{timeout:J,acceptOfImage:V,requests:j,fetchFn:G,fetch:{requestInit:M,bypassingCache:B,placeholderImage:q},font:W,workers:H,fontFamilies:L}=z;if($==="image"&&(S||u))z.drawImageCount++;let P=j.get(Z);if(!P){if(B){if(B instanceof RegExp&&B.test(X))X+=(/\?/.test(X)?"&":"?")+new Date().getTime()}let _=$.startsWith("font")&&W&&W.minify,O=new Set;if(_)$.split(";")[1].split(",").forEach((b)=>{if(!L.has(b))return;L.get(b).forEach((d)=>O.add(d))});let A=_&&O.size,U={url:X,timeout:J,responseType:A?"arrayBuffer":Y,headers:$==="image"?{accept:V}:void 0,...M};P={type:$,resolve:void 0,reject:void 0,response:null},P.response=(async()=>{if(G&&$==="image"){let I=await G(Z);if(I)return I}if(!S&&Z.startsWith("http")&&H.length)return new Promise((I,b)=>{H[j.size&H.length-1].postMessage({rawUrl:Z,...U}),P.resolve=I,P.reject=b});return kQ(U)})().catch((I)=>{if(j.delete(Z),$==="image"&&q)return z.log.warn("Failed to fetch image base64, trying to use placeholder image",X),typeof q==="string"?q:q(K);throw I}),j.set(Z,P)}return P.response}async function Oz(z,Q,Z,$){if(!_z(z))return z;for(let[Y,K]of NQ(z,Q))try{let X=await C(Z,{url:K,requestType:$?"image":"text",responseType:"dataUrl"});z=z.replace(IQ(Y),`$1${X}$3`)}catch(X){Z.log.warn("Failed to fetch css data url",Y,X)}return z}function _z(z){return/url\((['"]?)([^'"]+?)\1\)/.test(z)}var Az=/url\((['"]?)([^'"]+?)\1\)/g;function NQ(z,Q){let Z=[];return z.replace(Az,($,Y,K)=>{return Z.push([K,Gz(K,Q)]),$}),Z.filter(([$])=>!y($))}function IQ(z){let Q=z.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${Q})(['"]?\\))`,"g")}var UQ=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function DQ(z,Q){return UQ.map((Z)=>{let $=z.getPropertyValue(Z);if(!$||$==="none")return null;if(S||u)Q.drawImageCount++;return Oz($,null,Q,!0).then((Y)=>{if(!Y||$===Y)return;z.setProperty(Z,Y,z.getPropertyPriority(Z))})}).filter(Boolean)}function FQ(z,Q){if(R(z)){let Z=z.currentSrc||z.src;if(!y(Z))return[C(Q,{url:Z,imageDom:z,requestType:"image",responseType:"dataUrl"}).then(($)=>{if(!$)return;z.srcset="",z.dataset.originalSrc=Z,z.src=$||""})];if(S||u)Q.drawImageCount++}else if(f(z)&&!y(z.href.baseVal)){let Z=z.href.baseVal;return[C(Q,{url:Z,imageDom:z,requestType:"image",responseType:"dataUrl"}).then(($)=>{if(!$)return;z.dataset.originalSrc=Z,z.href.baseVal=$||""})]}return[]}function RQ(z,Q){let{ownerDocument:Z,svgDefsElement:$}=Q,Y=z.getAttribute("href")??z.getAttribute("xlink:href");if(!Y)return[];let[K,X]=Y.split("#");if(X){let J=`#${X}`,V=Q.shadowRoots.reduce((j,G)=>{return j??G.querySelector(`svg ${J}`)},Z?.querySelector(`svg ${J}`));if(K)z.setAttribute("href",J);if($?.querySelector(J))return[];if(V)return $?.appendChild(V.cloneNode(!0)),[];else if(K)return[C(Q,{url:K,responseType:"text"}).then((j)=>{$?.insertAdjacentHTML("beforeend",j)})]}return[]}function kz(z,Q){let{tasks:Z}=Q;if(k(z)){if(R(z)||Xz(z))Z.push(...FQ(z,Q));if(hz(z))Z.push(...RQ(z,Q))}if(w(z))Z.push(...DQ(z.style,Q));z.childNodes.forEach(($)=>{kz($,Q)})}async function wQ(z,Q){let{ownerDocument:Z,svgStyleElement:$,fontFamilies:Y,fontCssTexts:K,tasks:X,font:J}=Q;if(!Z||!$||!Y.size)return;if(J&&J.cssText){let V=o(J.cssText,Q);$.appendChild(Z.createTextNode(`${V}
|
|
8
|
+
`))}else{let V=Array.from(Z.styleSheets).filter((q)=>{try{return"cssRules"in q&&Boolean(q.cssRules.length)}catch(W){return Q.log.warn(`Error while reading CSS rules from ${q.href}`,W),!1}}),j=Z.implementation.createHTMLDocument(""),G=j.createElement("style");j.head.appendChild(G);let M=G.sheet;if(await Promise.all(V.flatMap((q)=>{return Array.from(q.cssRules).map(async(W)=>{if(bz(W)){let H=W.href,L="";try{L=await C(Q,{url:H,requestType:"text",responseType:"text"})}catch(_){Q.log.warn(`Error fetch remote css import from ${H}`,_)}let P=L.replace(Az,(_,O,A)=>_.replace(A,Gz(A,H)));for(let _ of CQ(P))try{M.insertRule(_,M.cssRules.length)}catch(O){Q.log.warn("Error inserting rule from remote css import",{rule:_,error:O})}}})})),M.cssRules.length)V.push(M);let B=[];V.forEach((q)=>{m(q.cssRules,B)}),B.filter((q)=>Tz(q)&&_z(q.style.getPropertyValue("src"))&&Mz(q.style.getPropertyValue("font-family"))?.some((W)=>Y.has(W))).forEach((q)=>{let W=q,H=K.get(W.cssText);if(H)$.appendChild(Z.createTextNode(`${H}
|
|
9
|
+
`));else X.push(Oz(W.cssText,W.parentStyleSheet?W.parentStyleSheet.href:null,Q).then((L)=>{L=o(L,Q),K.set(W.cssText,L),$.appendChild(Z.createTextNode(`${L}
|
|
10
|
+
`))}))})}}var EQ=/(\/\*[\s\S]*?\*\/)/g,n=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function CQ(z){if(z==null)return[];let Q=[],Z=z.replace(EQ,"");while(!0){let K=n.exec(Z);if(!K)break;Q.push(K[0])}Z=Z.replace(n,"");let $=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,Y=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");while(!0){let K=$.exec(Z);if(!K)if(K=Y.exec(Z),!K)break;else $.lastIndex=Y.lastIndex;else Y.lastIndex=$.lastIndex;Q.push(K[0])}return Q}var fQ=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,TQ=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function o(z,Q){let{font:Z}=Q,$=Z?Z?.preferredFormat:void 0;return $?z.replace(TQ,(Y)=>{while(!0){let[K,,X]=fQ.exec(Y)||[];if(!X)return"";if(X===$)return`src: ${K};`}}):z}function m(z,Q=[]){for(let Z of Array.from(z))if(Sz(Z))Q.push(...m(Z.cssRules));else if("cssRules"in Z)m(Z.cssRules,Q);else Q.push(Z);return Q}var bQ=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function SQ(z){return bQ.test(z.innerHTML)}async function hQ(z,Q){let Z=await N(z,Q);if(k(Z.node)&&f(Z.node)&&!SQ(Z.node))return Z.node;let{ownerDocument:$,log:Y,tasks:K,svgStyleElement:X,svgDefsElement:J,svgStyles:V,font:j,progress:G,autoDestruct:M,onCloneNode:B,onEmbedNode:q,onCreateForeignObjectSvg:W}=Z;Y.time("clone node");let H=await i(Z.node,Z,!0);if(X&&$){let A="";V.forEach((U,I)=>{A+=`${U.join(`,
|
|
11
|
+
`)} {
|
|
12
|
+
${I}
|
|
13
|
+
}
|
|
14
|
+
`}),X.appendChild($.createTextNode(A))}if(Y.timeEnd("clone node"),await B?.(H),j!==!1&&k(H))Y.time("embed web font"),await wQ(H,Z),Y.timeEnd("embed web font");Y.time("embed node"),kz(H,Z);let L=K.length,P=0,_=async()=>{while(!0){let A=K.pop();if(!A)break;try{await A}catch(U){Z.log.warn("Failed to run task",U)}G?.(++P,L)}};G?.(P,L),await Promise.all([...Array.from({length:4})].map(_)),Y.timeEnd("embed node"),await q?.(H);let O=gQ(H,Z);return J&&O.insertBefore(J,O.children[0]),X&&O.insertBefore(X,O.children[0]),M&&AQ(Z),await W?.(O),O}function gQ(z,Q){let{width:Z,height:$}=Q,Y=jz(Z,$,z.ownerDocument),K=Y.ownerDocument.createElementNS(Y.namespaceURI,"foreignObject");return K.setAttributeNS(null,"x","0%"),K.setAttributeNS(null,"y","0%"),K.setAttributeNS(null,"width","100%"),K.setAttributeNS(null,"height","100%"),K.append(z),Y.appendChild(K),Y}async function c(z,Q){let Z=await N(z,Q),$=await hQ(Z),Y=Vz($,Z.isEnable("removeControlCharacter"));if(!Z.autoDestruct)Z.svgStyleElement=qz(Z.ownerDocument),Z.svgDefsElement=Z.ownerDocument?.createElementNS(v,"defs"),Z.svgStyles.clear();let K=F(Y,$.ownerDocument);return await $Q(K,Z)}async function pQ(z,Q){let Z=await N(z,Q),{log:$,type:Y,quality:K,dpi:X}=Z,J=await c(Z);$.time("canvas to blob");let V=await sz(J,Y,K);if(["image/png","image/jpeg"].includes(Y)&&X){let j=await oz(V.slice(0,33)),G=new Uint8Array(j);if(Y==="image/png")G=$z(G,X);else if(Y==="image/jpeg")G=t(G,X);return $.timeEnd("canvas to blob"),new Blob([G,V.slice(33)],{type:Y})}return $.timeEnd("canvas to blob"),V}async function T(z,Q){let Z=await N(z,Q),{log:$,quality:Y,type:K,dpi:X}=Z,J=await c(Z);$.time("canvas to data url");let V=J.toDataURL(K,Y);if(["image/png","image/jpeg"].includes(K)&&X&&Kz&&Cz){let[j,G]=V.split(","),M=0,B=!1;if(K==="image/png"){let O=wz(G);if(O>=0)M=Math.ceil((O+28)/3)*4,B=!0;else M=44}else if(K==="image/jpeg")M=24;let q=G.substring(0,M),W=G.substring(M),H=window.atob(q),L=new Uint8Array(H.length);for(let O=0;O<L.length;O++)L[O]=H.charCodeAt(O);let P=K==="image/png"?$z(L,X,B):t(L,X),_=window.btoa(String.fromCharCode(...P));V=[j,",",_,W].join("")}return $.timeEnd("canvas to data url"),V}async function vQ(z,Q){let Z=await N(z,Q),{width:$,height:Y,ownerDocument:K}=Z,X=await T(Z),J=jz($,Y,K),V=J.ownerDocument.createElementNS(J.namespaceURI,"image");return V.setAttributeNS(null,"href",X),V.setAttributeNS(null,"height","100%"),V.setAttributeNS(null,"width","100%"),J.appendChild(V),Vz(J,Z.isEnable("removeControlCharacter"))}async function yQ(z,Q){let Z=await N(z,Q),{ownerDocument:$,width:Y,height:K,scale:X,type:J}=Z,V=J==="image/svg+xml"?await vQ(Z):await T(Z),j=F(V,$);return j.width=Math.floor(Y*X),j.height=Math.floor(K*X),j.style.width=`${Y}px`,j.style.height=`${K}px`,j}async function mQ(z,Q){return T(await N(z,{...Q,type:"image/jpeg"}))}async function xQ(z,Q){let Z=await N(z,Q),$=await c(Z);return $.getContext("2d").getImageData(0,0,$.width,$.height).data}async function uQ(z,Q){return T(await N(z,{...Q,type:"image/png"}))}async function iQ(z,Q){return T(await N(z,{...Q,type:"image/webp"}))}export{tz as waitUntilLoad,E as loadMedia,iQ as domToWebp,vQ as domToSvg,uQ as domToPng,xQ as domToPixel,mQ as domToJpeg,yQ as domToImage,hQ as domToForeignObjectSvg,T as domToDataUrl,c as domToCanvas,pQ as domToBlob,AQ as destroyContext,QQ as createContext};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as S,E as Wz,
|
|
1
|
+
import{C as S,E as Wz,aa as H,ba as Az,fa as Kz}from"/chunk-339jds4x.js";import{Da as I,Ea as _z,ga as h,ha as D}from"/chunk-yp4srgqt.js";import{Ec as A}from"/chunk-vkvb3hjm.js";var Y=A(h(),1);var K=A(D(),1),kz=[{label:"Trivial",prompt:"Reply with exactly: pong"},{label:"Reasoning",prompt:"Think carefully: a farmer has 17 sheep, all but 9 run away, then he buys twice as many as remain. How many sheep now? Reason it out before answering."},{label:"Command",prompt:"Run `ls -la` and summarize what you see in one sentence."},{label:"File edit",prompt:"Create or overwrite scratch.txt with three random words, one per line."},{label:"Plan",prompt:"Make a 3-step plan (use your plan tool) for adding a README to this folder, then execute it."},{label:"Subagent",prompt:"Spawn a subagent (collab/agent tool) to count the files in this directory and report back its answer."},{label:"Web search",prompt:"Search the web for the current Bun version and tell me what you find."},{label:"Slow (interrupt me)",prompt:"Run this exact command: sleep 30 && echo done. Nothing else."}];function Iz(_,Z=110){let Q=JSON.stringify(_);if(!Q)return"";return Q.length>Z?Q.slice(0,Z)+"…":Q}function c(_){let Z=_;if(typeof Z?.method==="string")return"id"in Z?`${Z.method} #${Z.id}`:Z.method;if("id"in(Z??{}))return`response #${Z.id}`;if(typeof Z?.kind==="string")return`${Z.kind}`;if(typeof Z?.type==="string")return`${Z.type}`;return"?"}function Cz(_){return new Date(_).toLocaleTimeString("en-GB",{hour12:!1})+"."+String(_%1000).padStart(3,"0")}function i({time:_,badge:Z,badgeClass:Q,label:J,body:X}){return K.jsxs("details",{className:"group border-b border-border/40 px-2 py-1 text-[11px] leading-tight",children:[K.jsxs("summary",{className:"flex cursor-pointer items-baseline gap-2 font-mono whitespace-nowrap",children:[K.jsx("span",{className:"text-muted-foreground/60 tabular-nums",children:Cz(_)}),K.jsx("span",{className:I("rounded px-1 font-semibold",Q),children:Z}),K.jsx("span",{className:"shrink-0 font-semibold",children:J}),K.jsx("span",{className:"truncate text-muted-foreground",children:Iz(X)})]}),K.jsx("pre",{className:"mt-1 max-h-80 overflow-auto rounded bg-muted p-2 text-[10px] whitespace-pre-wrap",children:JSON.stringify(X,null,2)})]})}function l({title:_,hint:Z,onClear:Q,children:J}){let X=Y.useRef(null),[B,U]=Y.useState(!0);return Y.useEffect(()=>{if(B&&X.current)X.current.scrollTop=X.current.scrollHeight}),K.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-lg border border-border bg-background",children:[K.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-2 py-1",children:[K.jsx("span",{className:"text-xs font-semibold",children:_}),Z&&K.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:Z}),K.jsx("span",{className:"grow"}),K.jsxs("label",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[K.jsx("input",{type:"checkbox",checked:B,onChange:(F)=>U(F.target.checked)}),"follow"]}),Q&&K.jsx(H,{type:"button",variant:"ghost",size:"sm",onClick:Q,children:"Clear"})]}),K.jsx("div",{ref:X,className:"min-h-0 flex-1 overflow-y-auto",children:J})]})}function $z(){let[_,Z]=Y.useState([]),[Q,J]=Y.useState(""),[X,B]=Y.useState([]),[U,F]=Y.useState(""),[L,g]=Y.useState(""),[E,p]=Y.useState(!0),[$,q]=Y.useState(()=>crypto.randomUUID()),[M,G]=Y.useState(!0),[b,C]=Y.useState(""),[m,Nz]=Y.useState(null),[yz,w]=Y.useState([]),[j,Qz]=Y.useState([]),[Yz,x]=Y.useState(null),[d,Bz]=Y.useState(!1),u=Y.useRef(0),P=Y.useRef(null),Fz=Y.useRef(0),k=Y.useRef($);k.current=$,Y.useEffect(()=>{fetch("/api/workspaces").then((z)=>z.json()).then((z)=>{Z(z),J((N)=>N||(z[0]?.id??""))}).catch(()=>{})},[]);let v=_.find((z)=>z.id===Q)?.type??"claude-code";Y.useEffect(()=>{if(!Q)return;fetch(`/api/workspaces/${Q}/models`).then((z)=>z.json()).then((z)=>B(z.models)).catch(()=>B([]))},[Q]),Y.useEffect(()=>{q(crypto.randomUUID()),G(!0),x(null)},[Q]),Y.useEffect(()=>{if(!Q)return;u.current=0,w([]);let z=setInterval(async()=>{try{let N=await fetch(`/api/workspaces/${Q}/harness/debug?sinceWire=${u.current}&sinceBroadcast=-1`);if(!N.ok)return;let O=await N.json();if(Nz(O.process),O.wire.length)u.current=O.wire[O.wire.length-1].seq,w((f)=>[...f,...O.wire].slice(-1000))}catch{}},1000);return()=>clearInterval(z)},[Q]),Y.useEffect(()=>{if(!Q)return;let z=new WebSocket(_z("/ws"));return P.current=z,z.onmessage=(N)=>{try{let O=JSON.parse(String(N.data));if(O.workspaceId&&O.workspaceId!==Q)return;if(O.type==="session_renamed"&&O.from===k.current)q(O.to),G(!1);Qz((f)=>[...f,{seq:++Fz.current,ts:Date.now(),frame:O}].slice(-1000))}catch{}},()=>{P.current=null,z.close()}},[Q]);let Zz=Y.useCallback((z)=>{if(!z.trim()||!P.current||P.current.readyState!==WebSocket.OPEN)return;P.current.send(JSON.stringify({type:"chat",workspaceId:Q,sessionId:k.current,isNew:M,content:z,optimisticId:crypto.randomUUID(),...U?{model:U}:{},...L?{effort:L}:{},stream:E})),G(!1)},[Q,M,U,L,E]),Lz=Y.useCallback(()=>{P.current?.send(JSON.stringify({type:"stop",workspaceId:Q,sessionId:k.current}))},[Q]),Ez=Y.useCallback(()=>{q(crypto.randomUUID()),G(!0),x(null)},[]),Pz=Y.useCallback(async()=>{let z=await fetch(`/api/workspaces/${Q}/sessions/${k.current}/events`);x(z.ok?await z.json():[])},[Q]),Rz=Y.useMemo(()=>X.find((z)=>z.value===U)?.supportedEffortLevels??[],[X,U]),bz=Y.useMemo(()=>d?j.filter((z)=>z.frame.type!=="preview"):j,[j,d]);return K.jsxs("div",{className:"flex h-dvh flex-col gap-2 bg-muted p-2",children:[K.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-background px-2 py-1.5 text-xs",children:[K.jsx("span",{className:"font-semibold tracking-widest text-muted-foreground uppercase",children:"Harness debug"}),K.jsxs("select",{className:"rounded border border-border bg-background px-1 py-0.5",value:Q,onChange:(z)=>J(z.target.value),children:[_.length===0&&K.jsx("option",{value:"",children:"no workspaces"}),_.map((z)=>K.jsx("option",{value:z.id,children:`${z.name??z.displayPath??z.path} · ${z.type??"claude-code"}`},z.id))]}),K.jsxs("select",{className:"rounded border border-border bg-background px-1 py-0.5",value:U,onChange:(z)=>F(z.target.value),children:[K.jsx("option",{value:"",children:"default model"}),X.map((z)=>K.jsx("option",{value:z.value,children:z.displayName},z.value))]}),K.jsxs("select",{className:"rounded border border-border bg-background px-1 py-0.5",value:L,onChange:(z)=>g(z.target.value),children:[K.jsx("option",{value:"",children:"default effort"}),Rz.map((z)=>K.jsx("option",{value:z,children:z},z))]}),K.jsxs("label",{className:"flex items-center gap-1",children:[K.jsx("input",{type:"checkbox",checked:E,onChange:(z)=>p(z.target.checked)}),"stream"]}),K.jsx("span",{className:"grow"}),v==="codex"&&K.jsx("span",{className:I("rounded px-1.5 py-0.5 font-mono text-[10px]",m?.running?"bg-green-500/15 text-green-600":"bg-muted text-muted-foreground"),children:m?.running?`app-server pid ${m.pid}`:"app-server not running"}),K.jsxs("span",{className:"max-w-56 truncate font-mono text-[10px] text-muted-foreground",children:["thread ",$]}),K.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:Ez,children:"New thread"}),K.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:Lz,children:"Stop"})]}),K.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-lg border border-border bg-background px-2 py-1.5",children:[kz.map((z)=>K.jsx(H,{type:"button",size:"sm",variant:"secondary",onClick:()=>Zz(z.prompt),children:z.label},z.label)),K.jsx("input",{className:"min-w-48 grow rounded border border-border bg-background px-2 py-1 text-xs",placeholder:"or type a custom prompt and hit Enter…",value:b,onChange:(z)=>C(z.target.value),onKeyDown:(z)=>{if(z.key==="Enter")Zz(b),C("")}})]}),K.jsxs("div",{className:"flex min-h-0 flex-1 gap-2",children:[K.jsx(l,{title:v==="codex"?"App-server wire":"Harness wire",hint:v==="codex"?"raw JSON-RPC, both directions":v==="openclaw"?"no wire tap for OpenClaw yet":"raw Agent SDK messages + enqueued inputs",onClear:()=>w([]),children:yz.map((z)=>K.jsx(i,{time:z.ts,badge:z.dir==="send"?"→":"←",badgeClass:z.dir==="send"?"bg-blue-500/15 text-blue-600":"bg-amber-500/15 text-amber-600",label:c(z.frame),body:z.frame},z.seq))}),K.jsxs(l,{title:"Client frames",hint:"what the browser receives on /ws",onClear:()=>Qz([]),children:[K.jsx("div",{className:"border-b border-border/40 px-2 py-1",children:K.jsxs("label",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[K.jsx("input",{type:"checkbox",checked:d,onChange:(z)=>Bz(z.target.checked)}),"hide preview frames"]})}),bz.map((z)=>K.jsx(i,{time:z.ts,badge:"ws",badgeClass:"bg-purple-500/15 text-purple-600",label:c(z.frame),body:z.frame},z.seq))]}),K.jsxs(l,{title:"Durable events",hint:"GET /sessions/:id/events replay",children:[K.jsx("div",{className:"border-b border-border/40 px-2 py-1",children:K.jsx(H,{type:"button",size:"sm",variant:"secondary",onClick:Pz,children:"Fetch events"})}),Yz?.map((z,N)=>K.jsx(i,{time:Date.now(),badge:"ev",badgeClass:"bg-teal-500/15 text-teal-600",label:c(z),body:z},N)),Yz?.length===0&&K.jsx("div",{className:"p-2 text-[11px] text-muted-foreground",children:"no events"})]})]})]})}var n=A(h(),1);var y=A(h(),1);var T=A(D(),1),vz=5,hz=5,qz=[".....","####.","#.#.#","#.#.#","#.#.#"];function Jz(_){return _.map((Z)=>[...Z].map((Q)=>Q==="#"))}function Sz(){return Array.from({length:hz},()=>Array.from({length:vz},()=>!1))}function Xz(){let[_,Z]=y.useState(()=>Jz(qz)),[Q,J]=y.useState(!1),X=y.useRef(!0),[B,U]=y.useState(!1);y.useEffect(()=>{let $=()=>J(!1);return window.addEventListener("mouseup",$),()=>window.removeEventListener("mouseup",$)},[]);function F($,q,M){Z((G)=>{if(G[$][q]===M)return G;let b=G.map((C)=>C.slice());return b[$][q]=M,b})}function L($,q){let M=!_[$][q];X.current=M,J(!0),F($,q,M)}function g($,q){if(Q)F($,q,X.current)}let E=_.map(($)=>$.map((q)=>q?"#":".").join("")).join(`
|
|
2
2
|
`);async function p(){await navigator.clipboard.writeText(E),U(!0),setTimeout(()=>U(!1),1200)}return T.jsxs("div",{className:"flex flex-col items-center gap-4",children:[T.jsx("div",{className:"grid w-fit grid-cols-[repeat(5,28px)] gap-px bg-border p-px select-none",children:_.map(($,q)=>$.map((M,G)=>T.jsx("div",{onMouseDown:()=>L(q,G),onMouseEnter:()=>g(q,G),className:I("size-7 cursor-pointer",M?"bg-foreground":"bg-background")},`${q}-${G}`)))}),T.jsx("pre",{className:"rounded-md border border-border bg-card px-3 py-2 text-center font-mono text-sm leading-snug text-card-foreground",children:E}),T.jsxs("div",{className:"flex gap-2",children:[T.jsx(H,{type:"button",size:"sm",onClick:p,children:B?"Copied!":"Copy"}),T.jsx(H,{type:"button",variant:"secondary",size:"sm",onClick:()=>Z(Sz()),children:"Clear"}),T.jsx(H,{type:"button",variant:"secondary",size:"sm",onClick:()=>Z(Jz(qz)),children:"Reset"})]})]})}var V=A(D(),1),gz=[{value:"moi",label:"M"},{value:"moi-full",label:"moi"}],pz=[{value:"none",label:"None"},{value:"wave",label:"Wave"},{value:"chaos",label:"Random"}];function Hz({options:_,value:Z,onChange:Q}){return V.jsx("div",{className:"flex gap-1 rounded-lg bg-accent p-1",children:_.map((J)=>V.jsx(H,{type:"button",variant:Z===J.value?"default":"ghost",size:"sm",onClick:()=>Q(J.value),children:J.label},String(J.value)))})}function Gz(){let[_,Z]=n.useState("moi"),[Q,J]=n.useState("none");return V.jsxs("div",{className:"relative flex min-h-dvh flex-col items-center justify-center gap-8 bg-muted",children:[V.jsx("span",{className:"absolute top-5 left-5 text-[11px] font-medium tracking-widest text-muted-foreground uppercase",children:"Playground"}),V.jsx(Xz,{}),V.jsx(Az,{sprite:_,effect:Q==="none"?void 0:Q,pixelSize:3,gap:0.5}),V.jsxs("div",{className:"flex flex-col items-center gap-2",children:[V.jsx(Hz,{options:gz,value:_,onChange:Z}),V.jsx(Hz,{options:pz,value:Q,onChange:J})]})]})}var Dz=A(h(),1);var r="/Users/kim/git/confetti",Oz={toolCallId:"toolu_fixture_tool_search",name:"ToolSearch",caller:"model",provider:"claude-code",state:"success",input:{query:"select:mcp__notion__notion-search,mcp__notion__notion-get-teams,mcp__notion__notion-get-users",max_results:3},output:`mcp__notion__notion-search
|
|
3
3
|
mcp__notion__notion-get-teams
|
|
4
4
|
mcp__notion__notion-get-users`},Uz={toolCallId:"toolu_fixture_notion_search",name:"mcp__notion__notion-search",caller:"model",provider:"claude-code",state:"success",input:{query:"project notes docs overview",query_type:"internal",page_size:25},output:'{"results":[{"id":"3f1c9a72-0d62-4511-9dc9-5b7f38409a22","title":"Reading List","url":"https://app.notion.com/p/3f1c9a720d6245119dc95b7f38409a22?pvs=1","type":"page","highlight":"Reading List","timestamp":"2024-10-17T13:51:00.000Z"},{"id":"8b2d17aa-6741-4993-88bc-5adf2dabb8da","title":"To-Do","url":"https://app.notion.com/p/8b2d17aa6741499388bc5adf2dabb8da?pvs=1","type":"page","highlight":"canvas-confetti performance notes and particle pooling","timestamp":"2026-06-15T13:14:00.000Z"},{"id":"244536fd-e65b-433f-92bf-aa95efa91f35","title":"Plans & Notes","url":"https://app.notion.com/p/244536fde65b433f92bfaa95efa91f35?pvs=1","type":"database","highlight":"Plans & Notes","timestamp":"2024-02-06T10:02:00.000Z"},{"id":"5a668c31-b678-4035-b58e-d33e3ce86f5e","title":"Animation Research","url":"https://app.notion.com/p/5a668c31b6784035b58ed33e3ce86f5e?pvs=1","type":"page","highlight":"spring easings vs. bezier — generate N particle bursts in parallel and compare frame budgets","timestamp":"2025-11-03T08:07:00.000Z"},{"id":"41c28e19-b678-40df-ade3-dd8cec63de64","title":"Roadmap","url":"https://app.notion.com/p/41c28e19b67840dfade3dd8cec63de64?pvs=1","type":"database","highlight":"Roadmap","timestamp":"2026-06-09T08:00:00.000Z"},{"id":"6d9e2f44-b678-423e-9795-01de5d5f6734","title":"Meeting notes","url":"https://app.notion.com/p/6d9e2f44b678423e979501de5d5f6734?pvs=1","type":"database","highlight":"Meeting notes","timestamp":"2025-11-06T15:22:00.000Z"},{"id":"7fa31c55-b678-401d-948f-c47118e21516","title":"illustrations","url":"https://app.notion.com/p/7fa31c55b678401d948fc47118e21516?pvs=1","type":"page","highlight":"illustrations","timestamp":"2026-06-09T18:01:00.000Z"},{"id":"92e4b5c8-8d50-4938-8808-716a4e89dba6","title":"Weekly Update: March 4","url":"https://app.notion.com/p/92e4b5c88d5049388808716a4e89dba6?pvs=1","type":"page","highlight":"add backlog project for migrating v1 users","timestamp":"2022-07-30T18:34:00.000Z"},{"id":"1c778a02-b678-407b-9340-e1e830e38c50","title":"demo site","url":"https://app.notion.com/p/1c778a02b678407b9340e1e830e38c50?pvs=1","type":"page","highlight":"Interactive playground (CodeSandbox style)","timestamp":"2026-06-15T08:15:00.000Z"},{"id":"e3558d21-b678-406b-9a90-efaac9d864cf","title":"Feature Requests","url":"https://app.notion.com/p/e3558d21b678406b9a90efaac9d864cf?pvs=1","type":"database","highlight":"Feature Requests","timestamp":"2026-03-09T13:03:00.000Z"},{"id":"a91f4c6e-ce16-4002-bcb1-ead4923b9963","title":"Beta feedback","url":"https://app.notion.com/p/a91f4c6ece164002bcb1ead4923b9963?pvs=1","type":"database","highlight":"Beta feedback","timestamp":"2026-04-22T11:56:00.000Z"},{"id":"b0537e88-b678-40f3-8f04-cc7fef16e055","title":"confetti-v2","url":"https://app.notion.com/p/b0537e88b67840f38f04cc7fef16e055?pvs=1","type":"page","highlight":"WebGL renderer spike — offscreen canvas + worker, fall back to 2d context","timestamp":"2026-04-21T09:42:00.000Z"},{"id":"c6b19d34-b678-4145-9023-ffb37c04037d","title":"Physics Notes","url":"https://app.notion.com/p/c6b19d34b67841459023ffb37c04037d?pvs=1","type":"page","highlight":"Physics Notes","timestamp":"2026-04-21T13:07:00.000Z"},{"id":"d84a6f10-b678-41ea-845c-d7cc7c2ad2c4","title":"Docs Outline","url":"https://app.notion.com/p/d84a6f10b67841ea845cd7cc7c2ad2c4?pvs=1","type":"page","highlight":"\uD83D\uDCD8 Getting started — full walkthrough (install, first burst, presets)","timestamp":"2026-06-09T08:44:00.000Z"},{"id":"f2c07b45-b678-402c-a8e7-d897826cf96d","title":"old","url":"https://app.notion.com/p/f2c07b45b678402ca8e7d897826cf96d?pvs=1","type":"page","highlight":"Notes:","timestamp":"2026-03-06T16:31:00.000Z"},{"id":"09d6e2a7-9908-4d54-be46-a974ac5019da","title":"Weekly Update: Jan 28","url":"https://app.notion.com/p/09d6e2a799084d54be46a974ac5019da'},mz={toolCallId:"toolu_fixture_notion_fetch_oss",name:"mcp__notion__notion-fetch",caller:"model",provider:"claude-code",state:"success",input:{id:"55e1c208-1f0f-47cd-9422-bd7dbc54d536"},output:'{"metadata":{"type":"page"},"title":"\uD83D\uDEE5 Open-Source","url":"https://app.notion.com/p/55e1c2081f0f47cd9422bd7dbc54d536","text":"Here is the result of \\"view\\" for the Page with URL https://app.notion.com/p/55e1c2081f0f47cd9422bd7dbc54d536 as of 2026-05-29T13:08:56.275Z:\\n<page url=\\"https://app.notion.com/p/55e1c2081f0f47cd9422bd7dbc54d536\\" icon=\\"\uD83D\uDEE5\\">\\n<ancestor-path></ancestor-path>\\n<properties>\\n{\\"title\\":\\"Open-Source\\"}\\n</properties>\\n<content>\\n<page url=\\"https://app.notion.com/p/71a2b39c6438406fac456aeef33a046d\\">tinyrouter</page>\\n<page url=\\"https://app.notion.com/p/83b4c5de45af40c28a19f635332f9c4c\\">confetti</page>\\n<page url=\\"https://app.notion.com/p/95c6d7f0210d42e0888168401a40345e\\">mdnav</page>\\n<page url=\\"https://app.notion.com/p/07d8e912111a4df295726341c22decbc\\">pixelpad</page>\\n<page url=\\"https://app.notion.com/p/19e0fb3405c743628f0c0b864b4182ee\\">`use-sparkle`</page>\\n<page url=\\"https://app.notion.com/p/2bf21c561e5d4e888f6cdb86e5adcb9d\\">use-hotkey</page>\\n<empty-block/>\\n<empty-block/>\\n</content>\\n</page>"}'},wz={toolCallId:"toolu_fixture_notion_fetch_confetti",name:"mcp__notion__notion-fetch",caller:"model",provider:"claude-code",state:"success",input:{id:"83b4c5de-45af-40c2-8a19-f635332f9c4c"},output:'{"metadata":{"type":"page"},"title":"confetti","url":"https://app.notion.com/p/83b4c5de45af40c28a19f635332f9c4c","text":"Here is the result of \\"view\\" for the Page with URL https://app.notion.com/p/83b4c5de45af40c28a19f635332f9c4c as of 2024-04-19T10:05:10.098Z:\\n<page url=\\"https://app.notion.com/p/83b4c5de45af40c28a19f635332f9c4c\\">\\n<ancestor-path>\\n<parent-page url=\\"https://app.notion.com/p/55e1c2081f0f47cd9422bd7dbc54d536\\" title=\\"Open-Source\\"/>\\n</ancestor-path>\\n<properties>\\n{\\"title\\":\\"confetti\\"}\\n</properties>\\n<content>\\n- [x] Split the physics step from the render step\\n- [x] Basic React API\\n\\t- [x] Controlled/uncontrolled\\n\\t- [x] SSR: ok! No canvas until mount\\n\\t- [x] Detach on unmount\\n\\t- [x] `asChild` prop\\n\\t- [x] Block elements and `tagName`\\n\\t- [x] Fire on `click`\\n\\t- [x] Pass particle options\\n\\t- [x] asChild types\\n\\t- [x] Reduced-motion fallback\\n- [x] Pause bursts when the tab is hidden (VisibilityObserver)\\n- [x] Default burst has no trail. Needs a wrapper that disables the selector via `:has` — but then how do block elements animate? And `asChild` breaks.\\n- [x] Dark/light theme, none, auto, accent color\\n- [x] Demo: light/dark theme\\n- [x] `useIsomorphicLayoutEffect`\\n- [x] Particle pooling (no per-frame allocs)\\n- [x] Build and package\\n- [x] Publish a canary and dogfood it on the demo site\\n- [x] Fallback for Safari + Firefox: pre-rendered sprite sheet, three layers offset by primes 3, 5, 7 — loop four frames\\n- [x] data-active\\n- [x] pixelRatio for the fallback\\n- [x] How should styles load? Ship them separately.\\n- [x] Simple README\\n- [x] Get the easing curve right\\n- [ ] Use inline style in SSR\\n<empty-block/>\\n```javascript\\n// Default confetti: uncontrolled, light theme, fires on click, creates an\\n// inline <span> wrapper, no trail, does not follow the pointer\\n\\n/**\\n * Elements \\n */\\n<Confetti>Party!</Confetti> // <span>Party!</span>\\n<Confetti className=\\"custom\\">Party!</Confetti>\\n\\n// block elements \\n<Confetti block><img /></Confetti> // <div><img /></div>\\n<Confetti tagName=\\"div\\"><img /></Confetti> // alias\\n\\n// advanced\\n<Confetti asChild><button aria-label=\\"celebrate\\" /></Confetti>\\n\\n/**\\n * Controlled/uncontrolled component \\n */\\n\\n<Confetti /> // fires on click, uncontrolled\\n<Confetti fireOn=\\"click\\" />\\n<Confetti fireOn=\\"hover\\" />\\n<Confetti defaultActive={false} onChange={(value) => change} />\\n\\n// when `active` is provided, it becomes controlled and\\n// `fireOn` and `defaultActive` have no effect \\n<Confetti active={true}>Always bursting</Confetti> // controlled\\n<Confetti active={value} onClick={() => setValue()}</Confetti> // controlled\\n\\n/** \\n * Theming \\n */\\n\\n<Confetti /> // default theme is `light`\\n<Confetti theme=\\"dark\\" />\\n<Confetti theme=\\"auto\\" /> // system-defined\\n<Confetti theme=\\"dark\\" accentColor=\\"red\\" /> // use `colord` here\\n\\n/**\\n * Particle options\\n */\\n<Confetti count={120} gravity={0.8} spread={60}>Boom</Confetti>\\n<Confetti preset=\\"fireworks\\">Boom</Confetti>\\n\\n/** \\n * Styling \\n */\\n\\nimport { Confetti } from \\"confetti\\"\\n\\nimport { Confetti } from \\"confetti/unstyled\\"\\nimport \\"confetti/styles.css\\"\\n```\\n<empty-block/>\\n<empty-block/>\\n<page url=\\"https://app.notion.com/p/3dc43e781e5d4e888f6cdb86e5adcb00\\">Confetti: website</page>\\n</content>\\n</page>"}'},Vz={toolCallId:"toolu_fixture_bash_pwd",name:"Bash",caller:"model",provider:"claude-code",state:"success",input:{command:'pwd && echo "---" && ls -la && echo "--- git ---" && git rev-parse --is-inside-work-tree 2>/dev/null && git remote -v 2>/dev/null',description:"Show current directory and git info"},output:`/Users/kim/git/confetti
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Hc as a}from"/chunk-vkvb3hjm.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function e(r){let{mount:t}=await import("/chunk-
|
|
1
|
+
import{Hc as a}from"/chunk-vkvb3hjm.js";if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);async function e(r){let{mount:t}=await import("/chunk-hbvfb6sk.js");t(r)}globalThis.__init=e;
|