@agi-cli/web-ui 0.1.75 → 0.1.76
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.
|
@@ -383,4 +383,4 @@ ${p?.absPath||""}`,children:n}),a&&S.jsx("span",{className:"text-xs px-2 py-0.5
|
|
|
383
383
|
*
|
|
384
384
|
* This source code is licensed under the ISC license.
|
|
385
385
|
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
-
*/const bK=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yK=Xi("x",bK),SK=G.memo(function({theme:t,onToggleTheme:n}){const a=ra(o=>o.toggleCollapse);return S.jsxs("header",{className:"h-14 border-b border-border bg-background px-4 flex items-center justify-between relative z-30",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:a,className:"md:hidden touch-manipulation",title:"Toggle menu","aria-label":"Toggle menu",children:S.jsx(dK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"AGI"})]}),S.jsx("div",{className:"flex items-center gap-2",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:`Switch to ${t==="dark"?"light":"dark"} mode`,"aria-label":`Switch to ${t==="dark"?"light":"dark"} mode`,className:"touch-manipulation",children:t==="dark"?S.jsx(gK,{className:"w-4 h-4"}):S.jsx(fK,{className:"w-4 h-4"})})})]})}),EK=G.memo(function({children:t,onNewSession:n}){const a=xn(u=>u.isDiffOpen),o=ra(u=>u.isCollapsed),l=ra(u=>u.toggleCollapse);return G.useEffect(()=>(o?document.body.style.overflow="":document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[o]),o?S.jsxs("aside",{className:"w-12 md:w-12 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out hidden md:flex",children:[S.jsx("div",{className:"h-14 border-b border-border flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:"New session",className:"rounded-full touch-manipulation",children:S.jsx(D0,{className:"w-4 h-4"})})}),S.jsx("button",{type:"button",className:"flex-1 cursor-pointer hover:bg-muted/50 transition-colors touch-manipulation",onClick:a?void 0:l,title:a?void 0:"Expand sidebar","aria-label":"Expand sidebar"}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Expand sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsx(uK,{className:"w-4 h-4"})})})]}):S.jsxs(S.Fragment,{children:[!o&&S.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 md:hidden",onClick:l,"aria-hidden":"true"}),S.jsxs("aside",{className:"w-full md:w-64 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out fixed md:relative top-0 left-0 z-50 h-screen md:h-auto",children:[S.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2 md:hidden bg-background",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Close menu",className:"touch-manipulation flex-shrink-0","aria-label":"Close menu",children:S.jsx(yK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground flex-1",children:"AGI"})]}),S.jsx("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2",children:S.jsxs(Et,{variant:"primary",size:"sm",onClick:n,className:"flex-1 touch-manipulation",children:[S.jsx(D0,{className:"w-4 h-4 mr-2"}),"New Session"]})}),S.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:t}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-end",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Collapse sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform duration-300",role:"img","aria-label":"Collapse sidebar",children:[S.jsx("title",{children:"Collapse sidebar"}),S.jsx("path",{d:"M15 18l-6-6 6-6"})]})})})]})]})}),vK=G.memo(function({sidebar:t,children:n,onNewSession:a,theme:o,onToggleTheme:l}){return S.jsxs("div",{className:"h-screen flex flex-col bg-background touch-manipulation",children:[S.jsx(SK,{onToggleTheme:l,theme:o}),S.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[S.jsx(EK,{onNewSession:a,children:t}),S.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden relative w-full md:w-auto",children:[S.jsx(tK,{}),n]}),S.jsxs("div",{className:"hidden md:block",children:[S.jsx(ZW,{}),S.jsx(XW,{})]})]}),S.jsx(nK,{})]})}),x1="agi-theme",M0="dark";function xK(){if(typeof window>"u")return M0;const e=window.localStorage.getItem(x1);return e==="light"||e==="dark"?e:M0}function TK(){const[e,t]=G.useState(()=>xK());G.useEffect(()=>{if(typeof document>"u")return;const a=document.documentElement;e==="dark"?a.classList.add("dark"):a.classList.remove("dark");try{window.localStorage.setItem(x1,e)}catch(o){console.warn("Failed to persist theme preference",o)}},[e]);const n=G.useCallback(()=>{t(a=>a==="dark"?"light":"dark")},[]);return G.useMemo(()=>({theme:e,setTheme:t,toggleTheme:n}),[e,n])}function AK(){const[e,t]=G.useState(null);return G.useEffect(()=>{(async()=>{try{const l=`${window.AGI_SERVER_URL||gS}/v1/config/cwd`;console.log("[useWorkingDirectory] Fetching from:",l);const u=await fetch(l);if(!u.ok)throw console.error("[useWorkingDirectory] Failed:",u.status,u.statusText),new Error(`Failed to fetch working directory: ${u.status}`);const d=await u.json();console.log("[useWorkingDirectory] Success:",d),d.dirName&&(console.log("[useWorkingDirectory] Setting title to:",d.dirName),t(d.dirName),document.title=d.dirName)}catch(a){console.error("[useWorkingDirectory] Error:",a),document.title="AGI"}})()},[]),e}function T1({sessionId:e}){const t=G.useRef(null),n=IW(),{theme:a,toggleTheme:o}=TK(),l=ra(m=>m.setCollapsed),u=Au();AK();const d=G.useCallback(()=>{setTimeout(()=>{t.current?.focus()},100)},[]),p=G.useCallback(async()=>{try{const m=await n.mutateAsync({agent:"general"});u({to:"/sessions/$sessionId",params:{sessionId:m.id},replace:!1}),l(!0),d()}catch(m){console.error("Failed to create session:",m)}},[n,u,l,d]),f=G.useCallback(m=>{u({to:"/sessions/$sessionId",params:{sessionId:m}}),l(!0),d()},[u,l,d]);G.useEffect(()=>{e&&d()},[e,d]);const h=G.useMemo(()=>e?S.jsxs(S.Fragment,{children:[S.jsx(LW,{sessionId:e}),S.jsx(HP,{ref:t,sessionId:e
|
|
386
|
+
*/const bK=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yK=Xi("x",bK),SK=G.memo(function({theme:t,onToggleTheme:n}){const a=ra(o=>o.toggleCollapse);return S.jsxs("header",{className:"h-14 border-b border-border bg-background px-4 flex items-center justify-between relative z-30",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:a,className:"md:hidden touch-manipulation",title:"Toggle menu","aria-label":"Toggle menu",children:S.jsx(dK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"AGI"})]}),S.jsx("div",{className:"flex items-center gap-2",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:`Switch to ${t==="dark"?"light":"dark"} mode`,"aria-label":`Switch to ${t==="dark"?"light":"dark"} mode`,className:"touch-manipulation",children:t==="dark"?S.jsx(gK,{className:"w-4 h-4"}):S.jsx(fK,{className:"w-4 h-4"})})})]})}),EK=G.memo(function({children:t,onNewSession:n}){const a=xn(u=>u.isDiffOpen),o=ra(u=>u.isCollapsed),l=ra(u=>u.toggleCollapse);return G.useEffect(()=>(o?document.body.style.overflow="":document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}),[o]),o?S.jsxs("aside",{className:"w-12 md:w-12 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out hidden md:flex",children:[S.jsx("div",{className:"h-14 border-b border-border flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:n,title:"New session",className:"rounded-full touch-manipulation",children:S.jsx(D0,{className:"w-4 h-4"})})}),S.jsx("button",{type:"button",className:"flex-1 cursor-pointer hover:bg-muted/50 transition-colors touch-manipulation",onClick:a?void 0:l,title:a?void 0:"Expand sidebar","aria-label":"Expand sidebar"}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-center",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Expand sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsx(uK,{className:"w-4 h-4"})})})]}):S.jsxs(S.Fragment,{children:[!o&&S.jsx("div",{className:"fixed inset-0 bg-black/50 z-40 md:hidden",onClick:l,"aria-hidden":"true"}),S.jsxs("aside",{className:"w-full md:w-64 border-r border-border bg-background flex flex-col transition-all duration-300 ease-in-out fixed md:relative top-0 left-0 z-50 h-screen md:h-auto",children:[S.jsxs("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2 md:hidden bg-background",children:[S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Close menu",className:"touch-manipulation flex-shrink-0","aria-label":"Close menu",children:S.jsx(yK,{className:"w-5 h-5"})}),S.jsx("h1",{className:"text-lg font-semibold text-foreground flex-1",children:"AGI"})]}),S.jsx("div",{className:"h-14 border-b border-border px-4 flex items-center gap-2",children:S.jsxs(Et,{variant:"primary",size:"sm",onClick:n,className:"flex-1 touch-manipulation",children:[S.jsx(D0,{className:"w-4 h-4 mr-2"}),"New Session"]})}),S.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-hide",children:t}),S.jsx("div",{className:"border-t border-border p-2 flex items-center justify-end",children:S.jsx(Et,{variant:"ghost",size:"icon",onClick:l,title:"Collapse sidebar",disabled:a,className:"transition-transform duration-200 hover:scale-110 touch-manipulation",children:S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform duration-300",role:"img","aria-label":"Collapse sidebar",children:[S.jsx("title",{children:"Collapse sidebar"}),S.jsx("path",{d:"M15 18l-6-6 6-6"})]})})})]})]})}),vK=G.memo(function({sidebar:t,children:n,onNewSession:a,theme:o,onToggleTheme:l}){return S.jsxs("div",{className:"h-screen flex flex-col bg-background touch-manipulation",children:[S.jsx(SK,{onToggleTheme:l,theme:o}),S.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[S.jsx(EK,{onNewSession:a,children:t}),S.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden relative w-full md:w-auto",children:[S.jsx(tK,{}),n]}),S.jsxs("div",{className:"hidden md:block",children:[S.jsx(ZW,{}),S.jsx(XW,{})]})]}),S.jsx(nK,{})]})}),x1="agi-theme",M0="dark";function xK(){if(typeof window>"u")return M0;const e=window.localStorage.getItem(x1);return e==="light"||e==="dark"?e:M0}function TK(){const[e,t]=G.useState(()=>xK());G.useEffect(()=>{if(typeof document>"u")return;const a=document.documentElement;e==="dark"?a.classList.add("dark"):a.classList.remove("dark");try{window.localStorage.setItem(x1,e)}catch(o){console.warn("Failed to persist theme preference",o)}},[e]);const n=G.useCallback(()=>{t(a=>a==="dark"?"light":"dark")},[]);return G.useMemo(()=>({theme:e,setTheme:t,toggleTheme:n}),[e,n])}function AK(){const[e,t]=G.useState(null);return G.useEffect(()=>{(async()=>{try{const l=`${window.AGI_SERVER_URL||gS}/v1/config/cwd`;console.log("[useWorkingDirectory] Fetching from:",l);const u=await fetch(l);if(!u.ok)throw console.error("[useWorkingDirectory] Failed:",u.status,u.statusText),new Error(`Failed to fetch working directory: ${u.status}`);const d=await u.json();console.log("[useWorkingDirectory] Success:",d),d.dirName&&(console.log("[useWorkingDirectory] Setting title to:",d.dirName),t(d.dirName),document.title=d.dirName)}catch(a){console.error("[useWorkingDirectory] Error:",a),document.title="AGI"}})()},[]),e}function T1({sessionId:e}){const t=G.useRef(null),n=IW(),{theme:a,toggleTheme:o}=TK(),l=ra(m=>m.setCollapsed),u=Au();AK();const d=G.useCallback(()=>{setTimeout(()=>{t.current?.focus()},100)},[]),p=G.useCallback(async()=>{try{const m=await n.mutateAsync({agent:"general"});u({to:"/sessions/$sessionId",params:{sessionId:m.id},replace:!1}),l(!0),d()}catch(m){console.error("Failed to create session:",m)}},[n,u,l,d]),f=G.useCallback(m=>{u({to:"/sessions/$sessionId",params:{sessionId:m}}),l(!0),d()},[u,l,d]);G.useEffect(()=>{e&&d()},[e,d]);const h=G.useMemo(()=>e?S.jsxs(S.Fragment,{children:[S.jsx(LW,{sessionId:e}),S.jsx(HP,{ref:t,sessionId:e})]}):S.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a session or create a new one to start"}),[e]);return S.jsx(vK,{onNewSession:p,theme:a,onToggleTheme:o,sidebar:S.jsx(MW,{activeSessionId:e,onSelectSession:f}),children:h})}const RK=ss("/sessions/")({component:wK});function wK(){return S.jsx(T1,{})}const A1=ss("/sessions/$sessionId")({component:_K});function _K(){const{sessionId:e}=A1.useParams();return S.jsx(T1,{sessionId:e})}const kK=bU.update({id:"/",path:"/",getParentRoute:()=>Ru}),NK=RK.update({id:"/sessions/",path:"/sessions/",getParentRoute:()=>Ru}),CK=A1.update({id:"/sessions/$sessionId",path:"/sessions/$sessionId",getParentRoute:()=>Ru}),OK={IndexRoute:kK,SessionsSessionIdRoute:CK,SessionsIndexRoute:NK},IK=Ru._addFileChildren(OK)._addFileTypes(),LK=()=>{const n=(typeof globalThis<"u"?globalThis.AGI_ROUTER_BASEPATH:void 0)??"/"??"/";if(!n||n==="/")return"/";const a=n.replace(/\/+$/,"")||"/";return a.startsWith("/")?a:`/${a}`},DK=pU({routeTree:IK,basepath:LK()}),MK=new mM({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,structuralSharing:!0}}});function UK(){return S.jsx(gM,{client:MK,children:S.jsx(mU,{router:DK})})}const R1=document.getElementById("root");if(!R1)throw new Error("Root element not found");VD.createRoot(R1).render(S.jsx(G.StrictMode,{children:S.jsx(UK,{})}));
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
9
9
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
10
10
|
<title>Loading...</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-BCsENQJb.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-B9wT9mlY.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|