@schlenkr/ragents 0.1.14 → 0.1.16
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/apps/server/package.json +1 -1
- package/apps/server/src/api/contracts.ts +19 -1
- package/apps/server/src/api/core-methods.ts +12 -0
- package/apps/server/src/chat-handler.ts +19 -0
- package/apps/server/src/host-api.json +2 -0
- package/apps/server/src/host-api.ts +2 -2
- package/apps/server/src/plugin-build/build.ts +1 -1
- package/apps/server/src/plugin-support/actor-programs/app-project.ts +62 -18
- package/apps/server/src/plugin-support/actor-programs/client-contracts.ts +47 -8
- package/apps/server/src/plugin-support/actor-programs/contract.ts +18 -1
- package/apps/server/src/plugin-support/actor-programs/service.ts +22 -1
- package/apps/server/src/plugin-support/plugin-folder.ts +14 -1
- package/apps/server/src/plugin-support/run-scripts.ts +27 -2
- package/apps/server/src/profile/compose.ts +2 -0
- package/apps/server/src/provider.ts +23 -4
- package/apps/server/src/ragents/chat-projection.ts +7 -0
- package/apps/server/src/ragents/global-chat.ts +5 -1
- package/apps/server/src/ragents/run-script-tools.ts +66 -0
- package/apps/server/src/ragents/session.ts +122 -60
- package/apps/web/dist/assets/{highlighted-body-KPVGNVTW-BslIwn_y.js → highlighted-body-KPVGNVTW-BwD4uYEe.js} +1 -1
- package/apps/web/dist/assets/{main-BUN8m8SW.js → main-KBrc5Q77.js} +1 -1
- package/apps/web/dist/assets/{mermaid-HWGCJPDP-B1erZlFM.js → mermaid-HWGCJPDP-CSCkaArr.js} +88 -88
- package/apps/web/dist/assets/runPanel-BjG5NBKm.js +26 -0
- package/apps/web/dist/help/guide-clients.html +21 -4
- package/apps/web/dist/help/guide-clients.md +23 -4
- package/apps/web/dist/help/guide-plugins.html +12 -2
- package/apps/web/dist/help/guide-plugins.md +9 -2
- package/apps/web/dist/help/guide-programs.html +8 -2
- package/apps/web/dist/help/guide-programs.md +9 -2
- package/apps/web/dist/help/guide-runtime.html +3 -2
- package/apps/web/dist/help/guide-runtime.md +3 -2
- package/apps/web/dist/help/index.html +1 -1
- package/apps/web/dist/help/mini-app.css +7 -2
- package/apps/web/dist/host-web.json +6 -6
- package/apps/web/dist/index.html +2 -2
- package/apps/web/dist/run-panel.html +2 -2
- package/apps/web/package.json +1 -1
- package/apps/web/src/run-panel/RunPanelApp.tsx +1 -1
- package/apps/web/src/run-panel/RunPanelMenu.tsx +47 -11
- package/bundles/ragents.activity/ragents-bundle.json +1 -1
- package/bundles/ragents.actor-programs/ragents-bundle.json +4 -2
- package/bundles/ragents.actor-programs/server/index.js +437 -24
- package/bundles/ragents.actor-programs/server/index.js.map +4 -4
- package/bundles/ragents.actor-programs/web/index.js.map +1 -1
- package/bundles/ragents.ask/ragents-bundle.json +2 -2
- package/bundles/ragents.ask/server/index.js +1 -0
- package/bundles/ragents.ask/server/index.js.map +2 -2
- package/bundles/ragents.browser/ragents-bundle.json +1 -1
- package/bundles/ragents.documents/ragents-bundle.json +1 -1
- package/bundles/ragents.lsp-fsharp/ragents-bundle.json +1 -1
- package/bundles/ragents.lsp-roslyn/ragents-bundle.json +1 -1
- package/bundles/ragents.lsp-typescript/ragents-bundle.json +1 -1
- package/bundles/ragents.model-relay/ragents-bundle.json +1 -1
- package/bundles/ragents.orchestration/ragents-bundle.json +7 -4
- package/bundles/ragents.orchestration/server/chunks/chunk-QS3WJ3D7.js +11 -0
- package/bundles/ragents.orchestration/server/chunks/chunk-QS3WJ3D7.js.map +7 -0
- package/bundles/ragents.orchestration/server/exports/server/contract.js +9 -0
- package/bundles/ragents.orchestration/server/exports/server/contract.js.map +7 -0
- package/bundles/ragents.orchestration/server/index.js +49 -3
- package/bundles/ragents.orchestration/server/index.js.map +2 -2
- package/bundles/ragents.orchestration/surface.hbs +5 -0
- package/bundles/ragents.overseer/ragents-bundle.json +1 -1
- package/bundles/ragents.processes/ragents-bundle.json +1 -1
- package/bundles/ragents.product/ragents-bundle.json +1 -1
- package/bundles/ragents.profile-distribution/ragents-bundle.json +1 -1
- package/bundles/ragents.reference/actors/notebook/package.json +16 -0
- package/bundles/ragents.reference/actors/notebook/src/client.tsx +31 -0
- package/bundles/ragents.reference/actors/notebook/src/server.ts +27 -0
- package/bundles/ragents.reference/actors/notebook/tests/program.test.ts +27 -0
- package/bundles/ragents.reference/ragents-bundle.json +4 -3
- package/bundles/ragents.reference/run-scripts/quick-note/RUN.md +14 -0
- package/bundles/ragents.reference/run-scripts/quick-note/package.json +9 -0
- package/bundles/ragents.reference/run-scripts/quick-note/src/server.ts +29 -0
- package/bundles/ragents.reference/run-scripts/quick-note/tests/program.test.ts +43 -0
- package/bundles/ragents.reference/run-scripts/run-roster/RUN.md +19 -0
- package/bundles/ragents.reference/run-scripts/run-roster/package.json +9 -0
- package/bundles/ragents.reference/run-scripts/run-roster/src/server.ts +26 -0
- package/bundles/ragents.reference/run-scripts/run-roster/tests/program.test.ts +47 -0
- package/bundles/ragents.todo/ragents-bundle.json +1 -1
- package/bundles/ragents.transcript/ragents-bundle.json +1 -1
- package/bundles/ragents.watch/ragents-bundle.json +1 -1
- package/bundles/ragents.workspace/ragents-bundle.json +1 -1
- package/package.json +3 -3
- package/packages/ragents/src/domain/vocabulary.ts +4 -0
- package/packages/ragents/src/index.ts +3 -1
- package/packages/ragents/src/plugin-host.ts +62 -10
- package/packages/ragents/src/plugin-types.ts +11 -0
- package/packages/ragents/src/runtime/guards.ts +2 -1
- package/packages/ragents/src/typescript/async-compiler.ts +11 -1
- package/plugins/ragents.actor-programs/server/index.ts +3 -0
- package/plugins/ragents.actor-programs/server/runtime.ts +424 -28
- package/plugins/ragents.actor-programs/server/script-state.ts +54 -0
- package/plugins/ragents.actor-programs/server/tool-contributor.ts +2 -0
- package/plugins/ragents.ask/server/ask-tool.ts +1 -0
- package/plugins/ragents.orchestration/ragents-plugin.json +1 -0
- package/plugins/ragents.orchestration/server/contract.ts +14 -0
- package/plugins/ragents.orchestration/server/index.ts +4 -1
- package/plugins/ragents.orchestration/server/surface-tool.ts +58 -2
- package/plugins/ragents.orchestration/surface.hbs +5 -0
- package/plugins/ragents.reference/actors/notebook/package.json +16 -0
- package/plugins/ragents.reference/actors/notebook/src/client.tsx +31 -0
- package/plugins/ragents.reference/actors/notebook/src/server.ts +27 -0
- package/plugins/ragents.reference/actors/notebook/tests/program.test.ts +27 -0
- package/plugins/ragents.reference/run-scripts/quick-note/RUN.md +14 -0
- package/plugins/ragents.reference/run-scripts/quick-note/package.json +9 -0
- package/plugins/ragents.reference/run-scripts/quick-note/src/server.ts +29 -0
- package/plugins/ragents.reference/run-scripts/quick-note/tests/program.test.ts +43 -0
- package/plugins/ragents.reference/run-scripts/run-roster/RUN.md +19 -0
- package/plugins/ragents.reference/run-scripts/run-roster/package.json +9 -0
- package/plugins/ragents.reference/run-scripts/run-roster/src/server.ts +26 -0
- package/plugins/ragents.reference/run-scripts/run-roster/tests/program.test.ts +47 -0
- package/scripts/agent/agent-cli.ts +46 -2
- package/scripts/package/ragents.mjs +3 -1
- package/apps/web/dist/assets/runPanel-s8gGpr9M.js +0 -21
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{a as U,H as D,u as G,r as o,j as e,B as k,I as Te,J as Ae,v as _e,l as ze,m as Fe,t as Me,k as Ue,P as De,G as ce,K as He,p as J,q as de,i as $e,L as ue,N as re,O as Be,T as Ve,A as oe,V as qe,Y as Je,Z as Ge,_ as Ke,s as Qe,$ as We,e as Ye,a0 as Ze,a1 as Xe,x as et,y as tt,a2 as nt,a3 as st,a4 as rt,z as ot,Q as at,a5 as it,a6 as lt,F as ct}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 he={name:"ellipsis-vertical",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],aliases:["more-vertical"]};he.node;const dt=U(he);/**
|
|
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 fe={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};fe.node;const ut=U(fe);/**
|
|
12
|
-
* @license lucide-react v1.46.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const pe={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};pe.node;const ht=U(pe);/**
|
|
17
|
-
* @license lucide-react v1.46.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const xe={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};xe.node;const ft=U(xe),V="flex w-full cursor-pointer items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2 disabled:cursor-default disabled:opacity-50 [&>svg]:size-4 [&>svg]:flex-none [&>svg]:text-muted-foreground";function q({onOpenSettings:t}){const a=D(),r=G(),[s,i]=o.useState(!1),[l,c]=o.useState(!1),[h,p]=o.useState(),S=o.useRef(null),u=o.useId(),N=d=>{var b;return d.reason==="outside-press"&&d.event.target instanceof Node&&((b=S.current)==null?void 0:b.contains(d.event.target))===!0},R=()=>{if(a.kind==="vscode"){a.requestLogout(),i(!1);return}c(!0),p(void 0),r.logout().then(()=>i(!1)).catch(d=>p(d instanceof Error?d.message:String(d))).finally(()=>c(!1))};return e.jsxs(e.Fragment,{children:[e.jsx(k,{"aria-controls":s?u:void 0,"aria-expanded":s,"aria-haspopup":"dialog","aria-label":"Panel menu",className:"self-center",onClick:()=>i(d=>!d),ref:S,size:"icon-lg",title:"Menu",variant:"ghost",children:e.jsx(dt,{})}),e.jsx(Te,{onOpenChange:(d,b)=>{!d&&N(b)||i(d)},open:s,children:e.jsxs(Ae,{align:"end",anchor:S,"aria-label":"Panel menu",className:"w-[220px] gap-0 p-1 text-[0.8rem]",collisionPadding:8,dim:!0,id:u,role:"dialog",side:"bottom",children:[e.jsxs("button",{className:V,onClick:()=>{i(!1),t()},type:"button",children:[e.jsx(_e,{}),"Settings"]}),a.kind==="vscode"&&e.jsxs("button",{className:V,onClick:()=>{i(!1),a.openExternal(new URL("/",window.location.href).toString())},type:"button",children:[e.jsx(ut,{}),"Open in browser"]}),r.enabled&&r.user&&e.jsxs("button",{className:V,disabled:l,onClick:R,title:r.user.id,type:"button",children:[e.jsx(ft,{}),e.jsxs("span",{className:"grid min-w-0",children:[e.jsx("span",{children:"Sign out"}),e.jsx("span",{className:"truncate text-[0.68rem] text-muted-foreground",children:r.user.label})]})]}),h&&e.jsx("p",{className:"px-2 py-1.5 text-[0.72rem] text-destructive",role:"alert",children:h})]})})]})}const pt=5e3;function me(t){const[a,r]=o.useState([]),[s,i]=o.useState(!1),l=o.useRef(void 0),c=o.useRef(!1),h=o.useCallback(()=>{if(!t)return Promise.resolve();if(l.current)return c.current=!0,l.current;const p=async()=>{do{c.current=!1;try{r(await Me()),i(!1)}catch{i(!0)}}while(c.current)};return l.current=p().finally(()=>{l.current=void 0}),l.current},[t]);return o.useEffect(()=>{if(!t)return;h();const p=ze.subscribe(Fe.channels.runs,{},()=>void h()),S=setInterval(()=>void h(),pt);return()=>{p(),clearInterval(S)}},[t,h]),{sessions:a,unreachable:s,refresh:h}}const ge="relative z-[80] flex h-header flex-none items-stretch border-b border-border bg-shell shadow-bar",ae="max-w-[120px] self-center truncate rounded-full bg-secondary px-2 py-0.5 text-[0.66rem] font-semibold text-muted-foreground",xt="min-w-0 flex-1 self-center truncate px-1.5 text-[0.82rem] font-semibold",mt="Stopped in the run panel",gt=5e3,v="New run",vt="relative z-[80] flex h-header flex-none items-center gap-2 border-b border-border bg-shell px-3 shadow-bar",ve="m-auto max-w-[420px] p-6 text-center text-muted-foreground",wt=new Set,St=()=>({id:crypto.randomUUID(),title:v,updatedAt:Date.now()}),we=(t,a="Run")=>({id:t,title:a,updatedAt:Date.now()}),bt={kind:"working",title:"Loading profile",detail:"Loading the server's interface."},jt={kind:"working",title:"Starting run",detail:"Creating the new run."},ie={kind:"working",title:"Starting run",detail:"Starting the template."},yt={kind:"waiting",title:"No run selected",detail:"On the Start page you start a new run or open an existing one."},kt={kind:"error",title:"No runs enabled",detail:"No runs are enabled for this user account."};function Nt({location:t}){const a=Ue(),r=t.layout==="app";if(a.status==="loading")return e.jsx(w,{headless:r,state:bt});if(a.status==="failed")return e.jsx(w,{headless:r,state:{kind:"error",title:"The profile could not be loaded",detail:a.error},children:e.jsx(k,{onClick:()=>window.location.reload(),size:"sm",variant:"outline",children:"Reload"})});const s=t.layout==="app"?e.jsx(It,{elementId:t.elementId,registry:a.registry,runId:t.runId}):e.jsx(Rt,{connection:t.connection,initialRunId:t.runId,registry:a.registry});return a.failures.length===0?s:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsx(De,{failures:a.failures}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:s})]})}function Rt({connection:t,initialRunId:a,registry:r}){var se;const s=D(),i=G(),l=i.can("runs.read"),c=l&&i.can("runs.write"),h=c&&i.can("runs.create"),p=h||c&&r.scriptEntries.some(n=>de(i,n.id)),S=$e((se=i.user)==null?void 0:se.id),[u,N]=o.useState(a),[R,d]=o.useState(),[b,I]=o.useState(),m=o.useCallback(()=>I(n=>n===u?void 0:n),[u]),[be,K]=o.useState(),[f,C]=o.useState(),[T,Q]=o.useState(),H=o.useRef(void 0),g=o.useCallback(n=>{H.current=n==null?void 0:n.runId,Q(n)},[]),[W,$]=o.useState(),[O,Y]=o.useState(!1),[Z,X]=o.useState(),B=o.useCallback(()=>Y(!0),[]),{sessions:ee,unreachable:je,refresh:ye}=me(l&&!f&&!T),[ke,Ne]=o.useState(null),[Re,Ce]=o.useState(null),P=o.useCallback((n,x)=>{var M;const j=(M=r.startEntries.find(Le=>Le.id===x))==null?void 0:M.fixedStartOptions;C({session:St(),startOptions:n&&ue(n,j),entryId:x})},[r]),Ee=o.useCallback(()=>P(),[P]),L=o.useCallback((n,x)=>{C(void 0),g(void 0),K(x),N(n),I(s.kind==="vscode"?n:void 0)},[s.kind,g]),te=o.useCallback(n=>{C(void 0),g(n),Ct(n,r,i).then(()=>{H.current===n.runId&&L(n.runId)},x=>{H.current===n.runId&&Q({...n,error:x instanceof Error?x.message:String(x)})})},[i,L,r,g]),Ie=o.useCallback(n=>{I(void 0),d(void 0),N(n)},[]),A=o.useCallback(()=>{I(void 0),C(void 0),g(void 0),$(void 0),s.kind==="vscode"?s.notify({type:"showStart"}):N(void 0)},[s,g]);o.useLayoutEffect(()=>{if(b){if(O||f){m();return}return window.addEventListener("pointerdown",m,!0),window.addEventListener("keydown",m,!0),window.addEventListener("blur",m),()=>{window.removeEventListener("pointerdown",m,!0),window.removeEventListener("keydown",m,!0),window.removeEventListener("blur",m)}}},[f,b,O,m]),o.useEffect(()=>s.onCommand(n=>{if(n.type==="selectRun"&&(I(void 0),C(void 0),g(void 0),$(void 0),K(void 0),d(void 0),N(n.runId??void 0)),n.type!=="newRun")return;if(s.kind!=="vscode"){p&&P(n.startOptions,n.entryId);return}const x=p?n.entryId===void 0&&!h?"Free runs are not enabled for this user account.":void 0:"New runs are not enabled for this user account.";if($(x),x!==void 0)return;const j=r.startEntries.find(M=>M.id===n.entryId);if(d((j==null?void 0:j.title)??v),n.entryId===void 0){L(crypto.randomUUID(),n.startOptions);return}if(j!==void 0&&r.guideFor(j)!==void 0){g(void 0),P(n.startOptions,j.id);return}te({runId:crypto.randomUUID(),entryId:n.entryId,startOptions:n.startOptions})}),[p,h,s,L,r,g,P,te]),o.useEffect(()=>{s.notify({type:"ready"})},[s]),o.useEffect(()=>{s.notify({type:"runChanged",runId:u??null})},[s,u]);const _=O&&e.jsx(Qe,{onClose:()=>Y(!1),registry:r}),E=n=>e.jsxs(e.Fragment,{children:[e.jsx(k,{"aria-label":"Back to Start",className:"self-center",onClick:A,size:"icon-lg",title:"Back to Start",variant:"ghost",children:e.jsx(re,{})}),e.jsx("strong",{className:xt,children:n}),t&&e.jsx("span",{className:ae,title:`Server ${t}`,children:t}),e.jsx(q,{onOpenSettings:B})]}),z=e.jsx(k,{onClick:A,size:"sm",variant:"outline",children:"Back to Start"}),ne=f&&e.jsx(J,{initialStartOptions:f.startOptions,onStarted:()=>{L(f.session.id),d(n=>n??v),ye()},registry:r,session:f.session,startDialog:{onClose:s.kind==="vscode"?A:()=>C(void 0),initialEntryId:f.entryId}},f.session.id);if(T)return e.jsxs(e.Fragment,{children:[T.error===void 0?e.jsx(w,{header:E(R??v),state:ie}):e.jsx(w,{header:E(R??v),state:{kind:"error",title:"The run could not be started",detail:T.error},children:z}),_]});if(s.kind==="vscode"&&f)return e.jsxs(e.Fragment,{children:[e.jsx(w,{header:E(R??v),state:ie}),ne,_]});if(s.kind==="vscode"&&!(l&&u))return e.jsxs(e.Fragment,{children:[l?W!==void 0?e.jsx(w,{header:E(v),state:{kind:"error",title:"No new run possible",detail:W},children:z}):e.jsx(Et,{header:E(v),children:z}):e.jsx(w,{header:E(v),state:kt,children:z}),_]});const F=ee.find(n=>n.id===u),Oe=()=>{u!==void 0&&(X(void 0),We(u,mt).catch(n=>X(`Stop failed: ${n instanceof Error?n.message:String(n)}`)))},Pe=l?e.jsx(Ye,{activeId:u,onCreate:p?Ee:void 0,onSelect:Ie,onToggleSelected:()=>{},registry:r,seenRevisions:S.revisions,selectMode:!1,selectedIds:wt,sessions:ee}):e.jsx("p",{className:ve,children:"No runs are enabled for this user account."});return e.jsxs("div",{className:"flex h-full flex-col bg-[image:var(--surface-backdrop)]",children:[l&&u?e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:ge,children:[e.jsx(k,{"aria-label":"Back to Start",className:"self-center",onClick:A,size:"icon-lg",title:"Back to Start",variant:"ghost",children:e.jsx(re,{})}),e.jsx("div",{"aria-label":"Run title bar",className:"flex min-w-0 flex-1 items-stretch overflow-x-auto no-scrollbar",ref:Ne,role:"region"}),t&&e.jsx("span",{className:ae,title:`Server ${t}`,children:t}),e.jsx(Be,{className:"self-center px-1.5",state:F!=null&&F.running?"running":"idle"}),e.jsx(Ve,{className:"self-center",disabled:!c,label:"Stop run",onClick:Oe,size:"icon-lg",title:"Stop the run with all agents and flows"}),e.jsx("div",{"aria-label":"Panel tools",className:"flex flex-none items-center empty:hidden",ref:Ce,role:"toolbar"}),e.jsx(q,{onOpenSettings:B})]}),Z&&e.jsx(oe,{variant:"destructive",children:Z}),e.jsx("main",{className:"relative z-1 flex min-h-0 min-w-0 flex-1 @container/chat-content",children:e.jsx(J,{autoFocusChat:b===u&&!O&&!f,onAutoFocusChatSettled:m,toolbarContainer:Re,headerContainer:ke,initialStartOptions:be,layout:"panel",onViewed:S.markViewed,registry:r,session:F??we(u,R),viewing:!f&&!O},u)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:vt,children:[e.jsx(ht,{"aria-hidden":!0,className:"size-4 flex-none text-muted-foreground"}),e.jsx("strong",{className:"min-w-0 flex-1 truncate text-[0.82rem] font-semibold",children:r.brand.title}),e.jsx(q,{onOpenSettings:B})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:[je&&e.jsx(oe,{className:"mb-3",variant:"destructive",children:"The server is unreachable."}),Pe]})]}),_,ne]})}async function Ct(t,a,r){const s=a.startEntries.find(i=>i.id===t.entryId);if(!s)throw new Error("This template does not exist in this profile.");if(!de(r,s.id))throw new Error(`${s.title} is not enabled for this user account.`);if(t.startOptions){const i=await qe(t.runId),l=ue(t.startOptions,s.fixedStartOptions);for(const[c,h]of Je(i,l))await Ge(t.runId,c,h)}await Ke(t.runId,s,null)}function Et({children:t,header:a}){const[r,s]=o.useState(!1);return o.useEffect(()=>{const i=window.setTimeout(()=>s(!0),gt);return()=>window.clearTimeout(i)},[]),r?e.jsx(w,{header:a,state:yt,children:t}):e.jsx(w,{header:a,state:jt})}function w({children:t,header:a,headless:r=!1,state:s}){return e.jsxs("div",{className:"flex h-full flex-col bg-[image:var(--surface-backdrop)]",children:[!r&&e.jsx("header",{className:ge,children:a}),e.jsx("main",{className:"grid min-h-0 flex-1 place-items-center overflow-hidden p-6",children:e.jsx(He,{state:s,children:t})})]})}function It({elementId:t,registry:a,runId:r}){const s=D(),i=G().can("runs.read"),{sessions:l}=me(i);return o.useEffect(()=>{s.notify({type:"ready"})},[s]),i?e.jsx("main",{className:"relative flex h-full min-h-0 min-w-0 flex-1 bg-background @container/chat-content",children:e.jsx(J,{layout:{element:t},registry:a,session:l.find(c=>c.id===r)??we(r)},r)}):e.jsx("p",{className:ve,children:"No runs are enabled for this user account."})}function Ot(){const t=D();return e.jsxs(ce,{children:[e.jsx("h1",{className:"my-3 text-[1.5rem]",children:"Sign-in required"}),e.jsx("p",{className:"mb-6 leading-normal text-muted-foreground",children:"Sign-in goes through VS Code. The panel then reloads."}),e.jsx(k,{className:"w-full",onClick:()=>t.requestLogin(),children:"Sign in with VS Code"})]})}const y=t=>t!=null&&t.trim()?t.trim():void 0,Pt=t=>{if(t==="browser"||t==="vscode")return t;throw new Error(`Unknown host ${JSON.stringify(t)}. Allowed are browser and vscode.`)};function Lt(t){const a=new URLSearchParams(t),r=y(a.get("layout"))??"panel";if(r!=="panel"&&r!=="app")throw new Error(`Unknown layout ${JSON.stringify(r)}. Allowed are panel and app.`);const s=y(a.get("theme"));if(s!==void 0&&!Ze(s))throw new Error(`Unknown theme ${JSON.stringify(s)}. Allowed are light and dark.`);const i={host:Pt(y(a.get("host"))??"browser"),connection:y(a.get("connection")),theme:s,access:y(a.get(Xe))},l=y(a.get("run"));if(r==="panel")return{layout:r,runId:l,...i};const c=y(a.get("element"));if(!l||!c)throw new Error("The app layout needs run and element.");return{layout:r,runId:l,elementId:c,...i}}et();const Se=document.getElementById("root");if(!Se)throw new Error("Root element is missing");const le=tt.createRoot(Se);try{const t=Lt(window.location.search);t.access!==void 0&&nt(t.access);const a=st(t.host,window);if(t.host==="vscode"){const s=rt(window)}const r=ot(window);t.theme!==void 0&&r.setPreference(t.theme),a.onCommand(s=>{s.type==="theme"&&r.setPreference(s.theme)}),le.render(e.jsx(o.StrictMode,{children:e.jsx(at,{children:e.jsx(it,{value:a,children:e.jsx(lt,{value:t.host==="vscode"?{open:a.openPage}:void 0,children:e.jsx(ct,{Login:t.host==="vscode"?Ot:void 0,children:e.jsx(Nt,{location:t})})})})})}))}catch(t){le.render(e.jsxs(ce,{children:[e.jsx("h1",{className:"my-3 text-[1.5rem]",children:"The RAgents panel could not be loaded"}),e.jsx("p",{className:"mb-6 leading-normal",role:"alert",children:t instanceof Error?t.message:String(t)}),e.jsx(k,{onClick:()=>window.location.reload(),variant:"outline",children:"Reload"})]}))}
|