dorkos 0.82.0 → 0.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +4 -0
  2. package/dist/bin/cli.js +8195 -2918
  3. package/dist/client/assets/{AboutPage-WmtNTKyp.js → AboutPage-BCPZr0Kt.js} +1 -1
  4. package/dist/client/assets/{AppearancePage-D7ZHuThu.js → AppearancePage-CJfCCSBv.js} +1 -1
  5. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-wUJCR3vL.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Rg6hvlIh.js} +1 -1
  6. package/dist/client/assets/{BlintzCanvas-BXKUjnNQ.js → BlintzCanvas-CUSuHP_Q.js} +23 -23
  7. package/dist/client/assets/{CanvasCsvContent-BLAtnhdQ.js → CanvasCsvContent-B3gnlTxe.js} +1 -1
  8. package/dist/client/assets/{CanvasFileContent-VogEwZeM.js → CanvasFileContent-C2PyVniO.js} +2 -2
  9. package/dist/client/assets/{CanvasModel3dContent-DCTC7eOc.js → CanvasModel3dContent-BU77_Cf0.js} +2 -2
  10. package/dist/client/assets/{CodeMirrorDiff-Cpi43Atp.js → CodeMirrorDiff-Dsell_F0.js} +1 -1
  11. package/dist/client/assets/{CodeMirrorEditor-CviERH82.js → CodeMirrorEditor-DW4-Dilh.js} +1 -1
  12. package/dist/client/assets/ConnectionAccessLists-C6PZsSaI.js +1 -0
  13. package/dist/client/assets/ConnectionsPage-d1mpye9j.js +1 -0
  14. package/dist/client/assets/{ConventionPage-Coim_h2z.js → ConventionPage-Dto1Cfs1.js} +3 -3
  15. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-lqp1rgj8.js → FloatingTanStackRouterDevtools-CqogiFob-B8JWq1xE.js} +1 -1
  16. package/dist/client/assets/HandlePage-D9x_OTks.js +1 -0
  17. package/dist/client/assets/{LexicalField-DPe-aAXb.js → LexicalField-BymSjNLW.js} +1 -1
  18. package/dist/client/assets/{ManagesPage-BZS2TdZL.js → ManagesPage-D0ykMsYy.js} +1 -1
  19. package/dist/client/assets/{Model3dViewer-qs0tZlVU.js → Model3dViewer-DpzkRmRI.js} +1 -1
  20. package/dist/client/assets/NamePage-zm23PjaF.js +1 -0
  21. package/dist/client/assets/{NotificationsPage-gmiItsT0.js → NotificationsPage-C4Ol8NO6.js} +1 -1
  22. package/dist/client/assets/PermissionsPage-BEtP78wl.js +1 -0
  23. package/dist/client/assets/{PersonalityPopover-Dej6dI7y.js → PersonalityPopover-xJuTkLLJ.js} +1 -1
  24. package/dist/client/assets/PhotoPage-DlqgNQWM.js +1 -0
  25. package/dist/client/assets/{RoomsPage-3_HuXajd.js → RoomsPage-CeB_8k-m.js} +1 -1
  26. package/dist/client/assets/{RunsOnPopover-DbSoBFaL.js → RunsOnPopover-DT6aWGUP.js} +1 -1
  27. package/dist/client/assets/{SessionsPage-Dc_lqBom.js → SessionsPage-CoZhOOr9.js} +2 -2
  28. package/dist/client/assets/SkillsPage-C8bahTTW.js +1 -0
  29. package/dist/client/assets/{TasksPage-DvzTPDnw.js → TasksPage-CuFN--Cj.js} +1 -1
  30. package/dist/client/assets/ToolsPage-C5cJiedq.js +2 -0
  31. package/dist/client/assets/{TopologyGraph-C-BTnRXU.js → TopologyGraph-3rXK5QTB.js} +1 -1
  32. package/dist/client/assets/{agent-browser-DT3ABR4l.js → agent-browser-DaDOSH9H.js} +1 -1
  33. package/dist/client/assets/{highlighted-body-KPVGNVTW-CVFODbIg.js → highlighted-body-KPVGNVTW-CGXZGdzv.js} +1 -1
  34. package/dist/client/assets/{index-Dh-3NGE9.js → index-3xtUyFwf.js} +1 -1
  35. package/dist/client/assets/{index-CN1plkKF.js → index-4zzP7Qsj.js} +1 -1
  36. package/dist/client/assets/{index-DN8DYUEX.js → index-B2AJ6tkg.js} +1 -1
  37. package/dist/client/assets/{index-PRwgIfzy.js → index-B9qRpVKa.js} +3 -3
  38. package/dist/client/assets/{index-DDXrdlj0.js → index-BMR65QI4.js} +435 -425
  39. package/dist/client/assets/{index-BrgOWbRQ.js → index-BabO0TEf.js} +2 -2
  40. package/dist/client/assets/{index-BZaMgVdg.js → index-Bco5PCIk.js} +1 -1
  41. package/dist/client/assets/{index-CaZw0EC7.js → index-Bg2WUou4.js} +1 -1
  42. package/dist/client/assets/{index-B8oHvyN5.js → index-BiKxY3b6.js} +1 -1
  43. package/dist/client/assets/{index-ClnyhFUL.js → index-C4yxotik.js} +1 -1
  44. package/dist/client/assets/index-C9o2w5d_.js +1 -0
  45. package/dist/client/assets/{index-DiFc1nSZ.js → index-CUDguphz.js} +1 -1
  46. package/dist/client/assets/{index-DGr90Ygi.js → index-CUXXDUxt.js} +1 -1
  47. package/dist/client/assets/{index-DbsvSNI-.js → index-CXeb3CZh.js} +1 -1
  48. package/dist/client/assets/{index-D_gnDrw3.js → index-Cc8vG2jf.js} +1 -1
  49. package/dist/client/assets/{index-PrqHZbD1.js → index-Ce4ArSsI.js} +1 -1
  50. package/dist/client/assets/{index-ByCzVYkU.js → index-CemK6fUn.js} +1 -1
  51. package/dist/client/assets/{index-nEQI8fB2.js → index-Ck1VEXu0.js} +1 -1
  52. package/dist/client/assets/{index-W25uMuZA.js → index-D4OPDslu.js} +1 -1
  53. package/dist/client/assets/index-D9vFzXJR.js +1 -0
  54. package/dist/client/assets/{index-DjY4p5H5.js → index-DPpw-DKV.js} +1 -1
  55. package/dist/client/assets/{index-DiFG9bwF.js → index-DQdV5YDl.js} +1 -1
  56. package/dist/client/assets/{index-Cca_q1vW.js → index-DT376l6b.js} +3 -3
  57. package/dist/client/assets/index-DZ-SO2sz.css +1 -0
  58. package/dist/client/assets/{index-DIkpB_1y.js → index-DdpxcyXN.js} +1 -1
  59. package/dist/client/assets/{index-lciid4H8.js → index-FOgsYoCt.js} +1 -1
  60. package/dist/client/assets/{index-CgakJfik.js → index-MUbvQBCQ.js} +1 -1
  61. package/dist/client/assets/{index-DEA1uIWn.js → index-Rf5Yz119.js} +1 -1
  62. package/dist/client/assets/index-Ygg0URfB.js +1 -0
  63. package/dist/client/assets/{index-J8BMKg6y.js → index-bR1UztQC.js} +1 -1
  64. package/dist/client/assets/{index-Dm6W0lml.js → index-dDcguWyg.js} +1 -1
  65. package/dist/client/assets/{index-BuU7EEtP.js → index-i6WvrE1p.js} +1 -1
  66. package/dist/client/assets/{index-B3P6TTvD.js → index-oU5xA1N3.js} +3 -3
  67. package/dist/client/assets/{index-DF5k9E7k.js → index-pBoKYStL.js} +1 -1
  68. package/dist/client/assets/{index-ClmokM0M.js → index-rJuQe7Pl.js} +1 -1
  69. package/dist/client/assets/{index-DgjZhEr3.js → index-z0vAkUHY.js} +1 -1
  70. package/dist/client/assets/{index-kzr7_3di.js → index-zrZDQvuW.js} +11 -11
  71. package/dist/client/assets/{room-files-source-CSKgcbkn.js → room-files-source-BXF5daqI.js} +2 -2
  72. package/dist/client/assets/{soul-file-BHeAw6R9.js → soul-file-C1wnpxhH.js} +1 -1
  73. package/dist/client/assets/{use-mesh-update-BP_UXq60.js → use-mesh-update-CZIA8V07.js} +1 -1
  74. package/dist/client/assets/{use-personality-commit-DyJAMzzb.js → use-personality-commit-OViAsTwD.js} +1 -1
  75. package/dist/client/index.html +5 -4
  76. package/dist/drizzle/0107_productive_peter_parker.sql +5 -0
  77. package/dist/drizzle/0108_magical_morph.sql +2 -0
  78. package/dist/drizzle/0109_aspiring_union_jack.sql +5 -0
  79. package/dist/drizzle/0110_ambiguous_wendigo.sql +1 -0
  80. package/dist/drizzle/meta/0107_snapshot.json +8966 -0
  81. package/dist/drizzle/meta/0108_snapshot.json +8980 -0
  82. package/dist/drizzle/meta/0109_snapshot.json +8987 -0
  83. package/dist/drizzle/meta/0110_snapshot.json +8994 -0
  84. package/dist/drizzle/meta/_journal.json +28 -0
  85. package/dist/server/index.js +82622 -70829
  86. package/dist/server/index.js.map +2 -2
  87. package/package.json +1 -2
  88. package/dist/client/assets/ConnectionAccessLists-Be1b30nn.js +0 -1
  89. package/dist/client/assets/ConnectionsPage-BVN7GiuC.js +0 -1
  90. package/dist/client/assets/HandlePage-DnzPN8N_.js +0 -1
  91. package/dist/client/assets/NamePage-DyWqRDIe.js +0 -1
  92. package/dist/client/assets/PhotoPage-GtCoB8dK.js +0 -1
  93. package/dist/client/assets/SkillsPage-C0qMUkgs.js +0 -1
  94. package/dist/client/assets/ToolsPage-Cwc96TTa.js +0 -2
  95. package/dist/client/assets/index-BUxNND2H.js +0 -1
  96. package/dist/client/assets/index-C08DUVQ4.css +0 -1
  97. package/dist/client/assets/index-CGqPFWQw.js +0 -1
  98. package/dist/client/assets/index-CXWMnEDK.js +0 -1
