@schlenkr/ragents 0.1.13 → 0.1.14

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.
Files changed (47) hide show
  1. package/apps/server/src/provider.ts +8 -2
  2. package/apps/server/src/title-compactor.ts +1 -1
  3. package/apps/web/dist/assets/{highlighted-body-KPVGNVTW-CpPi6QLr.js → highlighted-body-KPVGNVTW-BslIwn_y.js} +1 -1
  4. package/apps/web/dist/assets/main-BUN8m8SW.js +11 -0
  5. package/apps/web/dist/assets/{mermaid-HWGCJPDP-q-mf1kLN.js → mermaid-HWGCJPDP-B1erZlFM.js} +4 -4
  6. package/apps/web/dist/assets/{runPanel-nk_aMxSn.js → runPanel-s8gGpr9M.js} +1 -1
  7. package/apps/web/dist/help/mini-app.css +9 -0
  8. package/apps/web/dist/host-web.json +7 -7
  9. package/apps/web/dist/index.html +2 -2
  10. package/apps/web/dist/run-panel.html +2 -2
  11. package/apps/web/src/App.tsx +12 -1
  12. package/apps/web/src/PluginRegistry.tsx +2 -2
  13. package/apps/web/src/SessionList.tsx +7 -6
  14. package/apps/web/src/SettingsModal.tsx +3 -3
  15. package/apps/web/src/actor-programs/client-ui/FilePicker.tsx +1 -1
  16. package/apps/web/src/api.ts +2 -0
  17. package/apps/web/src/run-overview.ts +1 -1
  18. package/apps/web/src/ui/relative-time.ts +1 -1
  19. package/bundles/ragents.documents/ragents-bundle.json +2 -2
  20. package/bundles/ragents.documents/web/classes.json +1 -1
  21. package/bundles/ragents.documents/web/index.js +1 -1
  22. package/bundles/ragents.documents/web/index.js.map +2 -2
  23. package/bundles/ragents.orchestration/ragents-bundle.json +2 -2
  24. package/bundles/ragents.orchestration/web/index.js +3 -3
  25. package/bundles/ragents.orchestration/web/index.js.map +2 -2
  26. package/bundles/ragents.overseer/ragents-bundle.json +4 -3
  27. package/bundles/ragents.overseer/web/classes.json +1 -1
  28. package/bundles/ragents.overseer/web/index.js +1 -1
  29. package/bundles/ragents.overseer/web/index.js.map +4 -4
  30. package/bundles/ragents.processes/ragents-bundle.json +2 -2
  31. package/bundles/ragents.processes/web/classes.json +1 -1
  32. package/bundles/ragents.processes/web/index.js +1 -1
  33. package/bundles/ragents.processes/web/index.js.map +2 -2
  34. package/bundles/ragents.workspace/ragents-bundle.json +2 -2
  35. package/bundles/ragents.workspace/web/classes.json +1 -1
  36. package/bundles/ragents.workspace/web/index.js +1 -1
  37. package/bundles/ragents.workspace/web/index.js.map +2 -2
  38. package/package.json +2 -2
  39. package/plugins/ragents.documents/web/DocumentViewer.tsx +2 -2
  40. package/plugins/ragents.orchestration/web/ExecutionsPanel.tsx +1 -1
  41. package/plugins/ragents.orchestration/web/FlowInspector.tsx +1 -1
  42. package/plugins/ragents.orchestration/web/JournalStatus.tsx +1 -1
  43. package/plugins/ragents.orchestration/web/format.ts +1 -1
  44. package/plugins/ragents.overseer/web/index.tsx +51 -3
  45. package/plugins/ragents.processes/web/processes.ts +1 -1
  46. package/plugins/ragents.workspace/web/FileBrowser.tsx +1 -1
  47. package/apps/web/dist/assets/main-DJmCHGzM.js +0 -11
@@ -42,7 +42,7 @@ import { RunChatSession } from "./ragents/session.js";
42
42
  import { globalChatToken, globalRunPolicyOf, type GlobalChatPolicy, type ManagedRunStart, type RunManagement } from "./ragents/global-chat.js";
43
43
  import { workspaceRuntimeToken, type SessionWorkspace, type WorkspaceTransfer } from "./ragents/workspace-runtime.js";
