Release of @iterate-com/ui from 411c456e2423e255526b5b97be5d5721c4a99c88
ui release builder, 2026-11-26 23:40 UTC · be40d9d1c8f6c07801dc29d16b16ab2d5c921b68 · parent 16bb289
3 files changed
M dist/chunks/dash.mjs
@@ -1,1 +1,1 @@ -import{r as e}from"./rolldown-runtime.mjs";import{a as t,n}from"./vendor-react";import{itxSessionOf as r,kept as i,keptRead as a}from"../lib/itx-session";import{savedLogTails as o}from"../lib/saved-log-tail";import{n as s,r as c}from"./react.mjs";import{T as l,Z as u,kt as d,pt as f}from"./vendor-icons";import{i as p,n as m,p as h,r as g,t as _}from"./agent-summary.mjs";import{t as v}from"./read-progress.mjs";import{a as ee,g as y}from"./ui-shell";import{n as te,o as b,t as ne}from"./app-shell.mjs";import{a as x,d as S,h as C,i as w,m as T,o as E,p as D,s as O}from"./sidebar.mjs";import{ContextPathText as k}from"../components/context-path-text";import{dashPaths as A}from"../components/dash/dash-paths";import{go as re,keysOfLink as j,linkTo as M,pageHref as N,pathAddresses as ie,useAddress as ae,usePageParam as P,useView as F}from"../lib/page-url";import{n as I}from"./agent-look.mjs";import{AgentTooltip as L,StatusDot as R}from"../components/agents-nav";import{ApprovalsAlert as z}from"../components/approvals-alert";import{l as oe,u as se}from"./context-catalog-rows.mjs";import{n as ce}from"./context-catalog-live.mjs";import{ReconnectingMark as le}from"../components/reconnecting-mark";import{t as ue}from"./sonner.mjs";import{a as de,i as fe}from"./waiting-approvals.mjs";function B(e){return N(void 0,{agent:e})}ie(A);var V=/* @__PURE__ */ e(t(),1);const pe=/* @__PURE__ */ new WeakMap;function H(e,t){let n=pe.get(e)||/* @__PURE__ */ new Map;pe.set(e,n);let r=a(e,n.get(t),n=>Promise.resolve(e.rewriteRules.get(`itx.${t}`)).then(e=>!!e?.target,()=>(n(),!1)));return n.set(t,r),r.answer}var U=/* @__PURE__ */ e(n(),1);function me({agents:e,current:t,exclude:n,overview:r,overviewShown:i,shrink:a=!1}){let o=e?m(e).filter(e=>!n?.has(e.row.path)).slice(0,6):void 0,s=/* @__PURE__ */ (0,U.jsx)(C,{children:/* @__PURE__ */ (0,U.jsxs)(T,{isActive:i,tooltip:`View all agents`,render:/* @__PURE__ */ (0,U.jsx)(`a`,{...M(r)}),children:[/* @__PURE__ */ (0,U.jsx)(u,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:`View all`})]})}),c=M(r);return/* @__PURE__ */ (0,U.jsxs)(w,{className:a?`min-h-0 overflow-hidden`:void 0,children:[/* @__PURE__ */ (0,U.jsx)(O,{className:a?`shrink-0`:void 0,children:`Other Conversations`}),/* @__PURE__ */ (0,U.jsx)(x,{title:`New conversation`,"aria-label":`New conversation`,render:/* @__PURE__ */ (0,U.jsx)(`a`,{...c,onClick:e=>{c.onClick(e),e.currentTarget.blur(),document.querySelector(`[aria-label="Message a new agent"]`)?.focus()}}),children:/* @__PURE__ */ (0,U.jsx)(l,{"aria-hidden":!0})}),/* @__PURE__ */ (0,U.jsxs)(E,{className:a?`flex min-h-0 flex-1 flex-col`:void 0,children:[/* @__PURE__ */ (0,U.jsxs)(S,{className:a?`no-scrollbar min-h-0 overflow-y-auto group-data-[collapsible=icon]:overflow-hidden`:void 0,children:[o?o.map((e,n)=>/* @__PURE__ */ (0,U.jsx)(ge,{group:e,className:n>=5?`[@media(max-height:740px)]:hidden`:void 0,active:!!t&&(t===e.row.path||t.startsWith(`${e.row.path}/`))},e.row.path)):/* @__PURE__ */ (0,U.jsxs)(C,{"aria-label":`Reading the agents`,children:[/* @__PURE__ */ (0,U.jsx)(b,{className:W}),/* @__PURE__ */ (0,U.jsx)(b,{className:W}),/* @__PURE__ */ (0,U.jsx)(b,{className:W})]}),o?.length===0?/* @__PURE__ */ (0,U.jsx)(`p`,{className:`px-2 py-1 font-readme text-xs text-muted-foreground group-data-[collapsible=icon]:hidden`,children:`No other conversations yet.`}):null,a?null:s]}),a?/* @__PURE__ */ (0,U.jsx)(S,{className:`mt-1 shrink-0`,children:s}):null]})]})}function he({path:e,name:t=`Main conversation`,group:n,active:r}){let i=n?.row,a=I(i?.kind||null),o=n?[h(n.subagents.length),_(n.row)].filter(Boolean).join(` · `):``;return/* @__PURE__ */ (0,U.jsx)(C,{"data-agent-path":e,"data-main-agent":``,children:/* @__PURE__ */ (0,U.jsxs)(T,{size:`lg`,isActive:r,className:`focus-visible:ring-inset group-data-[collapsible=icon]:p-2!`,tooltip:{children:/* @__PURE__ */ (0,U.jsx)(L,{title:t,line:o,path:e})},render:/* @__PURE__ */ (0,U.jsx)(`a`,{"aria-label":t,...M(B(e))}),children:[/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`relative`,children:[/* @__PURE__ */ (0,U.jsx)(a,{"data-agent-kind":i?.kind||void 0}),i?.status?/* @__PURE__ */ (0,U.jsx)(R,{status:i.status}):null]}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col group-data-[collapsible=icon]:hidden`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),o?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-2xs text-muted-foreground`,"data-agent-line":!0,children:o}):/* @__PURE__ */ (0,U.jsx)(k,{path:e,truncate:!0,className:`text-2xs text-muted-foreground`})]})]})})}const W=`h-12 group-data-[collapsible=icon]:h-8 group-data-[collapsible=icon]:[&>:last-child]:hidden`;function ge({group:e,active:t,className:n,fallbackTitle:r,pinned:i=!1}){let{row:a,subagents:o}=e,s=I(a.kind),c=(a.titleFromWords?r||a.title:a.title||r)||``,l=c||p(a),u=[h(o.length),_(a)].filter(Boolean).join(` · `);return/* @__PURE__ */ (0,U.jsx)(C,{"data-agent-path":a.path,"data-pinned-agent":i?``:void 0,className:n,children:/* @__PURE__ */ (0,U.jsxs)(T,{size:`lg`,isActive:t,className:`focus-visible:ring-inset group-data-[collapsible=icon]:p-2!`,tooltip:{children:/* @__PURE__ */ (0,U.jsx)(L,{title:l,line:u,path:a.path})},render:/* @__PURE__ */ (0,U.jsx)(`a`,{"aria-label":l,...M(B(a.path))}),children:[/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`relative`,children:[/* @__PURE__ */ (0,U.jsx)(s,{"data-agent-kind":a.kind||void 0}),a.status?/* @__PURE__ */ (0,U.jsx)(R,{status:a.status}):null]}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col group-data-[collapsible=icon]:hidden`,children:[c?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-sm`,children:c}):/* @__PURE__ */ (0,U.jsx)(k,{path:a.path,truncate:!0,className:`text-xs`}),u?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-2xs text-muted-foreground`,"data-agent-line":!0,children:u}):c?/* @__PURE__ */ (0,U.jsx)(k,{path:a.path,truncate:!0,className:`text-2xs text-muted-foreground`}):null]})]})})}function G(e){let t;return()=>t||=e()}const _e=G(()=>import(`../components/context-explorer/context-explorer`)),ve=G(()=>import(`../components/repo-ide/repo-ide`)),ye=G(()=>import(`../components/secrets-page`)),be=G(()=>import(`../components/integrations-page`)),xe=G(()=>import(`../components/analytics-page`));function K({itx:e,root:t,off:n,children:r}){return(0,V.use)(H(e,t))?r:n}function q({children:e}){return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e})}function J({children:e,waiting:t,alert:n}){return/* @__PURE__ */ (0,U.jsx)(`p`,{role:n?`alert`:void 0,"data-spinner":t?`true`:void 0,className:n?`p-4 text-sm text-destructive`:`p-4 text-sm text-muted-foreground`,children:e})}function Y(){return/* @__PURE__ */ (0,U.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,"data-slot":`dash-placeholder`,className:`mx-auto flex w-full max-w-3xl flex-col gap-8 px-4 pt-8 md:px-8 md:pt-16`,children:[/* @__PURE__ */ (0,U.jsx)(v,{}),/* @__PURE__ */ (0,U.jsx)(y,{className:`h-12.5 shrink-0 md:h-14.5`}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex h-22 shrink-0 flex-col gap-5 pt-1`,children:[/* @__PURE__ */ (0,U.jsx)(y,{className:`h-3 w-28`}),/* @__PURE__ */ (0,U.jsx)(y,{className:`h-3 w-48`})]}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 pt-1`,children:[/* @__PURE__ */ (0,U.jsx)(y,{className:`h-3 w-28`}),/* @__PURE__ */ (0,U.jsx)(y,{className:`h-17`})]})]})}function Se({title:e,children:t}){return/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-8`,children:[/* @__PURE__ */ (0,U.jsx)(`h1`,{className:`mb-1.5 text-2xl font-semibold tracking-tight`,children:e}),/* @__PURE__ */ (0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})})}function Ce(e){let t=r(e);return(0,V.useSyncExternalStore)(t.subscribe,t.get,t.get)}function we({itx:e,mind:t,principal:n,page:i,pages:a,catalog:s}){let{ContextExplorer:c,contextPathOf:l,contextViewStateOf:u}=(0,V.use)(_e()),d=P(`context`),f=d?l(d):void 0,{view:p,patchView:m}=F(),h=(0,V.useMemo)(()=>({hrefOf:e=>N(i.id,{context:e}),onNavigate:(e,t)=>{t.preventDefault(),re(e)}}),[i.id]),g=(0,V.useCallback)(()=>e.cd(`/`),[e]),_=n===void 0?`pending`:n?.actor?o({mind:t,actor:n.actor}):void 0;return/* @__PURE__ */ (0,U.jsx)(c,{openRoot:g,deps:[e],session:r(e),tails:_,path:f,links:h,state:u(p),onStateChange:m,catalog:s,empty:`Pick a context from the list, or type a path.`,actions:f&&a.some(e=>e.id===`agents`)?/* @__PURE__ */ (0,U.jsx)(`a`,{...M(B(f)),className:`shrink-0 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:`Agent view`}):null})}we.staysOverReconnect=!0;function Te({itx:e,mind:t,principal:n}){let{RepoIde:r,repoIdeSearchOf:a}=(0,V.use)(ve()),o=P(`repo`)||`config`,{view:c,setView:l}=F(),u=(0,V.useCallback)(e=>{let t=Object.fromEntries(Object.entries({...c,...e}).filter(([,e])=>e!==void 0)),n=`file`in e&&e.file!==c.file||`commit`in e&&e.commit!==c.commit;l(t,!n)},[c,l]),{epoch:d,state:f}=Ce(e),p=s(()=>e.cd(`/`),[e,d]),[m]=(0,V.useState)(()=>i()),h=m(p,!!p.stub||!!p.error&&f===`open`,`root`);if(h.error)return/* @__PURE__ */ (0,U.jsx)(J,{alert:!0,children:h.error});if(!h.stub||n===void 0)return/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Opening the mind…`});let g=n?.email;return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:/* @__PURE__ */ (0,U.jsx)(r,{mind:h.stub,mindId:t,repoPath:`/repos/${o}`,author:g?{name:g,email:g}:void 0,search:a(c),onSearchChange:u},o)})}Te.staysOverReconnect=!0;async function Ee(e){try{return(await e.rewriteRules.get(`itx.secrets`))?.target?{secrets:await e.secrets.list()}:{off:!0}}catch(e){return{error:e instanceof Error?e.message:String(e)}}}function De({itx:e}){ye();let[t,n]=(0,V.useState)(()=>Ee(e)),r=(0,V.useCallback)(()=>{let t=Ee(e);return(0,V.startTransition)(()=>n(t)),t},[e]);return/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Reading the secrets…`}),children:/* @__PURE__ */ (0,U.jsx)(Oe,{itx:e,list:t,reload:r})})}De.staysOverReconnect=!0;function Oe({itx:e,list:t,reload:n}){let{SecretsPage:r,secretsPageStateOf:i}=(0,V.use)(ye()),{view:a,setView:o}=F(),s=(0,V.use)(t);return`error`in s?/* @__PURE__ */ (0,U.jsx)(J,{alert:!0,children:s.error}):`off`in s?/* @__PURE__ */ (0,U.jsx)(J,{children:`This mind has no vault for secrets yet.`}):/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(r,{itx:e,secrets:s.secrets,state:i(a),onStateChange:o,onChanged:n})})}function ke({itx:e,mind:t}){H(e,`integrations`);let{IntegrationsPage:n}=(0,V.use)(be()),r=(0,V.useCallback)(()=>e.cd(`/integrations`),[e]),i=(0,V.useCallback)((t,n)=>e.config[t](...n),[e]),{epoch:a}=Ce(e);return/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Reading the mind…`}),children:/* @__PURE__ */ (0,U.jsx)(K,{itx:e,root:`integrations`,off:/* @__PURE__ */ (0,U.jsx)(Se,{title:`Integrations`,children:`This mind has no integrations yet.`}),children:/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(n,{openRegistry:r,deps:[e,a],callConfig:i,mind:t})})})})}ke.staysOverReconnect=!0;function Ae({itx:e,mind:t}){H(e,`telemetry`);let{AnalyticsPage:n,TelemetryOff:r,telemetryQueryOf:i}=(0,V.use)(xe()),a=(0,V.useMemo)(()=>i(e),[i,e]);return/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Reading the mind…`}),children:/* @__PURE__ */ (0,U.jsx)(K,{itx:e,root:`telemetry`,off:/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(r,{mind:t})}),children:/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(n,{query:a})})})})}Ae.staysOverReconnect=!0;function je({itx:e,serves:t}){return(0,V.use)(H(e,t))?null:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Off`})}function Me({itx:e,mind:t,page:n,pages:r,links:i,waiting:a}){let o=r.filter(e=>e.row===!1),s=t?`https://${t}/`:``;return/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-8 px-4 py-8 md:px-8`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{children:[/* @__PURE__ */ (0,U.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n.name}),/* @__PURE__ */ (0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`These pages show what the mind holds. Each line opens one.`})]}),o.length>0?/* @__PURE__ */ (0,U.jsxs)(`section`,{children:[/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:`This mind`}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`divide-y overflow-hidden rounded-lg border bg-card`,children:o.map(t=>/* @__PURE__ */ (0,U.jsxs)(`a`,{...M(N(t.id)),className:`flex items-center gap-3 px-4 py-3 text-sm outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[/* @__PURE__ */ (0,U.jsx)(t.icon,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block font-medium text-foreground`,children:t.name}),t.about?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t.about}):null]}),t.serves?/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:null,children:/* @__PURE__ */ (0,U.jsx)(je,{itx:e,serves:t.serves})}):null,/* @__PURE__ */ (0,U.jsx)(d,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground/60`})]},t.id))})]}):null,i.filter(e=>e.rows.length>0).map(e=>{let n=!!s&&e.rows.every(e=>e.href.startsWith(s));return/* @__PURE__ */ (0,U.jsxs)(`section`,{children:[/* @__PURE__ */ (0,U.jsxs)(`h2`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:[e.title,n?/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`font-normal`,children:[` (pages on `,t,`)`]}):null]}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`divide-y overflow-hidden rounded-lg border bg-card`,children:e.rows.map(e=>/* @__PURE__ */ (0,U.jsxs)(`a`,{href:e.href,className:`flex items-center gap-3 px-4 py-3 text-sm outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block font-medium text-foreground`,children:e.name}),e.about?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.about}):null]}),e.count===`approvals`&&a?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-warning/15 px-2 py-0.5 text-xs font-medium text-warning tabular-nums`,children:a===1?`1 waits`:`${a} wait`}):null,/* @__PURE__ */ (0,U.jsx)(f,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/60`})]},e.name))})]},e.title)})]})})}Me.staysOverReconnect=!0;const X=`/agents/main`;function Ne(e){return e}function Pe({app:e,name:t,logo:n,itx:i,mind:a,principal:o,pages:s,links:c,pinned:l,foot:u,accountLinks:d,sidebarDefaultOpen:f}){let p=(0,V.useCallback)(e=>Promise.resolve(e(i)),[i]),h=de(a,p);(0,V.useEffect)(()=>{document.title=fe(document.title,h)},[h]);let g=(0,V.useSyncExternalStore)(()=>()=>{},Ve,()=>`light`),_=ae(),v=P(`page`),y=s.find(e=>e.id===`agents`),b=P(`agent`),x=y&&b||void 0,S=x&&y||s.find(e=>e.id===v)||s[0];if(!S)throw Error(`A Dash has at least one page`);let C=s[0]?.id;(0,V.useEffect)(()=>{C&&v===C&&_===`/${C}`&&re(`/${location.hash}`,!0)},[C,v,_]),(0,V.useEffect)(Be,[]);let w=S.component,T=(0,V.useCallback)(()=>i.contexts.list({limit:500}),[i]),E=ce(Ne(i),T,{of:a}),D=r(i),O=(0,V.useSyncExternalStore)(D.subscribe,D.get,D.get),k=Re(i,o,O.epoch),A=ze(i,!!y,O),j=(0,V.useMemo)(()=>A?m(A):void 0,[A]),ie=(0,V.useMemo)(()=>j?.find(e=>e.row.path===X),[j]),F=(0,V.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of E.rows||[])t.path!==X&&oe(t).includes(`pinned-in-dash`)&&e.set(t.path,se(t));return e},[E.rows]),I=(0,V.useMemo)(()=>j&&F.size>0?j.filter(e=>F.has(e.row.path)).map(e=>({group:e,fallbackTitle:F.get(e.row.path)})):[],[j,F]),L=(0,V.useMemo)(()=>{let e=/* @__PURE__ */ new Set([X]);for(let t of l||[]){let n=Q(t.href,s).agent;n&&e.add(n)}for(let{group:t}of I)e.add(t.row.path);return e},[l,s,I]),R=M(N(void 0)),z=(0,V.useMemo)(()=>({name:t||a,logo:n}),[t,a,n]),B=y?He(s,y):void 0;return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(ne,{app:e,mind:a,switcher:/* @__PURE__ */ (0,U.jsx)(te,{app:t||e,line:a,logo:n,href:R.href,onClick:R.onClick}),commandPalette:!1,sidebarAlert:!!h,nav:/* @__PURE__ */ (0,U.jsx)(qe,{itx:i,mind:a,pages:s,links:c,hasAgents:!!y,mainGroup:ie,pinned:l,pinnedGroups:I,foot:u,page:S,agent:x,waiting:h,agents:y?/* @__PURE__ */ (0,U.jsx)(me,{agents:A,current:x,exclude:L,overview:B,overviewShown:S===y&&!x,shrink:s.some(e=>e.id===`settings`)}):null}),account:k,accountActions:d?.length?/* @__PURE__ */ (0,U.jsx)(U.Fragment,{children:d.map(e=>/* @__PURE__ */ (0,U.jsxs)(ee,{render:/* @__PURE__ */ (0,U.jsx)(Z,{href:e.href,inPage:Q(e.href,s).inPage}),children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate`,children:e.name})]},e.name))}):void 0,sidebarDefaultOpen:f,locationKey:_,children:/* @__PURE__ */ (0,U.jsx)(Ue,{shows:x||``,children:/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(Y,{}),children:/* @__PURE__ */ (0,U.jsx)(w,{itx:i,mind:a,mindFace:z,principal:k,page:S,pages:s,links:c,catalog:E.rows,agents:A,waiting:h},w.staysOverReconnect?`stays`:O.epoch)})},S.id)}),/* @__PURE__ */ (0,U.jsx)(le,{itx:i}),/* @__PURE__ */ (0,U.jsx)(ue,{theme:g})]})}const Fe=/* @__PURE__ */ new WeakMap;function Ie(e){let t=Fe.get(e);if(!t){let n=/* @__PURE__ */ new Set,r={principal:void 0,asking:!1,refused:0,listeners:n,subscribe(e){return n.add(e),()=>n.delete(e)},get:()=>r.principal};t=r,Fe.set(e,t)}return t}function Le(e,t){t.asking||t.principal!==void 0||(t.asking=!0,Promise.resolve(e.whoami()).then(e=>{t.refused=0,t.principal=e.principal||null;for(let e of t.listeners)e()},()=>{let n=Math.min(1e3*2**t.refused,15e3);t.refused+=1,setTimeout(()=>{t.listeners.size>0&&Le(e,t)},n)}).finally(()=>{t.asking=!1}))}function Re(e,t,n){let r=Ie(e),i=(0,V.useSyncExternalStore)(r.subscribe,r.get,r.get),a=t!==void 0;return(0,V.useEffect)(()=>{a||Le(e,r)},[e,r,a,n]),a?t:i}function ze(e,t,n){let{epoch:r}=n,a=s(t?()=>e.cd(`/agents`):null,[e,t,r]),o=c(a.stub,`agents`),l=n.state===`open`&&(!!a.error||o.status===`error`),u=o.value!==void 0,d=(0,V.useMemo)(()=>u?g(o.value):void 0,[u,o.value]),[f]=(0,V.useState)(()=>i()),p=f(d,u,`agents`);return(0,V.useMemo)(()=>p||(l?[]:void 0),[p,l])}function Be(){let e=document.documentElement,t=()=>e.toggleAttribute(`data-unwatched`,document.hidden||!document.hasFocus()),n=()=>setTimeout(t);return t(),window.addEventListener(`focus`,t),window.addEventListener(`blur`,n),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,t),window.removeEventListener(`blur`,n),document.removeEventListener(`visibilitychange`,t),e.removeAttribute(`data-unwatched`)}}const Ve=()=>document.documentElement.classList.contains(`dark`)?`dark`:`light`;function Z({href:e,inPage:t,onClick:n,...r}){let i=t?M(e):void 0;return/* @__PURE__ */ (0,U.jsx)(`a`,{...r,href:i?.href||e,onClick:e=>{n?.(e),i?.onClick(e)}})}function Q(e,t){let n=j(e),r=n?.get(`agent`)||void 0,i=n?.get(`page`);return{agent:r,inPage:!!n&&(!!r||!i||t.some(e=>e.id===i))}}function He(e,t){return N(t===e[0]?void 0:t.id)}var Ue=class extends V.Component{state={error:null,shows:this.props.shows};static getDerivedStateFromProps(e,t){return e.shows===t.shows?null:{error:null,shows:e.shows}}static getDerivedStateFromError(e){return{error:e instanceof Error?e.message:String(e)}}componentDidCatch(e){try{window.reportPageError?.(e)}catch(t){console.error(`The page's error capture failed; the page's error was not reported.`,{captureError:t,error:e})}}render(){return this.state.error===null?this.props.children:/* @__PURE__ */ (0,U.jsxs)(J,{alert:!0,children:[`This page did not load: `,this.state.error,`. `,/* @__PURE__ */ (0,U.jsx)(`a`,{href:location.href,children:`Load the page again`}),` `,`to try once more.`]})}};function We({itx:e,serves:t,children:n}){return t?/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:n(!1),children:/* @__PURE__ */ (0,U.jsx)(Ge,{itx:e,serves:t,children:n})}):n(!1)}function Ge({itx:e,serves:t,children:n}){return n(!(0,V.use)(H(e,t)))}function $(e,t){return!!(e&&t)&&(e===t||e.startsWith(`${t}/`))}function Ke({row:e,pages:t,agent:n,waiting:r}){let i=Q(e.href,t);return/* @__PURE__ */ (0,U.jsxs)(C,{children:[/* @__PURE__ */ (0,U.jsxs)(T,{isActive:$(n,i.agent),tooltip:e.name,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:e.href,inPage:i.inPage}),children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:e.name})]}),e.count===`approvals`&&r?/* @__PURE__ */ (0,U.jsx)(D,{children:r}):null]})}function qe({itx:e,mind:t,pages:n,links:r,hasAgents:i,mainGroup:a,pinned:o=[],pinnedGroups:s=[],foot:c=[],page:l,agent:u,waiting:d,agents:f}){let p=n.filter((e,t)=>t>0&&e.row!==!1&&!(f&&e.id===`agents`)),m=n.some(e=>e.id===`settings`)?[]:r.filter(e=>e.rows.length>0);return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[d?/* @__PURE__ */ (0,U.jsx)(w,{className:`shrink-0 pb-0`,children:/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsx)(z,{waiting:d,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:`https://${t}/secrets/approvals`})})})}):null,i||o.length>0||s.length>0?/* @__PURE__ */ (0,U.jsx)(w,{className:`shrink-0 pb-0 group-data-[collapsible=icon]:pb-2`,children:/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsxs)(S,{children:[i?/* @__PURE__ */ (0,U.jsx)(he,{path:X,group:a,active:$(u,X)}):null,o.map(e=>{let t=Q(e.href,n);return/* @__PURE__ */ (0,U.jsx)(C,{children:/* @__PURE__ */ (0,U.jsxs)(T,{isActive:$(u,t.agent),tooltip:e.name,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:e.href,inPage:t.inPage}),children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:e.name})]})},e.name)}),s.map(({group:e,fallbackTitle:t})=>/* @__PURE__ */ (0,U.jsx)(ge,{group:e,fallbackTitle:t,pinned:!0,active:$(u,e.row.path)},e.row.path))]})})}):null,f,c.length>0||p.length>0?/* @__PURE__ */ (0,U.jsx)(w,{className:`mt-auto shrink-0`,children:/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsxs)(S,{children:[c.map(e=>/* @__PURE__ */ (0,U.jsx)(Ke,{row:e,pages:n,agent:u,waiting:d},e.name)),p.map(t=>/* @__PURE__ */ (0,U.jsx)(We,{itx:e,serves:t.serves,children:e=>/* @__PURE__ */ (0,U.jsxs)(C,{children:[/* @__PURE__ */ (0,U.jsxs)(T,{isActive:t===l||t.id===`settings`&&l.row===!1,tooltip:t.name,className:e?`text-muted-foreground`:void 0,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:He(n,t),inPage:!0}),children:[/* @__PURE__ */ (0,U.jsx)(t.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:t.name})]}),e?/* @__PURE__ */ (0,U.jsx)(D,{className:`text-muted-foreground`,children:`Off`}):null]})},t.id))]})})}):null,m.map(e=>/* @__PURE__ */ (0,U.jsxs)(w,{children:[/* @__PURE__ */ (0,U.jsx)(O,{children:e.title}),/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsx)(S,{children:e.rows.map(e=>/* @__PURE__ */ (0,U.jsx)(Ke,{row:e,pages:n,agent:u,waiting:d},e.name))})})]},e.title))]})}export{J as a,Te as c,Me as d,H as f,ke as i,q as l,Ae as n,Se as o,B as p,we as r,Y as s,Pe as t,De as u}; +import{r as e}from"./rolldown-runtime.mjs";import{a as t,n}from"./vendor-react";import{itxSessionOf as r,kept as i,keptRead as a}from"../lib/itx-session";import{savedLogTails as o}from"../lib/saved-log-tail";import{n as s,r as c}from"./react.mjs";import{T as l,Z as u,kt as d,pt as f}from"./vendor-icons";import{i as p,n as m,p as h,r as g,t as _}from"./agent-summary.mjs";import{t as v}from"./read-progress.mjs";import{a as ee,g as y}from"./ui-shell";import{n as te,o as b,t as ne}from"./app-shell.mjs";import{a as x,d as S,h as C,i as w,m as T,o as E,p as D,s as O}from"./sidebar.mjs";import{ContextPathText as k}from"../components/context-path-text";import{dashPaths as A}from"../components/dash/dash-paths";import{go as re,keysOfLink as j,linkTo as M,pageHref as N,pathAddresses as ie,useAddress as ae,usePageParam as P,useView as F}from"../lib/page-url";import{n as I}from"./agent-look.mjs";import{AgentTooltip as L,StatusDot as R}from"../components/agents-nav";import{ApprovalsAlert as z}from"../components/approvals-alert";import{l as oe,u as se}from"./context-catalog-rows.mjs";import{n as ce}from"./context-catalog-live.mjs";import{ReconnectingMark as le}from"../components/reconnecting-mark";import{t as ue}from"./sonner.mjs";import{a as de,i as fe}from"./waiting-approvals.mjs";function B(e){return N(void 0,{agent:e})}ie(A);var V=/* @__PURE__ */ e(t(),1);const pe=/* @__PURE__ */ new WeakMap;function H(e,t){let n=pe.get(e)||/* @__PURE__ */ new Map;pe.set(e,n);let r=a(e,n.get(t),n=>Promise.resolve(e.rewriteRules.get(`itx.${t}`)).then(e=>!!e?.target,()=>(n(),!1)));return n.set(t,r),r.answer}var U=/* @__PURE__ */ e(n(),1);function me({agents:e,current:t,exclude:n,overview:r,overviewShown:i,shrink:a=!1}){let o=e?m(e).filter(e=>!n?.has(e.row.path)).slice(0,6):void 0,s=/* @__PURE__ */ (0,U.jsx)(C,{children:/* @__PURE__ */ (0,U.jsxs)(T,{isActive:i,tooltip:`View all agents`,render:/* @__PURE__ */ (0,U.jsx)(`a`,{...M(r)}),children:[/* @__PURE__ */ (0,U.jsx)(u,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:`View all`})]})}),c=M(r);return/* @__PURE__ */ (0,U.jsxs)(w,{className:a?`min-h-0 overflow-hidden`:void 0,children:[/* @__PURE__ */ (0,U.jsx)(O,{className:a?`shrink-0`:void 0,children:`Other Conversations`}),/* @__PURE__ */ (0,U.jsx)(x,{title:`New conversation`,render:/* @__PURE__ */ (0,U.jsx)(`a`,{href:c.href,"aria-label":`New conversation`,onClick:e=>{c.onClick(e),e.currentTarget.blur(),document.querySelector(`[aria-label="Message a new agent"]`)?.focus()}}),children:/* @__PURE__ */ (0,U.jsx)(l,{"aria-hidden":!0})}),/* @__PURE__ */ (0,U.jsxs)(E,{className:a?`flex min-h-0 flex-1 flex-col`:void 0,children:[/* @__PURE__ */ (0,U.jsxs)(S,{className:a?`no-scrollbar min-h-0 overflow-y-auto group-data-[collapsible=icon]:overflow-hidden`:void 0,children:[o?o.map((e,n)=>/* @__PURE__ */ (0,U.jsx)(ge,{group:e,className:n>=5?`[@media(max-height:740px)]:hidden`:void 0,active:!!t&&(t===e.row.path||t.startsWith(`${e.row.path}/`))},e.row.path)):/* @__PURE__ */ (0,U.jsxs)(C,{"aria-label":`Reading the agents`,children:[/* @__PURE__ */ (0,U.jsx)(b,{className:W}),/* @__PURE__ */ (0,U.jsx)(b,{className:W}),/* @__PURE__ */ (0,U.jsx)(b,{className:W})]}),o?.length===0?/* @__PURE__ */ (0,U.jsx)(`p`,{className:`px-2 py-1 font-readme text-xs text-muted-foreground group-data-[collapsible=icon]:hidden`,children:`No other conversations yet.`}):null,a?null:s]}),a?/* @__PURE__ */ (0,U.jsx)(S,{className:`mt-1 shrink-0`,children:s}):null]})]})}function he({path:e,name:t=`Main conversation`,group:n,active:r}){let i=n?.row,a=I(i?.kind||null),o=n?[h(n.subagents.length),_(n.row)].filter(Boolean).join(` · `):``;return/* @__PURE__ */ (0,U.jsx)(C,{"data-agent-path":e,"data-main-agent":``,children:/* @__PURE__ */ (0,U.jsxs)(T,{size:`lg`,isActive:r,className:`focus-visible:ring-inset group-data-[collapsible=icon]:p-2!`,tooltip:{children:/* @__PURE__ */ (0,U.jsx)(L,{title:t,line:o,path:e})},render:/* @__PURE__ */ (0,U.jsx)(`a`,{"aria-label":t,...M(B(e))}),children:[/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`relative`,children:[/* @__PURE__ */ (0,U.jsx)(a,{"data-agent-kind":i?.kind||void 0}),i?.status?/* @__PURE__ */ (0,U.jsx)(R,{status:i.status}):null]}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col group-data-[collapsible=icon]:hidden`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),o?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-2xs text-muted-foreground`,"data-agent-line":!0,children:o}):/* @__PURE__ */ (0,U.jsx)(k,{path:e,truncate:!0,className:`text-2xs text-muted-foreground`})]})]})})}const W=`h-12 group-data-[collapsible=icon]:h-8 group-data-[collapsible=icon]:[&>:last-child]:hidden`;function ge({group:e,active:t,className:n,fallbackTitle:r,pinned:i=!1}){let{row:a,subagents:o}=e,s=I(a.kind),c=(a.titleFromWords?r||a.title:a.title||r)||``,l=c||p(a),u=[h(o.length),_(a)].filter(Boolean).join(` · `);return/* @__PURE__ */ (0,U.jsx)(C,{"data-agent-path":a.path,"data-pinned-agent":i?``:void 0,className:n,children:/* @__PURE__ */ (0,U.jsxs)(T,{size:`lg`,isActive:t,className:`focus-visible:ring-inset group-data-[collapsible=icon]:p-2!`,tooltip:{children:/* @__PURE__ */ (0,U.jsx)(L,{title:l,line:u,path:a.path})},render:/* @__PURE__ */ (0,U.jsx)(`a`,{"aria-label":l,...M(B(a.path))}),children:[/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`relative`,children:[/* @__PURE__ */ (0,U.jsx)(s,{"data-agent-kind":a.kind||void 0}),a.status?/* @__PURE__ */ (0,U.jsx)(R,{status:a.status}):null]}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col group-data-[collapsible=icon]:hidden`,children:[c?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-sm`,children:c}):/* @__PURE__ */ (0,U.jsx)(k,{path:a.path,truncate:!0,className:`text-xs`}),u?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate text-2xs text-muted-foreground`,"data-agent-line":!0,children:u}):c?/* @__PURE__ */ (0,U.jsx)(k,{path:a.path,truncate:!0,className:`text-2xs text-muted-foreground`}):null]})]})})}function G(e){let t;return()=>t||=e()}const _e=G(()=>import(`../components/context-explorer/context-explorer`)),ve=G(()=>import(`../components/repo-ide/repo-ide`)),ye=G(()=>import(`../components/secrets-page`)),be=G(()=>import(`../components/integrations-page`)),xe=G(()=>import(`../components/analytics-page`));function K({itx:e,root:t,off:n,children:r}){return(0,V.use)(H(e,t))?r:n}function q({children:e}){return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e})}function J({children:e,waiting:t,alert:n}){return/* @__PURE__ */ (0,U.jsx)(`p`,{role:n?`alert`:void 0,"data-spinner":t?`true`:void 0,className:n?`p-4 text-sm text-destructive`:`p-4 text-sm text-muted-foreground`,children:e})}function Y(){return/* @__PURE__ */ (0,U.jsxs)(`div`,{"aria-busy":`true`,"aria-label":`Loading`,"data-slot":`dash-placeholder`,className:`mx-auto flex w-full max-w-3xl flex-col gap-8 px-4 pt-8 md:px-8 md:pt-16`,children:[/* @__PURE__ */ (0,U.jsx)(v,{}),/* @__PURE__ */ (0,U.jsx)(y,{className:`h-12.5 shrink-0 md:h-14.5`}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex h-22 shrink-0 flex-col gap-5 pt-1`,children:[/* @__PURE__ */ (0,U.jsx)(y,{className:`h-3 w-28`}),/* @__PURE__ */ (0,U.jsx)(y,{className:`h-3 w-48`})]}),/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-4 pt-1`,children:[/* @__PURE__ */ (0,U.jsx)(y,{className:`h-3 w-28`}),/* @__PURE__ */ (0,U.jsx)(y,{className:`h-17`})]})]})}function Se({title:e,children:t}){return/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-8`,children:[/* @__PURE__ */ (0,U.jsx)(`h1`,{className:`mb-1.5 text-2xl font-semibold tracking-tight`,children:e}),/* @__PURE__ */ (0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})})}function Ce(e){let t=r(e);return(0,V.useSyncExternalStore)(t.subscribe,t.get,t.get)}function we({itx:e,mind:t,principal:n,page:i,pages:a,catalog:s}){let{ContextExplorer:c,contextPathOf:l,contextViewStateOf:u}=(0,V.use)(_e()),d=P(`context`),f=d?l(d):void 0,{view:p,patchView:m}=F(),h=(0,V.useMemo)(()=>({hrefOf:e=>N(i.id,{context:e}),onNavigate:(e,t)=>{t.preventDefault(),re(e)}}),[i.id]),g=(0,V.useCallback)(()=>e.cd(`/`),[e]),_=n===void 0?`pending`:n?.actor?o({mind:t,actor:n.actor}):void 0;return/* @__PURE__ */ (0,U.jsx)(c,{openRoot:g,deps:[e],session:r(e),tails:_,path:f,links:h,state:u(p),onStateChange:m,catalog:s,empty:`Pick a context from the list, or type a path.`,actions:f&&a.some(e=>e.id===`agents`)?/* @__PURE__ */ (0,U.jsx)(`a`,{...M(B(f)),className:`shrink-0 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:`Agent view`}):null})}we.staysOverReconnect=!0;function Te({itx:e,mind:t,principal:n}){let{RepoIde:r,repoIdeSearchOf:a}=(0,V.use)(ve()),o=P(`repo`)||`config`,{view:c,setView:l}=F(),u=(0,V.useCallback)(e=>{let t=Object.fromEntries(Object.entries({...c,...e}).filter(([,e])=>e!==void 0)),n=`file`in e&&e.file!==c.file||`commit`in e&&e.commit!==c.commit;l(t,!n)},[c,l]),{epoch:d,state:f}=Ce(e),p=s(()=>e.cd(`/`),[e,d]),[m]=(0,V.useState)(()=>i()),h=m(p,!!p.stub||!!p.error&&f===`open`,`root`);if(h.error)return/* @__PURE__ */ (0,U.jsx)(J,{alert:!0,children:h.error});if(!h.stub||n===void 0)return/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Opening the mind…`});let g=n?.email;return/* @__PURE__ */ (0,U.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:/* @__PURE__ */ (0,U.jsx)(r,{mind:h.stub,mindId:t,repoPath:`/repos/${o}`,author:g?{name:g,email:g}:void 0,search:a(c),onSearchChange:u},o)})}Te.staysOverReconnect=!0;async function Ee(e){try{return(await e.rewriteRules.get(`itx.secrets`))?.target?{secrets:await e.secrets.list()}:{off:!0}}catch(e){return{error:e instanceof Error?e.message:String(e)}}}function De({itx:e}){ye();let[t,n]=(0,V.useState)(()=>Ee(e)),r=(0,V.useCallback)(()=>{let t=Ee(e);return(0,V.startTransition)(()=>n(t)),t},[e]);return/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Reading the secrets…`}),children:/* @__PURE__ */ (0,U.jsx)(Oe,{itx:e,list:t,reload:r})})}De.staysOverReconnect=!0;function Oe({itx:e,list:t,reload:n}){let{SecretsPage:r,secretsPageStateOf:i}=(0,V.use)(ye()),{view:a,setView:o}=F(),s=(0,V.use)(t);return`error`in s?/* @__PURE__ */ (0,U.jsx)(J,{alert:!0,children:s.error}):`off`in s?/* @__PURE__ */ (0,U.jsx)(J,{children:`This mind has no vault for secrets yet.`}):/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(r,{itx:e,secrets:s.secrets,state:i(a),onStateChange:o,onChanged:n})})}function ke({itx:e,mind:t}){H(e,`integrations`);let{IntegrationsPage:n}=(0,V.use)(be()),r=(0,V.useCallback)(()=>e.cd(`/integrations`),[e]),i=(0,V.useCallback)((t,n)=>e.config[t](...n),[e]),{epoch:a}=Ce(e);return/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Reading the mind…`}),children:/* @__PURE__ */ (0,U.jsx)(K,{itx:e,root:`integrations`,off:/* @__PURE__ */ (0,U.jsx)(Se,{title:`Integrations`,children:`This mind has no integrations yet.`}),children:/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(n,{openRegistry:r,deps:[e,a],callConfig:i,mind:t})})})})}ke.staysOverReconnect=!0;function Ae({itx:e,mind:t}){H(e,`telemetry`);let{AnalyticsPage:n,TelemetryOff:r,telemetryQueryOf:i}=(0,V.use)(xe()),a=(0,V.useMemo)(()=>i(e),[i,e]);return/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(J,{waiting:!0,children:`Reading the mind…`}),children:/* @__PURE__ */ (0,U.jsx)(K,{itx:e,root:`telemetry`,off:/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(r,{mind:t})}),children:/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsx)(n,{query:a})})})})}Ae.staysOverReconnect=!0;function je({itx:e,serves:t}){return(0,V.use)(H(e,t))?null:/* @__PURE__ */ (0,U.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Off`})}function Me({itx:e,mind:t,page:n,pages:r,links:i,waiting:a}){let o=r.filter(e=>e.row===!1),s=t?`https://${t}/`:``;return/* @__PURE__ */ (0,U.jsx)(q,{children:/* @__PURE__ */ (0,U.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-8 px-4 py-8 md:px-8`,children:[/* @__PURE__ */ (0,U.jsxs)(`div`,{children:[/* @__PURE__ */ (0,U.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:n.name}),/* @__PURE__ */ (0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`These pages show what the mind holds. Each line opens one.`})]}),o.length>0?/* @__PURE__ */ (0,U.jsxs)(`section`,{children:[/* @__PURE__ */ (0,U.jsx)(`h2`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:`This mind`}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`divide-y overflow-hidden rounded-lg border bg-card`,children:o.map(t=>/* @__PURE__ */ (0,U.jsxs)(`a`,{...M(N(t.id)),className:`flex items-center gap-3 px-4 py-3 text-sm outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[/* @__PURE__ */ (0,U.jsx)(t.icon,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block font-medium text-foreground`,children:t.name}),t.about?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t.about}):null]}),t.serves?/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:null,children:/* @__PURE__ */ (0,U.jsx)(je,{itx:e,serves:t.serves})}):null,/* @__PURE__ */ (0,U.jsx)(d,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground/60`})]},t.id))})]}):null,i.filter(e=>e.rows.length>0).map(e=>{let n=!!s&&e.rows.every(e=>e.href.startsWith(s));return/* @__PURE__ */ (0,U.jsxs)(`section`,{children:[/* @__PURE__ */ (0,U.jsxs)(`h2`,{className:`mb-2 text-xs font-medium text-muted-foreground`,children:[e.title,n?/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`font-normal`,children:[` (pages on `,t,`)`]}):null]}),/* @__PURE__ */ (0,U.jsx)(`div`,{className:`divide-y overflow-hidden rounded-lg border bg-card`,children:e.rows.map(e=>/* @__PURE__ */ (0,U.jsxs)(`a`,{href:e.href,className:`flex items-center gap-3 px-4 py-3 text-sm outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{"aria-hidden":!0,className:`size-4 shrink-0 text-muted-foreground`}),/* @__PURE__ */ (0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block font-medium text-foreground`,children:e.name}),e.about?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.about}):null]}),e.count===`approvals`&&a?/* @__PURE__ */ (0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-warning/15 px-2 py-0.5 text-xs font-medium text-warning tabular-nums`,children:a===1?`1 waits`:`${a} wait`}):null,/* @__PURE__ */ (0,U.jsx)(f,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/60`})]},e.name))})]},e.title)})]})})}Me.staysOverReconnect=!0;const X=`/agents/main`;function Ne(e){return e}function Pe({app:e,name:t,logo:n,itx:i,mind:a,principal:o,pages:s,links:c,pinned:l,foot:u,accountLinks:d,sidebarDefaultOpen:f}){let p=(0,V.useCallback)(e=>Promise.resolve(e(i)),[i]),h=de(a,p);(0,V.useEffect)(()=>{document.title=fe(document.title,h)},[h]);let g=(0,V.useSyncExternalStore)(()=>()=>{},Ve,()=>`light`),_=ae(),v=P(`page`),y=s.find(e=>e.id===`agents`),b=P(`agent`),x=y&&b||void 0,S=x&&y||s.find(e=>e.id===v)||s[0];if(!S)throw Error(`A Dash has at least one page`);let C=s[0]?.id;(0,V.useEffect)(()=>{C&&v===C&&_===`/${C}`&&re(`/${location.hash}`,!0)},[C,v,_]),(0,V.useEffect)(Be,[]);let w=S.component,T=(0,V.useCallback)(()=>i.contexts.list({limit:500}),[i]),E=ce(Ne(i),T,{of:a}),D=r(i),O=(0,V.useSyncExternalStore)(D.subscribe,D.get,D.get),k=Re(i,o,O.epoch),A=ze(i,!!y,O),j=(0,V.useMemo)(()=>A?m(A):void 0,[A]),ie=(0,V.useMemo)(()=>j?.find(e=>e.row.path===X),[j]),F=(0,V.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of E.rows||[])t.path!==X&&oe(t).includes(`pinned-in-dash`)&&e.set(t.path,se(t));return e},[E.rows]),I=(0,V.useMemo)(()=>j&&F.size>0?j.filter(e=>F.has(e.row.path)).map(e=>({group:e,fallbackTitle:F.get(e.row.path)})):[],[j,F]),L=(0,V.useMemo)(()=>{let e=/* @__PURE__ */ new Set([X]);for(let t of l||[]){let n=Q(t.href,s).agent;n&&e.add(n)}for(let{group:t}of I)e.add(t.row.path);return e},[l,s,I]),R=M(N(void 0)),z=(0,V.useMemo)(()=>({name:t||a,logo:n}),[t,a,n]),B=y?He(s,y):void 0;return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[/* @__PURE__ */ (0,U.jsx)(ne,{app:e,mind:a,switcher:/* @__PURE__ */ (0,U.jsx)(te,{app:t||e,line:a,logo:n,href:R.href,onClick:R.onClick}),commandPalette:!1,sidebarAlert:!!h,nav:/* @__PURE__ */ (0,U.jsx)(qe,{itx:i,mind:a,pages:s,links:c,hasAgents:!!y,mainGroup:ie,pinned:l,pinnedGroups:I,foot:u,page:S,agent:x,waiting:h,agents:y?/* @__PURE__ */ (0,U.jsx)(me,{agents:A,current:x,exclude:L,overview:B,overviewShown:S===y&&!x,shrink:s.some(e=>e.id===`settings`)}):null}),account:k,accountActions:d?.length?/* @__PURE__ */ (0,U.jsx)(U.Fragment,{children:d.map(e=>/* @__PURE__ */ (0,U.jsxs)(ee,{render:/* @__PURE__ */ (0,U.jsx)(Z,{href:e.href,inPage:Q(e.href,s).inPage}),children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{className:`truncate`,children:e.name})]},e.name))}):void 0,sidebarDefaultOpen:f,locationKey:_,children:/* @__PURE__ */ (0,U.jsx)(Ue,{shows:x||``,children:/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:/* @__PURE__ */ (0,U.jsx)(Y,{}),children:/* @__PURE__ */ (0,U.jsx)(w,{itx:i,mind:a,mindFace:z,principal:k,page:S,pages:s,links:c,catalog:E.rows,agents:A,waiting:h},w.staysOverReconnect?`stays`:O.epoch)})},S.id)}),/* @__PURE__ */ (0,U.jsx)(le,{itx:i}),/* @__PURE__ */ (0,U.jsx)(ue,{theme:g})]})}const Fe=/* @__PURE__ */ new WeakMap;function Ie(e){let t=Fe.get(e);if(!t){let n=/* @__PURE__ */ new Set,r={principal:void 0,asking:!1,refused:0,listeners:n,subscribe(e){return n.add(e),()=>n.delete(e)},get:()=>r.principal};t=r,Fe.set(e,t)}return t}function Le(e,t){t.asking||t.principal!==void 0||(t.asking=!0,Promise.resolve(e.whoami()).then(e=>{t.refused=0,t.principal=e.principal||null;for(let e of t.listeners)e()},()=>{let n=Math.min(1e3*2**t.refused,15e3);t.refused+=1,setTimeout(()=>{t.listeners.size>0&&Le(e,t)},n)}).finally(()=>{t.asking=!1}))}function Re(e,t,n){let r=Ie(e),i=(0,V.useSyncExternalStore)(r.subscribe,r.get,r.get),a=t!==void 0;return(0,V.useEffect)(()=>{a||Le(e,r)},[e,r,a,n]),a?t:i}function ze(e,t,n){let{epoch:r}=n,a=s(t?()=>e.cd(`/agents`):null,[e,t,r]),o=c(a.stub,`agents`),l=n.state===`open`&&(!!a.error||o.status===`error`),u=o.value!==void 0,d=(0,V.useMemo)(()=>u?g(o.value):void 0,[u,o.value]),[f]=(0,V.useState)(()=>i()),p=f(d,u,`agents`);return(0,V.useMemo)(()=>p||(l?[]:void 0),[p,l])}function Be(){let e=document.documentElement,t=()=>e.toggleAttribute(`data-unwatched`,document.hidden||!document.hasFocus()),n=()=>setTimeout(t);return t(),window.addEventListener(`focus`,t),window.addEventListener(`blur`,n),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,t),window.removeEventListener(`blur`,n),document.removeEventListener(`visibilitychange`,t),e.removeAttribute(`data-unwatched`)}}const Ve=()=>document.documentElement.classList.contains(`dark`)?`dark`:`light`;function Z({href:e,inPage:t,onClick:n,...r}){let i=t?M(e):void 0;return/* @__PURE__ */ (0,U.jsx)(`a`,{...r,href:i?.href||e,onClick:e=>{n?.(e),i?.onClick(e)}})}function Q(e,t){let n=j(e),r=n?.get(`agent`)||void 0,i=n?.get(`page`);return{agent:r,inPage:!!n&&(!!r||!i||t.some(e=>e.id===i))}}function He(e,t){return N(t===e[0]?void 0:t.id)}var Ue=class extends V.Component{state={error:null,shows:this.props.shows};static getDerivedStateFromProps(e,t){return e.shows===t.shows?null:{error:null,shows:e.shows}}static getDerivedStateFromError(e){return{error:e instanceof Error?e.message:String(e)}}componentDidCatch(e){try{window.reportPageError?.(e)}catch(t){console.error(`The page's error capture failed; the page's error was not reported.`,{captureError:t,error:e})}}render(){return this.state.error===null?this.props.children:/* @__PURE__ */ (0,U.jsxs)(J,{alert:!0,children:[`This page did not load: `,this.state.error,`. `,/* @__PURE__ */ (0,U.jsx)(`a`,{href:location.href,children:`Load the page again`}),` `,`to try once more.`]})}};function We({itx:e,serves:t,children:n}){return t?/* @__PURE__ */ (0,U.jsx)(V.Suspense,{fallback:n(!1),children:/* @__PURE__ */ (0,U.jsx)(Ge,{itx:e,serves:t,children:n})}):n(!1)}function Ge({itx:e,serves:t,children:n}){return n(!(0,V.use)(H(e,t)))}function $(e,t){return!!(e&&t)&&(e===t||e.startsWith(`${t}/`))}function Ke({row:e,pages:t,agent:n,waiting:r}){let i=Q(e.href,t);return/* @__PURE__ */ (0,U.jsxs)(C,{children:[/* @__PURE__ */ (0,U.jsxs)(T,{isActive:$(n,i.agent),tooltip:e.name,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:e.href,inPage:i.inPage}),children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:e.name})]}),e.count===`approvals`&&r?/* @__PURE__ */ (0,U.jsx)(D,{children:r}):null]})}function qe({itx:e,mind:t,pages:n,links:r,hasAgents:i,mainGroup:a,pinned:o=[],pinnedGroups:s=[],foot:c=[],page:l,agent:u,waiting:d,agents:f}){let p=n.filter((e,t)=>t>0&&e.row!==!1&&!(f&&e.id===`agents`)),m=n.some(e=>e.id===`settings`)?[]:r.filter(e=>e.rows.length>0);return/* @__PURE__ */ (0,U.jsxs)(U.Fragment,{children:[d?/* @__PURE__ */ (0,U.jsx)(w,{className:`shrink-0 pb-0`,children:/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsx)(z,{waiting:d,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:`https://${t}/secrets/approvals`})})})}):null,i||o.length>0||s.length>0?/* @__PURE__ */ (0,U.jsx)(w,{className:`shrink-0 pb-0 group-data-[collapsible=icon]:pb-2`,children:/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsxs)(S,{children:[i?/* @__PURE__ */ (0,U.jsx)(he,{path:X,group:a,active:$(u,X)}):null,o.map(e=>{let t=Q(e.href,n);return/* @__PURE__ */ (0,U.jsx)(C,{children:/* @__PURE__ */ (0,U.jsxs)(T,{isActive:$(u,t.agent),tooltip:e.name,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:e.href,inPage:t.inPage}),children:[/* @__PURE__ */ (0,U.jsx)(e.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:e.name})]})},e.name)}),s.map(({group:e,fallbackTitle:t})=>/* @__PURE__ */ (0,U.jsx)(ge,{group:e,fallbackTitle:t,pinned:!0,active:$(u,e.row.path)},e.row.path))]})})}):null,f,c.length>0||p.length>0?/* @__PURE__ */ (0,U.jsx)(w,{className:`mt-auto shrink-0`,children:/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsxs)(S,{children:[c.map(e=>/* @__PURE__ */ (0,U.jsx)(Ke,{row:e,pages:n,agent:u,waiting:d},e.name)),p.map(t=>/* @__PURE__ */ (0,U.jsx)(We,{itx:e,serves:t.serves,children:e=>/* @__PURE__ */ (0,U.jsxs)(C,{children:[/* @__PURE__ */ (0,U.jsxs)(T,{isActive:t===l||t.id===`settings`&&l.row===!1,tooltip:t.name,className:e?`text-muted-foreground`:void 0,render:/* @__PURE__ */ (0,U.jsx)(Z,{href:He(n,t),inPage:!0}),children:[/* @__PURE__ */ (0,U.jsx)(t.icon,{}),/* @__PURE__ */ (0,U.jsx)(`span`,{children:t.name})]}),e?/* @__PURE__ */ (0,U.jsx)(D,{className:`text-muted-foreground`,children:`Off`}):null]})},t.id))]})})}):null,m.map(e=>/* @__PURE__ */ (0,U.jsxs)(w,{children:[/* @__PURE__ */ (0,U.jsx)(O,{children:e.title}),/* @__PURE__ */ (0,U.jsx)(E,{children:/* @__PURE__ */ (0,U.jsx)(S,{children:e.rows.map(e=>/* @__PURE__ */ (0,U.jsx)(Ke,{row:e,pages:n,agent:u,waiting:d},e.name))})})]},e.title))]})}export{J as a,Te as c,Me as d,H as f,ke as i,q as l,Ae as n,Se as o,B as p,we as r,Y as s,Pe as t,De as u};
M files.json
@@ -27,7 +27,7 @@ "dist/chunks/context-view.mjs": "sha256-PoD8eBs1Svd957Fh6WqC5LVJWlFwEiBJChVE6KZ5NDM=", "dist/chunks/dash-call.mjs": "sha256-ZKLNKu8kud9wJQ2SEAaF8ccHpWghzMzxUt4XnymHrD0=", "dist/chunks/dash-share.mjs": "sha256-wyDtgoOACan1Eifd8apND8sSKMTs3O4UIbO6E0OSV8E=", - "dist/chunks/dash.mjs": "sha256-/YVUVVI5Se68CZcLk0Q6v3Il/58Q3LVz2pkSEf5wXw0=", + "dist/chunks/dash.mjs": "sha256-12NXK89cg6GIlRizHVCK/rMKMyhOBoTUbiDaJBlK1DA=", "dist/chunks/dist.mjs": "sha256-srQYpnpHkHTS7+38EIJow37bj4WW8rpTSe4vBWXT8lk=", "dist/chunks/dist2.mjs": "sha256-BOepkV/v33M1ojl/SuRGF0Kv9GyFW1mOisyREkwI3+A=", "dist/chunks/dist3.mjs": "sha256-0URi1/zDCzYn6uGHAPZdA4C/s4nw5LRVtR9m6gKX4qs=",
M release.json
@@ -1,7 +1,7 @@ { "package": "@iterate-com/ui", - "source": "b5d39b4a69bd0f236ddbe0d2251844f389717b6c", - "workspace": "32ec53f622b5677d834315b7fb16cdd590a78c61", + "source": "411c456e2423e255526b5b97be5d5721c4a99c88", + "workspace": "a0c199343387b0b56e33d21ccac302e6d416a9aa", "modules": 189, "rewritten": 529 }