@@ -0,0 +1 @@
1
+ import{m as i,j as s,n as r,o as a}from"./index-BMR65QI4.js";function d({member:t}){var n;const e=i((n=t.agent)==null?void 0:n.runtime),o=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[o?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s runtime can’t use DorkOS tools, so these settings don’t change anything for it."}),s.jsx(r,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(a,{agentId:t.id})]})]})}export{d as PermissionsPage};
@@ -1 +1 @@
1
- import{u as o,j as t,a as i,z as u}from"./index-DDXrdlj0.js";import{u as l}from"./use-personality-commit-DyJAMzzb.js";import"./soul-file-BHeAw6R9.js";function f({member:r}){const{agent:e,isPending:a,update:n}=o(r),s=l(e,n);return a?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(u,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{f as PersonalityPopover};
1
+ import{u as o,j as t,a as i,F as u}from"./index-BMR65QI4.js";import{u as l}from"./use-personality-commit-OViAsTwD.js";import"./soul-file-C1wnpxhH.js";function f({member:r}){const{agent:e,isPending:a,update:n}=o(r),s=l(e,n);return a?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(u,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{f as PersonalityPopover};
@@ -0,0 +1 @@
1
+ import{j as t,k as r}from"./index-BMR65QI4.js";function i({member:o}){return t.jsx(r,{member:o})}export{i as PhotoPage};
@@ -1 +1 @@
1
- import{e as d,f as l,j as e,a as m,g as u,C as c,M as x,H as f}from"./index-DDXrdlj0.js";function h({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(x,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function g(s){return s===1?"1 member":`${s} members`}function j({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You are":`${s.displayName} is`," not in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(h,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:g(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({to:"/channels",search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{j as RoomsPage};
1
+ import{e as d,f as l,j as e,a as m,g as u,C as c,M as x,H as f}from"./index-BMR65QI4.js";function h({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(x,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function g(s){return s===1?"1 member":`${s} members`}function j({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You are":`${s.displayName} is`," not in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(h,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:g(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({to:"/channels",search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{j as RoomsPage};
@@ -1 +1 @@
1
- import{r as C,j as e,aK as ie,cl as de,J as ue,ag as j,cL as Q,cM as Z,cN as q,cO as G,cP as F,cQ as fe,cR as ee,cS as pe,cT as te,cU as me,cV as xe,cW as Y,cX as he,cY as be,cZ as T,c_ as je,c$ as E,d0 as ge,d1 as se,aM as ve,u as Ne,a as Se,d2 as Ee,d3 as Ce,d4 as ke,d5 as ye,d6 as we,d7 as Ae}from"./index-DDXrdlj0.js";import{u as Te}from"./use-mesh-update-BP_UXq60.js";const Le={duration:.12,ease:"easeOut"},Ie={type:"spring",stiffness:320,damping:28};function ae({isSetHere:n,serverDefault:l,onUseServerDefault:d,warning:r,className:a,"data-testid":i}){const[f,m]=C.useState(!1),o=n?"set here":`server default · ${l??"none"}`,s=n&&!!d,p=e.jsxs("span",{className:j("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?Q.warning:Q.neutral,s&&"hover:bg-accent hover:text-accent-foreground transition-colors",a),"data-testid":i,children:[r&&e.jsx(ie,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(de,{mode:"wait",initial:!1,children:e.jsx(ue.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Ie},exit:{opacity:0},transition:Le,children:o},o)})]});return s?e.jsxs(Z,{open:f,onOpenChange:m,children:[e.jsx(q,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:p})}),e.jsxs(G,{className:"w-64 p-2",align:"start",children:[e.jsx(F,{children:"Where this value comes from"}),r&&e.jsx("p",{className:j("px-2 pt-1 text-xs",fe.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{d(),m(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":i?`${i}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"the runtime picks, nothing is set"})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:p}):p}const ne="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function w({label:n,valueLabel:l,options:d,selected:r,isSetHere:a,serverDefault:i,warning:f,onSelect:m,onInherit:o,testId:s,showHeader:p=!0,className:k,describedBy:h}){const S=ee(),[b,c]=C.useState(!1);return e.jsxs("div",{className:j("space-y-1",k),children:[p&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:n}),!S&&e.jsx(ae,{isSetHere:a,serverDefault:i,warning:f,onUseServerDefault:o,"data-testid":`${s}-chip`})]}),e.jsxs(Z,{open:b,onOpenChange:c,children:[e.jsx(q,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...h?{"aria-describedby":h}:{},"data-testid":s,children:[e.jsx("span",{className:j("truncate",f?"text-amber-700 dark:text-amber-400":a?"md:text-foreground text-amber-700 dark:text-amber-400":"md:text-foreground text-emerald-700 dark:text-emerald-400"),children:l}),e.jsx(ve,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(G,{className:"w-64 p-1",align:"start",children:[e.jsx(F,{children:n}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:d.map(u=>e.jsxs("button",{type:"button","data-testid":`${s}-option-${u.value}`,onClick:()=>{m(u.value),c(!1)},className:j("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",u.value===r&&"bg-accent"),children:[u.label,u.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:u.hint})]},u.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),c(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${s}-inherit`,children:i?`Using server default: ${i}. Tap to restore`:"Use server default: the runtime picks"})]})]})]})}function Pe({agent:n,onUpdate:l,className:d}){var V,z,W,B,X,J;const r=ee(),{data:a}=pe(),{data:i,isPending:f}=te(),m=((V=a==null?void 0:a.executionDefaults)==null?void 0:V.runtime)??"claude-code",o=n.runtime??m,s=(z=a==null?void 0:a.executionDefaults)==null?void 0:z.perRuntime.find(t=>t.runtime===o),{data:p}=me({runtime:o}),k=n.model!=null,h=n.effort!=null,S=(s==null?void 0:s.model)??null,b=n.model??S,c=b?(p??[]).find(t=>t.value===b):void 0,u=(s==null?void 0:s.supportsEffort)??((W=xe(i,o))==null?void 0:W.supportsEffort),L=u===void 0&&f,I=u!==!1,P=c?c.supportsEffort??!1:void 0,g=(B=a==null?void 0:a.claudeCode)==null?void 0:B.accounts,x=g==null?void 0:g.flatMap(t=>t.id===null?[]:[{id:t.id,label:Y(t.path,g),path:t.path}]),v=n.account??null,$=v!==null,O=a!=null&&a.claudeCode?Y(a.claudeCode.resolvedAccount,g??[]):null,U=Te({errorLabel:"Couldn’t change this agent’s account"}),H=C.useCallback(t=>{U.mutate({id:n.id,updates:{account:t}})},[n.id,U]),le=he({agent:{runtime:n.runtime,model:n.model,effort:n.effort,account:n.account},defaultRuntime:m,serverDefaultModel:S,knownModels:be(p),knownAccounts:x,accountsUnavailable:(X=a==null?void 0:a.claudeCode)==null?void 0:X.accountsUnavailable,modelSupportsEffort:P,runtimeSupportsEffort:u,runtimeLabel:t=>T(t).label}),N=t=>{var K;return((K=le.breakages.find(ce=>t.includes(ce.kind)))==null?void 0:K.message)??null},y=!L&&I&&P!==!1,M=n.effort??(s==null?void 0:s.effort)??null,_=T(o).label,oe=o==="claude-code"&&x!==void 0&&(x.length>1||$),re=N(["account-unregistered"]),D=(p??[]).some(t=>t.unverified),R=C.useId();return e.jsxs("div",{className:j("grid grid-cols-2 gap-3",d),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{label:"Model",valueLabel:(c==null?void 0:c.displayName)??b??"Automatic",options:[...(p??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:b,isSetHere:k,serverDefault:(s==null?void 0:s.model)??null,warning:N(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:D?R:void 0}),D&&e.jsx(je,{id:R})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:"Effort"}),(!r||!y)&&(h||y)&&e.jsx(ae,{isSetHere:h,serverDefault:s!=null&&s.effort?E(s.effort):null,warning:N(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),L?e.jsx(A,{testId:"agent-effort-pending",text:`Checking what ${_} supports`,warning:null}):I?y?e.jsx(w,{label:"Effort",valueLabel:E(M),options:ge.filter(t=>!(c!=null&&c.supportedEffortLevels)||c.supportedEffortLevels.includes(t)).map(t=>({value:t,label:E(t)})),selected:M,isSetHere:h,serverDefault:s!=null&&s.effort?E(s.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(A,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:N(["effort-unsupported-model"])}):e.jsx(A,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${_}`,warning:N(["effort-unsupported-runtime"])})]}),oe&&e.jsx(w,{label:"Account",valueLabel:v!==null?((J=x==null?void 0:x.find(t=>t.id===v))==null?void 0:J.label)??v:O??"Default account",options:(x??[]).map(t=>({value:t.id,label:t.label,hint:se(t.path)})),selected:v,isSetHere:$,serverDefault:O,warning:re,onSelect:t=>H(t),onInherit:()=>H(null),testId:"agent-account-row",className:"col-span-full"})]})}function A({text:n,warning:l,testId:d}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":d,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:n}),l&&e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:l})]})}const $e="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function He({member:n}){const{agent:l,projectPath:d,isPending:r,update:a}=Ne(n),{data:i}=te();if(r)return e.jsx(Se,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const f=i?Object.keys(i.capabilities):[l.runtime],m=f.includes(l.runtime)?f:[l.runtime,...f];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:$e,children:"Runtime"}),e.jsxs(Ee,{value:l.runtime??"claude-code",onValueChange:o=>a({runtime:o}),children:[e.jsx(Ce,{className:"h-8 text-sm",responsive:!1,children:e.jsx(ke,{})}),e.jsx(ye,{children:m.map(o=>e.jsx(we,{value:o,responsive:!1,children:T(o).label},o))})]})]}),e.jsx(Pe,{agent:l,onUpdate:a,className:"grid-cols-1"}),d&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ae,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:se(d)})]})]})}export{He as RunsOnPopover};
1
+ import{r as C,j as e,aN as ce,co as de,N as ue,aj as j,cO as Z,cP as G,cQ as J,cR as K,cS as F,cT as fe,cU as ee,cV as pe,cW as te,cX as me,cY as xe,cZ as q,c_ as he,c$ as be,d0 as T,d1 as je,d2 as E,d3 as ve,d4 as se,aP as ge,u as Ne,a as Se,d5 as Ee,d6 as Ce,d7 as ke,d8 as ye,d9 as we,da as Ae}from"./index-BMR65QI4.js";import{u as Te}from"./use-mesh-update-CZIA8V07.js";const Le={duration:.12,ease:"easeOut"},Ie={type:"spring",stiffness:320,damping:28};function ae({isSetHere:n,serverDefault:l,onUseServerDefault:d,warning:r,className:a,"data-testid":c}){const[f,m]=C.useState(!1),o=n?"set here":`server default · ${l??"none"}`,s=n&&!!d,p=e.jsxs("span",{className:j("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?Z.warning:Z.neutral,s&&"hover:bg-accent hover:text-accent-foreground transition-colors",a),"data-testid":c,children:[r&&e.jsx(ce,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(de,{mode:"wait",initial:!1,children:e.jsx(ue.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Ie},exit:{opacity:0},transition:Le,children:o},o)})]});return s?e.jsxs(G,{open:f,onOpenChange:m,children:[e.jsx(J,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:p})}),e.jsxs(K,{className:"w-64 p-2",align:"start",children:[e.jsx(F,{children:"Where this value comes from"}),r&&e.jsx("p",{className:j("px-2 pt-1 text-xs",fe.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{d(),m(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":c?`${c}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"the runtime picks, nothing is set"})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:p}):p}const ne="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function w({label:n,valueLabel:l,options:d,selected:r,isSetHere:a,serverDefault:c,warning:f,onSelect:m,onInherit:o,testId:s,showHeader:p=!0,className:k,describedBy:h}){const S=ee(),[b,i]=C.useState(!1);return e.jsxs("div",{className:j("space-y-1",k),children:[p&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:n}),!S&&e.jsx(ae,{isSetHere:a,serverDefault:c,warning:f,onUseServerDefault:o,"data-testid":`${s}-chip`})]}),e.jsxs(G,{open:b,onOpenChange:i,children:[e.jsx(J,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...h?{"aria-describedby":h}:{},"data-testid":s,children:[e.jsx("span",{className:j("truncate",f?"text-amber-700 dark:text-amber-400":a?"md:text-foreground text-amber-700 dark:text-amber-400":"md:text-foreground text-emerald-700 dark:text-emerald-400"),children:l}),e.jsx(ge,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(K,{className:"w-64 p-1",align:"start",children:[e.jsx(F,{children:n}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:d.map(u=>e.jsxs("button",{type:"button","data-testid":`${s}-option-${u.value}`,onClick:()=>{m(u.value),i(!1)},className:j("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",u.value===r&&"bg-accent"),children:[u.label,u.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:u.hint})]},u.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),i(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${s}-inherit`,children:c?`Using server default: ${c}. Tap to restore`:"Use server default: the runtime picks"})]})]})]})}function Pe({agent:n,onUpdate:l,className:d}){var V,z,W,B,X,Q;const r=ee(),{data:a}=pe(),{data:c,isPending:f}=te(),m=((V=a==null?void 0:a.executionDefaults)==null?void 0:V.runtime)??"claude-code",o=n.runtime??m,s=(z=a==null?void 0:a.executionDefaults)==null?void 0:z.perRuntime.find(t=>t.runtime===o),{data:p}=me({runtime:o}),k=n.model!=null,h=n.effort!=null,S=(s==null?void 0:s.model)??null,b=n.model??S,i=b?(p??[]).find(t=>t.value===b):void 0,u=(s==null?void 0:s.supportsEffort)??((W=xe(c,o))==null?void 0:W.supportsEffort),L=u===void 0&&f,I=u!==!1,P=i?i.supportsEffort??!1:void 0,v=(B=a==null?void 0:a.claudeCode)==null?void 0:B.accounts,x=v==null?void 0:v.flatMap(t=>t.id===null?[]:[{id:t.id,label:q(t.path,v),path:t.path}]),g=n.account??null,$=g!==null,O=a!=null&&a.claudeCode?q(a.claudeCode.resolvedAccount,v??[]):null,U=Te({errorLabel:"Couldn’t change this agent’s account"}),H=C.useCallback(t=>{U.mutate({id:n.id,updates:{account:t}})},[n.id,U]),le=he({agent:{runtime:n.runtime,model:n.model,effort:n.effort,account:n.account},defaultRuntime:m,serverDefaultModel:S,knownModels:be(p),knownAccounts:x,accountsUnavailable:(X=a==null?void 0:a.claudeCode)==null?void 0:X.accountsUnavailable,modelSupportsEffort:P,runtimeSupportsEffort:u,runtimeLabel:t=>T(t).label}),N=t=>{var Y;return((Y=le.breakages.find(ie=>t.includes(ie.kind)))==null?void 0:Y.message)??null},y=!L&&I&&P!==!1,_=n.effort??(s==null?void 0:s.effort)??null,D=T(o).label,oe=o==="claude-code"&&x!==void 0&&(x.length>1||$),re=N(["account-unregistered"]),M=(p??[]).some(t=>t.unverified),R=C.useId();return e.jsxs("div",{className:j("grid grid-cols-2 gap-3",d),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{label:"Model",valueLabel:(i==null?void 0:i.displayName)??b??"Automatic",options:[...(p??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:b,isSetHere:k,serverDefault:(s==null?void 0:s.model)??null,warning:N(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:M?R:void 0}),M&&e.jsx(je,{id:R})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:"Effort"}),(!r||!y)&&(h||y)&&e.jsx(ae,{isSetHere:h,serverDefault:s!=null&&s.effort?E(s.effort):null,warning:N(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),L?e.jsx(A,{testId:"agent-effort-pending",text:`Checking what ${D} supports`,warning:null}):I?y?e.jsx(w,{label:"Effort",valueLabel:E(_),options:ve.filter(t=>!(i!=null&&i.supportedEffortLevels)||i.supportedEffortLevels.includes(t)).map(t=>({value:t,label:E(t)})),selected:_,isSetHere:h,serverDefault:s!=null&&s.effort?E(s.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(A,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:N(["effort-unsupported-model"])}):e.jsx(A,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${D}`,warning:N(["effort-unsupported-runtime"])})]}),oe&&e.jsx(w,{label:"Account",valueLabel:g!==null?((Q=x==null?void 0:x.find(t=>t.id===g))==null?void 0:Q.label)??g:O??"Default account",options:(x??[]).map(t=>({value:t.id,label:t.label,hint:se(t.path)})),selected:g,isSetHere:$,serverDefault:O,warning:re,onSelect:t=>H(t),onInherit:()=>H(null),testId:"agent-account-row",className:"col-span-full"})]})}function A({text:n,warning:l,testId:d}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":d,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:n}),l&&e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:l})]})}const $e="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function He({member:n}){const{agent:l,projectPath:d,isPending:r,update:a}=Ne(n),{data:c}=te();if(r)return e.jsx(Se,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const f=c?Object.keys(c.capabilities):[l.runtime],m=f.includes(l.runtime)?f:[l.runtime,...f];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:$e,children:"Runtime"}),e.jsxs(Ee,{value:l.runtime??"claude-code",onValueChange:o=>a({runtime:o}),children:[e.jsx(Ce,{className:"h-8 text-sm",responsive:!1,children:e.jsx(ke,{})}),e.jsx(ye,{children:m.map(o=>e.jsx(we,{value:o,responsive:!1,children:T(o).label},o))})]})]}),e.jsx(Pe,{agent:l,onUpdate:a,className:"grid-cols-1"}),d&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ae,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:se(d)})]})]})}export{He as RunsOnPopover};
@@ -1,6 +1,6 @@
1
- import{e0 as ie,er as re,es as oe,w as D,r as d,et as le,eu as ce,ev as ue,ew as de,bd as P,ex as me,ey as xe,ez as pe,eA as fe,j as e,eB as ge,eC as he,eD as je,eE as z,aj as F,eF as ve,eG as T,cl as be,J as w,eH as ye,eI as Ne,bB as N,cZ as O,eJ as Ce,ag as S,eK as V,eL as we,cm as R,cn as M,co as A,eM as $,aB as K,eN as B,eO as Se,eP as _,aM as ke,eQ as G,eR as W,eS as L,eT as Re,eU as Me,eV as Ae,b1 as Pe,au as Le,eW as Te,av as Ie,aw as ze,ax as Ee,ay as De,eX as Fe,e as Oe,x as Ve,eY as $e,eZ as Ke,a as Be,e_ as _e,I as Ge,e$ as We,f0 as Qe,aV as qe}from"./index-DDXrdlj0.js";/**
1
+ import{e3 as ie,eu as re,ev as oe,z as D,r as d,ew as le,ex as ce,ey as ue,ez as de,bg as P,eA as me,m as xe,eB as pe,eC as fe,j as e,eD as ge,eE as he,eF as je,eG as E,am as F,eH as ve,eI as T,co as be,N as S,eJ as ye,eK as Ne,bE as N,d0 as O,eL as Ce,aj as w,eM as V,eN as Se,cp as R,cq as A,cr as M,eO as $,aE as K,eP as _,eQ as we,eR as B,aP as ke,eS as G,eT as W,eU as L,eV as Re,eW as Ae,eX as Me,b4 as Pe,ax as Le,eY as Te,ay as ze,az as Ee,aA as Ie,aB as De,eZ as Fe,e as Oe,A as Ve,e_ as $e,e$ as Ke,a as _e,f0 as Be,I as Ge,f1 as We,f2 as qe,aY as Qe}from"./index-BMR65QI4.js";/**
2
2
  * @license lucide-react v1.44.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const Q={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};Q.node;const q=ie(Q);function He(){const t=re(),s=oe(r=>r.contextReadings),a=D(),n=d.useMemo(()=>Array.from(new Set(t.map(r=>r.runtime))),[t]),i=d.useCallback(r=>{const c={};return n.forEach((u,m)=>{var x;const f=(x=r[m])==null?void 0:x.data;if(!f)return;const j={};for(const h of f)h.contextWindow!=null&&(j[h.value]=h.contextWindow);c[u]=j}),c},[n]),l=le({queries:n.map(r=>ce(a,{runtime:r})),combine:i});return d.useMemo(()=>{var c;const r={total:0,known:0,unknown:0,warning:0,critical:0,autoCompacted:0};for(const u of t){r.total+=1;const m=u.model?(c=l[u.runtime])==null?void 0:c[u.model]:void 0,f=ue(u,{reading:s[u.id]??null,window:m});f.autoCompactedAt&&(r.autoCompacted+=1),f.status==="known"?(r.known+=1,f.severity==="warning"?r.warning+=1:f.severity==="critical"&&(r.critical+=1)):r.unknown+=1}return r},[t,s,l])}function Ue(t,s,a){return t&&s!==void 0&&!a}function H(t,s,a,n="borderLeftColor"){const i=de()??!1,l=Ue(t,a,i);return d.useMemo(()=>!l||!a?{animate:void 0,transition:void 0,pulsing:!1}:{animate:{[n]:[s,a,s]},transition:{[n]:{duration:2,repeat:1/0,ease:"easeInOut"}},pulsing:!0},[l,s,a,n])}function U({value:t,onCommit:s,onEnd:a}){const[n,i]=d.useState(!1),[l,r]=d.useState(""),c=d.useRef(null),u=d.useRef(!1),m=P(t),f=P(s),j=P(a);d.useEffect(()=>{if(!n)return;u.current=!1;const o=requestAnimationFrame(()=>{var p,k;(p=c.current)==null||p.focus(),(k=c.current)==null||k.select()});return()=>cancelAnimationFrame(o)},[n]);const x=d.useCallback(()=>{var o;i(!1),(o=j.read())==null||o()},[j]),h=d.useCallback(()=>{r(m.read()),i(!0)},[m]),v=d.useCallback(()=>{if(u.current)return;u.current=!0,x();const o=l.trim();o.length===0||o===m.read()||f.read()(o)},[x,l,m,f]),b=d.useCallback(()=>{u.current=!0,x()},[x]),y=d.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),v()):o.key==="Escape"&&(o.preventDefault(),b())},[v,b]);return{isRenaming:n,renameValue:l,setRenameValue:r,inputRef:c,start:h,commit:v,cancel:b,handleKeyDown:y}}function Z(t){const s=me(t.id,{enabled:!1,fallback:t.permissionMode})??t.permissionMode,a=xe(t.runtime),n=a==null?void 0:a.permissionModes.values.find(l=>l.id===s),i=n?pe(n):fe(s);return{permissionMode:s,isFullPower:i}}function J({children:t,onRename:s,onFork:a}){return!s&&!a?e.jsx(e.Fragment,{children:t}):e.jsxs(ge,{children:[e.jsx(he,{asChild:!0,children:t}),e.jsxs(je,{className:"w-44",children:[s&&e.jsxs(z,{onClick:s,children:[e.jsx(F,{className:"mr-2 size-4"}),"Rename"]}),s&&a&&e.jsx(ve,{}),a&&e.jsxs(z,{onClick:a,children:[e.jsx(q,{className:"mr-2 size-4"}),"Fork session"]})]})]})}const C="font-mono select-all";function E(t){try{return new Date(t).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function Ze({session:t,expanded:s,onFork:a,className:n}){var m;const{permissionMode:i,isFullPower:l}=Z(t),r=l?"Full power":we(i),{nameFor:c}=T(),u=t.account?c(t.account):null;return e.jsx(be,{initial:!1,children:s&&e.jsx(w.div,{variants:Ne,initial:"initial",animate:"animate",exit:"exit",transition:ye,className:"relative z-10 overflow-hidden","data-slot":"session-details-panel",children:e.jsxs("div",{className:S("text-muted-foreground text-2xs mx-2 space-y-1.5 px-3 pt-2 pb-2",n),children:[e.jsx(N,{label:"Session ID",align:"start",copyValue:t.id,valueClassName:C,children:t.id}),e.jsx(N,{label:"Created",align:"start",valueClassName:C,children:E(t.createdAt)}),e.jsx(N,{label:"Updated",align:"start",valueClassName:C,children:E(t.updatedAt)}),e.jsx(N,{label:"Runtime",align:"start",valueClassName:C,children:O(t.runtime).label}),u&&e.jsx(N,{label:"Account",align:"start",copyValue:t.account,valueClassName:C,children:u}),e.jsx(N,{label:"Origin",align:"start",valueClassName:C,children:t.originLabel??((m=Ce(t.origin))==null?void 0:m.label)??"You"}),e.jsx(N,{label:"Permissions",align:"start",valueClassName:S(C,l&&V.power),children:r}),a&&e.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a(t.id)},className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground mt-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors duration-100","aria-label":"Fork session",children:[e.jsx(q,{className:"size-(--size-icon-xs)"}),e.jsx("span",{children:"Fork"})]})]})})})}function X({account:t,className:s}){const{isMultiAccount:a,nameFor:n}=T();if(!t||!a)return null;const i=n(t);return e.jsxs(R,{children:[e.jsx(M,{asChild:!0,children:e.jsx("span",{"aria-label":`Account: ${i}`,className:S("text-3xs max-w-24 shrink-0 truncate",s),children:i})}),e.jsx(A,{side:"top",sideOffset:4,children:t})]})}function Je({session:t,isActive:s,onClick:a,onFork:n,onRename:i,isNew:l=!1}){const[r,c]=d.useState(!1),{isRenaming:u,renameValue:m,setRenameValue:f,inputRef:j,start:x,commit:h,handleKeyDown:v}=U({value:t.title,onCommit:g=>i==null?void 0:i(t.id,g)}),{isFullPower:b}=Z(t),y=$(6e4),o=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,y]),p=B(t.id),k=d.useCallback(g=>{g.stopPropagation(),c(ne=>!ne)},[]),ee=d.useCallback(g=>{g.stopPropagation(),x()},[x]),{animate:te,transition:se,initial:ae,pulsing:I}=Ye({isNew:l,borderState:p});return e.jsx(R,{children:e.jsxs(w.div,{"data-testid":"session-row",initial:ae,animate:te,transition:se,"data-pulsing":I?"true":"false",style:I?void 0:{borderLeftColor:p.color},className:S("group relative rounded-lg border-l-2 transition-colors duration-150",s?"text-foreground":"hover:bg-secondary/60"),children:[s&&e.jsx(w.div,{layoutId:"active-session-bg",className:"bg-secondary absolute inset-0 rounded-lg",transition:{type:"spring",stiffness:280,damping:32}}),e.jsx(J,{onRename:i?x:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(M,{asChild:!0,disabled:p.kind==="idle",children:e.jsxs(w.div,{role:"button",tabIndex:0,"aria-current":s?"page":void 0,"aria-label":`Session: ${L(t.title)}. ${p.label}.`,onClick:a,onKeyDown:g=>{u||(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),a())},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[e.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"min-w-0 flex-1",children:o}),e.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx(Se,{session:t}),p.kind==="pendingApproval"&&e.jsx(_,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting your approval"}),b&&e.jsx(Xe,{}),i&&!u&&e.jsx("button",{type:"button",onClick:ee,className:"text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 max-md:p-1.5 max-md:opacity-100","aria-label":"Rename session",children:e.jsx(F,{className:"size-(--size-icon-xs)"})}),e.jsx("button",{type:"button",onClick:k,className:S("rounded p-0.5 transition-opacity duration-150 max-md:p-1.5",r?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 max-md:opacity-100"),"aria-label":"Session details","aria-expanded":r,children:e.jsx(w.div,{animate:{rotate:r?180:0},transition:{type:"spring",stiffness:400,damping:30},children:e.jsx(ke,{className:"size-(--size-icon-sm)"})})})]})]}),u?e.jsx("input",{ref:j,autoFocus:!0,value:m,onChange:g=>f(g.target.value),onBlur:h,onKeyDown:v,onClick:g=>g.stopPropagation(),className:"bg-background text-foreground mt-0.5 w-full rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[e.jsx(G,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(W,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(X,{account:t.account,className:"text-muted-foreground/60"}),e.jsx("div",{className:"text-muted-foreground/70 min-w-0 flex-1 truncate text-xs",title:i?"Click the pencil icon to rename":void 0,children:L(t.title)})]})]})})}),e.jsx(A,{side:"right",sideOffset:8,children:p.label}),e.jsx(Ze,{session:t,expanded:r,className:"border-border/30 border-t",...n?{onFork:n}:{}})]})})}function Xe(){return e.jsxs(R,{children:[e.jsx(M,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex cursor-help","aria-label":Re,onClick:t=>t.stopPropagation(),children:e.jsx(Me,{className:`size-(--size-icon-xs) ${V.power}`})})}),e.jsx(A,{side:"top",sideOffset:4,children:"This chat runs commands without stopping for approval."})]})}function Ye({isNew:t,borderState:s}){const{animate:a,transition:n,pulsing:i}=H(s.pulse,s.color,s.dimColor);return d.useMemo(()=>{if(!(t||i))return{initial:void 0,animate:void 0,transition:void 0,pulsing:i};const r={...t?{opacity:1,y:0}:{},...a},c={...t?{opacity:{duration:.2,ease:[0,0,.2,1]},y:{duration:.2,ease:[0,0,.2,1]}}:{},...n};return{initial:t?{opacity:0,y:-8}:void 0,animate:r,transition:c,pulsing:i}},[t,i,a,n])}function et({session:t,isActive:s,onClick:a,onFork:n,onRename:i}){const{isRenaming:l,renameValue:r,setRenameValue:c,inputRef:u,start:m,commit:f,handleKeyDown:j}=U({value:t.title,onCommit:p=>i==null?void 0:i(t.id,p)}),x=B(t.id),h=$(6e4),v=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,h]),{animate:b,transition:y,pulsing:o}=H(x.pulse,x.color,x.dimColor,"backgroundColor");return e.jsxs(R,{children:[e.jsx(J,{onRename:i?m:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(M,{asChild:!0,children:e.jsxs("button",{type:"button","data-testid":"session-row",onClick:a,className:S("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs",Ae,s?"bg-secondary text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(w.span,{"aria-hidden":!0,"data-pulsing":o?"true":"false",animate:b,transition:y,style:o?void 0:{backgroundColor:x.color},className:"size-1.5 shrink-0 rounded-full"}),l?e.jsx("input",{ref:u,autoFocus:!0,value:r,onChange:p=>c(p.target.value),onBlur:f,onKeyDown:j,onClick:p=>p.stopPropagation(),className:"bg-background text-foreground min-w-0 flex-1 rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:L(t.title)}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[x.kind==="pendingApproval"&&e.jsx(_,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting approval"}),e.jsx(G,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(W,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(X,{account:t.account,className:"text-muted-foreground/60"}),e.jsx("span",{className:"text-muted-foreground/60 text-3xs",children:v})]})]})})}),x.kind!=="idle"&&e.jsx(A,{side:"right",sideOffset:8,children:x.label})]})}function tt({variant:t,session:s,isActive:a,onClick:n,onFork:i,onRename:l,isNew:r}){return t==="compact"?e.jsx(et,{session:s,isActive:a,onClick:n,onFork:i,onRename:l}):e.jsx(Je,{session:s,isActive:a,onClick:n,onFork:i,onRename:l,isNew:r})}function st(){const{known:t,warning:s,critical:a,autoCompacted:n}=He(),i=s+a;if(t===0&&i===0&&n===0)return null;const l=i>0||n>0,r=l?a>0?"bg-red-500":i>0?"bg-amber-500":"bg-muted-foreground/40":"bg-emerald-500",c=l?[i>0?`${i} near full`:null,n>0?`${n} auto-compacted`:null].filter(Boolean).join(" · "):"All sessions have room.";return e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1.5 text-xs","data-testid":"fleet-context-bar",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${r}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:c})]})}function Y(t){return t.account?`${t.runtime}-${t.account}`:t.runtime}function at({warning:t}){const{nameFor:s}=T(),a=O(t.runtime).label,n=t.account?`${a} sessions from ${s(t.account)}`:`${a} sessions`;return e.jsxs("p",{className:"text-muted-foreground/60 flex items-start gap-1.5 text-xs",title:t.message,"data-testid":`session-list-warning-${Y(t)}`,children:[e.jsx(Pe,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:["Couldn’t load ",n]})]})}function nt({activeSessionId:t,groupedSessions:s,warnings:a=[],onSessionClick:n,onForkSession:i,onRenameSession:l}){const r=d.useId();return e.jsxs(Le,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:[a.length>0&&e.jsx("div",{className:"space-y-1 px-4 pt-2","data-testid":"session-list-warnings",children:a.map(c=>e.jsx(at,{warning:c},Y(c)))}),e.jsx(st,{}),e.jsx(w.div,{layout:!0,children:e.jsx(Te,{id:r,children:s.length>0?e.jsx(e.Fragment,{children:s.map(c=>{const u=s.length===1&&c.label==="Today";return e.jsxs(Ie,{children:[!u&&e.jsx(ze,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:c.label}),e.jsx(Ee,{children:c.sessions.map(m=>e.jsx(De,{children:e.jsx(tt,{variant:"full",session:m,isActive:m.id===t,onClick:()=>n(m.id),onFork:i,onRename:l})},m.id))})]},c.label)})}):e.jsx("div",{className:"flex h-32 items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})]})}function it(t,s){return s===""?!0:(t.title??"").toLowerCase().includes(s)}function ot({member:t}){var y;const s=((y=t.agent)==null?void 0:y.projectPath)??null,{sessions:a,isLoading:n,isError:i,activeSessionId:l}=Fe(s),r=Oe(),c=D(),u=Ve(),m=$e(s),[f,j]=d.useState(""),x=f.trim().toLowerCase(),h=d.useMemo(()=>Ke(a.filter(o=>it(o,x))),[a,x]);function v(o){!r||s===null||(We.getState().recordOpened("agent",s),r({to:"/session",search:{dir:s,session:o}}))}async function b(o){try{const p=await c.forkSession(o,void 0,s??void 0);await u.invalidateQueries({queryKey:Qe.listRoot}),v(p.id)}catch(p){qe.error("Couldn’t branch off this conversation.",{description:p instanceof Error?p.message:"The original is untouched."})}}return n?e.jsx(Be,{className:"h-16 w-full"}):i?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Couldn’t read ",t.displayName,"’s conversations."]}):a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversations yet. ",t.displayName," starts one the first time you message it."]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(_e,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"}),e.jsx(Ge,{value:f,onChange:o=>j(o.target.value),placeholder:"Search conversations","aria-label":"Search conversations",className:"h-8 pl-7 text-sm"})]}),h.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversation matches “",f.trim(),"”."]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:e.jsx(nt,{activeSessionId:l,groupedSessions:h,onSessionClick:v,onForkSession:o=>void b(o),onRenameSession:(o,p)=>m.mutate({sessionId:o,title:p})})})]})}export{ot as SessionsPage};
6
+ */const q={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};q.node;const Q=ie(q);function He(){const t=re(),s=oe(r=>r.contextReadings),a=D(),n=d.useMemo(()=>Array.from(new Set(t.map(r=>r.runtime))),[t]),i=d.useCallback(r=>{const c={};return n.forEach((u,m)=>{var x;const f=(x=r[m])==null?void 0:x.data;if(!f)return;const j={};for(const h of f)h.contextWindow!=null&&(j[h.value]=h.contextWindow);c[u]=j}),c},[n]),l=le({queries:n.map(r=>ce(a,{runtime:r})),combine:i});return d.useMemo(()=>{var c;const r={total:0,known:0,unknown:0,warning:0,critical:0,autoCompacted:0};for(const u of t){r.total+=1;const m=u.model?(c=l[u.runtime])==null?void 0:c[u.model]:void 0,f=ue(u,{reading:s[u.id]??null,window:m});f.autoCompactedAt&&(r.autoCompacted+=1),f.status==="known"?(r.known+=1,f.severity==="warning"?r.warning+=1:f.severity==="critical"&&(r.critical+=1)):r.unknown+=1}return r},[t,s,l])}function Ue(t,s,a){return t&&s!==void 0&&!a}function H(t,s,a,n="borderLeftColor"){const i=de()??!1,l=Ue(t,a,i);return d.useMemo(()=>!l||!a?{animate:void 0,transition:void 0,pulsing:!1}:{animate:{[n]:[s,a,s]},transition:{[n]:{duration:2,repeat:1/0,ease:"easeInOut"}},pulsing:!0},[l,s,a,n])}function U({value:t,onCommit:s,onEnd:a}){const[n,i]=d.useState(!1),[l,r]=d.useState(""),c=d.useRef(null),u=d.useRef(!1),m=P(t),f=P(s),j=P(a);d.useEffect(()=>{if(!n)return;u.current=!1;const o=requestAnimationFrame(()=>{var p,k;(p=c.current)==null||p.focus(),(k=c.current)==null||k.select()});return()=>cancelAnimationFrame(o)},[n]);const x=d.useCallback(()=>{var o;i(!1),(o=j.read())==null||o()},[j]),h=d.useCallback(()=>{r(m.read()),i(!0)},[m]),v=d.useCallback(()=>{if(u.current)return;u.current=!0,x();const o=l.trim();o.length===0||o===m.read()||f.read()(o)},[x,l,m,f]),b=d.useCallback(()=>{u.current=!0,x()},[x]),y=d.useCallback(o=>{o.key==="Enter"?(o.preventDefault(),v()):o.key==="Escape"&&(o.preventDefault(),b())},[v,b]);return{isRenaming:n,renameValue:l,setRenameValue:r,inputRef:c,start:h,commit:v,cancel:b,handleKeyDown:y}}function Y(t){const s=me(t.id,{enabled:!1,fallback:t.permissionMode})??t.permissionMode,a=xe(t.runtime),n=a==null?void 0:a.permissionModes.values.find(l=>l.id===s),i=n?pe(n):fe(s);return{permissionMode:s,isFullPower:i}}function X({children:t,onRename:s,onFork:a}){return!s&&!a?e.jsx(e.Fragment,{children:t}):e.jsxs(ge,{children:[e.jsx(he,{asChild:!0,children:t}),e.jsxs(je,{className:"w-44",children:[s&&e.jsxs(E,{onClick:s,children:[e.jsx(F,{className:"mr-2 size-4"}),"Rename"]}),s&&a&&e.jsx(ve,{}),a&&e.jsxs(E,{onClick:a,children:[e.jsx(Q,{className:"mr-2 size-4"}),"Fork session"]})]})]})}const C="font-mono select-all";function I(t){try{return new Date(t).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function Ye({session:t,expanded:s,onFork:a,className:n}){var m;const{permissionMode:i,isFullPower:l}=Y(t),r=l?"Full power":Se(i),{nameFor:c}=T(),u=t.account?c(t.account):null;return e.jsx(be,{initial:!1,children:s&&e.jsx(S.div,{variants:Ne,initial:"initial",animate:"animate",exit:"exit",transition:ye,className:"relative z-10 overflow-hidden","data-slot":"session-details-panel",children:e.jsxs("div",{className:w("text-muted-foreground text-2xs mx-2 space-y-1.5 px-3 pt-2 pb-2",n),children:[e.jsx(N,{label:"Session ID",align:"start",copyValue:t.id,valueClassName:C,children:t.id}),e.jsx(N,{label:"Created",align:"start",valueClassName:C,children:I(t.createdAt)}),e.jsx(N,{label:"Updated",align:"start",valueClassName:C,children:I(t.updatedAt)}),e.jsx(N,{label:"Runtime",align:"start",valueClassName:C,children:O(t.runtime).label}),u&&e.jsx(N,{label:"Account",align:"start",copyValue:t.account,valueClassName:C,children:u}),e.jsx(N,{label:"Origin",align:"start",valueClassName:C,children:t.originLabel??((m=Ce(t.origin))==null?void 0:m.label)??"You"}),e.jsx(N,{label:"Permissions",align:"start",valueClassName:w(C,l&&V.power),children:r}),a&&e.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a(t.id)},className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground mt-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors duration-100","aria-label":"Fork session",children:[e.jsx(Q,{className:"size-(--size-icon-xs)"}),e.jsx("span",{children:"Fork"})]})]})})})}function Z({account:t,className:s}){const{isMultiAccount:a,nameFor:n}=T();if(!t||!a)return null;const i=n(t);return e.jsxs(R,{children:[e.jsx(A,{asChild:!0,children:e.jsx("span",{"aria-label":`Account: ${i}`,className:w("text-3xs max-w-24 shrink-0 truncate",s),children:i})}),e.jsx(M,{side:"top",sideOffset:4,children:t})]})}function Xe({session:t,isActive:s,onClick:a,onFork:n,onRename:i,isNew:l=!1}){const[r,c]=d.useState(!1),{isRenaming:u,renameValue:m,setRenameValue:f,inputRef:j,start:x,commit:h,handleKeyDown:v}=U({value:t.title,onCommit:g=>i==null?void 0:i(t.id,g)}),{isFullPower:b}=Y(t),y=$(6e4),o=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,y]),p=_(t.id),k=d.useCallback(g=>{g.stopPropagation(),c(ne=>!ne)},[]),ee=d.useCallback(g=>{g.stopPropagation(),x()},[x]),{animate:te,transition:se,initial:ae,pulsing:z}=Je({isNew:l,borderState:p});return e.jsx(R,{children:e.jsxs(S.div,{"data-testid":"session-row",initial:ae,animate:te,transition:se,"data-pulsing":z?"true":"false",style:z?void 0:{borderLeftColor:p.color},className:w("group relative rounded-lg border-l-2 transition-colors duration-150",s?"text-foreground":"hover:bg-secondary/60"),children:[s&&e.jsx(S.div,{layoutId:"active-session-bg",className:"bg-secondary absolute inset-0 rounded-lg",transition:{type:"spring",stiffness:280,damping:32}}),e.jsx(X,{onRename:i?x:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(A,{asChild:!0,disabled:p.kind==="idle",children:e.jsxs(S.div,{role:"button",tabIndex:0,"aria-current":s?"page":void 0,"aria-label":`Session: ${L(t.title)}. ${p.label}.`,onClick:a,onKeyDown:g=>{u||(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),a())},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[e.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[e.jsx("span",{className:"min-w-0 flex-1",children:o}),e.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx(we,{session:t}),p.kind==="pendingApproval"&&e.jsx(B,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting your approval"}),b&&e.jsx(Ze,{}),i&&!u&&e.jsx("button",{type:"button",onClick:ee,className:"text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 max-md:p-1.5 max-md:opacity-100","aria-label":"Rename session",children:e.jsx(F,{className:"size-(--size-icon-xs)"})}),e.jsx("button",{type:"button",onClick:k,className:w("rounded p-0.5 transition-opacity duration-150 max-md:p-1.5",r?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 max-md:opacity-100"),"aria-label":"Session details","aria-expanded":r,children:e.jsx(S.div,{animate:{rotate:r?180:0},transition:{type:"spring",stiffness:400,damping:30},children:e.jsx(ke,{className:"size-(--size-icon-sm)"})})})]})]}),u?e.jsx("input",{ref:j,autoFocus:!0,value:m,onChange:g=>f(g.target.value),onBlur:h,onKeyDown:v,onClick:g=>g.stopPropagation(),className:"bg-background text-foreground mt-0.5 w-full rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[e.jsx(G,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(W,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(Z,{account:t.account,className:"text-muted-foreground/60"}),e.jsx("div",{className:"text-muted-foreground/70 min-w-0 flex-1 truncate text-xs",title:i?"Click the pencil icon to rename":void 0,children:L(t.title)})]})]})})}),e.jsx(M,{side:"right",sideOffset:8,children:p.label}),e.jsx(Ye,{session:t,expanded:r,className:"border-border/30 border-t",...n?{onFork:n}:{}})]})})}function Ze(){return e.jsxs(R,{children:[e.jsx(A,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex cursor-help","aria-label":Re,onClick:t=>t.stopPropagation(),children:e.jsx(Ae,{className:`size-(--size-icon-xs) ${V.power}`})})}),e.jsx(M,{side:"top",sideOffset:4,children:"This chat runs commands without stopping for approval."})]})}function Je({isNew:t,borderState:s}){const{animate:a,transition:n,pulsing:i}=H(s.pulse,s.color,s.dimColor);return d.useMemo(()=>{if(!(t||i))return{initial:void 0,animate:void 0,transition:void 0,pulsing:i};const r={...t?{opacity:1,y:0}:{},...a},c={...t?{opacity:{duration:.2,ease:[0,0,.2,1]},y:{duration:.2,ease:[0,0,.2,1]}}:{},...n};return{initial:t?{opacity:0,y:-8}:void 0,animate:r,transition:c,pulsing:i}},[t,i,a,n])}function et({session:t,isActive:s,onClick:a,onFork:n,onRename:i}){const{isRenaming:l,renameValue:r,setRenameValue:c,inputRef:u,start:m,commit:f,handleKeyDown:j}=U({value:t.title,onCommit:p=>i==null?void 0:i(t.id,p)}),x=_(t.id),h=$(6e4),v=d.useMemo(()=>K(t.updatedAt),[t.updatedAt,h]),{animate:b,transition:y,pulsing:o}=H(x.pulse,x.color,x.dimColor,"backgroundColor");return e.jsxs(R,{children:[e.jsx(X,{onRename:i?m:void 0,onFork:n?()=>n(t.id):void 0,children:e.jsx(A,{asChild:!0,children:e.jsxs("button",{type:"button","data-testid":"session-row",onClick:a,className:w("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs",Me,s?"bg-secondary text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(S.span,{"aria-hidden":!0,"data-pulsing":o?"true":"false",animate:b,transition:y,style:o?void 0:{backgroundColor:x.color},className:"size-1.5 shrink-0 rounded-full"}),l?e.jsx("input",{ref:u,autoFocus:!0,value:r,onChange:p=>c(p.target.value),onBlur:f,onKeyDown:j,onClick:p=>p.stopPropagation(),className:"bg-background text-foreground min-w-0 flex-1 rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:L(t.title)}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[x.kind==="pendingApproval"&&e.jsx(B,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting approval"}),e.jsx(G,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(W,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(Z,{account:t.account,className:"text-muted-foreground/60"}),e.jsx("span",{className:"text-muted-foreground/60 text-3xs",children:v})]})]})})}),x.kind!=="idle"&&e.jsx(M,{side:"right",sideOffset:8,children:x.label})]})}function tt({variant:t,session:s,isActive:a,onClick:n,onFork:i,onRename:l,isNew:r}){return t==="compact"?e.jsx(et,{session:s,isActive:a,onClick:n,onFork:i,onRename:l}):e.jsx(Xe,{session:s,isActive:a,onClick:n,onFork:i,onRename:l,isNew:r})}function st(){const{known:t,warning:s,critical:a,autoCompacted:n}=He(),i=s+a;if(t===0&&i===0&&n===0)return null;const l=i>0||n>0,r=l?a>0?"bg-red-500":i>0?"bg-amber-500":"bg-muted-foreground/40":"bg-emerald-500",c=l?[i>0?`${i} near full`:null,n>0?`${n} auto-compacted`:null].filter(Boolean).join(" · "):"All sessions have room.";return e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1.5 text-xs","data-testid":"fleet-context-bar",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${r}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:c})]})}function J(t){return t.account?`${t.runtime}-${t.account}`:t.runtime}function at({warning:t}){const{nameFor:s}=T(),a=O(t.runtime).label,n=t.account?`${a} sessions from ${s(t.account)}`:`${a} sessions`;return e.jsxs("p",{className:"text-muted-foreground/60 flex items-start gap-1.5 text-xs",title:t.message,"data-testid":`session-list-warning-${J(t)}`,children:[e.jsx(Pe,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:["Couldn’t load ",n]})]})}function nt({activeSessionId:t,groupedSessions:s,warnings:a=[],onSessionClick:n,onForkSession:i,onRenameSession:l}){const r=d.useId();return e.jsxs(Le,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:[a.length>0&&e.jsx("div",{className:"space-y-1 px-4 pt-2","data-testid":"session-list-warnings",children:a.map(c=>e.jsx(at,{warning:c},J(c)))}),e.jsx(st,{}),e.jsx(S.div,{layout:!0,children:e.jsx(Te,{id:r,children:s.length>0?e.jsx(e.Fragment,{children:s.map(c=>{const u=s.length===1&&c.label==="Today";return e.jsxs(ze,{children:[!u&&e.jsx(Ee,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:c.label}),e.jsx(Ie,{children:c.sessions.map(m=>e.jsx(De,{children:e.jsx(tt,{variant:"full",session:m,isActive:m.id===t,onClick:()=>n(m.id),onFork:i,onRename:l})},m.id))})]},c.label)})}):e.jsx("div",{className:"flex h-32 items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})]})}function it(t,s){return s===""?!0:(t.title??"").toLowerCase().includes(s)}function ot({member:t}){var y;const s=((y=t.agent)==null?void 0:y.projectPath)??null,{sessions:a,isLoading:n,isError:i,activeSessionId:l}=Fe(s),r=Oe(),c=D(),u=Ve(),m=$e(s),[f,j]=d.useState(""),x=f.trim().toLowerCase(),h=d.useMemo(()=>Ke(a.filter(o=>it(o,x))),[a,x]);function v(o){!r||s===null||(We.getState().recordOpened("agent",s),r({to:"/session",search:{dir:s,session:o}}))}async function b(o){try{const p=await c.forkSession(o,void 0,s??void 0);await u.invalidateQueries({queryKey:qe.listRoot}),v(p.id)}catch(p){Qe.error("Couldn’t branch off this conversation.",{description:p instanceof Error?p.message:"The original is untouched."})}}return n?e.jsx(_e,{className:"h-16 w-full"}):i?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Couldn’t read ",t.displayName,"’s conversations."]}):a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversations yet. ",t.displayName," starts one the first time you message it."]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(Be,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"}),e.jsx(Ge,{value:f,onChange:o=>j(o.target.value),placeholder:"Search conversations","aria-label":"Search conversations",className:"h-8 pl-7 text-sm"})]}),h.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversation matches “",f.trim(),"”."]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:e.jsx(nt,{activeSessionId:l,groupedSessions:h,onSessionClick:v,onForkSession:o=>void b(o),onRenameSession:(o,p)=>m.mutate({sessionId:o,title:p})})})]})}export{ot as SessionsPage};
@@ -0,0 +1 @@
1
+ import{z as b,ah as B,el as p,em as g,A as w,D as A,aY as z,en as M,j as e,eo as O,r as d,aP as H,aj as N,B as j,aN as I,cO as y,ep as C,dF as q,dG as K,dH as W,dI as Q,dJ as U,dK as G,dL as Y,dM as J,e as E,eq as R,er as Z,aR as V,a as $,es as X,et as L,Z as P}from"./index-BMR65QI4.js";function D(s){const t=b();return B({queryKey:p.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const ee={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},se={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",te=new Set(["native","projected"]);function _(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function ne(s,t){return`${g[s]} ${ee[t]}`}function ae(s){return s.reason??s.target}function F(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function re(s,t){if(t.length===0)return!1;const n=F(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return te.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function le(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function ie(s){return`Shared with all ${s}`}function oe(s){return s===1?"1 agent file":`${s} agent files`}function ce(s){return`Every agent file ${s} cannot see — skills, rules, commands and more.`}function de(s){return s===1?"1 entry":`${s} entries`}function ue(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:_(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const xe={drop:"Not shared",warning:"Could not read",write:"Will be written",notice:"Notice"};function fe(s){return`${xe[s.kind]} · ${s.artifact} ${s.name}`}function me(s){const t=b(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),z.success("Agent files updated.")}})}function he(s){const t=w();M("approval_resolved",()=>{t.invalidateQueries({queryKey:p.status(s)})})}function pe({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(O,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:le(r.length)})]})})}function ge(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something else is in the way.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills live where only a few of your agents look.",variant:"info",actionable:!1}:null}function je({projectPath:s}){return he(s),null}function ve({projectPath:s}){const{data:t}=D(s),n=me(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(je,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(pe,{result:n.data,onDismiss:()=>c(!0)})]});const o=ge(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(O,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(H,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function Ne(s){const t=b(),n=w();return A({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),n.setQueriesData({queryKey:p.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const ye={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function ke({harness:s,cell:t}){var l;const n=ne(s,t.state),a=ae(t),r=(l=t.warnings)!=null&&l.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ye[se[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(I,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function Se(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Lives where only some of your agents look. Move it to .agents/skills so every agent can read it.":`Lives in ${n}. Move it to .agents/skills so every agent can read it.`}function be(s,t){return`dorkos harness adopt ${s} --project ${t}`}const we="Share with every agent";function Ce(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}, and DorkOS leaves a link behind so Claude Code still finds it.`:`${a}, where every agent reads it.`}const De="for all your projects";function $e({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=Ne(n),x=F(s,t),m=re(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:De}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:h})=>g[h]).join(" · "),onClick:()=>l(h=>!h),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[ie(x.length),e.jsx(H,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:T})=>e.jsx(ke,{harness:h,cell:T},h))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||Se(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:be(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:we})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(K,{children:[e.jsxs(W,{children:[e.jsxs(Q,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(U,{children:Ce(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(G,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(J,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const Ae="https://dorkos.ai/docs/guides/cli-usage#agent-files";function Oe(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{className:"h-3 w-32"}),e.jsx($,{className:"h-3 w-48"})]},s))})]})}function He({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=E();if(a)return e.jsx(Oe,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Ee,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({to:"/marketplace",search:{type:"skill-pack"}}),children:[e.jsx(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(Z,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(V,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx($e,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},_(i)))})]})}function Ee({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(X,{href:Ae,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Re({group:s}){const[t,n]=d.useState(!1);return e.jsxs(L,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:oe(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ce(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Le({rows:s,enabled:t}){const n=ue(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Re,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(L,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:fe(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function _e({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but this folder isn’t sharing to it.`:`${g[t]} files are in this folder, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(_e,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Te({projectPath:s}){const t=E(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ve,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(He,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Le,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Pe,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({to:"/marketplace",search:{type:"skill-pack"}}),children:[e.jsx(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function ze({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Te,{projectPath:t})}export{ze as SkillsPage};
@@ -1 +1 @@
1
- import{an as F,ac as y,ao as U,ap as D,aq as L,ar as P,as as B,r as u,j as e,at as G,au as O,av as f,aw as j,ax as g,ay as k,az as N,aA as w,aB as R,aC as $,aD as X,aE as _,aF as q,aG as H,aH as V,aI as W}from"./index-DDXrdlj0.js";const J=5;function K({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(V,{className:"size-3 shrink-0 text-green-500","aria-hidden":!0});case"failed":return e.jsx(H,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(q,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(_,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"blocked":return e.jsx(X,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function Q(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),c=n%60;return`${a}m ${c}s`}function Y({run:t,scheduleName:n}){return e.jsx(k,{children:e.jsxs(N,{className:"text-sm",children:[e.jsx(w,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:R(t.startedAt)})]})})}function Z({schedule:t,onEdit:n}){return e.jsx(k,{children:e.jsxs(N,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx($,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:R(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(k,{children:e.jsxs(N,{className:"text-sm",children:[e.jsx(K,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:Q(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:R(t.finishedAt)})]})]})})}function se({toolStatus:t,agentId:n}){const a=F(),c=y(s=>s.setTasksAgentFilter),l=y(s=>s.setTasksEditScheduleId),o=t!=="disabled-by-server",{data:h=[]}=U(o),{data:I=0}=D(o),{data:S=[]}=L(void 0,o),{data:v=[]}=P(),{openWithTemplate:z}=B(),T=[v[0],v[2]].filter(Boolean),d=u.useMemo(()=>n?h.filter(s=>s.agentId===n):h,[n,h]),x=u.useMemo(()=>{const s=new Map;for(const r of d)s.set(r.id,r.name);return s},[d]),A=u.useMemo(()=>S.filter(s=>x.has(s.scheduleId)),[S,x]),{runningRuns:b,recentRuns:C}=u.useMemo(()=>{const s=[],r=[];for(const i of A)i.finishedAt!=null||i.status!=="running"?r.push(i):s.push(i);return r.sort((i,p)=>(p.finishedAt??p.createdAt).localeCompare(i.finishedAt??i.createdAt)),{runningRuns:s,recentRuns:r.slice(0,J)}},[A]),M=u.useMemo(()=>d.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[d]),m=()=>{n&&(c(n),l(null)),a.open()},E=s=>{l(s),c(null),a.open()};return t==="disabled-by-agent"?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 px-4 py-8",children:[e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Scheduled tasks are off for this agent"}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})]}):d.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),T.length>0&&e.jsx("div",{className:"space-y-2",children:T.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:G(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{z(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})]}):e.jsx(O,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[b.length>0&&e.jsxs(f,{children:[e.jsxs(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(g,{children:b.map(s=>e.jsx(Y,{run:s,scheduleName:x.get(s.scheduleId)??"Unknown"},s.id))})]}),M.length>0&&e.jsxs(f,{children:[e.jsx(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(g,{children:M.map(s=>e.jsx(Z,{schedule:s,onEdit:E},s.id))})]}),C.length>0&&e.jsxs(f,{children:[e.jsx(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent Runs"}),e.jsx(g,{children:C.map(s=>e.jsx(ee,{run:s,scheduleName:x.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})})]})})}function ne({member:t}){var l,o;const n=((l=t.agent)==null?void 0:l.projectPath)??null,a=W(n),c=((o=t.agent)==null?void 0:o.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{toolStatus:a.tasks,agentId:c})})}export{ne as TasksPage};
1
+ import{aq as F,af as y,ar as U,as as D,at as L,au as P,av as B,r as u,j as e,aw as G,ax as O,ay as p,az as j,aA as g,aB as k,aC as N,aD as w,aE as R,aF as $,aG as X,aH as _,aI as q,aJ as H,aK as J,aL as K}from"./index-BMR65QI4.js";const V=5;function W({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(J,{className:"size-3 shrink-0 text-green-500","aria-hidden":!0});case"failed":return e.jsx(H,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(q,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(_,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"blocked":return e.jsx(X,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function Q(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),c=n%60;return`${a}m ${c}s`}function Y({run:t,scheduleName:n}){return e.jsx(k,{children:e.jsxs(N,{className:"text-sm",children:[e.jsx(w,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:R(t.startedAt)})]})})}function Z({schedule:t,onEdit:n}){return e.jsx(k,{children:e.jsxs(N,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx($,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:R(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(k,{children:e.jsxs(N,{className:"text-sm",children:[e.jsx(W,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:Q(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:R(t.finishedAt)})]})]})})}function se({toolStatus:t,agentId:n}){const a=F(),c=y(s=>s.setTasksAgentFilter),l=y(s=>s.setTasksEditScheduleId),o=t!=="disabled-by-server",{data:h=[]}=U(o),{data:I=0}=D(o),{data:S=[]}=L(void 0,o),{data:v=[]}=P(),{openWithTemplate:z}=B(),T=[v[0],v[2]].filter(Boolean),d=u.useMemo(()=>n?h.filter(s=>s.agentId===n):h,[n,h]),x=u.useMemo(()=>{const s=new Map;for(const r of d)s.set(r.id,r.name);return s},[d]),A=u.useMemo(()=>S.filter(s=>x.has(s.scheduleId)),[S,x]),{runningRuns:b,recentRuns:C}=u.useMemo(()=>{const s=[],r=[];for(const i of A)i.finishedAt!=null||i.status!=="running"?r.push(i):s.push(i);return r.sort((i,f)=>(f.finishedAt??f.createdAt).localeCompare(i.finishedAt??i.createdAt)),{runningRuns:s,recentRuns:r.slice(0,V)}},[A]),M=u.useMemo(()=>d.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[d]),m=()=>{n&&(c(n),l(null)),a.open()},E=s=>{l(s),c(null),a.open()};return t==="disabled-by-agent"?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 px-4 py-8",children:[e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"Scheduled tasks are off for this agent"}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})]}):d.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),T.length>0&&e.jsx("div",{className:"space-y-2",children:T.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:G(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{z(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})]}):e.jsx(O,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[b.length>0&&e.jsxs(p,{children:[e.jsxs(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(g,{children:b.map(s=>e.jsx(Y,{run:s,scheduleName:x.get(s.scheduleId)??"Unknown"},s.id))})]}),M.length>0&&e.jsxs(p,{children:[e.jsx(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(g,{children:M.map(s=>e.jsx(Z,{schedule:s,onEdit:E},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(j,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent Runs"}),e.jsx(g,{children:C.map(s=>e.jsx(ee,{run:s,scheduleName:x.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open Schedules →"})})]})})}function ne({member:t}){var l,o;const n=((l=t.agent)==null?void 0:l.projectPath)??null,a=K(n),c=((o=t.agent)==null?void 0:o.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{toolStatus:a.tasks,agentId:c})})}export{ne as TasksPage};
@@ -0,0 +1,2 @@
1
+ import{z as ne,ah as Ze,D as de,A as te,fF as ue,fG as ke,r as c,j as e,cu as O,cv as M,fH as Te,B as x,P as Ae,fI as me,er as _,I as Z,d5 as Oe,d6 as Me,d7 as Ee,d8 as Re,d9 as X,fJ as xe,bB as Je,fK as Xe,C as ie,aj as ve,fL as he,cp as U,cq as q,Z as se,cr as G,bE as L,aQ as es,fM as je,aD as oe,dw as ss,dx as ns,dy as ts,dz as as,dA as re,ak as rs,dC as is,aR as le,fN as os,f7 as ls,fO as cs,fP as ds,m as De,a as ce,fQ as us,dS as ms,fR as hs,fS as gs,fT as ze,fU as J,fV as be,fW as ps,fX as fs,u as xs}from"./index-BMR65QI4.js";import{u as Pe}from"./use-mesh-update-CZIA8V07.js";import{a as vs}from"./agent-browser-DaDOSH9H.js";function js(s,n){const t=ne();return Ze({queryKey:["mcp-config",s,n??null],queryFn:()=>t.getMcpConfig(s,{runtime:n??void 0}),enabled:!!s,staleTime:3e4})}function Ie(s,n){s.invalidateQueries({queryKey:ue.mcpServers(n)}),s.invalidateQueries({queryKey:["mcp-config"]})}function Fe(s){const n=ne(),t=te();return de({mutationFn:async({input:i,approval:a})=>a?(await n.grantApproval(a.approvalId),s(n,i,a.approvalToken)):s(n,i),onSuccess:(i,{input:a})=>{i.status==="ok"&&Ie(t,a.agentId)}})}function _e(){return Fe((s,n,t)=>s.addAgentMcpServer(n,t?{approvalToken:t}:void 0))}function bs(){return Fe((s,n,t)=>s.importAgentMcpServer(n,t?{approvalToken:t}:void 0))}function ge(s){const n=ne(),t=te();return de({mutationFn:({agentId:i,name:a})=>s(n,i,a),onSuccess:(i,{agentId:a})=>Ie(t,a)})}function Ns(){return ge((s,n,t)=>s.removeAgentMcpServer(n,t))}function ys(){return ge((s,n,t)=>s.enableAgentMcpServer(n,t))}function Ss(){return ge((s,n,t)=>s.disableAgentMcpServer(n,t))}function Cs(){const s=ne();return de({mutationFn:({agentId:n,name:t})=>s.testAgentMcpServer(n,t)})}function ws({agentId:s,serverName:n,onDone:t}){const i=ke(s,n),{start:a}=i,r=c.useRef(!1);return c.useEffect(()=>{r.current||(r.current=!0,a())},[a]),e.jsx(O,{children:e.jsxs(M,{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",n]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"This server needs you to sign in before your agent can use it."}),e.jsx(Te,{flow:i,serverName:n,failedActions:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:e.jsx(x,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&e.jsx(x,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const ks=["stdio","http","sse"],Ts=/^[a-zA-Z0-9_-]+$/;function Ne(s){const n={};for(const t of s.split(`
2
+ `)){const i=t.trim();if(!i)continue;const a=i.indexOf("=");if(a===-1)continue;const r=i.slice(0,a).trim();r&&(n[r]=i.slice(a+1).trim())}return n}function ye(s){return s.trim().length?s.trim().split(/\s+/):[]}function As(s,n){if(s.status!=="ok")return!1;const t=s.servers.find(a=>a.name===n),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function Os({agentId:s,agentLabel:n,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=_e(),[o,d]=c.useState(!1),[m,f]=c.useState(""),[p,u]=c.useState(t[0]??"stdio"),l=t.includes(p)?p:t[0]??"stdio",[j,v]=c.useState(""),[b,k]=c.useState(""),[N,z]=c.useState(""),[C,E]=c.useState(""),[P,T]=c.useState(""),[R,I]=c.useState(null),[A,F]=c.useState(null),[ae,V]=c.useState(null),[$,Q]=c.useState(null),B=Ts.test(m)&&m.length<=64,Y=l==="stdio"?j.trim().length>0:C.trim().length>0,h=B&&Y&&!r.isPending,y=c.useCallback(()=>l==="stdio"?{transport:"stdio",command:j.trim(),args:ye(b),env:Ne(N)}:{transport:l,url:C.trim(),headers:Ne(P)},[l,j,b,N,C,P]),w=c.useCallback(()=>({agentId:s,name:m.trim(),connection:y()}),[s,m,y]),D=c.useCallback(()=>{d(!1),I(null),F(null),f(""),u(t[0]??"stdio"),v(""),k(""),z(""),E(""),T("")},[t]),fe=c.useCallback(g=>{i({name:g.name,transport:g.connection.transport}),D()},[i,D]),H=c.useCallback((g,S)=>{const We=As(g,S.name);fe(S),We&&V(S.name)},[fe]),Ve=c.useCallback(async()=>{F(null);const g=w();try{const S=await r.mutateAsync({input:g});S.status==="approval_required"?I(S.approval):H(S,g)}catch(S){F(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,H]),Qe=c.useCallback(async()=>{if(!R)return;F(null);const g=w();try{const S=await r.mutateAsync({input:g,approval:R});S.status==="ok"?H(S,g):F("The server still needs approval. Try again.")}catch(S){F(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,R,H]),W=ae??(a&&a!==$?a:null),Ye=c.useCallback(()=>{Q(W),V(null)},[W]),He=c.useMemo(()=>[j.trim(),...ye(b)].filter(Boolean).join(" "),[j,b]);return W?e.jsx(ws,{agentId:s,serverName:W,onDone:Ye}):o?R?e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(me,{className:"mt-0.5 size-4 shrink-0 text-amber-500"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Confirm this server for ",n]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:l==="stdio"?"This command runs on your machine whenever the agent starts a session.":"The agent connects to this URL whenever it starts a session."})]})]}),e.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:l==="stdio"?He:C.trim()}),A&&e.jsx("p",{className:"text-destructive text-xs",children:A}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>I(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),e.jsx(x,{size:"sm",onClick:Qe,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Confirm & add"})]})]})}):e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-name",children:"Name"}),e.jsx(Z,{id:"mcp-name",value:m,onChange:g=>f(g.target.value),placeholder:"my-server","aria-invalid":m.length>0&&!B}),m.length>0&&!B&&e.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-transport",children:"Transport"}),e.jsxs(Oe,{value:l,onValueChange:g=>u(g),children:[e.jsx(Me,{id:"mcp-transport",className:"w-full",children:e.jsx(Ee,{})}),e.jsx(Re,{children:t.map(g=>e.jsx(X,{value:g,children:g},g))})]})]}),l==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-command",children:"Command"}),e.jsx(Z,{id:"mcp-command",value:j,onChange:g=>v(g.target.value),placeholder:"npx",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-args",children:"Arguments"}),e.jsx(Z,{id:"mcp-args",value:b,onChange:g=>k(g.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),e.jsx(xe,{id:"mcp-env",value:N,onChange:g=>z(g.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-url",children:"URL"}),e.jsx(Z,{id:"mcp-url",value:C,onChange:g=>E(g.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),e.jsx(xe,{id:"mcp-headers",value:P,onChange:g=>T(g.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),A&&e.jsx("p",{className:"text-destructive text-xs",children:A}),e.jsx(Je,{}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"ghost",size:"sm",onClick:D,className:"focus-visible:ring-2",children:"Cancel"}),e.jsx(x,{size:"sm",onClick:Ve,disabled:!h,className:"focus-visible:ring-2",children:"Continue"})]})]})}):e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>d(!0),className:"focus-visible:ring-2",children:[e.jsx(Ae,{className:"size-4"}),"Add server"]})}const Ms={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},Es=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function pe(s){if(!s)return"cant-reach";const n=s.toLowerCase();return Es.some(t=>n.includes(t))?"setup-problem":"cant-reach"}function Le(s){return s.transport==="stdio"||s.authKind==="oauth2"?!1:Object.keys(s.headers).some(n=>n.toLowerCase()==="authorization")}function Rs(s){const{connection:n,authStatus:t}=s;return n.transport!=="stdio"&&n.authKind==="oauth2"?!0:t!==void 0}function Ke(s){const{enabled:n,testedOk:t,signedInNow:i,runtimeStatus:a,runtimeError:r,authStatus:o,ownKey:d}=s;return n?t?"connected":i?"signed-in":a==="failed"?pe(r):o==="connected"&&a==="needs-auth"?"signed-in":o==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Ms[a]:o==="connected"?"signed-in":o==="needs-auth"?"needs-sign-in":d?"uses-your-key":"not-checked":"off"}function Ds(s){const{statusKey:n,testResult:t,signedInNow:i}=s;return n==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:n==="needs-sign-in"}function zs(s){const{stamped:n,signedInNow:t,authStatus:i,rosterUpdatedAt:a}=s;if(!n)return;const{result:r}=n;if(!(t&&r.needsAuth===!0)&&!(n.at<=a&&(i==="needs-auth"&&r.ok||i==="connected"&&r.needsAuth===!0)))return r}function Ps(s){const{status:n,probe:t}=s;return n==="off"||!t||t.ok?n:t.needsAuth===!0?"needs-sign-in":pe(t.error)}const ee={attention:0,working:1,elsewhere:2,off:3};function Is(s){return s==="off"?ee.off:s==="needs-sign-in"||s==="cant-reach"||s==="setup-problem"?ee.attention:ee.working}function Fs(s){const{managed:n,live:t,discovered:i}=s;return[...n.map(r=>{var o,d;return{name:r.name,band:Is(Ke({enabled:r.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(o=t.get(r.name))==null?void 0:o.status,runtimeError:(d=t.get(r.name))==null?void 0:d.error,authStatus:r.authStatus,ownKey:Le(r.connection)}))}}),...i.map(r=>({name:r.name,band:ee.elsewhere}))].map((r,o)=>({entry:r,index:o})).sort((r,o)=>r.entry.band-o.entry.band||r.index-o.index).map(({entry:r})=>r.name)}function _s(s){const{frozen:n,present:t}=s,i=new Set(t),a=new Set(n);return{ordered:n.filter(r=>i.has(r)),added:t.filter(r=>!a.has(r))}}function Ls(){const s=Xe(null);return({bothSettled:n,managed:t,live:i,discovered:a,present:r})=>{s.read()===null&&n&&r.length>0&&s.write(Fs({managed:t,live:i,discovered:a}));const{ordered:o,added:d}=_s({frozen:s.read()??[],present:r});return d.length>0&&s.read()!==null&&s.write([...o,...d]),[...o,...d]}}const $e={"needs-sign-in":{label:"Needs sign-in",tooltip:"Sign in to let this agent use the server.",tone:"attention"},"signing-in":{label:"Signing in…",tooltip:"A sign-in is in progress. Finish it in the tab that opened.",tone:"attention"},connected:{label:"Connected",tooltip:"This server answered, and its tools are available to the agent.",tone:"calm"},"signed-in":{label:"Signed in",tooltip:"DorkOS has a sign-in for this server. Use Test to check it responds.",tone:"calm"},"uses-your-key":{label:"Uses your key",tooltip:"This server is authenticated with a key you supplied, not one DorkOS holds.",tone:"calm"},"cant-reach":{label:"Can’t reach",tooltip:"The server did not answer. Open Details for what it said.",tone:"error"},"setup-problem":{label:"Setup problem",tooltip:"This server’s setup is wrong, so it could not start. Open Details for the reason.",tone:"error"},connecting:{label:"Connecting…",tooltip:"The agent is connecting to this server.",tone:"calm"},"not-checked":{label:"Not checked yet",tooltip:"Nothing has contacted this server yet, so there is nothing to report.",tone:"calm"},off:{label:"Off",tooltip:"Turned off. Its tools are not given to the agent.",tone:"calm"}},Ks={"needs-sign-in":"sign-in","signing-in":"none",connected:"none","signed-in":"test","uses-your-key":"test","cant-reach":"try-again","setup-problem":"try-again",connecting:"none","not-checked":"test",off:"none"};function $s(s){return Ks[s]}function Bs({toolCount:s,justSignedIn:n}){const t=n?"Signed in just now. ":"";return s===null?`${t||"This server answered. "}Its tools are available.`:`${t}${s} tool${s===1?"":"s"} available.`}function Us(s,n){switch(s){case"needs-sign-in":return`Sign in to ${n.displayName} so this agent can use its tools.`;case"signing-in":return null;case"connected":return Bs(n);case"signed-in":return n.justSignedIn?"Signed in just now. Test to check the server responds.":"DorkOS has a sign-in for this server. Test to check it responds.";case"uses-your-key":return"You added an access key when setting this up.";case"cant-reach":return"This server didn’t answer. It may be down.";case"setup-problem":return"This server’s setup has a problem.";case"connecting":return"Connecting to this server.";case"not-checked":return"Nothing has checked this server yet.";case"off":return"Turned off. The agent doesn’t see this server."}}function qs(s){const{connection:n,authStatus:t,clientOrigin:i}=s;return n.transport==="stdio"?"None. This server doesn’t need one.":n.authKind==="oauth2"?i==="manual"?`OAuth: using your own app credentials, ${t==="connected"?"signed in, and it renews automatically":"not signed in yet"}. DorkOS holds the key; the agent never sees it.`:t==="connected"?"OAuth: signed in, and it renews automatically. DorkOS holds the key; the agent never sees it.":"OAuth: DorkOS will hold the key for you; the agent never sees it.":Object.keys(n.headers).some(r=>r.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":t===void 0?"Nothing has checked this yet.":"None. This server doesn’t need one."}function Gs(s){if(s.transport==="stdio")return`Runs \`${s.command}\` on this computer`;const n=Vs(s.url);return n?`${n} (web service)`:`${s.url} (web service)`}function Vs(s){try{return new URL(s).host}catch{return null}}const Qs={agent:"Added to this agent through DorkOS",project:"From this project, declared in its config files",plugin:"Comes with a plugin",computer:"From your computer-wide config"},Ys={agent:"Added to this agent through DorkOS.",project:"From this project’s config. Add it to manage it here.",plugin:"Comes with a plugin. Add it to manage it here.",computer:"From your computer-wide config. Add it to manage it here."},Hs=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:s=>({pluginName:s[1],displayName:s[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:s=>({pluginName:s[1],displayName:s[1]})}];function Be(s){for(const n of Hs){const t=s.match(n.pattern);if(!t)continue;const{displayName:i,pluginName:a}=n.read(t);if(!(!i||!a))return{displayName:i,pluginName:a,rawName:s}}return{displayName:s,pluginName:null,rawName:s}}function Ws(s,n){return n.pluginName?"plugin":s.scope==="project"||s.scope==="local"?"project":s.scope==="user"?"computer":null}const Zs="This agent’s runtime loads this server. Add it to manage it here.";function Ue(s,n){return s==="plugin"&&n?`Comes with the ${n} plugin`:Qs[s]}function Js(s,n){return s===null?Zs:s==="plugin"&&n?`Comes with the ${n} plugin. Add it to manage it here.`:Ys[s]}const Xs=he("border-border/60 relative overflow-hidden rounded-md border px-3 py-2.5 transition-colors",{variants:{managed:{true:"bg-card",false:"bg-muted/30"},dimmed:{true:"opacity-65",false:""}},defaultVariants:{managed:!0,dimmed:!1}}),en=he("pointer-events-none absolute inset-y-0 left-0 w-0.5",{variants:{tone:{calm:"hidden",attention:"bg-status-warning",error:"bg-status-error"}},defaultVariants:{tone:"calm"}}),sn=he("shrink-0 rounded-full px-2 py-0.5 text-2xs leading-4 font-medium whitespace-nowrap",{variants:{chip:{success:"bg-status-success-bg text-status-success-fg",info:"bg-status-info-bg text-status-info-fg",warning:"bg-status-warning-bg text-status-warning-fg",error:"bg-status-error-bg text-status-error-fg",neutral:"bg-muted text-muted-foreground"}},defaultVariants:{chip:"neutral"}}),nn={connected:"success","signed-in":"info","needs-sign-in":"warning","signing-in":"warning","cant-reach":"error","setup-problem":"error","uses-your-key":"neutral",connecting:"neutral","not-checked":"neutral",off:"neutral"};function tn({status:s}){const n=$e[s];return e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx("span",{className:sn({chip:nn[s]}),children:n.label})}),e.jsx(G,{children:n.tooltip})]})}function an({scope:s,pluginName:n}){return e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx(se,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:s})}),e.jsx(G,{children:Ue(s,n)})]})}function qe({displayName:s,rawName:n,scope:t,pluginName:i,status:a,sentence:r,managed:o,toggle:d,actions:m,children:f,details:p,defaultDetailsOpen:u=!1}){const[l,j]=c.useState(u),v=c.useId(),b=$e[a].tone;return e.jsxs("div",{"data-mcp-server":n,className:ve(Xs({managed:o,dimmed:a==="off"}),"mb-2 last:mb-0"),children:[e.jsx("span",{className:en({tone:b}),"aria-hidden":!0}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s}),t&&e.jsx(an,{scope:t,pluginName:i}),e.jsx(tn,{status:a}),d]}),r&&e.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:r}),f,m&&e.jsx("div",{className:"mt-2 flex items-center gap-1",children:m}),p&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>j(k=>!k),"aria-expanded":l,"aria-controls":v,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[e.jsx(ie,{className:ve("size-3 transition-transform",l&&"rotate-90"),"aria-hidden":!0}),"Details"]}),l&&e.jsxs("div",{id:v,children:[p,e.jsxs("button",{type:"button",onClick:()=>j(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[e.jsx(ie,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const rn=3,K="text-muted-foreground/70";function on({tools:s}){const[n,t]=c.useState(!1),i=n?s:s.slice(0,rn),a=s.length-i.length;return e.jsxs("div",{className:"mt-1.5",children:[i.map(r=>e.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[e.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:r.name}),r.description&&e.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:r.description})]},r.name)),a>0&&e.jsxs("button",{type:"button",onClick:()=>t(!0),className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs focus-visible:ring-2",children:[e.jsx(ie,{className:"size-3","aria-hidden":!0}),"Show ",a," more"]})]})}function ln(s){const{scope:n,pluginName:t,connection:i}=s;return n==="plugin"&&t?`Comes with the ${t} plugin`:i?Gs(i):n?Ue(n,t):null}function Ge({connection:s,authStatus:n,authClientOrigin:t,scope:i,pluginName:a,rawName:r,displayName:o,toolCount:d,tools:m,serverInfo:f,alsoUsedBy:p,error:u}){const l=ln({scope:i,pluginName:a,connection:s});return e.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[s&&e.jsx(L,{label:"Sign-in",align:"start",wrap:!0,labelClassName:K,children:e.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[e.jsx(es,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),qs({connection:s,authStatus:n,clientOrigin:t})]})}),l&&e.jsx(L,{label:"Source",align:"start",wrap:!0,labelClassName:K,children:l}),r!==o&&e.jsx(L,{label:"Raw id",align:"start",wrap:!0,labelClassName:K,children:e.jsx("code",{className:"text-2xs font-mono",children:r})}),f&&e.jsx(L,{label:"Server",align:"start",wrap:!0,labelClassName:K,children:f}),p&&e.jsx(L,{label:"Also used by",align:"start",wrap:!0,labelClassName:K,children:p}),typeof d=="number"&&e.jsx(L,{label:"Tools",align:"start",labelClassName:K,children:d}),m&&m.length>0&&e.jsx(on,{tools:m}),u&&e.jsx(L,{label:"Error",align:"start",wrap:!0,labelClassName:K,children:e.jsx("code",{className:"text-2xs font-mono break-all",children:u})})]})}function cn({flow:s,serverName:n}){return e.jsxs(e.Fragment,{children:[e.jsx(Te,{flow:s,serverName:n,failedActions:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",size:"sm",onClick:()=>s.start(),className:"focus-visible:ring-2",children:"Try again"}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(s.state.step==="disclosure"||s.state.step==="waiting")&&e.jsx("div",{className:"mt-2",children:e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>s.reset(),"aria-label":`Cancel signing in to ${n}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function dn({server:s,agentId:n,live:t,testResult:i,rosterUpdatedAt:a,testing:r,busy:o,onToggle:d,onTest:m,onRemove:f}){const p=ke(n,s.name),u=p.state.step==="connected",l=zs({stamped:i,signedInNow:u,authStatus:s.authStatus,rosterUpdatedAt:a}),j=Le(s.connection),v=Ke({enabled:s.enabled,testedOk:(l==null?void 0:l.ok)===!0,signedInNow:u,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.error,authStatus:s.authStatus,ownKey:j}),b=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||b,N=k?"signing-in":v,z=Ds({statusKey:v,testResult:l,signedInNow:u})&&(p.state.step==="idle"||b),C=Be(s.name),E=l!=null&&l.ok?l.toolCount??null:p.state.toolCount,P=k?N:Ps({status:N,probe:l}),T=Us(P,{displayName:C.displayName,toolCount:E,justSignedIn:u}),R=k?"none":$s(P),I=Rs({connection:s.connection,authStatus:s.authStatus});return e.jsx(qe,{displayName:C.displayName,rawName:s.name,scope:"agent",pluginName:C.pluginName,status:N,sentence:T,managed:!0,toggle:e.jsx(le,{checked:s.enabled,onCheckedChange:A=>d(s.name,A),disabled:o,"aria-label":`Enable ${s.name}`}),actions:e.jsxs(e.Fragment,{children:[z&&e.jsxs(x,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:o||b,"aria-label":`Sign in to ${s.name}`,className:"gap-1.5 focus-visible:ring-2",children:[e.jsx(je,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!z&&R==="try-again"&&e.jsxs(x,{variant:"outline",size:"sm",onClick:()=>m(s.name),disabled:r||o,"aria-label":`Try ${s.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?e.jsx(oe,{size:"xs"}):null,"Try again"]}),!z&&R==="test"&&e.jsx(x,{variant:"outline",size:"sm",onClick:()=>m(s.name),disabled:r||o,className:"focus-visible:ring-2",children:r?e.jsx(oe,{size:"xs"}):"Test"}),e.jsxs(ss,{children:[e.jsx(ns,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"sm","aria-label":`More actions for ${s.name}`,className:"ml-auto focus-visible:ring-2",children:e.jsx(ts,{className:"size-4","aria-hidden":!0})})}),e.jsxs(as,{align:"end",children:[e.jsxs(re,{onSelect:()=>m(s.name),disabled:r||o,children:[e.jsx(rs,{className:"size-3.5","aria-hidden":!0}),"Test"]}),I&&e.jsxs(re,{onSelect:()=>p.start(),disabled:o,children:[e.jsx(je,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),e.jsx(is,{}),e.jsx(re,{variant:"destructive",onSelect:()=>f(s.name),disabled:o,children:"Remove"})]})]})]}),details:e.jsx(Ge,{connection:s.connection,authStatus:s.authStatus,authClientOrigin:s.authClientOrigin,scope:"agent",pluginName:C.pluginName,rawName:C.rawName,displayName:C.displayName,toolCount:E,error:(l==null?void 0:l.ok)===!1?l.error:t==null?void 0:t.error}),children:e.jsx(cn,{flow:p,serverName:C.displayName})})}function un(s){switch(s.status){case"connected":return"connected";case"failed":return pe(s.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function mn(s){const{displayName:n,scope:t,pluginName:i}=s,a=hn(t,i);return`${n} ${a}. Manage it here to enable, disable, or sign in from DorkOS.`}function hn(s,n){return s==="plugin"&&n?`comes with the ${n} plugin`:s==="project"?"comes from this project’s own config":s==="computer"?"comes from your computer-wide config":"is loaded by this agent’s runtime"}function gn({entry:s,agentId:n,agentLabel:t,canImport:i}){const a=bs(),[r,o]=c.useState(null),[d,m]=c.useState(null),f=c.useCallback(async()=>{m(null);try{const N=await a.mutateAsync({input:{agentId:n,name:s.name}});N.status==="approval_required"&&o(N.approval)}catch(N){m(N instanceof Error?N.message:"Couldn’t add the server.")}},[a,n,s.name]),p=c.useCallback(async()=>{if(r){m(null);try{(await a.mutateAsync({input:{agentId:n,name:s.name},approval:r})).status!=="ok"&&m("Adding it still needs approval. Try again.")}catch(N){m(N instanceof Error?N.message:"Couldn’t add the server.")}}},[a,n,s.name,r]),u=Be(s.name),l=Ws(s,u),j=l!==null,v=u.rawName!==u.displayName,b=s.error!==void 0,k=j||v||b;return r?e.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(me,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Add “",u.displayName,"” to ",t,"?"]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:mn({displayName:u.displayName,scope:l,pluginName:u.pluginName})})]})]}),d&&e.jsx("p",{className:"text-destructive text-xs",children:d}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>o(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),e.jsx(x,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):e.jsx(qe,{displayName:u.displayName,rawName:s.name,scope:l,pluginName:u.pluginName,status:un(s),sentence:Js(l,u.pluginName),managed:!1,actions:i?e.jsxs(e.Fragment,{children:[e.jsxs(x,{variant:"outline",size:"sm",onClick:f,disabled:a.isPending,"aria-label":`Add ${s.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?e.jsx(oe,{size:"xs"}):e.jsx(Ae,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),d&&e.jsx("p",{className:"text-destructive text-xs",children:d})]}):void 0,details:k?e.jsx(Ge,{scope:l,pluginName:u.pluginName,rawName:u.rawName,displayName:u.displayName,error:s.error}):void 0})}function pn(s,n){return{agentId:s,name:n.server.name,connection:n.server.connection}}function fn(s){const n=s.sites.filter(t=>!t.expired).map(t=>t.site);return n.length<=3?n.join(", "):`${n.slice(0,3).join(", ")} and ${n.length-3} more`}function xn({agentId:s,agentLabel:n}){const t=os(),i=_e(),[a,r]=c.useState(null),[o,d]=c.useState(null),m=c.useCallback(async l=>{if(t.data){d(null);try{const j=await i.mutateAsync({input:pn(s,t.data),...l?{approval:l}:{}});j.status!=="approval_required"?r(null):l?d("The browser still needs approval. Try again."):r(j.approval)}catch(j){d(j instanceof Error?j.message:"Couldn’t add the browser.")}}},[i,s,t.data]);if(!t.data)return null;const f=t.data,p=fn(f),u=`${f.loginCommand} <site>`;return e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[a?e.jsx(me,{className:"mt-0.5 size-4 shrink-0 text-amber-500"}):e.jsx(ls,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:a?`Confirm the signed-in browser for ${n}`:"Signed-in browser"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:a?"This command runs on your machine whenever the agent starts a session. Each session gets its own browser, so agents working at the same time never share one.":"A web browser that starts signed in to the sites you saved. The agent never sees your passwords."}),f.saved?e.jsxs("p",{className:"text-xs",children:["Signed in to ",p,"."]}):e.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:["No sign-ins saved yet, so it starts signed out. Run"," ",e.jsx("code",{className:"font-mono",children:u}),e.jsx(cs,{value:u,label:"Copy the sign-in command",size:"xs",className:"mx-0.5 inline-flex align-middle"})," ","in a terminal first."]})]})]}),a&&e.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:[f.server.connection.command,...f.server.connection.args].join(" ")}),o&&e.jsx("p",{className:"text-destructive text-xs",children:o}),e.jsxs("div",{className:"flex justify-end gap-2",children:[a&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),e.jsx(x,{variant:a?"default":"outline",size:"sm",onClick:()=>void m(a??void 0),disabled:i.isPending,className:"focus-visible:ring-2",children:i.isPending?"Adding…":a?"Confirm & add":"Give it the browser"})]})]})})}const vn={codex:["stdio","http"],opencode:["stdio","http"]};function Se(s){return vn[s]??ks}function jn(){const{open:s}=us();return e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Want other apps to use DorkOS as an MCP server instead? That is the other direction."," ",e.jsx(x,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>s("tools","external-mcp"),children:"See Settings → Tools"})]})}function bn({agent:s,projectPath:n}){var Y;const t=ds(s.id),i=js(n,s.runtime),a=i.data,r=De(s.runtime),o=(r==null?void 0:r.supportsManagedMcpServers)??!0,d=ys(),m=Ss(),f=Ns(),p=Cs(),[u,l]=c.useState({}),[j,v]=c.useState(null),[b,k]=c.useState(null),N=Ls(),z=c.useCallback((h,y)=>{(y?d:m).mutate({agentId:s.id,name:h})},[s.id,d,m]),C=c.useCallback(h=>{f.mutate({agentId:s.id,name:h}),l(y=>{const w={...y};return delete w[h],w})},[s.id,f]),E=c.useCallback(async h=>{v(h);try{const y=await p.mutateAsync({agentId:s.id,name:h});l(w=>({...w,[h]:{result:y,at:Date.now()}}))}finally{v(null)}},[s.id,p]),P=c.useCallback(({name:h,transport:y})=>{k(h),y!=="stdio"&&E(h).catch(()=>{})},[E]),T=t.data??[],R=new Set(T.map(h=>h.name)),I=new Map(((a==null?void 0:a.servers)??[]).map(h=>[h.name,h])),A=((a==null?void 0:a.servers)??[]).filter(h=>!R.has(h.name)),F=d.isPending||m.isPending||f.isPending,ae=T.some(h=>vs(h.connection)!==void 0),V=o&&!t.isPending&&!ae&&Se(s.runtime).includes("stdio"),$=new Map;T.forEach((h,y)=>$.set(h.name,{kind:"managed",index:y})),A.forEach((h,y)=>$.set(h.name,{kind:"discovered",index:y}));const Q=N({bothSettled:!t.isPending&&!i.isPending,managed:T,live:I,discovered:A,present:[...T.map(h=>h.name),...A.map(h=>h.name)]});function B(h){const y=$.get(h);if(!y)return null;if(y.kind==="managed"){const D=T[y.index];return e.jsx(dn,{server:D,agentId:s.id,live:I.get(D.name),testResult:u[D.name],rosterUpdatedAt:t.dataUpdatedAt,testing:j===D.name,busy:F,onToggle:z,onTest:E,onRemove:C},D.name)}const w=A[y.index];return e.jsx(gn,{entry:w,agentId:s.id,agentLabel:s.displayName??s.name,canImport:o},w.name)}return e.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),o&&e.jsx(Os,{agentId:s.id,agentLabel:s.displayName??s.name,supportedTransports:Se(s.runtime),onAdded:P,oauthDetectedFor:b&&((Y=u[b])==null?void 0:Y.result.needsAuth)===!0?b:null})]}),e.jsx(jn,{}),V&&e.jsx(xn,{agentId:s.id,agentLabel:s.displayName??s.name}),!o&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent’s runtime can’t run DorkOS-managed MCP servers yet. Any servers below show read-only status."}),t.isLoading?e.jsx(O,{children:e.jsxs(M,{className:"space-y-2",children:[e.jsx(ce,{className:"h-5 w-full"}),e.jsx(ce,{className:"h-5 w-3/4"})]})}):t.isError?e.jsx(O,{children:e.jsxs(M,{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),e.jsx(x,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Retry"})]})}):Q.length===0?e.jsx(O,{children:e.jsx(M,{children:e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",o?"Add one to give this agent tools from an external server.":"This runtime can’t run managed servers."]})})}):e.jsx(O,{children:e.jsx(M,{children:Q.map(B)})})]})}function Ce({tools:s}){return e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx(se,{tone:"neutral",variant:"outline",className:"shrink-0 cursor-default font-normal",children:s.length})}),e.jsx(G,{side:"top",className:"max-w-xs",children:e.jsx("p",{className:"font-mono text-xs",children:s.join(", ")})})]})}function Nn({domain:s,agentOverride:n,globalDefault:t,onToggle:i,onReset:a}){const r=n!==void 0,o=n??t;return s.serverDisabled?e.jsx(be,{label:s.label,description:s.description,className:"py-1",children:e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{variant:"secondary",children:"Disabled"}),e.jsx(Ce,{tools:s.tools}),e.jsx(le,{checked:!1,disabled:!0,"aria-label":`Toggle ${s.label} tools`})]})}),e.jsx(G,{side:"left",children:s.serverDisabledReason??"Disabled globally by server configuration."})]})}):e.jsx(be,{label:s.label,description:s.description,className:"py-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[!r&&e.jsx(se,{tone:"neutral",variant:"outline",className:"font-normal",children:"default"}),r&&e.jsxs(U,{children:[e.jsx(q,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>a(s.key),"aria-label":`Reset ${s.label} to default`,children:e.jsx(ps,{className:"size-3"})})}),e.jsx(G,{side:"top",children:"Reset to global default"})]}),e.jsx(Ce,{tools:s.tools}),e.jsx(le,{checked:o,onCheckedChange:d=>i(s.key,d),"aria-label":`Toggle ${s.label} tools`})]})})}const yn=["tasks","relay","mesh","adapter"];function we(s){const n={};for(const t of yn)(s==null?void 0:s[t])!==void 0&&(n[t]=s[t]);return n}function Sn({agent:s}){const n=Pe(),t=te(),i=s.tierCeiling??fs,a=c.useCallback(r=>{n.mutate({id:s.id,updates:{tierCeiling:r}},{onSettled:()=>{t.invalidateQueries({queryKey:ue.all}),t.invalidateQueries({queryKey:ze})}})},[s.id,t,n]);return e.jsx(O,{children:e.jsxs(M,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"The most this agent can ever do"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Anything past this line is refused, and no approval can unlock it. Use it when you want an agent that reads your work but can never take anything away."})]}),e.jsxs(Oe,{value:i,onValueChange:a,disabled:n.isPending,children:[e.jsx(Me,{className:"w-56","aria-label":"The most this agent can ever do",children:e.jsx(Ee,{})}),e.jsxs(Re,{children:[e.jsx(X,{value:"observe",children:"Read only"}),e.jsx(X,{value:"act",children:"Change things, never delete"}),e.jsx(X,{value:"destructive",children:"No extra limit"})]})]})]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Every agent starts with no extra limit, so nothing you already run changes until you set one here. An agent can tighten its own limit; only you can loosen it."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"This covers what the agent asks DorkOS to do. An agent that can run terminal commands can still act outside DorkOS. Turn on Require login, in Settings under Access, to close that door too."})]})})}function Cn({agent:s,projectPath:n}){const t=ms(),i=hs(),{config:a}=gs(),r=Pe(),o=te(),d=De(s.runtime),m=(d==null?void 0:d.supportsMcp)??!0,f=c.useCallback(v=>{r.mutate({id:s.id,updates:{enabledToolGroups:v}},{onSettled:()=>{o.invalidateQueries({queryKey:ue.all}),o.invalidateQueries({queryKey:ze})}})},[s.id,o,r]),p=c.useCallback((v,b)=>{f({...we(s.enabledToolGroups),[v]:b})},[s.enabledToolGroups,f]),u=c.useCallback(v=>{const b=we(s.enabledToolGroups);delete b[v],f(b)},[s.enabledToolGroups,f]),l=[{key:"tasks",configKey:"tasksTools",label:"Scheduling",description:"Create and run scheduled tasks",tools:J("tasks"),serverDisabled:!i,serverDisabledReason:"Disabled globally by server configuration."},{key:"relay",configKey:"relayTools",label:"Messaging",description:"Send and receive messages between agents",tools:J("relay"),serverDisabled:!t,serverDisabledReason:"Disabled globally by server configuration."},{key:"mesh",configKey:"meshTools",label:"Agent discovery",description:"Find and register agents on this machine",tools:J("mesh")},{key:"adapter",configKey:"adapterTools",label:"Connection management",description:"Set up Telegram, Slack, and webhooks, and route each chat to an agent",tools:J("adapter"),serverDisabled:!t,serverDisabledReason:"Disabled globally by server configuration."}],j=s.enabledToolGroups??{};return e.jsxs("div",{className:"space-y-4",children:[m?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Choose which tool groups this agent is told about. Turn a group off and the agent stops being told those tools exist, so it stops reaching for them. This is guidance, not a lock: an agent that asks for one anyway still gets it. Leave a group unset to inherit the global default."}),e.jsx(O,{children:e.jsx(M,{children:l.map(v=>e.jsx(Nn,{domain:v,agentOverride:j[v.key],globalDefault:a[v.configKey],onToggle:p,onReset:u},v.key))})}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Core tools (ping, server info, agent identity) are always registered, whatever you set here."})]}):e.jsx(O,{children:e.jsx(M,{children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s runtime does not support DorkOS tool groups (Scheduling, Messaging, Agent discovery, Connection management). These are delivered over MCP, which this runtime cannot consume."})})}),e.jsx(Sn,{agent:s}),e.jsx(bn,{agent:s,projectPath:n})]})}function An({member:s}){const{agent:n,projectPath:t,isPending:i}=xs(s);return i?e.jsx(ce,{className:"h-32 w-full"}):!n||t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s tools."}):e.jsx(Cn,{agent:n,projectPath:t})}export{An as ToolsPage};
@@ -1,4 +1,4 @@
1
- import{e0 as PRn,gS as ORn,gA as NRn,r as on,j as de,gn as Kan,g2 as $Rn,gT as DRn,gU as LRn,gV as _Rn,J as MN,cl as A2e,B as Wan,gW as Van,ag as r2,eU as M2e,aC as C2e,aB as FRn,aa as jN,gX as wK,P as RRn,dr as e2e,dq as BRn,gY as JRn,X as GRn,gZ as HRn,g_ as qRn,g$ as Fhn,dk as zRn,h0 as URn,h1 as XRn,ek as KRn,h2 as WRn,h3 as VRn,dP as QRn,h4 as YRn,dQ as ZRn,dS as eBn,dT as nBn,bd as VX,fI as tBn,aA as Rhn,a7 as iBn,h5 as rBn,f5 as cBn,fU as uBn,dX as oBn,dC as sBn,dD as fBn,dE as lBn,dF as hBn,dG as aBn,dH as dBn,dI as bBn,dJ as wBn}from"./index-DDXrdlj0.js";/**
1
+ import{e3 as PRn,gT as ORn,gB as NRn,r as on,j as de,go as Kan,g3 as $Rn,gU as DRn,gV as LRn,gW as _Rn,N as MN,co as A2e,B as Wan,gX as Van,aj as r2,eW as M2e,aF as C2e,aE as FRn,Z as jN,gY as wK,P as RRn,du as e2e,dt as BRn,gZ as JRn,X as GRn,g_ as HRn,g$ as qRn,h0 as Fhn,dn as zRn,h1 as URn,h2 as XRn,en as KRn,h3 as WRn,h4 as VRn,dS as QRn,h5 as YRn,dT as ZRn,dV as eBn,dW as nBn,bg as VX,fK as tBn,aD as Rhn,V as iBn,h6 as rBn,f7 as cBn,fW as uBn,d_ as oBn,dF as sBn,dG as fBn,dH as lBn,dI as hBn,dJ as aBn,dK as dBn,dL as bBn,dM as wBn}from"./index-BMR65QI4.js";/**
2
2
  * @license lucide-react v1.44.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{o as t,_ as c,m as a,n as l,s as e,q as s,v as m}from"./index-DDXrdlj0.js";function S(o){if(o.transport!=="stdio"||!o.args)return;const r=o.args;if(!r.some(i=>i.startsWith("@playwright/mcp")))return;const g=r.indexOf("--storage-state");if(g!==-1)return r[g+1];const n=r.find(i=>i.startsWith("--storage-state="));return n==null?void 0:n.slice(16)}const u=t({name:e(),value:e(),domain:e(),path:e(),expires:l(),httpOnly:a(),secure:a(),sameSite:c(["Strict","Lax","None"])}).passthrough(),h=t({origin:e(),localStorage:s(t({name:e(),value:e()}))}).passthrough();t({cookies:s(u),origins:s(h).default([])}).passthrough();const d=t({site:e(),cookies:l().int(),expiresAt:e().nullable(),expired:a(),pageStorage:a()});t({stateFile:e(),saved:a(),savedAt:e().nullable(),sites:s(d),loginCommand:e(),server:t({name:e(),connection:t({transport:m("stdio"),command:e(),args:s(e()),env:t({}).catchall(e())})})});export{S as a};
1
+ import{q as t,_ as c,s as a,v as l,w as e,x as s,y as m}from"./index-BMR65QI4.js";function S(o){if(o.transport!=="stdio"||!o.args)return;const r=o.args;if(!r.some(i=>i.startsWith("@playwright/mcp")))return;const g=r.indexOf("--storage-state");if(g!==-1)return r[g+1];const n=r.find(i=>i.startsWith("--storage-state="));return n==null?void 0:n.slice(16)}const u=t({name:e(),value:e(),domain:e(),path:e(),expires:l(),httpOnly:a(),secure:a(),sameSite:c(["Strict","Lax","None"])}).passthrough(),h=t({origin:e(),localStorage:s(t({name:e(),value:e()}))}).passthrough();t({cookies:s(u),origins:s(h).default([])}).passthrough();const d=t({site:e(),cookies:l().int(),expiresAt:e().nullable(),expired:a(),pageStorage:a()});t({stateFile:e(),saved:a(),savedAt:e().nullable(),sites:s(d),loginCommand:e(),server:t({name:e(),connection:t({transport:m("stdio"),command:e(),args:s(e()),env:t({}).catchall(e())})})});export{S as a};
@@ -1 +1 @@
1
- import{r,S as d,E as p,j as E,c as f}from"./index-DDXrdlj0.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"./index-BMR65QI4.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 +1 @@
1
- import{L as G,E as A,C as N}from"./index-nEQI8fB2.js";import{s as I,t as p,E as Y,e as k,j,a as U,L as Z,i as B,f as D,O as M}from"./index-B3P6TTvD.js";import"./index-DDXrdlj0.js";const h=1,F=2,L=3,K=4,H=5,J=36,ee=37,te=38,Oe=11,oe=13;function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ne(e){return e==9||e==10||e==13||e==32}let Q=null,V=null,X=0;function W(e,t){let o=e.pos+t;if(V==e&&X==o)return Q;for(;ne(e.peek(t));)t++;let O="";for(;;){let r=e.peek(t);if(!re(r))break;O+=String.fromCharCode(r),t++}return V=e,X=o,Q=O||null}function _(e,t){this.name=e,this.parent=t}const ae=new N({start:null,shift(e,t,o,O){return t==h?new _(W(O,1)||"",e):e},reduce(e,t){return t==Oe&&e?e.parent:e},reuse(e,t,o,O){let r=t.type.id;return r==h||r==oe?new _(W(O,1)||"",e):e},strict:!1}),le=new A((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let o=W(e,0);if(!o)return e.acceptToken(H);if(t.context&&o==t.context.name)return e.acceptToken(F);for(let O=t.context;O;O=O.parent)if(O.name==o)return e.acceptToken(L,-2);e.acceptToken(K)}else if(e.next!=33&&e.next!=63)return e.acceptToken(h)}},{contextual:!0});function y(e,t){return new A(o=>{let O=0,r=t.charCodeAt(0);e:for(;!(o.next<0);o.advance(),O++)if(o.next==r){for(let a=1;a<t.length;a++)if(o.peek(a)!=t.charCodeAt(a))continue e;break}O&&o.acceptToken(e)})}const se=y(J,"-->"),ie=y(ee,"?>"),ce=y(te,"]]>"),me=I({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),$e=G.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tO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OWWOXWOyPO!QTO!SUO~ORdO~P!SOteO!PgO~OuhO!RjO~O^lOz^O~OvZOxoO~O^qOz^O~O[vO`sOdwOz^O~ORyO~P!SO^{Oz^O~OteO!P}O~OuhO!R!PO~O^!QOz^O~O[!SOz^O~O[!VO`sOd!WOz^O~Oa!YOz^O~Oz^O[mX`mXdmX~O[!VO`sOd!WO~O^!]Oz^O~O[!_Oz^O~O[!aOz^O~O[!cO`sOd!dOz^O~O[!cO`sOd!dO~Oa!eOz^O~Oz^O{!gO}!hO~Oz^O[ma`madma~O[!kOz^O~O[!lOz^O~O[!mO`sOd!nO~OW!qOX!qO{!sO|!qO~OW!tOX!tO}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:ae,nodeProps:[["closedBy",1,"SelfCloseEndTag EndTag",13,"CloseTag MissingCloseTag"],["openedBy",12,"StartTag StartCloseTag",19,"OpenTag",20,"StartTag"],["isolate",-6,13,18,19,21,22,24,""]],propSources:[me],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$q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W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$qk!'aZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_#P$q#P#Q!(S#Q;'S$q;'S;=`)c<%lO$qk!(]ZVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_!`$q!`!a!)O!a;'S$q;'S;=`)c<%lO$qk!)ZXxQVP|W!O`Or$qrs%gsv$qwx'^x!^$q!^!_(o!_;'S$q;'S;=`)c<%lO$q",tokenizers:[le,se,ie,ce,0,1,2,3,4],topRules:{Document:[0,6]},tokenPrec:0});function T(e,t){let o=t&&t.getChild("TagName");return o?e.sliceString(o.from,o.to):""}function P(e,t){let o=t&&t.firstChild;return!o||o.name!="OpenTag"?"":T(e,o)}function Se(e,t,o){let O=t&&t.getChildren("Attribute").find(a=>a.from<=o&&a.to>=o),r=O&&O.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}function C(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function ge(e,t){var o;let O=k(e).resolveInner(t,-1),r=null;for(let a=O;!r&&a.parent;a=a.parent)(a.name=="OpenTag"||a.name=="CloseTag"||a.name=="SelfClosingTag"||a.name=="MismatchedCloseTag")&&(r=a);if(r&&(r.to>t||r.lastChild.type.isError)){let a=r.parent;if(O.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:a}:{type:"openTag",from:O.from,context:C(a)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:r};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:r};let s=O==r||O.name=="Attribute"?O.childBefore(t):O;return(s==null?void 0:s.name)=="StartTag"?{type:"openTag",from:t,context:C(a)}:(s==null?void 0:s.name)=="StartCloseTag"&&s.to<=t?{type:"closeTag",from:t,context:a}:(s==null?void 0:s.name)=="Is"?{type:"attrValue",from:t,context:r}:s?{type:"attrName",from:t,context:r}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((o=O.lastChild)===null||o===void 0)&&o.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:C(O)}:null}class ue{constructor(t,o,O){this.attrs=o,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(r=>({label:r,type:"text"})):[]}}const b=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function R(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let o=[],O=[],r=Object.create(null);for(let n of t){let $=E(n);o.push($),n.global&&O.push($),n.values&&(r[n.name]=n.values.map(R))}let a=[],s=[],f=Object.create(null);for(let n of e){let $=O,c=r;n.attributes&&($=$.concat(n.attributes.map(l=>typeof l=="string"?o.find(d=>d.label==l)||{label:l,type:"property"}:(l.values&&(c==r&&(c=Object.create(c)),c[l.name]=l.values.map(R)),E(l)))));let u=new ue(n,$,c);f[u.name]=u,a.push(u),n.top&&s.push(u)}s.length||(s=a);for(let n=0;n<a.length;n++){let $=e[n],c=a[n];if($.children)for(let u of $.children)f[u]&&c.children.push(f[u]);else c.children=a}return n=>{var $;let{doc:c}=n.state,u=ge(n.state,n.pos);if(!u||u.type=="tag"&&!n.explicit)return null;let{type:l,from:d,context:S}=u;if(l=="openTag"){let i=s,m=P(c,S);if(m){let g=f[m];i=(g==null?void 0:g.children)||a}return{from:d,options:i.map(g=>g.completion),validFor:b}}else if(l=="closeTag"){let i=P(c,S);return i?{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)==">"?1:0),options:[(($=f[i])===null||$===void 0?void 0:$.closeNameCompletion)||{label:i+">",type:"type"}],validFor:b}:null}else if(l=="attrName"){let i=f[T(c,S)];return{from:d,options:(i==null?void 0:i.attrs)||O,validFor:b}}else if(l=="attrValue"){let i=Se(c,S,d);if(!i)return null;let m=f[T(c,S)],g=((m==null?void 0:m.attrValues)||r)[i];return!g||!g.length?null:{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)=='"'?1:0),options:g,validFor:/^"[^"]*"?$/}}else if(l=="tag"){let i=P(c,S),m=f[i],g=[],q=S&&S.lastChild;i&&(!q||q.name!="CloseTag"||T(c,q)!=i)&&g.push(m?m.closeCompletion:{label:"</"+i+">",type:"type",boost:2});let v=g.concat(((m==null?void 0:m.children)||(S?a:s)).map(x=>x.openCompletion));if(S&&(m!=null&&m.text.length)){let x=S.firstChild;x.to>n.pos-20&&!/\S/.test(n.state.sliceDoc(x.to,n.pos))&&(v=v.concat(m.text))}return{from:d,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const w=Z.define({name:"xml",parser:$e.configure({props:[B.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),D.add({Element(e){let t=e.firstChild,o=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:o.name=="CloseTag"?o.from:e.to}}}),M.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function Te(e={}){let t=[w.data.of({autocomplete:pe(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(fe),new U(w,t)}function z(e,t,o=e.length){if(!t)return"";let O=t.firstChild,r=O&&O.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,o)):""}const fe=Y.inputHandler.of((e,t,o,O,r)=>{if(e.composing||e.state.readOnly||t!=o||O!=">"&&O!="/"||!w.isActiveAt(e.state,t,-1))return!1;let a=r(),{state:s}=a,f=s.changeByRange(n=>{var $,c,u;let{head:l}=n,d=s.doc.sliceString(l-1,l)==O,S=k(s).resolveInner(l,-1),i;if(d&&O==">"&&S.name=="EndTag"){let m=S.parent;if(((c=($=m.parent)===null||$===void 0?void 0:$.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(i=z(s.doc,m.parent,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`</${i}>`;return{range:n,changes:{from:l,to:g,insert:q}}}}else if(d&&O=="/"&&S.name=="StartCloseTag"){let m=S.parent;if(S.from==l-2&&((u=m.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(i=z(s.doc,m,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`${i}>`;return{range:j.cursor(l+q.length,-1),changes:{from:l,to:g,insert:q}}}}return{range:n}});return f.changes.empty?!1:(e.dispatch([a,s.update(f,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{fe as autoCloseTags,pe as completeFromSchema,Te as xml,w as xmlLanguage};
1
+ import{L as G,E as A,C as N}from"./index-Ck1VEXu0.js";import{s as I,t as p,E as Y,e as k,j,a as U,L as Z,i as B,f as D,O as M}from"./index-oU5xA1N3.js";import"./index-BMR65QI4.js";const h=1,F=2,L=3,K=4,H=5,J=36,ee=37,te=38,Oe=11,oe=13;function re(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}function ne(e){return e==9||e==10||e==13||e==32}let Q=null,V=null,X=0;function W(e,t){let o=e.pos+t;if(V==e&&X==o)return Q;for(;ne(e.peek(t));)t++;let O="";for(;;){let r=e.peek(t);if(!re(r))break;O+=String.fromCharCode(r),t++}return V=e,X=o,Q=O||null}function _(e,t){this.name=e,this.parent=t}const ae=new N({start:null,shift(e,t,o,O){return t==h?new _(W(O,1)||"",e):e},reduce(e,t){return t==Oe&&e?e.parent:e},reuse(e,t,o,O){let r=t.type.id;return r==h||r==oe?new _(W(O,1)||"",e):e},strict:!1}),le=new A((e,t)=>{if(e.next==60){if(e.advance(),e.next==47){e.advance();let o=W(e,0);if(!o)return e.acceptToken(H);if(t.context&&o==t.context.name)return e.acceptToken(F);for(let O=t.context;O;O=O.parent)if(O.name==o)return e.acceptToken(L,-2);e.acceptToken(K)}else if(e.next!=33&&e.next!=63)return e.acceptToken(h)}},{contextual:!0});function y(e,t){return new A(o=>{let O=0,r=t.charCodeAt(0);e:for(;!(o.next<0);o.advance(),O++)if(o.next==r){for(let a=1;a<t.length;a++)if(o.peek(a)!=t.charCodeAt(a))continue e;break}O&&o.acceptToken(e)})}const se=y(J,"-->"),ie=y(ee,"?>"),ce=y(te,"]]>"),me=I({Text:p.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,AttributeValue:p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta,Cdata:p.special(p.string)}),$e=G.deserialize({version:14,states:",lOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DT'#DTOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C|'#C|O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C}'#C}O$dOrO,59^OOOP,59^,59^OOOS'#DO'#DOO$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dO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}!sO!O!tO~O[!vOz^O~OW!qOX!qO{!yO|!qO~OW!tOX!tO}!yO!O!tO~O",goto:"%cxPPPPPPPPPPyyP!PP!VPP!`!jP!pyyyP!v!|#S$[$k$q$w$}%TPPPP%ZXWORYbXRORYb_t`qru!T!U!bQ!i!YS!p!e!fR!w!oQdRRybXSORYbQYORmYQ[PRn[Q_QQkVjp_krz!R!T!X!Z!^!`!f!j!oQr`QzcQ!RlQ!TqQ!XsQ!ZtQ!^{Q!`!QQ!f!YQ!j!]R!o!eQu`S!UqrU![u!U!bR!b!TQ!r!gR!x!rQ!u!hR!z!uQbRRxbQfTR|fQiUR!OiSXOYTaRb",nodeNames:"⚠ StartTag StartCloseTag MissingCloseTag StartCloseTag StartCloseTag Document Text EntityReference CharacterReference Cdata Element EndTag OpenTag TagName Attribute AttributeName Is AttributeValue CloseTag SelfCloseEndTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag DoctypeDecl",maxTerm:50,context:ae,nodeProps:[["closedBy",1,"SelfCloseEndTag EndTag",13,"CloseTag MissingCloseTag"],["openedBy",12,"StartTag StartCloseTag",19,"OpenTag",20,"StartTag"],["isolate",-6,13,18,19,21,22,24,""]],propSources:[me],skippedNodes:[0],repeatNodeCount:9,tokenData:"!)v~R!YOX$qXY)iYZ)iZ]$q]^)i^p$qpq)iqr$qrs*vsv$qvw+fwx/ix}$q}!O0[!O!P$q!P!Q2z!Q![$q![!]4n!]!^$q!^!_8U!_!`!#t!`!a!$l!a!b!%d!b!c$q!c!}4n!}#P$q#P#Q!'W#Q#R$q#R#S4n#S#T$q#T#o4n#o%W$q%W%o4n%o%p$q%p&a4n&a&b$q&b1p4n1p4U$q4U4d4n4d4e$q4e$IS4n$IS$I`$q$I`$Ib4n$Ib$Kh$q$Kh%#t4n%#t&/x$q&/x&Et4n&Et&FV$q&FV;'S4n;'S;:j8O;:j;=`)c<%l?&r$q?&r?Ah4n?Ah?BY$q?BY?Mn4n?MnO$qi$zXVP|W!O`Or$qrs%gsv$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e.sliceString(o.from,o.to):""}function P(e,t){let o=t&&t.firstChild;return!o||o.name!="OpenTag"?"":T(e,o)}function Se(e,t,o){let O=t&&t.getChildren("Attribute").find(a=>a.from<=o&&a.to>=o),r=O&&O.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}function C(e){for(let t=e&&e.parent;t;t=t.parent)if(t.name=="Element")return t;return null}function ge(e,t){var o;let O=k(e).resolveInner(t,-1),r=null;for(let a=O;!r&&a.parent;a=a.parent)(a.name=="OpenTag"||a.name=="CloseTag"||a.name=="SelfClosingTag"||a.name=="MismatchedCloseTag")&&(r=a);if(r&&(r.to>t||r.lastChild.type.isError)){let a=r.parent;if(O.name=="TagName")return r.name=="CloseTag"||r.name=="MismatchedCloseTag"?{type:"closeTag",from:O.from,context:a}:{type:"openTag",from:O.from,context:C(a)};if(O.name=="AttributeName")return{type:"attrName",from:O.from,context:r};if(O.name=="AttributeValue")return{type:"attrValue",from:O.from,context:r};let s=O==r||O.name=="Attribute"?O.childBefore(t):O;return(s==null?void 0:s.name)=="StartTag"?{type:"openTag",from:t,context:C(a)}:(s==null?void 0:s.name)=="StartCloseTag"&&s.to<=t?{type:"closeTag",from:t,context:a}:(s==null?void 0:s.name)=="Is"?{type:"attrValue",from:t,context:r}:s?{type:"attrName",from:t,context:r}:null}else if(O.name=="StartCloseTag")return{type:"closeTag",from:t,context:O.parent};for(;O.parent&&O.to==t&&!(!((o=O.lastChild)===null||o===void 0)&&o.type.isError);)O=O.parent;return O.name=="Element"||O.name=="Text"||O.name=="Document"?{type:"tag",from:t,context:O.name=="Element"?O:C(O)}:null}class ue{constructor(t,o,O){this.attrs=o,this.attrValues=O,this.children=[],this.name=t.name,this.completion=Object.assign(Object.assign({type:"type"},t.completion||{}),{label:this.name}),this.openCompletion=Object.assign(Object.assign({},this.completion),{label:"<"+this.name}),this.closeCompletion=Object.assign(Object.assign({},this.completion),{label:"</"+this.name+">",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=t.textContent?t.textContent.map(r=>({label:r,type:"text"})):[]}}const b=/^[:\-\.\w\u00b7-\uffff]*$/;function E(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function R(e){return typeof e=="string"?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function pe(e,t){let o=[],O=[],r=Object.create(null);for(let n of t){let $=E(n);o.push($),n.global&&O.push($),n.values&&(r[n.name]=n.values.map(R))}let a=[],s=[],f=Object.create(null);for(let n of e){let $=O,c=r;n.attributes&&($=$.concat(n.attributes.map(l=>typeof l=="string"?o.find(d=>d.label==l)||{label:l,type:"property"}:(l.values&&(c==r&&(c=Object.create(c)),c[l.name]=l.values.map(R)),E(l)))));let u=new ue(n,$,c);f[u.name]=u,a.push(u),n.top&&s.push(u)}s.length||(s=a);for(let n=0;n<a.length;n++){let $=e[n],c=a[n];if($.children)for(let u of $.children)f[u]&&c.children.push(f[u]);else c.children=a}return n=>{var $;let{doc:c}=n.state,u=ge(n.state,n.pos);if(!u||u.type=="tag"&&!n.explicit)return null;let{type:l,from:d,context:S}=u;if(l=="openTag"){let i=s,m=P(c,S);if(m){let g=f[m];i=(g==null?void 0:g.children)||a}return{from:d,options:i.map(g=>g.completion),validFor:b}}else if(l=="closeTag"){let i=P(c,S);return i?{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)==">"?1:0),options:[(($=f[i])===null||$===void 0?void 0:$.closeNameCompletion)||{label:i+">",type:"type"}],validFor:b}:null}else if(l=="attrName"){let i=f[T(c,S)];return{from:d,options:(i==null?void 0:i.attrs)||O,validFor:b}}else if(l=="attrValue"){let i=Se(c,S,d);if(!i)return null;let m=f[T(c,S)],g=((m==null?void 0:m.attrValues)||r)[i];return!g||!g.length?null:{from:d,to:n.pos+(c.sliceString(n.pos,n.pos+1)=='"'?1:0),options:g,validFor:/^"[^"]*"?$/}}else if(l=="tag"){let i=P(c,S),m=f[i],g=[],q=S&&S.lastChild;i&&(!q||q.name!="CloseTag"||T(c,q)!=i)&&g.push(m?m.closeCompletion:{label:"</"+i+">",type:"type",boost:2});let v=g.concat(((m==null?void 0:m.children)||(S?a:s)).map(x=>x.openCompletion));if(S&&(m!=null&&m.text.length)){let x=S.firstChild;x.to>n.pos-20&&!/\S/.test(n.state.sliceDoc(x.to,n.pos))&&(v=v.concat(m.text))}return{from:d,options:v,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}else return null}}const w=Z.define({name:"xml",parser:$e.configure({props:[B.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),D.add({Element(e){let t=e.firstChild,o=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:o.name=="CloseTag"?o.from:e.to}}}),M.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/$/}});function Te(e={}){let t=[w.data.of({autocomplete:pe(e.elements||[],e.attributes||[])})];return e.autoCloseTags!==!1&&t.push(fe),new U(w,t)}function z(e,t,o=e.length){if(!t)return"";let O=t.firstChild,r=O&&O.getChild("TagName");return r?e.sliceString(r.from,Math.min(r.to,o)):""}const fe=Y.inputHandler.of((e,t,o,O,r)=>{if(e.composing||e.state.readOnly||t!=o||O!=">"&&O!="/"||!w.isActiveAt(e.state,t,-1))return!1;let a=r(),{state:s}=a,f=s.changeByRange(n=>{var $,c,u;let{head:l}=n,d=s.doc.sliceString(l-1,l)==O,S=k(s).resolveInner(l,-1),i;if(d&&O==">"&&S.name=="EndTag"){let m=S.parent;if(((c=($=m.parent)===null||$===void 0?void 0:$.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(i=z(s.doc,m.parent,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`</${i}>`;return{range:n,changes:{from:l,to:g,insert:q}}}}else if(d&&O=="/"&&S.name=="StartCloseTag"){let m=S.parent;if(S.from==l-2&&((u=m.lastChild)===null||u===void 0?void 0:u.name)!="CloseTag"&&(i=z(s.doc,m,l))){let g=l+(s.doc.sliceString(l,l+1)===">"?1:0),q=`${i}>`;return{range:j.cursor(l+q.length,-1),changes:{from:l,to:g,insert:q}}}}return{range:n}});return f.changes.empty?!1:(e.dispatch([a,s.update(f,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});export{fe as autoCloseTags,pe as completeFromSchema,Te as xml,w as xmlLanguage};
@@ -1 +1 @@
1
- import{j as e,b0 as C,b1 as M,a as i,b2 as R,b3 as I,ac as u,b4 as L,b5 as O,b6 as z,b7 as F,b8 as v,r,b9 as q,ba as T,bb as U,bc as _,bd as K,be as V,bf as $,bg as B}from"./index-DDXrdlj0.js";import{bh as Z,bi as ee,bj as se,bk as te,bl as ne,bm as ae,bn as le,bo as oe,bp as re,bq as ie,br as ce,bs as de,bt as ue}from"./index-DDXrdlj0.js";function G(){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[e.jsx("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:e.jsx(C,{className:"text-muted-foreground size-5"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"No agent selected"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Select an agent to view its profile."})]})]})}function H({agentPath:s}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[e.jsx("div",{className:"bg-destructive/10 flex size-12 items-center justify-center rounded-full",children:e.jsx(M,{className:"text-destructive size-5"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Agent not found"}),e.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"The agent at this path could not be loaded."})]})]})}function J(){return e.jsxs("div",{"data-slot":"profile-dock-skeleton",className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 pt-6 pb-4",children:[e.jsx(i,{className:"size-16 rounded-full"}),e.jsx(i,{className:"mt-1 h-4 w-28 rounded"}),e.jsx(i,{className:"h-3 w-16 rounded"}),e.jsx(i,{className:"h-3 w-36 rounded"})]}),e.jsx("div",{className:"space-y-2 px-4",children:["w-full","w-full","w-full"].map((s,f)=>e.jsx(i,{className:`h-8 ${s} rounded`},f))})]})}function W(){var N;const s=R(),f=I(),b=u(t=>t.rightPanelOpen),S=L(),c=O(s??void 0),p=z({enabled:c!==void 0}),l=(N=p.data)==null?void 0:N.members,D=c===void 0||l==null?void 0:l.find(t=>t.id===c),x=S.isFetched&&(c===void 0||p.isFetched),n=D??null,g=F(s),d=v(t=>t.setDockedEntries),m=v(t=>t.clearDockedStacks),E=u(t=>t.setRightPanelOpen),j=u(t=>t.releaseRightPanelRequest),[w,h]=r.useState(!1),a=r.useMemo(()=>n?q(n.id,[...g]):null,[n,g]),P=a===null?null:T(a),o=(P===(n==null?void 0:n.id)?n:l==null?void 0:l.find(t=>t.id===P))??n,y=r.useCallback(t=>{!s||!a||d(s,U(a,t).entries)},[s,a,d]),A=r.useCallback(()=>{!s||!a||d(s,_(a).entries)},[s,a,d]);r.useEffect(()=>{s===null||!x||o!==null||j(s)},[s,x,o,j]);const k=K(o===null?null:{home:"docked",memberId:o.id});return r.useEffect(()=>{if(b)return()=>{if(!u.getState().rightPanelOpen){if(V(k.read()))return h(!0);m()}}},[b,m,k]),s?!n||!a||!o?x?e.jsx(H,{agentPath:s}):e.jsx(J,{}):e.jsxs("div",{"data-slot":"profile-dock",className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx($,{member:o,roster:l??[],home:"docked",inOwnSession:s===f.agentPath&&o.id===n.id,stack:a,onPush:y,onPop:A}),e.jsx(B,{open:w,onKeep:()=>{h(!1),E(!0)},onDiscard:()=>{h(!1),m()}})]}):e.jsx(G,{})}export{Z as AccountMenu,ee as AccountMenuContainer,se as PROFILE_PANEL_ID,W as ProfileDock,te as ProfilePanel,ne as ProfilePanelContainer,ae as ProfileSheet,le as ProfileSheetContainer,$ as ProfileView,oe as handleErrorMessage,re as identityLinkErrorMessage,q as profileStack,ie as useLegacyProfileLinkRedirect,ce as useProfileDockDeepLink,de as useProfileShortcut,v as useProfileStore,ue as useSetIdentityLinkedToMe};
1
+ import{j as e,b3 as C,b4 as M,a as i,b5 as R,b6 as I,af as u,b7 as L,b8 as O,b9 as z,ba as F,bb as v,r,bc as q,bd as T,be as U,bf as _,bg as K,bh as V,bi as $,bj as B}from"./index-BMR65QI4.js";import{bk as Z,bl as ee,bm as se,bn as te,bo as ne,bp as ae,bq as le,br as oe,bs as re,bt as ie,bu as ce,bv as de,bw as ue}from"./index-BMR65QI4.js";function G(){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[e.jsx("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:e.jsx(C,{className:"text-muted-foreground size-5"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"No agent selected"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Select an agent to view its profile."})]})]})}function H({agentPath:s}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[e.jsx("div",{className:"bg-destructive/10 flex size-12 items-center justify-center rounded-full",children:e.jsx(M,{className:"text-destructive size-5"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Agent not found"}),e.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"The agent at this path could not be loaded."})]})]})}function J(){return e.jsxs("div",{"data-slot":"profile-dock-skeleton",className:"flex h-full flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 pt-6 pb-4",children:[e.jsx(i,{className:"size-16 rounded-full"}),e.jsx(i,{className:"mt-1 h-4 w-28 rounded"}),e.jsx(i,{className:"h-3 w-16 rounded"}),e.jsx(i,{className:"h-3 w-36 rounded"})]}),e.jsx("div",{className:"space-y-2 px-4",children:["w-full","w-full","w-full"].map((s,f)=>e.jsx(i,{className:`h-8 ${s} rounded`},f))})]})}function W(){var N;const s=R(),f=I(),b=u(t=>t.rightPanelOpen),S=L(),c=O(s??void 0),p=z({enabled:c!==void 0}),l=(N=p.data)==null?void 0:N.members,D=c===void 0||l==null?void 0:l.find(t=>t.id===c),x=S.isFetched&&(c===void 0||p.isFetched),n=D??null,g=F(s),d=v(t=>t.setDockedEntries),m=v(t=>t.clearDockedStacks),E=u(t=>t.setRightPanelOpen),j=u(t=>t.releaseRightPanelRequest),[w,h]=r.useState(!1),a=r.useMemo(()=>n?q(n.id,[...g]):null,[n,g]),P=a===null?null:T(a),o=(P===(n==null?void 0:n.id)?n:l==null?void 0:l.find(t=>t.id===P))??n,y=r.useCallback(t=>{!s||!a||d(s,U(a,t).entries)},[s,a,d]),A=r.useCallback(()=>{!s||!a||d(s,_(a).entries)},[s,a,d]);r.useEffect(()=>{s===null||!x||o!==null||j(s)},[s,x,o,j]);const k=K(o===null?null:{home:"docked",memberId:o.id});return r.useEffect(()=>{if(b)return()=>{if(!u.getState().rightPanelOpen){if(V(k.read()))return h(!0);m()}}},[b,m,k]),s?!n||!a||!o?x?e.jsx(H,{agentPath:s}):e.jsx(J,{}):e.jsxs("div",{"data-slot":"profile-dock",className:"flex h-full min-h-0 flex-col overflow-hidden",children:[e.jsx($,{member:o,roster:l??[],home:"docked",inOwnSession:s===f.agentPath&&o.id===n.id,stack:a,onPush:y,onPop:A}),e.jsx(B,{open:w,onKeep:()=>{h(!1),E(!0)},onDiscard:()=>{h(!1),m()}})]}):e.jsx(G,{})}export{Z as AccountMenu,ee as AccountMenuContainer,se as PROFILE_PANEL_ID,W as ProfileDock,te as ProfilePanel,ne as ProfilePanelContainer,ae as ProfileSheet,le as ProfileSheetContainer,$ as ProfileView,oe as handleErrorMessage,re as identityLinkErrorMessage,q as profileStack,ie as useLegacyProfileLinkRedirect,ce as useProfileDockDeepLink,de as useProfileShortcut,v as useProfileStore,ue as useSetIdentityLinkedToMe};