moi-computer 0.3.1-next.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -12
- package/client/api/workspace-keys.ts +2 -2
- package/client/app/AppRouter.tsx +0 -2
- package/client/app/shell/SidebarLayout.tsx +3 -16
- package/client/assets/openai.svg +1 -3
- package/client/components/shared/Composer.tsx +53 -2
- package/client/components/ui/button.tsx +1 -1
- package/client/components/ui/tooltip.tsx +12 -15
- package/client/features/chat/ChatComposer.tsx +25 -15
- package/client/features/chat/ChatPanel.tsx +5 -2
- package/client/features/chat/MarkdownContent.tsx +20 -2
- package/client/features/chat/ModelPicker.tsx +5 -3
- package/client/features/chat/TurnView.tsx +2 -2
- package/client/features/chat/chat-frames.ts +13 -6
- package/client/features/chat/chat-send.ts +1 -1
- package/client/features/chat/chat-store.ts +22 -17
- package/client/features/chat/tool-group/ToolOutput.tsx +4 -12
- package/client/features/chat/tool-group/format.ts +22 -7
- package/client/features/chat/useChat.ts +11 -2
- package/client/features/connectors/McpServerCards.tsx +95 -0
- package/client/features/connectors/api.ts +0 -11
- package/client/features/dev/HarnessDebugPage.tsx +210 -74
- package/client/features/home/HomePage.tsx +33 -28
- 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/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceSettings.tsx +8 -4
- package/client/features/views/ViewBuilderTab.tsx +19 -15
- package/client/features/views/useViewBuilderActions.ts +1 -1
- package/client/features/workspace/WorkspaceLayoutContext.tsx +3 -4
- package/client/features/workspace/WorkspaceScreen.tsx +11 -3
- package/client/features/workspace/api.ts +19 -1
- package/client/features/workspace/moi-context.ts +85 -0
- package/client/main.tsx +16 -5
- package/dist/chunk-19g80zc9.css +1 -0
- package/dist/{chunk-jen6xcm1.js → chunk-2vaafjp4.js} +1 -1
- package/dist/{chunk-vkvb3hjm.js → chunk-35fq49qa.js} +1 -1
- package/dist/chunk-69nhbjhy.js +50 -0
- package/dist/{chunk-axszxe4c.js → chunk-72atbmh3.js} +1 -1
- package/dist/{chunk-zpxrb1ce.js → chunk-7mkv2gr0.js} +2 -2
- package/dist/{chunk-cs8vbert.js → chunk-fh2mf6v9.js} +3 -3
- package/dist/chunk-gt7n06ef.js +1 -0
- package/dist/chunk-jwmc32rp.js +63 -0
- package/dist/chunk-kh24bstm.js +10 -0
- package/dist/chunk-sfa4mbmx.js +15 -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 +29 -11
- package/lib/view-builder-directives.ts +16 -0
- package/lib/workspace-types.ts +12 -0
- package/package.json +2 -1
- package/server/api.ts +92 -30
- package/server/harness/README.md +25 -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 +33 -12
- 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/codex/NOTES.md +41 -11
- package/server/harness/codex/adapter.ts +121 -16
- package/server/harness/codex/client.ts +67 -18
- package/server/harness/codex/discovery.ts +114 -0
- package/server/harness/codex/index.ts +10 -5
- package/server/harness/codex/probe.ts +4 -2
- package/server/harness/codex/session.ts +89 -13
- package/server/harness/executable.ts +82 -0
- package/server/harness/openclaw/adapter.ts +8 -1
- package/server/harness/openclaw/index.ts +8 -14
- 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 +22 -5
- package/server/registry.ts +57 -12
- package/server/view-builders.ts +3 -2
- package/server/web.ts +24 -8
- package/server/workspace-import.ts +45 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +3 -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-6c8cwpzc.js +0 -1
- package/dist/chunk-b3ynfk4g.js +0 -62
- package/dist/chunk-b4b276wx.js +0 -15
- package/dist/chunk-kxmvv1ax.js +0 -48
- package/dist/chunk-npwq6jmr.css +0 -1
- package/dist/openai-h13pza4b.svg +0 -3
- package/lib/view-builder-meta.ts +0 -35
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{Ac as H5,Ca as LD,Cc as b0,Dc as Z5,Ea as E,Ga as _4,Gb as X0,Tb as u5,Ub as $8,Vb as S5,_a as F4,bb as Q5,gb as $4,ha as j,ia as v,oa as p8}from"/chunk-kh24bstm.js";import{Fc as Z,Gc as h4}from"/chunk-35fq49qa.js";var G8=h4((K4)=>{var V=Z(j());function P4(D,F){return D===F&&(D!==0||1/D===1/F)||D!==D&&F!==F}var J4=typeof Object.is==="function"?Object.is:P4,O4=V.useState,H4=V.useEffect,Z4=V.useLayoutEffect,g4=V.useDebugValue;function G4(D,F){var $=F(),M=O4({inst:{value:$,getSnapshot:F}}),_=M[0].inst,B=M[1];return Z4(function(){_.value=$,_.getSnapshot=F,y0(_)&&B({inst:_})},[D,$,F]),H4(function(){return y0(_)&&B({inst:_}),D(function(){y0(_)&&B({inst:_})})},[D]),g4($),$}function y0(D){var F=D.getSnapshot;D=D.value;try{var $=F();return!J4(D,$)}catch(M){return!0}}function z4(D,F){return F()}var I4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?z4:G4;K4.useSyncExternalStore=V.useSyncExternalStore!==void 0?V.useSyncExternalStore:I4});function g8(D,F){if(D instanceof RegExp)return{keys:!1,pattern:D};var $,M,_,B,A=[],N="",h=D.split("/");h[0]||h.shift();while(_=h.shift())if($=_[0],$==="*")A.push($),N+=_[1]==="?"?"(?:/(.*))?":"/(.*)";else if($===":"){if(M=_.indexOf("?",1),B=_.indexOf(".",1),A.push(_.substring(1,~M?M:~B?B:_.length)),N+=!!~M&&!~B?"(?:/([^/]+?))?":"/([^/]+?)",~B)N+=(~M?"?":"")+"\\"+_.substring(B)}else N+="/"+_;return{keys:A,pattern:new RegExp("^"+N+(F?"(?=$|/)":"/?$"),"i")}}var a=Z(j(),1),G=Z(j(),1);var q0=Z(G8(),1);var q4=a.useInsertionEffect,Q4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",z8=Q4?a.useLayoutEffect:a.useEffect,E4=q4||z8,Q0=(D)=>{let F=a.useRef([D,(...$)=>F[0](...$)]).current;return E4(()=>{F[0]=D}),F[1]};var v4="popstate",V0="pushState",T0="replaceState",j4="hashchange",I8=[v4,V0,T0,j4],R4=(D)=>{for(let F of I8)addEventListener(F,D);return()=>{for(let F of I8)removeEventListener(F,D)}},Q8=(D,F)=>q0.useSyncExternalStore(R4,D,F),K8=()=>location.search,E8=({ssrSearch:D}={})=>Q8(K8,D!=null?()=>D:K8),k8=()=>location.pathname,C4=({ssrPath:D}={})=>Q8(k8,D!=null?()=>D:k8);var U4=(D,{replace:F=!1,state:$=null}={})=>history[F?T0:V0]($,"",D),v8=(D={})=>[C4(D),U4],q8=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[q8]>"u"){for(let D of[V0,T0]){let F=history[D];history[D]=function(){let $=F.apply(this,arguments),M=new Event(D);return M.arguments=arguments,dispatchEvent(M),$}}Object.defineProperty(window,q8,{value:!0})}var b4=(D,F)=>!F.toLowerCase().indexOf(D.toLowerCase())?F.slice(D.length)||"/":"~"+F,j8=(D="")=>D==="/"?"":D,R8=(D,F)=>D[0]==="~"?D.slice(1):j8(F)+D,C8=(D="",F)=>b4(d0(j8(D)),d0(F)),X4=(D)=>D[0]==="?"?D.slice(1):D,d0=(D)=>{try{return decodeURI(D)}catch(F){return D}},U8=(D)=>d0(X4(D));var X8={hook:v8,searchHook:E8,parser:g8,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:(D)=>D,aroundNav:(D,F,$)=>D(F,$)},f8=G.createContext(X8),$0=()=>G.useContext(f8),W8={},Y8=G.createContext(W8),f4=()=>G.useContext(Y8),E0=(D)=>{let[F,$]=D.hook(D);return[C8(D.base,F),Q0((M,_)=>D.aroundNav($,R8(M,D.base),_))]},W4=()=>E0($0()),Y4=()=>{let D=$0();return U8(D.searchHook(D))},y8=(D,F,$,M)=>{let{pattern:_,keys:B}=F instanceof RegExp?{keys:!1,pattern:F}:D(F||"*",M),A=_.exec($)||[],[N,...h]=A;return N!==void 0?[!0,(()=>{let L=B!==!1?Object.fromEntries(B.map((J,H)=>[J,h[H]])):A.groups,w={...h};return L&&Object.assign(w,L),w})(),...M?[N]:[]]:[!1,null]};var y4=({children:D,...F})=>{let $=$0(),M=F.hook?X8:$,_=M,[B,A=F.ssrSearch??""]=F.ssrPath?.split("?")??[];if(B)F.ssrSearch=A,F.ssrPath=B;F.hrefs=F.hrefs??F.hook?.hrefs,F.searchHook=F.searchHook??F.hook?.searchHook;let N=G.useRef({}),h=N.current,L=h;for(let w in M){let J=w==="base"?M[w]+(F[w]??""):F[w]??M[w];if(h===L&&J!==L[w])N.current=L={...L};if(L[w]=J,J!==M[w]||J!==_[w])_=L}return G.createElement(f8.Provider,{value:_,children:D})},b8=({children:D,component:F},$)=>{if(F)return G.createElement(F,{params:$});return typeof D==="function"?D($):D},V4=(D)=>{let F=G.useRef(W8),$=F.current;return F.current=Object.keys(D).length!==Object.keys($).length||Object.entries(D).some(([M,_])=>_!==$[M])?D:$};function HF(){let[D,F]=W4(),$=Y4(),M=G.useMemo(()=>new URLSearchParams($),[$]),_=M,B=Q0((A,N)=>{_=new URLSearchParams(typeof A==="function"?A(_):A),F(D+"?"+_,N)});return[M,B]}var ZF=({path:D,nest:F,match:$,...M})=>{let _=$0(),[B]=E0(_),[A,N,h]=$??y8(_.parser,D,B,F),L=V4({...f4(),...N});if(!A)return null;let w=h?G.createElement(y4,{base:h},b8(M,L)):b8(M,L);return G.createElement(Y8.Provider,{value:L,children:w})},gF=G.forwardRef((D,F)=>{let $=$0(),[M,_]=E0($),{to:B="",href:A=B,onClick:N,asChild:h,children:L,className:w,replace:J,state:H,transition:K,...Q}=D,q=Q0((C)=>{if(C.ctrlKey||C.metaKey||C.altKey||C.shiftKey||C.button!==0)return;if(N?.(C),!C.defaultPrevented)C.preventDefault(),_(A,D)}),f=$.hrefs(A[0]==="~"?A.slice(1):$.base+A,$);return h&&G.isValidElement(L)?G.cloneElement(L,{onClick:q,href:f}):G.createElement("a",{...Q,onClick:q,href:f,className:w?.call?w(M===A):w,children:L,ref:F})}),V8=(D)=>Array.isArray(D)?D.flatMap((F)=>V8(F&&F.type===G.Fragment?F.props.children:F)):[D],GF=({children:D,location:F})=>{let $=$0(),[M]=E0($);for(let _ of V8(D)){let B=0;if(G.isValidElement(_)&&(B=y8($.parser,_.props.path,F||M,_.props.nest))[0])return G.cloneElement(_,{match:B})}return null};var _D=Z(j(),1);var M0=Z(j(),1);var u0=Z(j(),1);var d8=Z(j(),1),T8={};function N0(D,F){let $=d8.useRef(T8);if($.current===T8)$.current=D(F);return $}var x0=u0[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],T4=x0&&x0!==u0.useLayoutEffect?x0:(D)=>D();function S0(D){let F=N0(d4).current;return F.next=D,T4(F.effect),F.trampoline}function d4(){let D={next:void 0,callback:x4,trampoline:(...F)=>D.callback?.(...F),effect:()=>{D.callback=D.next}};return D}function x4(){}var u4=Z(j(),1),qF={...u4};var x8=Z(j(),1),S4=()=>{},u8=typeof document<"u"?x8.useLayoutEffect:S4;function w0(D,F){if(D&&!F)return D;if(!D&&F)return F;if(D||F)return{...D,...F};return}var P0={};function v0(D,F,$,M,_){let B={...m0(D,P0)};if(F)B=h0(B,F);if($)B=h0(B,$);if(M)B=h0(B,M);if(_)B=h0(B,_);return B}function S8(D){if(D.length===0)return P0;if(D.length===1)return m0(D[0],P0);let F={...m0(D[0],P0)};for(let $=1;$<D.length;$+=1)F=h0(F,D[$]);return F}function h0(D,F){if(m8(F))return F(D);return m4(D,F)}function m4(D,F){if(!F)return D;for(let $ in F){let M=F[$];switch($){case"style":{D[$]=w0(D.style,M);break}case"className":{D[$]=c0(D.className,M);break}default:if(c4($,M))D[$]=i4(D[$],M);else D[$]=M}}return D}function c4(D,F){let $=D.charCodeAt(0),M=D.charCodeAt(1),_=D.charCodeAt(2);return $===111&&M===110&&_>=65&&_<=90&&(typeof F==="function"||typeof F>"u")}function m8(D){return typeof D==="function"}function m0(D,F){if(m8(D))return D(F);return D??P0}function i4(D,F){if(!F)return D;if(!D)return F;return($)=>{if(l4($)){let _=$;j0(_);let B=F(_);if(!_.baseUIHandlerPrevented)D?.(_);return B}let M=F($);return D?.($),M}}function j0(D){return D.preventBaseUIHandler=()=>{D.baseUIHandlerPrevented=!0},D}function c0(D,F){if(F){if(D)return F+" "+D;return F}return D}function l4(D){return D!=null&&typeof D==="object"&&"nativeEvent"in D}function J0(D,...F){let $=new URL("https://base-ui.com/production-error");return $.searchParams.set("code",D.toString()),F.forEach((M)=>$.searchParams.append("args[]",M)),`Base UI error #${D}; visit ${$} for the full message.`}var R0=Z(j(),1),p4=R0.createContext(void 0);function c8(D=!1){let F=R0.useContext(p4);if(F===void 0&&!D)throw Error(J0(16));return F}var i8=Z(j(),1);function l8(D){let{focusableWhenDisabled:F,disabled:$,composite:M=!1,tabIndex:_=0,isNativeButton:B}=D,A=M&&F!==!1,N=M&&F===!1;return{props:i8.useMemo(()=>{let L={onKeyDown(w){if($&&F&&w.key!=="Tab")w.preventDefault()}};if(!M){if(L.tabIndex=_,!B&&$)L.tabIndex=F?_:-1}if(B&&(F||A)||!B&&$)L["aria-disabled"]=$;if(B&&(!F||N))L.disabled=$;return L},[M,$,F,A,N,B,_])}}function o8(D={}){let{disabled:F=!1,focusableWhenDisabled:$,tabIndex:M=0,native:_=!0}=D,B=M0.useRef(null),A=c8(!0)!==void 0,N=S0(()=>{let H=B.current;return Boolean(H?.tagName==="A"&&H?.href)}),{props:h}=l8({focusableWhenDisabled:$,disabled:F,composite:A,tabIndex:M,isNativeButton:_}),L=M0.useCallback(()=>{let H=B.current;if(!o4(H))return;if(A&&F&&h.disabled===void 0&&H.disabled)H.disabled=!1},[F,h.disabled,A]);u8(L,[L]);let w=M0.useCallback((H={})=>{let{onClick:K,onMouseDown:Q,onKeyUp:q,onKeyDown:f,onPointerDown:C,...T}=H;return v0({type:_?"button":void 0,onClick(z){if(F){z.preventDefault();return}K?.(z)},onMouseDown(z){if(!F)Q?.(z)},onKeyDown(z){if(!F)j0(z),f?.(z);if(z.baseUIHandlerPrevented)return;let u=z.target===z.currentTarget&&!_&&!N()&&!F,n=z.key==="Enter",r=z.key===" ";if(u){if(r||n)z.preventDefault();if(n)K?.(z)}},onKeyUp(z){if(!F)j0(z),q?.(z);if(z.baseUIHandlerPrevented)return;if(z.target===z.currentTarget&&!_&&!F&&z.key===" ")K?.(z)},onPointerDown(z){if(F){z.preventDefault();return}C?.(z)}},!_?{role:"button"}:void 0,h,T)},[F,h,_,N]),J=S0((H)=>{B.current=H,L()});return{getButtonProps:w,buttonRef:J}}function o4(D){return p8(D)&&D.tagName==="BUTTON"}var p=Z(j(),1);function i0(D,F,$,M){let _=N0(s8).current;if(a4(_,D,F,$,M))n8(_,[D,F,$,M]);return _.callback}function a8(D){let F=N0(s8).current;if(s4(F,D))n8(F,D);return F.callback}function s8(){return{callback:null,cleanup:null,refs:[]}}function a4(D,F,$,M,_){return D.refs[0]!==F||D.refs[1]!==$||D.refs[2]!==M||D.refs[3]!==_}function s4(D,F){return D.refs.length!==F.length||D.refs.some(($,M)=>$!==F[M])}function n8(D,F){if(D.refs=F,F.every(($)=>$==null)){D.callback=null;return}D.callback=($)=>{if(D.cleanup)D.cleanup(),D.cleanup=null;if($!=null){let M=Array(F.length).fill(null);for(let _=0;_<F.length;_+=1){let B=F[_];if(B==null)continue;switch(typeof B){case"function":{let A=B($);if(typeof A==="function")M[_]=A;break}case"object":{B.current=$;break}default:}}D.cleanup=()=>{for(let _=0;_<F.length;_+=1){let B=F[_];if(B==null)continue;switch(typeof B){case"function":{let A=M[_];if(typeof A==="function")A();else B(null);break}case"object":{B.current=null;break}default:}}}}}}var e8=Z(j(),1);var r8=Z(j(),1),n4=parseInt(r8.version,10);function t8(D){return n4>=D}function l0(D){if(!e8.isValidElement(D))return null;let F=D,$=F.props;return(t8(19)?$?.ref:F.ref)??null}function DD(D,F){let $={};for(let M in D){let _=D[M];if(F?.hasOwnProperty(M)){let B=F[M](_);if(B!=null)Object.assign($,B);continue}if(_===!0)$[`data-${M.toLowerCase()}`]="";else if(_)$[`data-${M.toLowerCase()}`]=_.toString()}return $}function FD(D,F){return typeof D==="function"?D(F):D}function $D(D,F){return typeof D==="function"?D(F):D}function oF(){}var r4=Object.freeze([]),l=Object.freeze({});var sF=500,nF=500,rF={style:{transition:"none"}},tF="data-base-ui-click-trigger",eF={fallbackAxisSide:"none"},D7={fallbackAxisSide:"end"},F7={clipPath:"inset(50%)",position:"fixed",top:0,left:0};var p0=Z(j(),1);function MD(D,F,$={}){let M=F.render,_=t4(F,$);if($.enabled===!1)return null;let B=$.state??l;return D1(D,M,_,B)}function t4(D,F={}){let{className:$,style:M,render:_}=D,{state:B=l,ref:A,props:N,stateAttributesMapping:h,enabled:L=!0}=F,w=L?FD($,B):void 0,J=L?$D(M,B):void 0,H=L?DD(B,h):l,K=L?w0(H,Array.isArray(N)?S8(N):N)??l:l;if(typeof document<"u")if(!L)i0(null,null);else if(Array.isArray(A))K.ref=a8([K.ref,l0(_),...A]);else K.ref=i0(K.ref,l0(_),A);if(!L)return l;if(w!==void 0)K.className=c0(K.className,w);if(J!==void 0)K.style=w0(K.style,J);return K}var e4=Symbol.for("react.lazy");function D1(D,F,$,M){if(F){if(typeof F==="function")return F($,M);let _=v0($,F.props);_.ref=$.ref;let B=F;if(B?.$$typeof===e4)B=p.Children.toArray(F)[0];return p.cloneElement(B,_)}if(D){if(typeof D==="string")return F1(D,$)}throw Error(J0(8))}function F1(D,F){if(D==="button")return p0.createElement("button",{type:"button",...F,key:F.key});if(D==="img")return p0.createElement("img",{alt:"",...F,key:F.key});return p.createElement(D,F)}var o0=_D.forwardRef(function(F,$){let{render:M,className:_,disabled:B=!1,focusableWhenDisabled:A=!1,nativeButton:N=!0,...h}=F,{getButtonProps:L,buttonRef:w}=o8({disabled:B,focusableWhenDisabled:A,native:N});return MD("button",F,{state:{disabled:B},ref:[$,w],props:[h,L]})});var BD=(D)=>typeof D==="boolean"?`${D}`:D===0?"0":D,AD=LD,ND=(D,F)=>($)=>{var M;if((F===null||F===void 0?void 0:F.variants)==null)return AD(D,$===null||$===void 0?void 0:$.class,$===null||$===void 0?void 0:$.className);let{variants:_,defaultVariants:B}=F,A=Object.keys(_).map((L)=>{let w=$===null||$===void 0?void 0:$[L],J=B===null||B===void 0?void 0:B[L];if(w===null)return null;let H=BD(w)||BD(J);return _[L][H]}),N=$&&Object.entries($).reduce((L,w)=>{let[J,H]=w;if(H===void 0)return L;return L[J]=H,L},{}),h=F===null||F===void 0?void 0:(M=F.compoundVariants)===null||M===void 0?void 0:M.reduce((L,w)=>{let{class:J,className:H,...K}=w;return Object.entries(K).every((Q)=>{let[q,f]=Q;return Array.isArray(f)?f.includes({...B,...N}[q]):{...B,...N}[q]===f})?[...L,J,H]:L},[]);return AD(D,A,h,$===null||$===void 0?void 0:$.class,$===null||$===void 0?void 0:$.className)};var wD=Z(v(),1),$1=ND("inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-sm text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground disabled:opacity-100",secondary:"bg-accent text-foreground hover:bg-[color-mix(in_oklch,var(--accent),var(--foreground)_5%)] hover:text-accent-foreground",outline:"bg-background shadow-xs hover:text-accent-foreground hover:shadow-sm",ghost:"hover:bg-accent hover:text-accent-foreground",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20"},size:{sm:"h-7 gap-1.5 rounded-xs px-2.5 text-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg]:size-4",default:"h-8 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5 [&_svg]:size-5",lg:"h-10 rounded-lg px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3 [&_svg]:size-5","icon-sm":"size-7 rounded-xs [&_svg]:size-4",icon:"size-8 [&_svg]:size-5","icon-lg":"size-10 rounded-lg [&_svg]:size-5"}},defaultVariants:{variant:"default",size:"default"}});function a0({className:D,variant:F="default",size:$="default",...M}){return wD.jsx(o0,{"data-slot":"button",className:E($1({variant:F,size:$,className:D})),...M})}var C0=Z(j(),1);var s0=Z(v(),1),JD=(D)=>D.map((F)=>[...F].map(($)=>$==="#"?1:0)),M1=["####.","#.#.#","#.#.#","#.#.#","#.#.#"],_1=["###.#","#.#.#","#.#.#","#.#.#","###.#"],B1=JD([".....","####.","#.#.#","#.#.#","#.#.#"]),A1=JD(M1.map((D,F)=>`${D}.${_1[F]}`)),L1={moi:B1,"moi-full":A1};function OD(D,F,$){let M=[];for(let _=0;_<F;_++){let B=[];for(let A=0;A<D;A++)B.push($(A,_));M.push(B)}return M}function hD(D,F,$){let M=Math.sin(D*12.9898+F*78.233+$*37.719)*43758.5453;return M-Math.floor(M)}function N1(D,F,$){return OD(F,$,(M,_)=>{let B=hD(M,_,0)*Math.PI*2,A=5+hD(M,_,1)*6,N=0.5+0.5*Math.sin(D*A+B);return N*N})}function w1(D,F,$){return OD(F,$,(_,B)=>0.5+0.5*Math.sin(_*0.5+B*0.32-D*6.5))}var HD=0.55;function h1(D,F){let $=D.length,M=D.reduce((h,L)=>Math.max(h,L.length),0),_=Math.min(F/HD,1),B=1-Math.pow(1-_,3),A=Math.round((1-B)*$),N=[];for(let h=0;h<$;h++){let L=[];for(let w=0;w<M;w++)L.push(D[h-A]?.[w]??0);N.push(L)}return N}function PD(D,F,$){let M=L1[D];if(F===void 0)return h1(M,$);let _=M.length,B=M[0]?.length??0;return F==="wave"?w1($,B,_):N1($,B,_)}var P1=24;function J1(D,F,$){let[M,_]=C0.useState(()=>PD(D,F,0));return C0.useEffect(()=>{let B=0,A=null,N=0,h=1000/$,L=(w)=>{if(A===null)A=w;let J=(w-A)/1000;if(w-N>=h){if(N=w,_(PD(D,F,J)),F===void 0&&J>=HD)return}B=requestAnimationFrame(L)};return B=requestAnimationFrame(L),()=>cancelAnimationFrame(B)},[D,F,$]),M}function O1(D){return`rgba(23, 23, 23, ${(0.1+Math.max(0,Math.min(1,D))*0.9).toFixed(3)})`}function j7({sprite:D="moi",effect:F,fps:$=P1,pixelSize:M=3,gap:_=1,className:B}){let A=J1(D,F,$),N=A[0]?.length??0,h=F!==void 0;return s0.jsx("div",{className:E("grid",B),style:{gridTemplateColumns:`repeat(${N}, ${M}px)`,gap:`${_}px`},children:A.flatMap((L,w)=>L.map((J,H)=>s0.jsx("div",{className:"rounded-[2px]",style:{width:M,height:M,background:O1(J),boxShadow:h?`0 0 ${(M*(0.4+J)).toFixed(1)}px rgba(23, 23, 23, ${(J*0.35).toFixed(3)})`:void 0}},`${w}-${H}`)))})}var O8=Z(j(),1);var ZD="/agentation-4s0nn45p.png";var gD="/airtable-hsa66v6q.png";var GD="/apollo-2ed5dy2d.png";var zD="/asana-tvgtwbx2.png";var ID="/atlassian-b3tq39hs.png";var KD="/box-w3n36t5g.png";var n0="/chrome-tspm94rw.svg";var kD="/clickup-qqrqqvqb.png";var qD="/cloudflare-j9p931v6.png";var QD="/context7-8ht0xjfy.png";var ED="/datadog-70ne3yzt.png";var vD="/discord-vejhptwx.png";var jD="/dropbox-4m5s9mgr.png";var RD="/elevenlabs-2nzzej1t.png";var CD="/exa-qqj3vr0x.png";var UD="/figma-y9898rry.png";var bD="/firecrawl-w2t8nehx.png";var XD="/github-av5r5y3e.png";var fD="/gitlab-4pv5vm6b.png";var WD="/gmail-sg6a5v3x.png";var YD="/googlecalendar-nqhh2v7r.png";var yD="/googledrive-6s8xyab7.png";var VD="/grafana-1yfsnwr6.png";var TD="/granola-7j3b0nk2.png";var dD="/hubspot-hghcmc2t.png";var xD="/huggingface-kxzaxj83.png";var uD="/intercom-td763jt8.png";var SD="/linear-v9s3az2d.png";var mD="/monday-jdbs4wwf.png";var cD="/mongodb-emzxvhd5.png";var iD="/neon-zj4qar44.png";var lD="/notion-w034c0b8.png";var pD="/paper-zbt34fab.png";var oD="/paypal-kwwf7xsc.png";var aD="/perplexity-4y63rxvj.png";var sD="/postgresql-qsspbsr1.png";var nD="/posthog-sphppc4w.png";var rD="/puppeteer-2xjt1a9b.png";var tD="/railway-834de8d2.png";var eD="/redis-spm6w2m1.png";var D5="/salesforce-1mk56v4z.png";var F5="/sentry-hdwpmvek.png";var $5="/shopify-90dadaav.png";var M5="/slack-1c1wj62s.png";var _5="/snowflake-hfpykpgy.png";var B5="/stripe-zrfaqbj3.png";var A5="/supabase-4vg33zf2.png";var L5="/telegram-v6tjyrs7.png";var N5="/twilio-dpyjdwpj.png";var w5="/vercel-7d0ssw28.png";var h5="/zapier-p67qfch0.png";var P3={agentation:ZD,airtable:gD,apollo:GD,asana:zD,atlassian:ID,box:KD,chrome:n0,"chrome-devtools":n0,clickup:kD,cloudflare:qD,context7:QD,datadog:ED,discord:vD,dropbox:jD,elevenlabs:RD,exa:CD,figma:UD,firecrawl:bD,github:XD,gitlab:fD,gmail:WD,googlecalendar:YD,googledrive:yD,grafana:VD,granola:TD,hubspot:dD,huggingface:xD,intercom:uD,linear:SD,monday:mD,mongodb:cD,neon:iD,notion:lD,paper:pD,paypal:oD,perplexity:aD,postgresql:sD,posthog:nD,puppeteer:rD,railway:tD,redis:eD,salesforce:D5,sentry:F5,shopify:$5,slack:M5,snowflake:_5,stripe:B5,supabase:A5,telegram:L5,twilio:N5,vercel:w5,zapier:h5},J3={"google drive":"googledrive","google calendar":"googlecalendar",gcal:"googlecalendar",gdrive:"googledrive","apollo.io":"apollo","paper-desktop":"paper","granola-mcp":"granola","claude-in-chrome":"chrome",postgres:"postgresql","hugging face":"huggingface",jira:"atlassian",confluence:"atlassian"};function P5(D){let F=D.match(/^claude[._]ai[._\s]+(.+)$/i);if(!F)return D;return F[1].replace(/_/g," ")}function U0(D){return D.toLowerCase().replace(/[\s._-]+/g,"")}var O3=new Map(Object.entries(P3).map(([D,F])=>[U0(D),F])),H3=new Map(Object.entries(J3).map(([D,F])=>[U0(D),U0(F)]));function J5(D){let F=U0(P5(D));return O3.get(H3.get(F)??F)}function O5(D){return P5(D).split(/[\s._-]+/).filter(Boolean).map((F)=>F[0].toUpperCase()+F.slice(1)).join(" ")}var r0=Z(v(),1);function O0({open:D,children:F}){return r0.jsx(H5,{initial:!1,children:D&&r0.jsx(b0.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{type:"spring",duration:0.25,bounce:0.1},className:"overflow-hidden",children:F},"content")})}var g5=Z(j(),1);var I5=Z(v(),1),Z3=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function G5(D,F){if(D.name!=="Read"||!F)return null;let $=D.input,M=typeof $.file_path==="string"?$.file_path:null;if(!M||!Z3.test(M))return null;let _=F.endsWith("/")?F:`${F}/`;if(!M.startsWith(_))return null;return M.slice(_.length)}function z5({relPath:D}){let F=Z5(),[$,M]=g5.useState(!1);if($)return null;let _=`/api/workspaces/${F}/preview/${D.split("/").map(encodeURIComponent).join("/")}`;return I5.jsx("img",{src:_,alt:D,loading:"lazy",onError:()=>M(!0),className:"max-h-64 max-w-full self-start rounded-md border border-border object-contain"})}var G0=Z(j(),1);var k5=Z(v(),1),g3=E("animate-[text-shimmer_2s_ease-in-out_infinite]","bg-clip-text text-transparent","bg-[length:200%_auto]","bg-[linear-gradient(90deg,var(--muted-foreground)_0%,var(--muted-foreground)_40%,var(--foreground)_50%,var(--muted-foreground)_60%,var(--muted-foreground)_100%)]");function K5({children:D,active:F=!0,className:$}){return k5.jsx("span",{className:E($,F&&g3),children:D})}var H0=Z(v(),1);function q5({className:D}){return H0.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:D,"aria-hidden":"true",children:[H0.jsx("path",{d:"M3.49994 11.7501L11.6717 3.57855C12.7762 2.47398 14.5672 2.47398 15.6717 3.57855C16.7762 4.68312 16.7762 6.47398 15.6717 7.57855M15.6717 7.57855L9.49994 13.7501M15.6717 7.57855C16.7762 6.47398 18.5672 6.47398 19.6717 7.57855C20.7762 8.68312 20.7762 10.474 19.6717 11.5785L12.7072 18.543C12.3167 18.9335 12.3167 19.5667 12.7072 19.9572L13.9999 21.2499"}),H0.jsx("path",{d:"M17.4999 9.74921L11.3282 15.921C10.2238 17.0255 8.43275 17.0255 7.32825 15.921C6.22376 14.8164 6.22376 13.0255 7.32825 11.921L13.4999 5.74939"})]})}var b=Z(v(),1),t0="group/row flex w-full items-center gap-2 py-1.5 text-left select-none";function Z0({isFirst:D,isLast:F,marker:$,loading:M=!1,isError:_=!1,children:B}){return b.jsxs("div",{className:"relative flex gap-2.5",children:[b.jsxs("div",{className:"relative w-[13px] shrink-0",children:[!D&&b.jsx("span",{className:"absolute top-0 left-1/2 h-4 w-px -translate-x-1/2 bg-border"}),!F&&b.jsx("span",{className:"absolute top-[15px] bottom-0 left-1/2 w-px -translate-x-1/2 bg-border"}),$?b.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2",children:$}):M?b.jsx("span",{className:"absolute top-[15px] left-1/2 z-10 flex -translate-x-1/2 -translate-y-1/2 rounded-full bg-background p-0.5",children:b.jsx(X0,{size:12,stroke:1.75,className:"animate-spin text-ring"})}):b.jsx("span",{className:E("absolute top-[15px] left-1/2 z-10 size-[5px] -translate-x-1/2 -translate-y-1/2 rounded-full ring-3 ring-background",_?"bg-destructive":"bg-border")})]}),B]})}function g0({open:D}){return b.jsx(b0.span,{animate:{rotate:D?90:0},transition:{type:"spring",duration:0.2,bounce:0.1},className:E("flex shrink-0",D?"opacity-100":"opacity-0 group-hover/row:opacity-100"),children:b.jsx(Q5,{size:12,stroke:1.75})})}function _0({children:D,className:F}){return b.jsx("span",{className:E("flex size-4 items-center justify-center overflow-hidden rounded-[4px] bg-muted ring-2 ring-background",F),children:D})}function E5({icon:D,size:F=12,stroke:$=1.75}){return b.jsx(_0,{children:b.jsx(D,{size:F,stroke:$,className:"text-muted-foreground"})})}function v5({src:D}){if(!D)return b.jsx(_0,{children:b.jsx(q5,{className:"size-3 text-muted-foreground"})});return b.jsx(_0,{children:b.jsx("img",{src:D,alt:"",className:"size-full object-cover"})})}var G3=/^[A-Za-z]:\//;function z3(D=""){if(!D)return D;return D.replace(/\\/g,"/").replace(G3,(F)=>F.toUpperCase())}var I3=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;var j5=/^\/([A-Za-z]:)?$/;function K3(){if(typeof process<"u"&&typeof process.cwd==="function")return process.cwd().replace(/\\/g,"/");return"/"}var e0=function(...D){D=D.map((M)=>z3(M));let F="",$=!1;for(let M=D.length-1;M>=-1&&!$;M--){let _=M>=0?D[M]:K3();if(!_||_.length===0)continue;F=`${_}/${F}`,$=D8(_)}if(F=R5(F,!$),$&&!D8(F))return`/${F}`;return F.length>0?F:"."};function R5(D,F){let $="",M=0,_=-1,B=0,A=null;for(let N=0;N<=D.length;++N){if(N<D.length)A=D[N];else if(A==="/")break;else A="/";if(A==="/"){if(_===N-1||B===1);else if(B===2){if($.length<2||M!==2||$[$.length-1]!=="."||$[$.length-2]!=="."){if($.length>2){let h=$.lastIndexOf("/");if(h===-1)$="",M=0;else $=$.slice(0,h),M=$.length-1-$.lastIndexOf("/");_=N,B=0;continue}else if($.length>0){$="",M=0,_=N,B=0;continue}}if(F)$+=$.length>0?"/..":"..",M=2}else{if($.length>0)$+=`/${D.slice(_+1,N)}`;else $=D.slice(_+1,N);M=N-_-1}_=N,B=0}else if(A==="."&&B!==-1)++B;else B=-1}return $}var D8=function(D){return I3.test(D)};var F8=function(D,F){let $=e0(D).replace(j5,"$1").split("/"),M=e0(F).replace(j5,"$1").split("/");if(M[0][1]===":"&&$[0][1]===":"&&$[0]!==M[0])return M.join("/");let _=[...$];for(let B of _){if(M[0]!==B)break;$.shift(),M.shift()}return[...$.map(()=>".."),...M].join("/")};function U5(D){if(!(D.name==="Bash"||D.name==="exec"))return null;let $=D.input??{},M=typeof $.command==="string"?$.command:"";if(!M)return null;let _=M.match(/(?:^|\s|\$\()mcporter(?:\)?)\s+call\s+([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)((?:\s+(?!&&|\|\||;|\|)\S+)*)/);if(!_)return null;return{server:_[1],tool:_[2],rest:(_[3]??"").trim()}}function b5(D){let F=D.name;if(!F.startsWith("mcp__"))return null;let $=F.slice(5),M=$.indexOf("__");if(M<=0)return null;return{server:$.slice(0,M),tool:$.slice(M+2),rest:""}}function X5(D){if(D.provider!=="codex"||!D.mcpServer)return null;if(D.name in Y5)return null;if(D.mcpServer==="codex")return null;let F=D.name.indexOf(".");if(F>0)return{server:D.name.slice(0,F),tool:D.name.slice(F+1),rest:""};return{server:D.mcpServer,tool:D.name,rest:""}}function f5(D,F){let $=F.toLowerCase();return["-","_","."].find((_)=>$.startsWith(D.toLowerCase()+_))?F.slice(D.length+1):F}function I(D,F){let $=D[F];return typeof $==="string"?$:""}function W5(D){if(D<1000)return`${Math.round(D)}ms`;let F=D/1000;if(F<60)return`${F<10?F.toFixed(1):Math.round(F)}s`;let $=Math.floor(F/60),M=Math.round(F%60);return M?`${$}m ${M}s`:`${$}m`}function k3(D){return(F)=>F.replace(/\/[^\s"']+/g,($)=>{if(!D)return $;let M=F8(D,$);return M.startsWith("..")?$:M})}var q3={read:"Read file",write:"Write file",edit:"Edit file",apply_patch:"Edit",exec:"Bash",process:"Manage process",web_search:"Web search",web_fetch:"Fetch",sessions_list:"List sessions",sessions_history:"Recall session",sessions_yield:"Yield to session",sessions_send:"Send to session",sessions_spawn:"Spawn session",subagents:"Run sub-agent",agents_list:"List agents",session_status:"Session status",image:"Analyze image",image_generate:"Generate image",memory_get:"Read memory",memory_search:"Search memory",update_plan:"Update plan",message:"Send message",browser:"Browser",canvas:"Canvas",cron:"Cron",gateway:"Gateway",code_execution:"Run Python",tts:"Text-to-speech",music_generate:"Generate music",video_generate:"Generate video",x_search:"Search X"},Q3={ToolSearch:"Tool Search",WebSearch:"Web Search",WebFetch:"Web Fetch"},Y5={exec:"Bash",apply_patch:"Edit",web_search:"Web search",update_plan:"Update plan",subagent:"Run sub-agent",subagent_activity:"Sub-agent",review:"Review",view_image:"View image",generate_image:"Generate image",list_mcp_resources:"List MCP resources",list_mcp_resource_templates:"List MCP templates",read_mcp_resource:"Read MCP resource"},y5={read:"Read",listFiles:"List files",search:"Search"};function V5(D){let F=D?.commandActions;if(!Array.isArray(F)||F.length===0)return null;let $=F[0],M=$?.type;if(!M||!(M in y5))return null;if(F.some((_)=>_?.type!==M))return null;return $}var C5={spawn_agent:"Run sub-agent",send_input:"Message the agent",resume_agent:"Resume the agent",close_agent:"Stopping the agent"};function T5(D){if(D.provider==="openclaw")return q3[D.name]??D.name;if(D.provider==="codex"){if(D.name==="exec"){let F=V5(D.input);if(F?.type)return y5[F.type]}if(D.name==="subagent"){let F=D.input?.action;if(typeof F==="string"&&F in C5)return C5[F]}return Y5[D.name]??D.name}return Q3[D.name]??D.name}function E3(D){if(!D.startsWith("mcp__"))return D;let F=D.slice(5).split("__");return F.length>=2?F.slice(1).join("__"):F[0]}function d5(D,F){let $=D.input??{},M=k3(F);if(D.provider==="openclaw")return R3(D.name,$,M);if(D.provider==="codex")return v3(D.name,$,M);return j3(D.name,$,M)}function v3(D,F,$){if(D==="exec"){let M=V5(F);if(M?.type==="read")return $(M.path||M.name||"");if(M?.type==="search")return[M.query&&`/${M.query}/`,M.path&&$(M.path)].filter(Boolean).join(" ");if(M?.type==="listFiles")return M.path?$(M.path):"";return $(`$ ${I(F,"command")}`)}if(D==="apply_patch"){let M=F.changes;if(Array.isArray(M))return M.map((B)=>B&&typeof B==="object"?B.path:void 0).filter((B)=>typeof B==="string").map($).join(", ");return""}if(D==="web_search"){let M=F.queries;if(Array.isArray(M)&&M.length>0)return M.filter((_)=>typeof _==="string").join(" · ");return I(F,"query")}if(D==="update_plan"){let M=F.plan;return typeof M==="string"?M.split(`
|
|
2
|
+
`)[0]:""}if(D==="subagent"){if(I(F,"action")==="close_agent")return"";return I(F,"prompt")}if(D==="subagent_activity")return I(F,"kind");if(D==="generate_image")return I(F,"prompt").split(`
|
|
3
|
+
`)[0];if(D==="read_mcp_resource")return I(F,"uri");if(D==="list_mcp_resources"||D==="list_mcp_resource_templates")return I(F,"server");return""}function j3(D,F,$){if(D==="Bash")return $(`$ ${I(F,"command")}`);if(D==="Read"||D==="Write"||D==="Edit")return $(I(F,"file_path"));if(D==="Glob")return $(I(F,"pattern"));if(D==="Grep")return`/${I(F,"pattern")}/ ${$(I(F,"path"))}`;if(D==="WebSearch")return I(F,"query");if(D==="WebFetch")return I(F,"url");if(D==="ToolSearch"){let M=I(F,"query");if(M.startsWith("select:"))return M.slice(7).split(",").map(E3).join(", ");return M}return""}function R3(D,F,$){if(D==="read"||D==="write"||D==="edit")return $(I(F,"path"));if(D==="apply_patch"){let M=I(F,"patch"),_=M.split(`
|
|
4
|
+
`).find((B)=>B.startsWith("*** "))??M.split(`
|
|
5
|
+
`)[0];return $(_??"")}if(D==="exec")return $(`$ ${I(F,"command")}`);if(D==="process"){let M=I(F,"action"),_=I(F,"name");return[M,_].filter(Boolean).join(" ")||$(I(F,"command"))}if(D==="web_search"||D==="x_search")return I(F,"query");if(D==="web_fetch")return I(F,"url");if(D==="memory_search")return I(F,"query");if(D==="memory_get")return I(F,"key")||I(F,"name");if(D==="sessions_history"||D==="sessions_send"||D==="sessions_yield")return I(F,"sessionKey")||I(F,"agentId");if(D==="sessions_list"||D==="agents_list")return I(F,"agentId");if(D==="subagents"||D==="sessions_spawn")return I(F,"task")||I(F,"agentId");if(D==="image"||D==="image_generate")return I(F,"prompt")||$(I(F,"path"));if(D==="message")return I(F,"recipient")||I(F,"to");if(D==="update_plan"){let M=F.plan;if(Array.isArray(M)){let B=M.find((A)=>!!A&&typeof A==="object"&&A.status==="in_progress")?.step??M[0]?.step;if(typeof B==="string")return B}return""}return""}var R=Z(v(),1),x5=[u5,S5,$8];function C3(){let[D,F]=G0.useState(0);G0.useEffect(()=>{let M=setInterval(()=>F((_)=>(_+1)%x5.length),600);return()=>clearInterval(M)},[]);let $=x5[D];return R.jsx(_0,{className:"size-5",children:R.jsx($,{size:16,stroke:1.75,className:"text-foreground"})})}function m5({call:D,cwd:F,isFirst:$,isLast:M,renderNestedParts:_}){let[B,A]=G0.useState(!1),N=D.subagent,h=D.input??{},L=N?.description??h.description??"Subtask",w=N?.status,J=D.state==="error"||w==="failed",H=D.state==="running"||w==="running",K=N?.usage?.toolUses,Q=N?.usage?.durationMs,f=(H&&N?.progress?.length?N.progress[N.progress.length-1]:null)??(K!=null?`Took ${K} step${K===1?"":"s"}`:null),C=(N?.transcript??[]).flatMap((z)=>z.parts),T=typeof D.output==="string"?D.output:"",m=C.length>0||!!T;return R.jsx(Z0,{isFirst:$,isLast:M,marker:H?R.jsx(C3,{}):R.jsx(_0,{className:"size-5",children:R.jsx($8,{size:16,stroke:1.75,className:"text-foreground"})}),isError:J,children:R.jsxs("div",{className:"min-w-0 flex-1",children:[R.jsxs("button",{type:"button",title:`Agent: ${L}`,onClick:()=>m&&A((z)=>!z),className:E("group/row flex w-full flex-col items-start gap-0.5 py-1.5 text-left select-none",m?"cursor-pointer":"cursor-default"),children:[R.jsxs("span",{className:"flex w-full items-center gap-2",children:[R.jsxs(K5,{active:H,className:"min-w-0 flex-1 truncate text-xs font-medium",children:["Agent: ",L]}),!H&&Q!=null&&R.jsx("span",{className:"shrink-0 rounded-full border border-border px-1.5 text-[10px] font-medium text-muted-foreground tabular-nums",children:W5(Q)}),w==="failed"&&R.jsx("span",{className:"shrink-0 text-xs text-destructive",children:"✗"}),w==="stopped"&&R.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"✗"}),m&&R.jsx(g0,{open:B})]}),f&&R.jsx("span",{className:"w-full truncate text-xs text-muted-foreground",children:f})]}),m&&R.jsx(O0,{open:B,children:R.jsxs("div",{className:"mt-1 mb-1 overflow-hidden rounded-md border border-border",children:[C.length>0&&R.jsx("div",{className:"py-1.5 pr-2 pl-3",children:_(C,F)}),T&&R.jsx("div",{className:E("bg-muted/30 px-3.5 py-3 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",C.length>0&&"border-t border-border"),children:T})]})})]})})}var s=Z(j(),1);var t5=Z(j(),1);var B8=new Set(["<",">","{","}","[","]"]),w8=new Set(["for","do","while","if","else","return","function","var","let","const","true","false","undefined","this","new","delete","typeof","in","instanceof","void","break","continue","switch","case","default","throw","try","catch","finally","debugger","with","yield","async","await","class","extends","super","import","export","from","static"]),U3=new Set([...w8,"type","interface","enum","implements","readonly","abstract","declare","namespace","module","private","protected","public","override","keyof","infer","is","asserts","satisfies","as","unknown","never","any","number","string","boolean","bigint","symbol","object"]),p5=new Set(["+","-","*","/","%","=","!","&","|","^","~","!","?",":",".",",",";","'",'"',".","(",")","[","]","#","@","\\",...B8]),b3={keywords:w8,onCommentStart:n5,onCommentEnd:x3};function X3(D){let F=0;if(/\binterface\s+[A-Za-z_$][\w$]*/.test(D))F+=2;if(/\btype\s+[A-Za-z_$][\w$]*\s*=/.test(D))F+=2;if(/\benum\s+[A-Za-z_$][\w$]*/.test(D))F+=2;if(/\b(?:implements|readonly|declare|namespace|satisfies|infer|keyof|asserts)\b/.test(D))F+=2;if(/:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?(?=\s*[,)=;{])/m.test(D))F+=1;if(/\b(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*:\s*/.test(D))F+=1;if(/\)\s*:\s*[A-Za-z_$][\w$]*(?:<[^>\n]+>)?(?:\[\])?\s*(?:=>|\{)/.test(D))F+=1;return F>=2}function f3(D,F){if(D[F]!=="<")return!1;let $=0,M=!1;for(let _=F;_<D.length;_++){let B=D[_];if(B==="<"){$++;continue}if(B===">"){if($--,$===0){let A=_+1;while(A<D.length&&/\s/.test(D[A]))A++;if(!(M&&D[A]==="("))return!1;let N=D.slice(A,A+320);return/\)\s*(?::[\s\S]{0,120}?)?=>/.test(N)}continue}if($===0)continue;if(/[$A-Za-z_]/.test(B)){M=!0;continue}if(/[\s,\.\=\?\:\|\&\[\]]/.test(B))continue;return!1}return!1}var f0=["identifier","keyword","string","class","property","entity","jsxliterals","sign","comment","break","space"],[B0,W3,o,M8,_8,Y3,y3,x,c5,A8,i5]=f0.map((D,F)=>F);function z0(D){return/^[^\S\r\n]+$/g.test(D)}function V3(D){return p5.has(D)}function T3(D){return D.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function W0(D){return/^[\w_]+$/.test(D)||o5(D)}function l5(D){let F=D[0];return W0(F)&&F===F.toUpperCase()||D==="null"}function o5(D){return/[^\u0000-\u007f]/.test(D)}function a5(D){return/^[a-zA-Z]$/.test(D)}function s5(D){return a5(D)||o5(D)}function A0(D){return s5(D[0])&&(D.length===1||W0(D.slice(1)))}function L8(D){return D==="`"}function N8(D){return D==='"'||D==="'"}function d3(D){return N8(D)||L8(D)}function n5(D,F){let $=D+F;if($==="/*")return 2;return $==="//"?1:0}function x3(D,F){return D+F==="*/"?2:F===`
|
|
6
|
+
`?1:0}function u3(D){return D[0]==="/"&&!n5(D[0],D[1])}function S3(D,F){let $={...b3,...F},M=!!(F&&F.keywords instanceof Set),_=X3(D),B=M?$.keywords:_?U3:w8,{onCommentStart:A,onCommentEnd:N}=$,h=$.typeKeywords instanceof Set?$.typeKeywords:null,L="",w=-1,J=[-1,""],H=[-2,""],K=[],Q=!1,q=0,f=!1,C=0,T=()=>Q&&!f&&!q,m=()=>q&&!T(),z=()=>!q&&T()&&!f&&C>0,u=null,n=!1,r=0,t=0,I0=()=>u!==null,B4=()=>n,c=()=>t>r,A4=()=>t>0&&t===r,K0=()=>I0()||c();function L4(O){let P=O===`
|
|
7
|
+
`;if(m()){if(I0())return o;let[,X]=J;if(A0(O)){if(X==="<"||X==="</")return Y3}}if(z())return y3;if(I0()||c())return o;else if(h&&h.has(O))return J[1]==="."?B0:M8;else if(B.has(O))return J[1]==="."?B0:W3;else if(P)return A8;else if(z0(O))return i5;else if(O.split("").every(V3))return x;else if(l5(O))return m()?B0:M8;else{if(A0(O)){let X=J[1]==="."&&A0(H[1]);if(!K0()&&!X)return B0;if(X)return _8}return o}}let g=(O,P)=>{if(P)L=P;if(L){w=typeof O==="number"?O:L4(L);let S=[w,L];if(w!==i5&&w!==A8)H=J,J=S;K.push(S)}L=""};for(let O=0;O<D.length;O++){let P=D[O],S=D[O-1],X=D[O+1],Y0=S+P,Y=P+X;if(typeof $.onQuote==="function"&&P==="'"&&!I0()&&!z()&&!c()){let U=$.onQuote(P,O,D);if(typeof U==="number"&&U>=1&&!Number.isNaN(U)){let i=Math.min(U,D.length-O),y=O+i;g(),L=D.slice(O,y),g(B0),O=y-1;continue}}if(N8(P)&&!z()&&!c()){if(g(),S!=="\\"){if(u&&P===u)u=null;else if(!u)u=P}g(o,P);continue}if(!c()){if(S!=="\\n"&&L8(P)){g(),g(o,P),t++;continue}}if(c()){if(S!=="\\n"&&L8(P)){if(t>0){g(),t--,g(o,P);continue}}if(Y==="${"){r++,g(o),g(x,Y),O++;continue}}if(A4()&&P==="}"){g(),r--,g(x,P);continue}if(T()){if(P==="{"){g(),g(x,P),f=!0;continue}}if(Q){if(!q&&P==="<"){if(g(),X==="/")q=2,L=Y,O++;else q=1,L=P;g(x);continue}if(q){if(P===">"&&!"/=".includes(S)){if(g(),q===1)q=0,C++;else q=0,Q=!1;g(x,P);continue}if(Y==="/>"||Y==="</"){if(L!=="<"&&L!=="/")g();if(Y==="/>")q=0;else C--;if(!C)Q=!1;L=Y,O++,g(x);continue}if(P==="<"){g(),L=P,g(x);continue}if(X==="-"&&!K0()&&!z()){if(L){g(_8,L+P+X),O++;continue}}if(X==="="&&!K0()){if(!z0(P)){if(z0(L))g();let U=L+P;if(A0(U)){g(_8,U);continue}}}}}if(!q&&(P==="<"&&s5(X)||Y==="</")){let U=O-1;while(U>=0&&/\s/.test(D[U]))U--;let i=U>=0?D[U]:"",[y,k0]=J,e=!1,L0=!1;if(L&&!z0(L)){let d=L;if(l5(d)||d==="true"||d==="false")e=!0;else if(B.has(d)&&A0(d))L0=!0;else if(A0(d))e=!0}let D0=P==="<"&&/[$\w\]\)]/.test(i)&&(e||!L0&&(y===B0||y===M8||y===x&&(k0===")"||k0==="]"))),F0=P==="<"&&f3(D,O);if(!D0&&!F0)q=X==="/"?2:1;if(P==="<"&&(X==="/"||a5(X))){if(!D0&&!F0&&!K0()&&!z()&&!B4())Q=!0}}let N4=d3(P),w4=c(),H8=!Q&&u3(Y),Z8=z();if(N4||w4||N8(u))L+=P;else if(H8){g();let[U,i]=J;if(H8&&U!==-1&&!(U===x&&i!==")"||U===c5)){L=P,g();continue}n=!0;let y=O++,k0=()=>O>=D.length,e=()=>k0()||D[O]===`
|
|
8
|
+
`,L0=!1,D0=!1;for(;!e();O++){let F0=D[O],d=D[O-1]==="\\";if(!d&&F0==="[")D0=!0;if(!d&&F0==="]")D0=!1;if(F0==="/"&&!D0&&!d){L0=!0;while(y!==O&&/^[a-z]$/.test(D[O+1])&&!e())O++;break}}if(n=!1,y!==O&&L0)L=D.slice(y,O+1),g(o);else L=P,g(),O=y}else if(A(P,X)){g();let U=O,i=A(P,X);if(i){for(;O<D.length;O++)if(N(D[O-1],D[O])==i)break}L=D.slice(U,O+1),g(c5)}else if(P===" "||P===`
|
|
9
|
+
`)if(P===" "&&(z0(L)||!L||Z8)){if(L+=P,X==="<")g()}else g(),L=P,g();else if(f&&P==="}")g(),L=P,g(),f=!1;else if(Z8&&!B8.has(P)||c()||(W0(P)===W0(L[L.length-1])||T())&&!p5.has(P))L+=P;else{if(Y0==="</")L=Y0;if(g(),Y0!=="</")L=P;if(Y==="</"||Y==="/>")L=Y,g(),O++;else if(B8.has(P))g()}}return g(),K}function m3(D,F){let $=[],M=F&&typeof F.lineClassName==="function"?F.lineClassName:null,_=0,B=(L,w)=>{let J=M?M(w,_):"";return _++,{type:"element",tagName:"span",children:L,properties:{className:J?`sh__line ${J}`:"sh__line"}}};function A(L){let w=L.map(([,H])=>H).join(""),J=L.map(([H,K])=>{let Q=f0[H];return{type:"element",tagName:"span",children:[{type:"text",value:K}],properties:{className:`sh__token--${Q}`,style:{color:`var(--sh-${Q})`}}}});$.push(B(J,w))}let N=[],h=!1;for(let L=0;L<D.length;L++){let w=D[L],[J,H]=w,K=L===D.length-1;if(J!==A8){if(H.includes(`
|
|
10
|
+
`)){let Q=H.split(`
|
|
11
|
+
`);for(let q=0;q<Q.length;q++)if(N.push([J,Q[q]]),q<Q.length-1)A(N),N.length=0}else N.push(w);h=!1}else{if(h)A([]);else A(N),N.length=0;if(K)A([]);h=!0}}if(N.length)A(N);return $}var c3=(D)=>{let F=`class="${D.className}"`;if(D.style){let $=Object.entries(D.style).map(([M,_])=>`${M}:${_}`).join(";");F+=` style="${$}"`}return F};function i3(D){return D.map((F)=>{let{tagName:$}=F,M=F.children.map((_)=>{let{tagName:B,children:A,properties:N}=_;return`<${B} ${c3(N)}>${T3(A[0].value)}</${B}>`}).join("");return`<${$} class="${F.properties.className}">${M}</${$}>`}).join(`
|
|
12
|
+
`)}function r5(D,F){let $=S3(D,F),M=m3($,F);return i3(M)}var _9={TokenTypes:f0,TokenMap:new Map(f0.map((D,F)=>[D,F]))};var h8=Z(v(),1),l3=E("[--sh-identifier:#1f2937]","[--sh-keyword:#cf222e]","[--sh-string:#16a34a]","[--sh-class:#2d6e7e]","[--sh-property:#0550ae]","[--sh-entity:#6f42c1]","[--sh-jsxliterals:#6f42c1]","[--sh-sign:#8b949e]","[--sh-comment:#9ca3af]");function e5({code:D,className:F}){let $=t5.useMemo(()=>r5(D),[D]);return h8.jsx("pre",{className:E("overflow-auto font-mono text-xs leading-relaxed whitespace-pre",l3,F),children:h8.jsx("code",{dangerouslySetInnerHTML:{__html:$}})})}var p3={ts:"ts",tsx:"tsx",js:"js",jsx:"jsx",mjs:"js",cjs:"js",json:"json",md:"md",mdx:"mdx",css:"css",scss:"scss",html:"html",py:"py",rb:"rb",go:"go",rs:"rs",java:"java",c:"c",h:"c",cpp:"cpp",sh:"sh",bash:"sh",yml:"yaml",yaml:"yaml",toml:"toml",sql:"sql",php:"php",swift:"swift",kt:"kt"};function o3(D){let F=D.split(/[\\/]/).pop()??"",$=F.lastIndexOf("."),M=$>0?F.slice($+1).toLowerCase():"";return p3[M]??null}function a3(D){let F=D.trim();if(F.length<2||!(F.startsWith("{")||F.startsWith("[")))return null;try{return JSON.stringify(JSON.parse(F),null,2)}catch{return null}}function s3(D){let F=D.split(`
|
|
13
|
+
`);if(!F.some(($)=>/^\s*\d+\t/.test($)))return D;return F.map(($)=>$.replace(/^\s*\d+\t/,"")).join(`
|
|
14
|
+
`)}function D4(D,F){let $=D.input??{},M=typeof $.file_path==="string"?$.file_path:typeof $.path==="string"?$.path:"",_=M?o3(M):null,B=D.name==="Read"||D.name==="read",A=D.name==="Write"||D.name==="write";if(_&&B&&F)return{kind:"highlight",code:s3(F),label:_};if(_&&A&&typeof $.content==="string"&&$.content)return{kind:"highlight",code:$.content,label:_};let N=a3(F);if(N)return{kind:"highlight",code:N,label:"json"};return{kind:"plain"}}var W=Z(v(),1),P8="max-h-[280px] overflow-auto px-3 py-2.5 font-mono text-xs leading-relaxed";function M4({call:D,output:F,isError:$}){let[M,_]=s.useState(!1),B=s.useMemo(()=>$?{kind:"plain"}:D4(D,F),[D,F,$]);if(B.kind==="plain")return W.jsx("div",{className:E("rounded-md border",$?"border-destructive/30 bg-destructive/10":"border-border bg-muted"),children:W.jsx("pre",{className:E(P8,"break-all whitespace-pre-wrap",$?"text-destructive":"text-muted-foreground"),children:F||"(empty)"})});return W.jsxs("div",{className:"overflow-hidden rounded-md border border-border bg-muted",children:[W.jsx(n3,{raw:M,onRaw:_,label:B.label,copyText:M?F:B.code}),M?W.jsx("pre",{className:E(P8,"break-all whitespace-pre-wrap text-muted-foreground"),children:F||"(empty)"}):W.jsx(e5,{code:B.code,className:E(P8,"text-muted-foreground")})]})}function n3({raw:D,onRaw:F,label:$,copyText:M}){return W.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2",children:[[[!1,$],[!0,"raw"]].map(([B,A])=>W.jsx(a0,{type:"button",variant:D===B?"outline":"ghost",size:"sm",onClick:()=>F(B),className:"rounded-full text-xs uppercase",children:A},A)),W.jsx("div",{className:"flex-1"}),W.jsx(r3,{text:M})]})}function r3({text:D}){let[F,$]=s.useState(!1);return s.useEffect(()=>{if(!F)return;let _=setTimeout(()=>$(!1),1500);return()=>clearTimeout(_)},[F]),W.jsx(a0,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard?.writeText(D).then(()=>$(!0)).catch(()=>{})},"aria-label":F?"Copied":"Copy",children:F?W.jsx(F4,{stroke:1.75}):W.jsx($4,{stroke:1.75})})}var k=Z(v(),1);function t3({parts:D,cwd:F=null,processing:$=!1}){let M=D.filter((_)=>_.type==="reasoning"||_.type==="tool-call");return k.jsx("div",{className:"flex flex-col",children:M.map((_,B)=>{let A=B===M.length-1,N={isFirst:B===0,isLast:A};if(_.type==="reasoning")return k.jsx(e3,{text:_.text,inProgress:$&&A,...N},B);return k.jsx(DF,{call:_.call,cwd:F,...N},_.call.toolCallId||B)})})}function J8({isFirst:D,isLast:F,call:$,leading:M,marker:_,name:B,brief:A,preview:N}){let[h,L]=O8.useState(!1),w=$.state==="error",J=$.state==="running"||$.state==="pending",H=w?$.errorText??"":typeof $.output==="string"?$.output:"",K=!!(H||w||N),Q=A?`${B}: ${A}`:B;return k.jsx(Z0,{isFirst:D,isLast:F,marker:_,loading:J,isError:w,children:k.jsxs("div",{className:"min-w-0 flex-1",children:[k.jsxs("button",{type:"button",title:Q,onClick:()=>K&&L((q)=>!q),className:E(t0,K?"cursor-pointer":"cursor-default"),children:[M,k.jsx("span",{className:"shrink-0 text-xs font-medium whitespace-nowrap",children:B}),A&&k.jsx("span",{className:"min-w-0 self-baseline truncate text-[12px] text-ring",children:A}),J&&_&&k.jsx(X0,{size:12,stroke:1.75,className:"shrink-0 animate-spin text-ring"}),K&&k.jsx(g0,{open:h})]}),K&&k.jsx(O0,{open:h,children:k.jsxs("div",{className:"mt-1 mb-1 flex flex-col gap-1.5",children:[N,(H||w)&&k.jsx(M4,{call:$,output:H,isError:w})]})})]})})}function e3({isFirst:D,isLast:F,text:$,inProgress:M=!1}){let[_,B]=O8.useState(!1),A=M?"Thinking":"Thought",N=M||_;return k.jsx(Z0,{isFirst:D,isLast:F,loading:M,children:k.jsxs("div",{className:"min-w-0 flex-1",children:[k.jsxs("button",{type:"button",title:`${A}: ${$}`,onClick:()=>B((h)=>!h),className:E(t0,"cursor-pointer"),children:[k.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:A}),k.jsx(g0,{open:N})]}),k.jsx(O0,{open:N,children:k.jsx("div",{className:"mt-1 mb-1 pr-2 text-xs leading-relaxed whitespace-pre-wrap text-muted-foreground",children:$})})]})})}function DF({call:D,cwd:F,isFirst:$,isLast:M}){if(D.caller==="subagent")return k.jsx(m5,{call:D,cwd:F,isFirst:$,isLast:M,renderNestedParts:(A,N)=>k.jsx(t3,{parts:A,cwd:N})});if(D.name==="Skill"&&D.skill){let A=D.state==="success";return k.jsx(J8,{isFirst:$,isLast:M,call:D,marker:A?k.jsx(E5,{icon:_4,size:16,stroke:1.75}):void 0,name:"Loading Skill",brief:D.skill.skillName})}let _=U5(D)??b5(D)??X5(D);if(_){let A=f5(_.server,_.tool);return k.jsx(J8,{isFirst:$,isLast:M,call:D,marker:k.jsx(v5,{src:J5(_.server)}),name:O5(_.server),brief:_.rest?`${A} ${_.rest}`:A})}let B=D.state==="error"?null:G5(D,F);return k.jsx(J8,{isFirst:$,isLast:M,call:D,leading:k.jsx(FF,{call:D}),name:T5(D),brief:d5(D,F),preview:B?k.jsx(z5,{relPath:B}):void 0})}function FF({call:D}){if(D.caller!=="mcp"&&D.caller!=="server-tool")return null;let F=D.caller==="mcp"?`mcp${D.mcpServer?`:${D.mcpServer.slice(0,8)}`:""}`:"server";return k.jsx("span",{className:"shrink-0 rounded border border-border px-1 text-[9px] text-muted-foreground uppercase",children:F})}
|
|
15
|
+
export{G8 as z,W4 as A,y4 as B,HF as C,ZF as D,gF as E,GF as F,N0 as G,u8 as H,J0 as I,S0 as J,qF as K,oF as L,r4 as M,l as N,sF as O,nF as P,rF as Q,tF as R,eF as S,D7 as T,F7 as U,i0 as V,t8 as W,v0 as X,MD as Y,c8 as Z,o8 as _,ND as $,$1 as aa,a0 as ba,j7 as ca,J5 as da,O5 as ea,q5 as fa,t3 as ga};
|
package/dist/index.html
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
|
-
<link rel="stylesheet" crossorigin href="/chunk-
|
|
24
|
+
<link rel="stylesheet" crossorigin href="/chunk-19g80zc9.css"><script type="module" crossorigin src="/chunk-72atbmh3.js"></script></head>
|
|
25
25
|
<body>
|
|
26
26
|
<div id="root"></div>
|
|
27
27
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg fill="none" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>OpenAI</title><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z" fill="#111111"></path></svg>
|
package/lib/ids.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { customAlphabet } from 'nanoid'
|
|
2
|
+
|
|
3
|
+
// Short, shell- and URL-safe ids: base36 (0-9a-z), no dashes — so an id never
|
|
4
|
+
// looks like a CLI flag or reads oddly in a URL.
|
|
5
|
+
const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz'
|
|
6
|
+
|
|
7
|
+
// Workspace ids live in `/workspace/<id>` URLs and persist for the workspace's
|
|
8
|
+
// whole life. 10 chars (~52 bits) stays collision-free at any realistic count.
|
|
9
|
+
export const newWorkspaceId = customAlphabet(ALPHABET, 10)
|
|
10
|
+
|
|
11
|
+
// Builder handles are copied onto the command line (`moi builder set …
|
|
12
|
+
// --builder <id>`), and only need to be unique among a workspace's handful of
|
|
13
|
+
// builders — so 6 chars (~31 bits) keeps the command short while staying
|
|
14
|
+
// collision-free at that scale.
|
|
15
|
+
export const newBuilderId = customAlphabet(ALPHABET, 6)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// The moi context envelope: ambient workspace state that rides along with
|
|
2
|
+
// every user message so the agent knows it is running inside a moi workspace
|
|
3
|
+
// and what the user is looking at. Everything about the envelope lives here —
|
|
4
|
+
// the structured `MoiContext` form, the rendered `<moi-context>` text, the
|
|
5
|
+
// per-harness injection transforms, and the strip used to keep the envelope
|
|
6
|
+
// out of chat bubbles.
|
|
7
|
+
//
|
|
8
|
+
// Flow: a structured `MoiContext` is assembled at send time — by the client
|
|
9
|
+
// for chat sends (client/features/workspace/moi-context.ts, sent as the chat
|
|
10
|
+
// frame's `context`), by the server for view-builder requests — and travels
|
|
11
|
+
// structured all the way to the harness, which renders it with the transform
|
|
12
|
+
// matching its conventions:
|
|
13
|
+
// - Claude Code — `moiContextSystemReminder` as its own leading text block
|
|
14
|
+
// (mirrors how Claude Code itself injects ambient context; a string
|
|
15
|
+
// prefix would defeat the SDK's first-prompt extraction, which skips
|
|
16
|
+
// tag-leading text)
|
|
17
|
+
// - Codex — native `turn/start.additionalContext` (`renderMoiContextBody`,
|
|
18
|
+
// the entry key becomes the tag) on servers >= 0.135; `appendMoiContext`
|
|
19
|
+
// fallback below that
|
|
20
|
+
// - OpenClaw — `appendMoiContext` after the user's text
|
|
21
|
+
// Display paths strip with `stripMoiContext` so the envelope never surfaces
|
|
22
|
+
// in a bubble, live or replayed from a transcript.
|
|
23
|
+
import type { WorkspaceTabId } from './types'
|
|
24
|
+
|
|
25
|
+
const MOI_CONTEXT_OPEN = '<moi-context>'
|
|
26
|
+
const MOI_CONTEXT_CLOSE = '</moi-context>'
|
|
27
|
+
// Start of the first line inside the tag. Doubles as the strip guard: a user
|
|
28
|
+
// literally typing `<moi-context>` in their message won't have their text
|
|
29
|
+
// eaten. Keep this phrase byte-stable when rewording the envelope.
|
|
30
|
+
const MOI_CONTEXT_MARKER = 'You are running in a `moi` workspace'
|
|
31
|
+
|
|
32
|
+
const SYSTEM_REMINDER_OPEN = '<system-reminder>'
|
|
33
|
+
const SYSTEM_REMINDER_CLOSE = '</system-reminder>'
|
|
34
|
+
|
|
35
|
+
// The structured form built at send time — by the client for chat sends, by
|
|
36
|
+
// the server for programmatic sends (the view builder). Extend this (and
|
|
37
|
+
// `renderMoiContext`) when new ambient fields land.
|
|
38
|
+
export type MoiContext = {
|
|
39
|
+
// The workspace tab the user is on when they hit send — for a view-builder
|
|
40
|
+
// request that's the builder's own tab (`view-builder:<id>`).
|
|
41
|
+
activeTab: WorkspaceTabId
|
|
42
|
+
// UI label of the active tab when it differs from the id — a view's
|
|
43
|
+
// configured title (e.g. "Grading review" for `view:color-studio`), or a
|
|
44
|
+
// view builder's claimed title while the build runs. The tab bar falls
|
|
45
|
+
// back to the id when unset; so does the envelope.
|
|
46
|
+
tabTitle?: string
|
|
47
|
+
// One-shot imperative lines for this message only (e.g. the view-builder
|
|
48
|
+
// bootstrap instructions from lib/view-builder-directives.ts).
|
|
49
|
+
directives?: string[]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// One sentence per tab, using the labels the user sees in the tab bar (except
|
|
53
|
+
// view-builder tabs, which print the builder id — that's what `moi builder
|
|
54
|
+
// set` needs). A view tab also names its backing file: the user speaks in
|
|
55
|
+
// titles ("fix the Grading review page") while the agent edits
|
|
56
|
+
// `.moi/views/<id>.tsx` — this line connects the two.
|
|
57
|
+
function describeTab(tab: WorkspaceTabId, title?: string): string {
|
|
58
|
+
if (tab === 'agent') return 'The user is on the "Agent" tab (full page chat).'
|
|
59
|
+
if (tab === 'widgets') return 'The user is on the "Widgets" tab.'
|
|
60
|
+
if (tab === 'scratchpad') return 'The user is on the "Scratchpad" tab.'
|
|
61
|
+
if (tab.startsWith('view-builder:')) {
|
|
62
|
+
const id = tab.slice('view-builder:'.length)
|
|
63
|
+
return title
|
|
64
|
+
? `The user is building a new view "${title}". Builder id "${id}".`
|
|
65
|
+
: `The user is building a new view. Builder id "${id}".`
|
|
66
|
+
}
|
|
67
|
+
if (tab.startsWith('view:')) {
|
|
68
|
+
const id = tab.slice('view:'.length)
|
|
69
|
+
return `The user is on the "${title ?? id}" view tab (.moi/views/${id}.tsx).`
|
|
70
|
+
}
|
|
71
|
+
return `The user is on the "${tab}" tab.`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Format (modeled on Claude Code's system-reminder context blocks): a short
|
|
75
|
+
// orientation preamble with the skill pointer, `# Section` headers with
|
|
76
|
+
// complete sentences under them, and an IMPORTANT footer with handling rules.
|
|
77
|
+
// The body renderer exists for transports that supply their own tag — Codex
|
|
78
|
+
// `additionalContext` renders the entry key as the tag, so shipping the
|
|
79
|
+
// wrapped text would double-wrap it.
|
|
80
|
+
export function renderMoiContextBody(ctx: MoiContext): string {
|
|
81
|
+
const preamble = [
|
|
82
|
+
`${MOI_CONTEXT_MARKER} — a shared UI the user chats with you from, which you can extend and customize.`,
|
|
83
|
+
'Read the **`moi-workspace` skill** before responding — even to a simple question — unless you already read it in this chat.'
|
|
84
|
+
].join('\n')
|
|
85
|
+
const sections = [`# Active tab\n${describeTab(ctx.activeTab, ctx.tabTitle)}`]
|
|
86
|
+
if (ctx.directives?.length) {
|
|
87
|
+
sections.push(`# This message only\n${ctx.directives.join('\n')}`)
|
|
88
|
+
}
|
|
89
|
+
const footer = [
|
|
90
|
+
'IMPORTANT: This context comes from moi, not from the user, and the user does not see it.',
|
|
91
|
+
'Only the newest of these blocks is current. Do not respond to it directly, and omit it from summaries and compaction.'
|
|
92
|
+
].join('\n')
|
|
93
|
+
return [preamble, ...sections, footer].join('\n\n')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function renderMoiContext(ctx: MoiContext): string {
|
|
97
|
+
return `${MOI_CONTEXT_OPEN}\n${renderMoiContextBody(ctx)}\n${MOI_CONTEXT_CLOSE}`
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Wire-shape guard for the chat frame's `context` field (see web.ts).
|
|
101
|
+
export function isMoiContext(value: unknown): value is MoiContext {
|
|
102
|
+
if (typeof value !== 'object' || value === null) return false
|
|
103
|
+
const v = value as { activeTab?: unknown; tabTitle?: unknown; directives?: unknown }
|
|
104
|
+
return (
|
|
105
|
+
typeof v.activeTab === 'string' &&
|
|
106
|
+
(v.tabTitle === undefined || typeof v.tabTitle === 'string') &&
|
|
107
|
+
(v.directives === undefined ||
|
|
108
|
+
(Array.isArray(v.directives) && v.directives.every(d => typeof d === 'string')))
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Claude Code: the envelope rides as its OWN text block wrapped in
|
|
113
|
+
// `<system-reminder>`, placed before the user's text block. Keeping it out of
|
|
114
|
+
// the user's string matters: the SDK's first-prompt extraction (session
|
|
115
|
+
// titles, home-card previews) skips text starting with a tag, so a prefixed
|
|
116
|
+
// string would make every moi message invisible to it.
|
|
117
|
+
export function moiContextSystemReminder(contextText: string): string {
|
|
118
|
+
return `${SYSTEM_REMINDER_OPEN}\n${contextText}\n${SYSTEM_REMINDER_CLOSE}`
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Text-only harnesses (OpenClaw; Codex fallback): the envelope is appended
|
|
122
|
+
// after the user's text.
|
|
123
|
+
export function appendMoiContext(text: string, contextText: string): string {
|
|
124
|
+
return text ? `${text}\n\n${contextText}` : contextText
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Remove the envelope (and, for Claude Code transcripts, its enclosing
|
|
128
|
+
// system-reminder wrapper) from user-message text before display. Repeats
|
|
129
|
+
// until no marker-bearing envelope remains, so a user pasting a full envelope
|
|
130
|
+
// into their message can't shield the injected one from stripping.
|
|
131
|
+
export function stripMoiContext(text: string): string {
|
|
132
|
+
let out = text
|
|
133
|
+
for (;;) {
|
|
134
|
+
const next = stripOneMoiContext(out)
|
|
135
|
+
if (next === out) return out
|
|
136
|
+
out = next
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function stripOneMoiContext(text: string): string {
|
|
141
|
+
const start = text.indexOf(MOI_CONTEXT_OPEN)
|
|
142
|
+
if (start === -1) return text
|
|
143
|
+
const end = text.indexOf(MOI_CONTEXT_CLOSE, start)
|
|
144
|
+
if (end === -1) return text
|
|
145
|
+
if (!text.slice(start, end).includes(MOI_CONTEXT_MARKER)) return text
|
|
146
|
+
let before = text.slice(0, start)
|
|
147
|
+
let after = text.slice(end + MOI_CONTEXT_CLOSE.length)
|
|
148
|
+
if (
|
|
149
|
+
before.trimEnd().endsWith(SYSTEM_REMINDER_OPEN) &&
|
|
150
|
+
after.trimStart().startsWith(SYSTEM_REMINDER_CLOSE)
|
|
151
|
+
) {
|
|
152
|
+
before = before.trimEnd().slice(0, -SYSTEM_REMINDER_OPEN.length)
|
|
153
|
+
after = after.trimStart().slice(SYSTEM_REMINDER_CLOSE.length)
|
|
154
|
+
}
|
|
155
|
+
return `${before.trim()}\n\n${after.trim()}`.trim()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// For truncated snippets (session-list / home-card previews): like
|
|
159
|
+
// `stripMoiContext`, but also cuts an envelope (or its system-reminder
|
|
160
|
+
// wrapper) left unterminated by mid-envelope truncation. Skips the marker
|
|
161
|
+
// guard — cutting a preview short on a user-typed literal tag is harmless,
|
|
162
|
+
// unlike eating chat-bubble text.
|
|
163
|
+
export function stripMoiContextLoose(text: string): string {
|
|
164
|
+
let stripped = stripMoiContext(text)
|
|
165
|
+
const open = stripped.indexOf(MOI_CONTEXT_OPEN)
|
|
166
|
+
if (open !== -1) stripped = stripped.slice(0, open)
|
|
167
|
+
const reminder = stripped.indexOf(SYSTEM_REMINDER_OPEN)
|
|
168
|
+
if (reminder !== -1) stripped = stripped.slice(0, reminder)
|
|
169
|
+
return stripped.trimEnd()
|
|
170
|
+
}
|
package/lib/types.ts
CHANGED
|
@@ -230,6 +230,11 @@ export type ClientMessage =
|
|
|
230
230
|
// `supportsStreaming` (Claude Code); ignored otherwise. Like effort, a
|
|
231
231
|
// change forces the live session to rebuild.
|
|
232
232
|
stream?: boolean
|
|
233
|
+
// Structured moi context (lib/moi-context.ts): ambient workspace state
|
|
234
|
+
// snapshotted at send time, assembled by
|
|
235
|
+
// client/features/workspace/moi-context.ts. The server renders it per
|
|
236
|
+
// harness; display paths strip the rendered envelope from bubbles.
|
|
237
|
+
context?: import('./moi-context').MoiContext
|
|
233
238
|
}
|
|
234
239
|
| { type: 'stop'; workspaceId: string; sessionId: string }
|
|
235
240
|
// Reply to a relayed Scratchpad op (see ScratchpadOpMessage). Carries the
|
|
@@ -330,13 +335,14 @@ export type BroadcastFrame =
|
|
|
330
335
|
| Omit<ErrorFrame, 'workspaceId'>
|
|
331
336
|
| Omit<StoppedFrame, 'workspaceId'>
|
|
332
337
|
|
|
333
|
-
// Sent to a client right after it connects
|
|
334
|
-
//
|
|
335
|
-
// any session NOT listed is marked
|
|
336
|
-
// terminal `status
|
|
338
|
+
// Sent to a client right after it connects (and re-broadcast periodically): the
|
|
339
|
+
// authoritative set of non-idle sessions across all workspaces. The client
|
|
340
|
+
// treats it as ground truth — any session NOT listed is marked idle — which
|
|
341
|
+
// clears a spinner whose terminal `status` frame was lost (disconnect window,
|
|
342
|
+
// dropped frame, harness gap).
|
|
337
343
|
export type StatusSnapshotMessage = {
|
|
338
344
|
type: 'status_snapshot'
|
|
339
|
-
|
|
345
|
+
sessions: { workspaceId: string; sessionId: string; activity: SessionActivity }[]
|
|
340
346
|
}
|
|
341
347
|
|
|
342
348
|
export type WorkspaceSwitchMessage = {
|
|
@@ -346,6 +352,12 @@ export type WorkspaceSwitchMessage = {
|
|
|
346
352
|
|
|
347
353
|
export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex'
|
|
348
354
|
|
|
355
|
+
// Whether an agent backend's runtime is installed on this machine. `reason` is
|
|
356
|
+
// user-facing copy explaining what to do next. Surfaced by
|
|
357
|
+
// GET /api/workspaces/create (per-type map, drives setup dialogs) and
|
|
358
|
+
// GET /api/workspaces/:id/availability (disables Send in existing workspaces).
|
|
359
|
+
export type HarnessAvailability = { available: true } | { available: false; reason: string }
|
|
360
|
+
|
|
349
361
|
// One MCP server's connection status, as surfaced by GET /api/workspaces/:id/mcp
|
|
350
362
|
// (a subset of the agent SDK's McpServerStatus — only what the UI renders).
|
|
351
363
|
export type McpServerState = 'connected' | 'failed' | 'needs-auth' | 'pending' | 'disabled'
|
|
@@ -379,12 +391,9 @@ export type WorkspaceEntry = {
|
|
|
379
391
|
|
|
380
392
|
export type DiscoveredWorkspace = {
|
|
381
393
|
path: string
|
|
382
|
-
type: WorkspaceType
|
|
383
|
-
name?: string
|
|
384
394
|
displayPath?: string
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
lastRunAt?: string
|
|
395
|
+
// Deduplicated in canonical provider order by the discovery API.
|
|
396
|
+
types: WorkspaceType[]
|
|
388
397
|
}
|
|
389
398
|
|
|
390
399
|
export type SessionRenamedMessage = {
|
|
@@ -407,11 +416,20 @@ export type StoppedFrame = {
|
|
|
407
416
|
sessionId: string
|
|
408
417
|
}
|
|
409
418
|
|
|
419
|
+
// Unified per-session activity state, mirrored from each harness's native
|
|
420
|
+
// lifecycle signal (CC `session_state_changed`, Codex `turn/*`, OpenClaw run
|
|
421
|
+
// lifecycle) rather than derived by counting messages:
|
|
422
|
+
// running — the agent is working; the client shows the loader/Stop
|
|
423
|
+
// requires-action — the agent is blocked on user input (permission prompt,
|
|
424
|
+
// MCP elicitation). Not rendered yet: no loader, no Stop.
|
|
425
|
+
// idle — everything else, including interrupted/failed turns
|
|
426
|
+
export type SessionActivity = 'idle' | 'running' | 'requires-action'
|
|
427
|
+
|
|
410
428
|
export type StatusMessage = {
|
|
411
429
|
type: 'status'
|
|
412
430
|
workspaceId: string
|
|
413
431
|
sessionId: string
|
|
414
|
-
|
|
432
|
+
activity: SessionActivity
|
|
415
433
|
}
|
|
416
434
|
|
|
417
435
|
// Workspace layout persistence
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// View-builder bootstrap instructions, delivered as one-shot directives inside
|
|
2
|
+
// the `<moi-context>` envelope (lib/moi-context.ts) via SendMessageInput's
|
|
3
|
+
// `context` channel — see the view-builder POST route in server/api.ts.
|
|
4
|
+
export function viewBuilderDirectives(builderId: string, availableIcons: string[]): string[] {
|
|
5
|
+
return [
|
|
6
|
+
'View builder request — this chat is linked to a pending view tab.',
|
|
7
|
+
`Builder id: ${builderId}`,
|
|
8
|
+
`Available view icons: ${availableIcons.join(', ')}`,
|
|
9
|
+
'Your first action must be to infer a stable view id, sentence-case title, and relevant icon from the requirements, then run:',
|
|
10
|
+
`moi builder set <view-id> --builder ${builderId} --kind view --title "<title>" --icon <icon-id>`,
|
|
11
|
+
'Do this before reading files, planning, or writing code. Choose the icon id from the available view icons above.',
|
|
12
|
+
'Capitalize only the first word of the title.',
|
|
13
|
+
'Use the same icon id in the view config.',
|
|
14
|
+
'After building the view, run `moi bundle --only views`.'
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WorkspaceType } from './types'
|
|
2
|
+
|
|
3
|
+
export const WORKSPACE_TYPE_ORDER = [
|
|
4
|
+
'claude-code',
|
|
5
|
+
'codex',
|
|
6
|
+
'openclaw'
|
|
7
|
+
] as const satisfies readonly WorkspaceType[]
|
|
8
|
+
|
|
9
|
+
export function orderWorkspaceTypes(types: Iterable<WorkspaceType>): WorkspaceType[] {
|
|
10
|
+
const unique = new Set(types)
|
|
11
|
+
return WORKSPACE_TYPE_ORDER.filter(type => unique.has(type))
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moi-computer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Local AI workspace powered by the Claude Agent SDK, Bun, React, and Tailwind. Requires Bun.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"lru-cache": "^11.3.5",
|
|
78
78
|
"modern-screenshot": "^4.7.0",
|
|
79
79
|
"motion": "^12.35.1",
|
|
80
|
+
"nanoid": "^6.0.0",
|
|
80
81
|
"pathe": "^2.0.3",
|
|
81
82
|
"picocolors": "^1.1.1",
|
|
82
83
|
"postcss": "^8.5.19",
|