44
44
  import { settingsResponse, skillDetailResponse, type SettingsResponse, type SettingsSkillDetail } from "./settings.js";
45
- import { createTitleCompactor } from "./title-compactor.js";
45
+ import { createTitleCompactor, MAX_TITLE_CHARS } from "./title-compactor.js";
46
46
  import { ModelRuntime } from "@ragents/agent";
47
47
  import { TitleSettingsStore } from "./title-settings.js";
48
48
  import { sandboxServicesToken } from "./plugin-support/workspace-sandbox-host.js";
@@ -59,6 +59,8 @@ type ListedSession = SessionInfo & {
59
59
  running: boolean;
60
60
  /** Whether the caller reaches the run's workspace; otherwise UIs hide what needs it. */
61
61
  workspaceAccessible: boolean;
62
+ /** Display name of the user who created the run; missing for a run created without sign-in. */
63
+ ownerLabel?: string;
62
64
  metadata?: Readonly<Record<string, unknown>>;
63
65
  metadataUnavailable?: Readonly<Record<string, string>>;
64
66
  };
@@ -295,6 +297,8 @@ export class RunSessionProvider implements ChatSessionProvider {
295
297
  const isCoordinator = (runId: string) => this.plugins.optionalService(globalChatToken)?.isCoordinator(runId) ?? false;
296
298
  const listed = engine.journal.runIds().filter((runId) => !isCoordinator(runId)
297
299
  && !this.deleteRequested.has(runId) && !this.deleted.has(runId) && visible(runId));
300
+ const anonymousUser = configuredAnonymousUser();
301
+ const userLabels = new Map([...configuredUsers() ?? [], ...anonymousUser ? [anonymousUser] : []].map((user) => [user.id, user.label]));
298
302
  const described = await Promise.all(listed.map(async (runId): Promise<ListedSession | undefined> => {
299
303
  const state = engine.journal.stateOf(runId);
300
304
  if (!state) return undefined;
@@ -317,6 +321,7 @@ export class RunSessionProvider implements ChatSessionProvider {
317
321
  running: [...state.actors.values()].some((actor) => actor.kind !== "human" && engine.scheduler.isRunning(runId, actor.id))
318
322
  || (this.sessions.get(runId)?.running ?? false),
319
323
  workspaceAccessible: workspace,
324
+ ...(state.ownerUserId !== null ? { ownerLabel: userLabels.get(state.ownerUserId) ?? state.ownerUserId } : {}),
320
325
  metadata: metadata.values,
321
326
  ...(Object.keys(metadata.unavailable).length > 0 ? { metadataUnavailable: metadata.unavailable } : {}),
322
327
  };
@@ -924,5 +929,6 @@ const lockedSession = (failure: JournalLoadFailure, journal: Journal): ListedSes
924
929
  const sessionTitle = (text: string | undefined): string | undefined => {
925
930
  const lines = text?.split(/\r?\n/).map((line) => line.trim()).filter(Boolean) ?? [];
926
931
  if (lines.length === 0) return undefined;
927
- return lines[0]?.startsWith("[Test:") && lines[1] ? `${lines[0]} ${lines[1]}` : lines[0];
932
+ const title = lines[0]?.startsWith("[Test:") && lines[1] ? `${lines[0]} ${lines[1]}` : lines[0] ?? "";
933
+ return title.length > MAX_TITLE_CHARS ? `${title.slice(0, MAX_TITLE_CHARS - 3)}...` : title;
928
934
  };
@@ -4,7 +4,7 @@ import type { ModelRuntime } from "@ragents/agent";
4
4
  import type { TitleModelSelection } from "./title-settings-contract.js";
5
5
 
6
6
  const MAX_PROMPT_CHARS = 4_000;
7
- const MAX_TITLE_CHARS = 80;
7
+ export const MAX_TITLE_CHARS = 80;
8
8
 
9
9
  const instruction =
10
10
  "You summarize the first task of a run as a list title. "
@@ -1 +1 @@
1
- import{r,S as d,E as p,j as E,c as f}from"./mermaid-HWGCJPDP-q-mf1kLN.js";var j=({code:i,language:e,maxHeight:o,raw:a,className:u,startLine:m,lineNumbers:n,...h})=>{let{shikiTheme:l}=r.useContext(d),t=p(),[c,s]=r.useState(a);return r.useEffect(()=>{if(!t){s(a);return}let g=t.highlight({code:i,language:e,themes:l},x=>{s(x)});g&&s(g)},[i,e,l,t,a]),E.jsx(f,{className:u,language:e,lineNumbers:n,maxHeight:o,result:c,startLine:m,...h})};export{j as HighlightedCodeBlockBody};
1
+ import{r,S as d,E as p,j as E,c as f}from"./mermaid-HWGCJPDP-B1erZlFM.js";var j=({code:i,language:e,maxHeight:o,raw:a,className:u,startLine:m,lineNumbers:n,...h})=>{let{shikiTheme:l}=r.useContext(d),t=p(),[c,s]=r.useState(a);return r.useEffect(()=>{if(!t){s(a);return}let g=t.highlight({code:i,language:e,themes:l},x=>{s(x)});g&&s(g)},[i,e,l,t,a]),E.jsx(f,{className:u,language:e,lineNumbers:n,maxHeight:o,result:c,startLine:m,...h})};export{j as HighlightedCodeBlockBody};
@@ -0,0 +1,11 @@
1
+ import{a as ue,r as s,j as e,D as fe,b as pe,d as ee,B as g,X as Le,M as Ie,C as xe,e as _e,f as Be,g as He,h as Ue,u as Fe,i as qe,k as Te,l as Ke,m as $e,A as We,n as Qe,o as Ve,U as Ge,P as Xe,W as Ye,R as Je,p as le,q as J,s as Ze,t as et,v as tt,w as st,x as nt,y as at,z as rt,Q as ot,F as it,G as lt}from"./mermaid-HWGCJPDP-B1erZlFM.js";/**
2
+ * @license lucide-react v1.46.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const me={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};me.node;const ct=ue(me);/**
7
+ * @license lucide-react v1.46.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const he={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};he.node;const dt=ue(he);function ut(n,r,a,u){if(!r||n.source!==r||n.origin!==a)return;const o=n.data;if(!(!o||typeof o!="object"||Array.isArray(o))&&"type"in o){if(o.type==="ragents:help-ready")return{type:"ready"};if(o.type==="ragents:start-sample"&&"entry"in o&&typeof o.entry=="string"&&u.includes(o.entry))return{type:"start",entry:o.entry}}}function ft({onClose:n,sampleEntries:r,onStartSample:a}){const u=s.useRef(null),o=s.useRef(null),p=s.useRef(void 0),m=s.useRef(!1);s.useEffect(()=>()=>{var i;return(i=p.current)==null?void 0:i.call(p)},[]),s.useEffect(()=>{var j;const i=(j=o.current)==null?void 0:j.contentWindow;if(!i)return;const l=()=>i.postMessage({type:"ragents:help-context",canStartSamples:r.length>0,entries:r},window.location.origin),h=k=>{const c=ut(k,i,window.location.origin,r);(c==null?void 0:c.type)==="ready"&&l(),(c==null?void 0:c.type)==="start"&&!m.current&&(m.current=!0,a(c.entry))};return window.addEventListener("message",h),l(),()=>window.removeEventListener("message",h)},[a,r]);const x=()=>{var k;(k=p.current)==null||k.call(p);const i=o.current,l=i==null?void 0:i.contentDocument,h=l==null?void 0:l.defaultView;if(!i||!l||!h)return;l.documentElement.dataset.helpEmbedded="true";for(const c of l.querySelectorAll("a[href]"))new URL(c.href).origin!==window.location.origin&&(c.target="_blank",c.rel="noopener noreferrer");const j=c=>{var v;if(!c.defaultPrevented){if(c.key==="Escape")c.preventDefault(),n();else if(c.key==="Tab"){const w=[...l.querySelectorAll("a[href], button, input, select, textarea, summary, [tabindex]")].filter(S=>S.tabIndex>=0&&!S.matches(":disabled")&&S.getClientRects().length>0),L=c.shiftKey?w[0]:w.at(-1);if(!w.length||l.activeElement===L||l.activeElement===l.body){if(!c.shiftKey&&l.activeElement===l.body&&w.length)return;c.preventDefault(),(v=u.current)==null||v.focus()}}}};h.addEventListener("keydown",j),p.current=()=>h.removeEventListener("keydown",j)};return e.jsx(fe,{open:!0,onOpenChange:i=>{i||n()},children:e.jsxs(pe,{className:"gap-0 p-0",initialFocus:u,scope:"page",showCloseButton:!1,size:"full",children:[e.jsx(ee,{className:"sr-only",children:"Help"}),e.jsx(g,{"aria-label":"Close help",className:"absolute top-3 right-4.5 z-1 rounded-full",onClick:n,ref:u,size:"icon",variant:"outline",children:e.jsx(Le,{})}),e.jsx("iframe",{className:"min-h-0 w-full min-w-0 flex-[1_1_0] bg-background",onLoad:x,ref:o,src:"/help/index.html",tabIndex:0,title:"RAgents: homepage and documentation"})]})})}const pt="button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",ve="pointer-events-auto shadow-pop";function xt({onBusy:n,onClose:r,onOpen:a,open:u,panels:o,registry:p,runs:m}){const x=s.useRef(null);return s.useEffect(()=>{if(!u)return;const i=requestAnimationFrame(()=>{var h;const l=x.current;!l||l.contains(document.activeElement)||(h=l.querySelector(pt))==null||h.focus({preventScroll:!0})});return()=>cancelAnimationFrame(i)},[u]),e.jsxs(Ie,{className:"pointer-events-none flex h-[min(900px,100%)] w-[min(1440px,100%)] flex-col rounded-none bg-transparent p-0 ring-0",keepMounted:!0,onClose:r,open:u,scope:"workspace",size:"full",children:[e.jsx(ee,{className:"sr-only",children:"Overview"}),e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 gap-4 max-[900px]:flex-col",id:"app-overview",ref:x,children:[o.map(({id:i,Panel:l})=>e.jsx(mt,{id:i,onBusy:n,onClose:r,onOpen:a,open:u,Panel:l,registry:p},i)),m&&e.jsx(ht,{...m})]})]})}function mt({id:n,onBusy:r,onClose:a,onOpen:u,open:o,Panel:p,registry:m}){const x=s.useCallback(i=>r(n,i),[n,r]);return s.useEffect(()=>()=>r(n,!1),[n,r]),e.jsx(xe,{className:`${ve} min-h-0 min-w-0 flex-1 gap-0 p-0`,children:e.jsx(p,{onBusy:x,onClose:a,onOpen:u,open:o,registry:m})})}function ht({activeId:n,canCreate:r,canDelete:a,onCreate:u,onDelete:o,onOpen:p,registry:m,sessions:x,seenRevisions:i,unreachable:l}){const[h,j]=s.useState(),[k,c]=s.useState(!1),[v,w]=s.useState(()=>new Set),[L,S]=s.useState(!1),[E,B]=s.useState(!1),H=()=>{c(!1),w(new Set)},b=f=>{w(O=>{const I=new Set(O);return I.delete(f)||I.add(f),I})},D=async f=>{B(!0),j(void 0);try{await o(f)}catch(O){j(O instanceof Error?O.message:String(O))}finally{B(!1)}},C=async()=>{await D(x.filter(f=>v.has(f.id)).map(f=>f.id)),S(!1),H()};return e.jsx("section",{"aria-labelledby":"overview-runs-title",className:"flex min-h-0 min-w-0 flex-1 flex-col max-[900px]:flex-[1_1_50%]",children:e.jsxs(xe,{className:`${ve} min-h-0 flex-1 gap-workspace-inset overflow-y-auto overscroll-contain pt-workspace-inset pr-6 pb-6 pl-6 max-[900px]:px-3 max-[900px]:pt-3.5 max-[900px]:pb-4`,children:[e.jsxs("header",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-2.5",children:[e.jsxs("h2",{className:"text-[0.95rem] font-semibold",id:"overview-runs-title",children:["Runs ",e.jsx("span",{className:"ml-1 text-[0.8rem] font-medium tabular-nums text-muted-foreground",children:x.length})]}),l&&e.jsx("span",{className:"text-[0.72rem] font-medium text-destructive",role:"alert",children:"Server unreachable"}),a&&x.length>0&&e.jsx("div",{className:"ml-auto flex flex-wrap items-center gap-1",children:k?e.jsxs(e.Fragment,{children:[e.jsx(g,{onClick:()=>w(new Set(x.map(f=>f.id))),size:"sm",variant:"ghost",children:"All"}),e.jsx(g,{onClick:()=>w(new Set),size:"sm",variant:"ghost",children:"None"}),e.jsxs(g,{className:"ml-auto",disabled:v.size===0||E,onClick:()=>S(!0),size:"sm",variant:"destructive",children:["Delete (",v.size,")"]}),e.jsx(g,{onClick:H,size:"sm",variant:"ghost",children:"Done"})]}):e.jsx(g,{onClick:()=>c(!0),size:"sm",variant:"ghost",children:"Select"})})]}),h&&e.jsx("p",{className:"text-[0.72rem] font-medium text-destructive",role:"alert",children:h}),e.jsx("p",{className:"mb-5.5 text-[0.75rem] text-muted-foreground",children:"By last activity in the run. New activity has come in since you last viewed it."}),e.jsx(_e,{seenRevisions:i,activeId:n,onCreate:r?u:void 0,onDelete:a?f=>void D([f]):void 0,onSelect:p,onToggleSelected:b,registry:m,selectMode:k,selectedIds:v,sessions:x}),L&&e.jsx(fe,{open:!0,onOpenChange:f=>{!f&&!E&&S(!1)},children:e.jsxs(pe,{scope:"page",showCloseButton:!1,size:"small",children:[e.jsxs(Be,{children:[e.jsx(ee,{children:"Delete runs"}),e.jsx(He,{children:v.size===1?"One run will be permanently deleted.":`${v.size} runs will be permanently deleted.`})]}),e.jsxs(Ue,{children:[e.jsx(g,{disabled:E,onClick:()=>S(!1),variant:"outline",children:"Cancel"}),e.jsx(g,{disabled:E,onClick:()=>void C(),children:E?"Deleting ...":`Delete (${v.size})`})]})]})})]})})}const Z="flex min-h-0 min-w-0 flex-1 flex-col",vt="inline-flex w-header min-h-header items-center justify-center border-r border-border text-primary transition-colors duration-100 not-disabled:cursor-pointer hover:not-disabled:bg-accent focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-3 aria-expanded:bg-primary aria-expanded:text-primary-foreground aria-pressed:bg-primary aria-pressed:text-primary-foreground disabled:opacity-45";function bt(){var ie;const n=Fe(),r=qe((ie=n.user)==null?void 0:ie.id),a=n.can("runs.read"),u=a&&n.can("runs.write"),o=n.can("runs.inspect"),p=a&&n.can("runs.delete"),m=Te(),x=s.useRef(null),i=s.useRef(null),[l,h]=s.useState(null),[j,k]=s.useState(null),[c,v]=s.useState(null),[w,L]=s.useState(null),[S,E]=s.useState(null),[B,H]=s.useState([]),[b,D]=s.useState(),[C,f]=s.useState(),[O,I]=s.useState(),[U,te]=s.useState(!1),[F,K]=s.useState(!1),[N,se]=s.useState(!1),[$,z]=s.useState(),[ge,we]=s.useState(!1),[ye,je]=s.useState(()=>new Set),[Se,ne]=s.useState(!1),_=s.useRef(void 0),W=s.useRef(!1),M=s.useCallback(()=>{if(!a)return Promise.resolve();if(_.current)return W.current=!0,_.current;const t=async()=>{do{W.current=!1;try{H(await et()),ne(!1)}catch{ne(!0)}}while(W.current)};return _.current=t().finally(()=>{_.current=void 0}),_.current},[a]);s.useEffect(()=>{if(!a||b)return;M();const t=Ke.subscribe($e.channels.runs,{},()=>void M()),d=setInterval(()=>void M(),5e3);return()=>{t(),clearInterval(d)}},[b,a,M]);const A=s.useCallback((t=!1)=>{var d;se(!1),t&&((d=x.current)==null||d.focus({preventScroll:!0}))},[]),Q=s.useCallback(()=>{z(void 0),we(!0),se(!0)},[]),V=s.useCallback(()=>{N?A(!0):Q()},[A,Q,N]);s.useEffect(()=>{const t=d=>{if(d.defaultPrevented||d.repeat||d.altKey||d.shiftKey||d.key.toLowerCase()!=="i"||d.metaKey===d.ctrlKey)return;const R=x.current;!R||R.closest("[inert]")||(d.preventDefault(),V())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[V]);const G=s.useCallback((t,d)=>je(R=>{if(R.has(t)===d)return R;const P=new Set(R);return d?P.add(t):P.delete(t),P}),[]),ae=B,Ce=ae.find(t=>t.id===C),ke=s.useCallback(()=>{z(void 0),te(!0)},[]),Ne=s.useCallback(()=>K(!1),[]),Re=s.useCallback(()=>{te(!1),requestAnimationFrame(()=>{var t;return(t=i.current)==null?void 0:t.focus()})},[]),Ee=e.jsx(g,{"aria-label":"Open settings",onClick:ke,ref:i,size:"icon-lg",title:"Settings",variant:"ghost",children:e.jsx(tt,{})}),De=t=>{f(t),A(!0)},Oe=()=>{z(void 0),A(!0),D({id:crypto.randomUUID(),title:"New run",updatedAt:Date.now()})},ze=async t=>{const d=await Promise.allSettled(t.map(T=>st(T))),R=t.filter((T,Pe)=>d[Pe].status==="fulfilled");C!==void 0&&R.includes(C)&&f(void 0),await M();const P=d.find(T=>T.status==="rejected");if(P)throw P.reason};if(m.status==="loading")return e.jsx("div",{className:"m-auto p-6 text-muted-foreground",children:"Loading profile."});if(m.status==="failed")return e.jsx("div",{className:"flex h-full",children:e.jsx("main",{className:"relative z-1 flex min-h-0 min-w-0 flex-1 bg-[image:var(--surface-backdrop)]",children:e.jsxs("div",{className:Z,children:[e.jsx("header",{className:"flex min-h-[42px] flex-none items-center gap-3 border-b border-border-soft pr-0.5 pb-2 pl-2.5",children:e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-3 text-[0.82rem] font-semibold text-foreground",children:"Profile unavailable"})}),e.jsxs(We,{className:"m-auto max-w-[560px] gap-3 p-6",variant:"destructive",children:[e.jsx("p",{children:m.error}),e.jsx(g,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload"})]})]})})});const y=m.registry,X=y.overviewPanels.filter(t=>t.readRight===void 0||n.can(t.readRight)),Y=X.filter(t=>(t.placement??"overview")==="overview"),Ae=X.filter(t=>t.placement==="toolbar"),q=a?X.find(t=>t.placement==="idle"):void 0,Me=a||Y.length>0,re=Y.some(t=>ye.has(t.id)),oe=Qe(a?C:void 0,N,O);return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("header",{className:"relative z-[80] flex h-header flex-none items-stretch border-b border-border bg-shell shadow-bar",children:[Me&&e.jsx("div",{className:"relative flex flex-none self-stretch",children:e.jsx("button",{"aria-controls":"app-overview","aria-expanded":N,"aria-haspopup":"dialog","aria-keyshortcuts":"Meta+I Control+I","aria-label":N?"Close overview":"Open overview",className:vt,onClick:V,ref:x,title:`Overview (Cmd+I / Ctrl+I)${re?": processing":""}`,type:"button",children:re?e.jsx(Ve,{"aria-hidden":!0,className:"size-[18px]"}):e.jsx(dt,{size:22})})}),Ae.map(({id:t,Panel:d})=>e.jsx(ce,{id:t,onBusy:G,onClose:()=>z(void 0),onOpen:()=>{!U&&!F&&!b&&(A(),z(t))},open:$===t,Panel:d,registry:y,userLocation:oe},t)),e.jsx("div",{"aria-label":"Run title bar",className:"flex min-w-0 flex-1 items-stretch overflow-x-auto no-scrollbar focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-3 max-md:in-[header:has([data-slot=overseer-toolbar][data-open=true])]:flex-[0_1_0]",ref:h,role:"region",tabIndex:0}),e.jsx(Ge,{}),e.jsxs("div",{className:"flex min-w-0 flex-[0_1_auto] items-stretch bg-shell has-data-[workspace-state=expanded]:w-[var(--workspace-panel-width,560px)] has-data-[workspace-state=expanded]:border-l has-data-[workspace-state=expanded]:border-border",children:[e.jsx("div",{className:"flex min-w-0 flex-1 empty:hidden",ref:k}),e.jsxs("div",{className:"flex flex-none items-center gap-1.5 px-2 max-md:gap-0.5 max-md:px-1",children:[n.can("settings.read")&&Ee,o&&e.jsx(g,{"aria-haspopup":"dialog","aria-label":"Open help",onClick:()=>{z(void 0),K(!0)},size:"icon-lg",title:"Help",variant:"ghost",children:e.jsx(ct,{})})]})]})]}),e.jsx(Xe,{failures:m.failures}),e.jsx(Ye.Provider,{value:w,children:e.jsx("div",{className:"relative flex min-h-0 flex-1 flex-col",ref:L,children:e.jsxs(Je.Provider,{value:S,children:[e.jsxs("div",{className:"relative flex h-auto min-h-0 flex-1",ref:E,children:[e.jsx("main",{className:"relative z-1 flex min-h-0 min-w-0 flex-1 bg-[image:var(--surface-backdrop)] @container/chat-content",children:a&&C?e.jsx(le,{headerContainer:l,workspaceHeaderContainer:j,statusContainer:c,onLocationChange:I,onViewed:r.markViewed,viewing:!N&&!U&&!F&&!b&&!$,registry:y,session:Ce??{id:C,title:"New run",updatedAt:Date.now()}},C):q?e.jsx("div",{className:Z,children:e.jsx(ce,{id:q.id,onBusy:G,onClose:()=>{},onOpen:()=>{},open:!N&&!U&&!F&&!b&&!$,Panel:q.Panel,registry:y,userLocation:oe},q.id)}):e.jsx("div",{className:Z,children:e.jsx("div",{className:"m-auto text-center text-muted-foreground",children:a?u?"Open the overview at the top left to choose a run or start a new one.":"Open the overview at the top left to choose a run. You have read access.":"No runs are shared with this user account."})})}),ge&&e.jsx(xt,{onOpen:Q,onBusy:G,onClose:()=>A(!0),open:N,panels:Y,registry:y,runs:a?{activeId:C,canCreate:u&&(n.can("runs.create")||y.scriptEntries.some(t=>J(n,t.id))),canDelete:p,onCreate:Oe,onDelete:ze,onOpen:De,registry:y,sessions:ae,seenRevisions:r.revisions,unreachable:Se}:void 0}),b&&e.jsx(le,{onStarted:()=>{f(b.id),D(void 0),M()},registry:y,session:b,startDialog:{onClose:()=>D(void 0),initialEntryId:b.startEntryId}},b.id),U&&e.jsx(Ze,{onClose:Re,registry:y}),o&&F&&e.jsx(ft,{onClose:Ne,sampleEntries:y.scriptEntries.filter(t=>J(n,t.id)).map(t=>t.id),onStartSample:t=>{!J(n,t)||!y.scriptEntries.some(d=>d.id===t)||(K(!1),z(void 0),A(),D({id:crypto.randomUUID(),title:"New run",updatedAt:Date.now(),startEntryId:t}))}})]}),e.jsx("footer",{"aria-label":"Run status bar",className:"relative flex h-statusbar w-full flex-none items-stretch pl-3 before:pointer-events-none before:absolute before:inset-0 before:z-[2] before:border-t before:border-border before:bg-shell before:shadow-status before:backdrop-blur-[16px] before:content-['']",ref:v})]})})})]})}function ce({id:n,onBusy:r,Panel:a,...u}){const o=s.useCallback(p=>r(n,p),[n,r]);return s.useEffect(()=>()=>r(n,!1),[n,r]),e.jsx(a,{...u,onBusy:o})}nt();const be=document.getElementById("root");if(!be)throw new Error("Root element is missing");const de=at.createRoot(be);try{const n=rt(window);de.render(e.jsx(s.StrictMode,{children:e.jsx(ot,{children:e.jsx(it,{children:e.jsx(bt,{})})})}))}catch(n){de.render(e.jsxs(lt,{children:[e.jsx("h1",{className:"my-3 text-[1.5rem]",children:"The view could not be loaded"}),e.jsx("p",{className:"mb-6 leading-normal",role:"alert",children:n instanceof Error?n.message:String(n)}),e.jsx(g,{onClick:()=>window.location.reload(),variant:"outline",children:"Reload"})]}))}