dorkos 0.93.0 → 0.95.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.
- package/README.md +1 -1
- package/dist/bin/cli.js +4450 -2445
- package/dist/client/assets/{AboutPage-R35A-Uu-.js → AboutPage-CG2AYFFf.js} +1 -1
- package/dist/client/assets/{AdapterIcon-kPDXiFU1.js → AdapterIcon-CBMQLe9z.js} +1 -1
- package/dist/client/assets/{AppearancePage-COqDtruX.js → AppearancePage-DspUlsTR.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CIKvkn5X.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-huqqF6pu.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-4FX_eaSh.js → BlintzCanvas-C6RZ2Ma8.js} +34 -34
- package/dist/client/assets/{CanvasCsvContent-Dq2X1kUl.js → CanvasCsvContent-B_2SiitK.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-CZUc62IR.js → CanvasFileContent-CzQ4p-Et.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-D1IN_nl9.js → CanvasModel3dContent-ClJWuggg.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-BeEhMSvL.js → CodeMirrorDiff-CCPfe0EW.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BlNLMvbo.js → CodeMirrorEditor-DPx3FVLK.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-s7RnRr1y.js → ConnectionAccessLists-ZIjMb4KK.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-BTTdQBdS.js → ConnectionsPage-BjJkzoDN.js} +3 -3
- package/dist/client/assets/{ConventionPage-CI3PeUHm.js → ConventionPage-D5vfTKHe.js} +1 -1
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-D6OvDT9K.js → FloatingTanStackRouterDevtools-CqogiFob-DNaod9If.js} +1 -1
- package/dist/client/assets/HandlePage-C57WT1ZF.js +1 -0
- package/dist/client/assets/{LexicalField-Bqq5KeUW.js → LexicalField-rxowXJdq.js} +1 -1
- package/dist/client/assets/{ManagesPage-CWdKDvw1.js → ManagesPage-0BFekgi1.js} +1 -1
- package/dist/client/assets/{Model3dViewer-ClJVGLDb.js → Model3dViewer-Czy1kuZW.js} +1 -1
- package/dist/client/assets/NamePage-C-fa4chy.js +1 -0
- package/dist/client/assets/{NotificationsPage-C6tE8iuE.js → NotificationsPage-zXNdi5ED.js} +1 -1
- package/dist/client/assets/{PermissionsPage-BqDl7shN.js → PermissionsPage-BaU8pkuw.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-B3q8QYcS.js → PersonalityPopover-8KiTZkS5.js} +1 -1
- package/dist/client/assets/PhotoPage-DBNYhKBY.js +1 -0
- package/dist/client/assets/{RoomsPage-DwYtOhd7.js → RoomsPage-DAJz2lm6.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-BDPs-RYB.js → RunsOnPopover-6Paa4ED-.js} +1 -1
- package/dist/client/assets/{SessionsPage-Du24E934.js → SessionsPage-CBPMrutR.js} +2 -2
- package/dist/client/assets/{SkillsPage-DjLUEngt.js → SkillsPage-C5EjuSO4.js} +1 -1
- package/dist/client/assets/{TasksPage-B6i3r76o.js → TasksPage-B-v9Yfni.js} +1 -1
- package/dist/client/assets/{ToolsPage-DNoC2MMz.js → ToolsPage-DW-wnHEF.js} +2 -2
- package/dist/client/assets/{TopologyGraph-DtBDaHqX.js → TopologyGraph-BvrMJGBi.js} +17 -17
- package/dist/client/assets/{agent-browser-da9rKrej.js → agent-browser-CNWjB1KM.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DJ5Xz8gv.js → highlighted-body-KPVGNVTW-CUHC5uD6.js} +1 -1
- package/dist/client/assets/{index-BzDP7VXZ.js → index-2SYRmZS_.js} +1 -1
- package/dist/client/assets/{index-Cvzimc0W.js → index-5pfHZhLE.js} +1 -1
- package/dist/client/assets/{index-DwfaFQZo.js → index-BDKfVboN.js} +1 -1
- package/dist/client/assets/{index-LcH-4hgH.js → index-BMFF169T.js} +1 -1
- package/dist/client/assets/{index-BVpHI-1y.js → index-BNDk_Yg-.js} +1 -1
- package/dist/client/assets/{index-DnN4PJaN.js → index-BOdZFetD.js} +1 -1
- package/dist/client/assets/{index-DsH33VjO.js → index-BRHzCdcO.js} +5 -5
- package/dist/client/assets/{index-CJK5Iw50.js → index-BU22tQ_6.js} +1 -1
- package/dist/client/assets/{index-Ca5JlBEc.js → index-Ba27lo1n.js} +1 -1
- package/dist/client/assets/{index-DdsOOmtz.js → index-BdIkR2G_.js} +1 -1
- package/dist/client/assets/{index-C9wgMNj5.js → index-BeRPIaN9.js} +8 -8
- package/dist/client/assets/{index-D1kH8Sr2.js → index-Bf3Hi1vd.js} +2 -2
- package/dist/client/assets/{index-Bp2CiCey.js → index-BorGy4Yi.js} +1 -1
- package/dist/client/assets/{index-CObinYlG.js → index-C1aaKV3U.js} +1 -1
- package/dist/client/assets/{index-DJGEk3-H.js → index-C6TgT2cV.js} +1 -1
- package/dist/client/assets/{index-CZ0BaV1t.js → index-CHcxc12T.js} +1 -1
- package/dist/client/assets/{index-CfUAagLY.js → index-CJ-SARTZ.js} +1 -1
- package/dist/client/assets/{index-CotYqF0w.js → index-CNQ9sgQn.js} +1 -1
- package/dist/client/assets/{index-1o6WO7iZ.js → index-CZuM2Qxl.js} +1 -1
- package/dist/client/assets/{index-Bl2j_xjE.js → index-CaBuRXmp.js} +1 -1
- package/dist/client/assets/{index-BQ-o6bQ0.js → index-CbrQOJ-r.js} +1 -1
- package/dist/client/assets/{index-Bu16-jWo.js → index-ChgU0Tq5.js} +1 -1
- package/dist/client/assets/{index-BnORUrPC.js → index-Ciylp2I7.js} +1 -1
- package/dist/client/assets/{index-B5yJddXH.js → index-DH0nOUQX.js} +1 -1
- package/dist/client/assets/{index-D0sn-ct6.js → index-DNl876ao.js} +1 -1
- package/dist/client/assets/{index-Dyeo69l2.js → index-DaIYCr-9.js} +1 -1
- package/dist/client/assets/{index-gIAwAMkn.js → index-DcdVwTgX.js} +1 -1
- package/dist/client/assets/{index-gHd4-GL-.js → index-DgrlhG9H.js} +1 -1
- package/dist/client/assets/index-DleaJjK-.js +1668 -0
- package/dist/client/assets/{index-3DE2Q3OD.js → index-DpnE5nll.js} +1 -1
- package/dist/client/assets/{index-CQXxVt4A.js → index-DyDsd7_9.js} +1 -1
- package/dist/client/assets/{index-CtJTMcuR.js → index-DzZSPXzN.js} +1 -1
- package/dist/client/assets/{index-DQWAoAN-.js → index-J5dXaon7.js} +1 -1
- package/dist/client/assets/index-XdysNkCU.css +1 -0
- package/dist/client/assets/{index-FsBhOkNr.js → index-iw7zEfsj.js} +1 -1
- package/dist/client/assets/{index-BC9LsNlJ.js → index-lnHJkPRg.js} +1 -1
- package/dist/client/assets/{index-CtlzkOJ3.js → index-m4dRQao_.js} +8 -8
- package/dist/client/assets/{room-files-source-DRQNpCWs.js → room-files-source-JVU1fIeW.js} +3 -3
- package/dist/client/assets/{soul-file-DcQD5pcS.js → soul-file-BQhkHCzH.js} +1 -1
- package/dist/client/assets/{use-personality-commit-Dsy9tqWY.js → use-personality-commit-CC3Q_bi4.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/0136_mirror_timeline_order.sql +23 -0
- package/dist/drizzle/meta/0136_snapshot.json +10232 -0
- package/dist/drizzle/meta/_journal.json +8 -1
- package/dist/server/index.js +8416 -5337
- package/dist/server/index.js.map +2 -2
- package/package.json +11 -11
- package/dist/client/assets/HandlePage-Dvqztr0N.js +0 -1
- package/dist/client/assets/NamePage-BgVZ-KD1.js +0 -1
- package/dist/client/assets/PhotoPage-lt6ZevHW.js +0 -1
- package/dist/client/assets/index-BCGiD7pg.js +0 -1674
- package/dist/client/assets/index-BG-HtbEP.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as E,j as e,cU as ce,cs as de,J as ue,al as b,db as G,dc as J,dd as Y,de as F,df as Z,dg as fe,af as pe,aj as me,dh as xe,di as ee,dj as he,dk as te,dl as ge,dm as be,dn as je,dp as ve,dq as Ne,dr as T,ds as Se,dt as S,du as Ee,dv as se,cW as ye,u as Ce,a as we,dw as ke,dx as Ae,dy as Te,dz as Le,dA as Ie,dB as Pe}from"./index-
|
|
1
|
+
import{r as E,j as e,cU as ce,cs as de,J as ue,al as b,db as G,dc as J,dd as Y,de as F,df as Z,dg as fe,af as pe,aj as me,dh as xe,di as ee,dj as he,dk as te,dl as ge,dm as be,dn as je,dp as ve,dq as Ne,dr as T,ds as Se,dt as S,du as Ee,dv as se,cW as ye,u as Ce,a as we,dw as ke,dx as Ae,dy as Te,dz as Le,dA as Ie,dB as Pe}from"./index-DleaJjK-.js";const $e={duration:.12,ease:"easeOut"},_e={type:"spring",stiffness:320,damping:28};function ae({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:o,className:n,"data-testid":d}){const[f,m]=E.useState(!1),r=a?"set here":`server default · ${l??"none"}`,s=a&&!!i,p=e.jsxs("span",{className:b("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",o?G.warning:G.neutral,s&&"hover:bg-accent hover:text-accent-foreground transition-colors",n),"data-testid":d,children:[o&&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:_e},exit:{opacity:0},transition:$e,children:r},r)})]});return s?e.jsxs(J,{open:f,onOpenChange:m,children:[e.jsx(Y,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${o?`: ${o}`:""}`,children:p})}),e.jsxs(F,{className:"w-64 p-2",align:"start",children:[e.jsx(Z,{children:"Where this value comes from"}),o&&e.jsx("p",{className:b("px-2 pt-1 text-xs",fe.warning),children:o}),e.jsxs("button",{type:"button",onClick:()=>{i(),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":d?`${d}-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"})]})]})]}):o?e.jsx("span",{title:o,"aria-label":`${r}: ${o}`,children:p}):p}const Me=["agents"];function Oe(a){const l=pe(),i=me();return xe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:o=>l.updateMeshAgent(o.id,o.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:Me})}})}const ne="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function k({label:a,valueLabel:l,options:i,selected:o,isSetHere:n,serverDefault:d,warning:f,onSelect:m,onInherit:r,testId:s,showHeader:p=!0,className:y,describedBy:h}){const N=ee(),[g,c]=E.useState(!1);return e.jsxs("div",{className:b("space-y-1",y),children:[p&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ne,children:a}),!N&&e.jsx(ae,{isSetHere:n,serverDefault:d,warning:f,onUseServerDefault:r,"data-testid":`${s}-chip`})]}),e.jsxs(J,{open:g,onOpenChange:c,children:[e.jsx(Y,{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:b("truncate",f?"text-status-warning-fg":n?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(ye,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(F,{className:"w-64 p-1",align:"start",children:[e.jsx(Z,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(u=>e.jsxs("button",{type:"button","data-testid":`${s}-option-${u.value}`,onClick:()=>{m(u.value),c(!1)},className:b("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",u.value===o&&"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:()=>{r(),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:d?`Using server default: ${d}. Tap to restore`:"Use server default: the runtime picks"})]})]})]})}function Ue({agent:a,onUpdate:l,className:i}){var z,B,K,Q,V,W;const o=ee(),{data:n}=he(),{data:d,isPending:f}=te(),m=((z=n==null?void 0:n.executionDefaults)==null?void 0:z.runtime)??"claude-code",r=a.runtime??m,s=(B=n==null?void 0:n.executionDefaults)==null?void 0:B.perRuntime.find(t=>t.runtime===r),{data:p}=ge({runtime:r}),y=a.model!=null,h=a.effort!=null,N=(s==null?void 0:s.model)??null,g=a.model??N,c=g?(p??[]).find(t=>t.value===g):void 0,u=(s==null?void 0:s.supportsEffort)??((K=be(d,r))==null?void 0:K.supportsEffort),L=u===void 0&&f,I=u!==!1,P=c?c.supportsEffort??!1:void 0,C=(Q=n==null?void 0:n.claudeCode)==null?void 0:Q.accounts,{nameFor:$}=je(),x=C==null?void 0:C.flatMap(t=>t.id===null?[]:[{id:t.id,label:$(t.path),path:t.path}]),j=a.account??null,_=j!==null,M=n!=null&&n.claudeCode?$(n.claudeCode.resolvedAccount):null,O=Oe({errorLabel:"Couldn’t change this agent’s account"}),U=E.useCallback(t=>{O.mutate({id:a.id,updates:{account:t}})},[a.id,O]),le=ve({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:m,serverDefaultModel:N,knownModels:Ne(p),knownAccounts:x,accountsUnavailable:(V=n==null?void 0:n.claudeCode)==null?void 0:V.accountsUnavailable,modelSupportsEffort:P,runtimeSupportsEffort:u,runtimeLabel:t=>T(t).label}),v=t=>{var X;return((X=le.breakages.find(ie=>t.includes(ie.kind)))==null?void 0:X.message)??null},w=!L&&I&&P!==!1,H=a.effort??(s==null?void 0:s.effort)??null,D=T(r).label,oe=r==="claude-code"&&x!==void 0&&(x.length>1||_),re=v(["account-unregistered"]),R=(p??[]).some(t=>t.unverified),q=E.useId();return e.jsxs("div",{className:b("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(k,{label:"Model",valueLabel:(c==null?void 0:c.displayName)??g??"Automatic",options:[...(p??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:g,isSetHere:y,serverDefault:(s==null?void 0:s.model)??null,warning:v(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:R?q:void 0}),R&&e.jsx(Se,{id:q})]}),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"}),(!o||!w)&&(h||w)&&e.jsx(ae,{isSetHere:h,serverDefault:s!=null&&s.effort?S(s.effort):null,warning:v(["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?w?e.jsx(k,{label:"Effort",valueLabel:S(H),options:Ee.filter(t=>!(c!=null&&c.supportedEffortLevels)||c.supportedEffortLevels.includes(t)).map(t=>({value:t,label:S(t)})),selected:H,isSetHere:h,serverDefault:s!=null&&s.effort?S(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:v(["effort-unsupported-model"])}):e.jsx(A,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${D}`,warning:v(["effort-unsupported-runtime"])})]}),oe&&e.jsx(k,{label:"Account",valueLabel:j!==null?((W=x==null?void 0:x.find(t=>t.id===j))==null?void 0:W.label)??j:M??"Default account",options:(x??[]).map(t=>({value:t.id,label:t.label,hint:se(t.path)})),selected:j,isSetHere:_,serverDefault:M,warning:re,onSelect:t=>U(t),onInherit:()=>U(null),testId:"agent-account-row",className:"col-span-full"})]})}function A({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const He="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function Re({member:a}){const{agent:l,projectPath:i,isPending:o,update:n}=Ce(a),{data:d}=te();if(o)return e.jsx(we,{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=d?Object.keys(d.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:He,children:"Runtime"}),e.jsxs(ke,{value:l.runtime??"claude-code",onValueChange:r=>n({runtime:r}),children:[e.jsx(Ae,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Te,{})}),e.jsx(Le,{children:m.map(r=>e.jsx(Ie,{value:r,responsive:!1,children:T(r).label},r))})]})]}),e.jsx(Ue,{agent:l,onUpdate:n,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Pe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:se(i)})]})]})}export{Re as RunsOnPopover};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{dT as de,eR as me,eS as xe,af as O,r as x,eT as fe,eU as pe,eV as ge,eW as he,b3 as T,eX as ve,m as je,eY as be,eZ as ye,e_ as Se,dn as _,e$ as Ce,f0 as Ne,f1 as we,f2 as ke,j as e,f3 as Re,f4 as Ae,f5 as Te,f6 as D,ao as V,f7 as Me,cs as Ie,J as R,f8 as Le,f9 as Pe,bs as w,dr as Ee,fa as ze,al as A,fb as B,fc as De,fd as Fe,fe as K,aG as G,ff as U,fg as M,ct as I,cu as L,fh as W,fi as Oe,fj as $,cW as _e,fk as q,fl as Q,cv as P,db as H,fm as Ve,fn as Be,fo as Ke,az as Ge,fp as Ue,aA as We,aB as $e,aC as qe,aD as Qe,fq as He,e as Xe,aj as Ye,fr as Ze,fs as Je,a as et,ft as tt,I as nt,fu as st,fv as at,fw as it,cS as ot}from"./index-
|
|
2
|
-
* @license lucide-react v1.
|
|
1
|
+
import{dT as de,eR as me,eS as xe,af as O,r as x,eT as fe,eU as pe,eV as ge,eW as he,b3 as T,eX as ve,m as je,eY as be,eZ as ye,e_ as Se,dn as _,e$ as Ce,f0 as Ne,f1 as we,f2 as ke,j as e,f3 as Re,f4 as Ae,f5 as Te,f6 as D,ao as V,f7 as Me,cs as Ie,J as R,f8 as Le,f9 as Pe,bs as w,dr as Ee,fa as ze,al as A,fb as B,fc as De,fd as Fe,fe as K,aG as G,ff as U,fg as M,ct as I,cu as L,fh as W,fi as Oe,fj as $,cW as _e,fk as q,fl as Q,cv as P,db as H,fm as Ve,fn as Be,fo as Ke,az as Ge,fp as Ue,aA as We,aB as $e,aC as qe,aD as Qe,fq as He,e as Xe,aj as Ye,fr as Ze,fs as Je,a as et,ft as tt,I as nt,fu as st,fv as at,fw as it,cS as ot}from"./index-DleaJjK-.js";/**
|
|
2
|
+
* @license lucide-react v1.48.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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{af as b,ai as B,eI as p,eJ as g,aj as w,dh as A,cS as z,eK as M,j as e,eL as O,r as d,cW as E,al as N,B as j,cU as I,db as y,eM as C,eh as W,ei as K,ej as q,ek as Q,el as U,em as G,en as J,eo as Y,e as H,eN as L,eO as V,$ as X,a as $,eP as Z,eQ as R,W as P}from"./index-BCGiD7pg.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 T(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=T(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(E,{"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=T(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(E,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:F})=>e.jsx(ke,{harness:h,cell:F},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(W,{open:c,onOpenChange:u,children:e.jsxs(K,{children:[e.jsxs(q,{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(J,{children:"Cancel"}),e.jsx(Y,{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 Ee({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=H();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(He,{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(L,{"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(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(X,{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 He({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(Z,{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 Le({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{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 Re({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(Le,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{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 Te({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 Fe({projectPath:s}){const t=H(),{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(Te,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Re,{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(L,{"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(Fe,{projectPath:t})}export{ze as SkillsPage};
|
|
1
|
+
import{af as b,ai as B,eI as p,eJ as g,aj as w,dh as A,cS as z,eK as M,j as e,eL as O,r as d,cW as E,al as N,B as j,cU as I,db as y,eM as C,eh as W,ei as K,ej as q,ek as Q,el as U,em as G,en as J,eo as Y,e as H,eN as L,eO as V,$ as X,a as $,eP as Z,eQ as R,W as P}from"./index-DleaJjK-.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 T(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=T(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(E,{"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=T(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(E,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:F})=>e.jsx(ke,{harness:h,cell:F},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(W,{open:c,onOpenChange:u,children:e.jsxs(K,{children:[e.jsxs(q,{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(J,{children:"Cancel"}),e.jsx(Y,{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 Ee({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=H();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(He,{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(L,{"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(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(X,{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 He({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(Z,{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 Le({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{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 Re({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(Le,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{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 Te({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 Fe({projectPath:s}){const t=H(),{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(Te,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Re,{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(L,{"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(Fe,{projectPath:t})}export{ze as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{as as F,ag as w,at as U,au as D,av as L,aw as B,ax as G,r as o,j as e,ay as $,az as O,aA as p,aB as f,aC as j,aD as g,aE as k,aF as E,aG as N,aH as P,aI as X,aJ as _,aK as H,aL as J,aM as K,aN as V}from"./index-
|
|
1
|
+
import{as as F,ag as w,at as U,au as D,av as L,aw as B,ax as G,r as o,j as e,ay as $,az as O,aA as p,aB as f,aC as j,aD as g,aE as k,aF as E,aG as N,aH as P,aI as X,aJ as _,aK as H,aL as J,aM as K,aN as V}from"./index-DleaJjK-.js";const W=5;function q({status:t}){switch(t){case"running":return e.jsx(E,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(K,{className:"text-status-success size-3 shrink-0","aria-hidden":!0});case"failed":return e.jsx(J,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(H,{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),i=n%60;return`${a}m ${i}s`}function Y({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(E,{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:N(t.startedAt)})]})})}function Z({schedule:t,onEdit:n}){return e.jsx(g,{children:e.jsxs(k,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx(P,{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:N(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(q,{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:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=F(),i=w(s=>s.setTasksAgentFilter),R=w(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=U(u),{data:I=0}=D(u),{data:T=[]}=L(void 0,u),{data:S=[]}=B(),{openWithTemplate:y}=G(),v=[S[0],S[2]].filter(Boolean),l=o.useMemo(()=>n?x.filter(s=>s.agentId===n):x,[n,x]),d=o.useMemo(()=>{const s=new Map;for(const r of l)s.set(r.id,r.name);return s},[l]),A=o.useMemo(()=>T.filter(s=>d.has(s.scheduleId)),[T,d]),{runningRuns:M,recentRuns:b}=o.useMemo(()=>{const s=[],r=[];for(const c of A)c.finishedAt!=null||c.status!=="running"?r.push(c):s.push(c);return r.sort((c,h)=>(h.finishedAt??h.createdAt).localeCompare(c.finishedAt??c.createdAt)),{runningRuns:s,recentRuns:r.slice(0,W)}},[A]),C=o.useMemo(()=>l.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[l]),m=()=>{n&&(i(n),R(null)),a.open()},z=s=>{R(s),i(null),a.open()};return l.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."}),v.length>0&&e.jsx("div",{className:"space-y-2",children:v.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:$(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{y(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:[M.length>0&&e.jsxs(p,{children:[e.jsxs(f,{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(j,{children:M.map(s=>e.jsx(Y,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(Z,{schedule:s,onEdit:z},s.id))})]}),b.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent Runs"}),e.jsx(j,{children:b.map(s=>e.jsx(ee,{run:s,scheduleName:d.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 i;const n=V(),a=((i=t.agent)==null?void 0:i.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{available:n,agentId:a})})}export{ne as TasksPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{af as W,ai as Fe,dh as se,aj as ge,fx as De,fy as pe,r as l,j as n,cy as F,cz as D,fz as fe,B as f,P as xe,fA as te,eO as _,I as G,dw as _e,dx as Le,dy as $e,dz as Ke,dA as Be,fB as ce,bp as Ue,fC as Ve,C as Z,al as le,fD as ae,ct as ve,cu as je,W as qe,cv as Ne,bs as L,cX as He,fE as de,aF as ee,e9 as Ye,ea as Ge,eb as Qe,ec as We,ed as X,am as Je,ef as Xe,$ as Ze,fF as en,fG as nn,fH as sn,fI as tn,m as an,a as ne,fJ as rn,u as on}from"./index-
|
|
2
|
-
`)){const i=t.trim();if(!i)continue;const a=i.indexOf("=");if(a===-1)continue;const r=i.slice(0,a).trim();r&&(s[r]=i.slice(a+1).trim())}return s}function me(e){return e.trim().length?e.trim().split(/\s+/):[]}function vn(e,s){if(e.status!=="ok")return!1;const t=e.servers.find(a=>a.name===s),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function jn({agentId:e,agentLabel:s,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=ye(),[c,u]=l.useState(!1),[h,x]=l.useState(""),[p,m]=l.useState(t[0]??"stdio"),o=t.includes(p)?p:t[0]??"stdio",[v,C]=l.useState(""),[b,k]=l.useState(""),[j,E]=l.useState(""),[y,M]=l.useState(""),[P,A]=l.useState(""),[O,R]=l.useState(null),[T,I]=l.useState(null),[J,U]=l.useState(null),[K,V]=l.useState(null),B=xn.test(h)&&h.length<=64,q=o==="stdio"?v.trim().length>0:y.trim().length>0,d=B&&q&&!r.isPending,N=l.useCallback(()=>o==="stdio"?{transport:"stdio",command:v.trim(),args:me(b),env:ue(j)}:{transport:o,url:y.trim(),headers:ue(P)},[o,v,b,j,y,P]),w=l.useCallback(()=>({agentId:e,name:h.trim(),connection:N()}),[e,h,N]),z=l.useCallback(()=>{u(!1),R(null),I(null),x(""),m(t[0]??"stdio"),C(""),k(""),E(""),M(""),A("")},[t]),oe=l.useCallback(g=>{i({name:g.name,transport:g.connection.transport}),z()},[i,z]),H=l.useCallback((g,S)=>{const Ie=vn(g,S.name);oe(S),Ie&&U(S.name)},[oe]),ze=l.useCallback(async()=>{I(null);const g=w();try{const S=await r.mutateAsync({input:g});S.status==="approval_required"?R(S.approval):H(S,g)}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,H]),Ee=l.useCallback(async()=>{if(!O)return;I(null);const g=w();try{const S=await r.mutateAsync({input:g,approval:O});S.status==="ok"?H(S,g):I("The server still needs approval. Try again.")}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,O,H]),Y=J??(a&&a!==K?a:null),Pe=l.useCallback(()=>{V(Y),U(null)},[Y]),Re=l.useMemo(()=>[v.trim(),...me(b)].filter(Boolean).join(" "),[v,b]);return Y?n.jsx(pn,{agentId:e,serverName:Y,onDone:Pe}):c?O?n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Confirm this server for ",s]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:o==="stdio"?"This command runs on your machine whenever the agent starts a session.":"The agent connects to this URL whenever it starts a session."})]})]}),n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:o==="stdio"?Re:y.trim()}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>R(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{size:"sm",onClick:Ee,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Confirm & add"})]})]})}):n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-name",children:"Name"}),n.jsx(G,{id:"mcp-name",value:h,onChange:g=>x(g.target.value),placeholder:"my-server","aria-invalid":h.length>0&&!B}),h.length>0&&!B&&n.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(_e,{value:o,onValueChange:g=>m(g),children:[n.jsx(Le,{id:"mcp-transport",className:"w-full",children:n.jsx($e,{})}),n.jsx(Ke,{children:t.map(g=>n.jsx(Be,{value:g,children:g},g))})]})]}),o==="stdio"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-command",children:"Command"}),n.jsx(G,{id:"mcp-command",value:v,onChange:g=>C(g.target.value),placeholder:"npx",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(G,{id:"mcp-args",value:b,onChange:g=>k(g.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-env",value:j,onChange:g=>E(g.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-url",children:"URL"}),n.jsx(G,{id:"mcp-url",value:y,onChange:g=>M(g.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-headers",value:P,onChange:g=>A(g.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsx(Ue,{}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:z,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:ze,disabled:!d,className:"focus-visible:ring-2",children:"Continue"})]})]})}):n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>u(!0),className:"focus-visible:ring-2",children:[n.jsx(xe,{className:"size-4"}),"Add server"]})}const Nn={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},bn=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function ie(e){if(!e)return"cant-reach";const s=e.toLowerCase();return bn.some(t=>s.includes(t))?"setup-problem":"cant-reach"}function Ce(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(s=>s.toLowerCase()==="authorization")}function Sn(e){const{connection:s,authStatus:t}=e;return s.transport!=="stdio"&&s.authKind==="oauth2"?!0:t!==void 0}function we(e){const{enabled:s,testedOk:t,signedInNow:i,runtimeStatus:a,runtimeError:r,authStatus:c,ownKey:u}=e;return s?t?"connected":i?"signed-in":a==="failed"?ie(r):c==="connected"&&a==="needs-auth"?"signed-in":c==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Nn[a]:c==="connected"?"signed-in":c==="needs-auth"?"needs-sign-in":u?"uses-your-key":"not-checked":"off"}function yn(e){const{statusKey:s,testResult:t,signedInNow:i}=e;return s==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:s==="needs-sign-in"}function Cn(e){const{stamped:s,signedInNow:t,authStatus:i,rosterUpdatedAt:a}=e;if(!s)return;const{result:r}=s;if(!(t&&r.needsAuth===!0)&&!(s.at<=a&&(i==="needs-auth"&&r.ok||i==="connected"&&r.needsAuth===!0)))return r}function wn(e){const{status:s,probe:t}=e;return s==="off"||!t||t.ok?s:t.needsAuth===!0?"needs-sign-in":ie(t.error)}const Q={attention:0,working:1,elsewhere:2,off:3};function kn(e){return e==="off"?Q.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?Q.attention:Q.working}function An(e){const{managed:s,live:t,discovered:i}=e;return[...s.map(r=>{var c,u;return{name:r.name,band:kn(we({enabled:r.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(c=t.get(r.name))==null?void 0:c.status,runtimeError:(u=t.get(r.name))==null?void 0:u.error,authStatus:r.authStatus,ownKey:Ce(r.connection)}))}}),...i.map(r=>({name:r.name,band:Q.elsewhere}))].map((r,c)=>({entry:r,index:c})).sort((r,c)=>r.entry.band-c.entry.band||r.index-c.index).map(({entry:r})=>r.name)}function Tn(e){const{frozen:s,present:t}=e,i=new Set(t),a=new Set(s);return{ordered:s.filter(r=>i.has(r)),added:t.filter(r=>!a.has(r))}}function Mn(){const e=Ve(null);return({bothSettled:s,managed:t,live:i,discovered:a,present:r})=>{e.read()===null&&s&&r.length>0&&e.write(An({managed:t,live:i,discovered:a}));const{ordered:c,added:u}=Tn({frozen:e.read()??[],present:r});return u.length>0&&e.read()!==null&&e.write([...c,...u]),[...c,...u]}}const ke={"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"}},On={"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 zn(e){return On[e]}function En({toolCount:e,justSignedIn:s}){const t=s?"Signed in just now. ":"";return e===null?`${t||"This server answered. "}Its tools are available.`:`${t}${e} tool${e===1?"":"s"} available.`}function Pn(e,s){switch(e){case"needs-sign-in":return`Sign in to ${s.displayName} so this agent can use its tools.`;case"signing-in":return null;case"connected":return En(s);case"signed-in":return s.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 Rn(e){const{connection:s,authStatus:t,clientOrigin:i}=e;return s.transport==="stdio"?"None. This server doesn’t need one.":s.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(s.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 In(e){if(e.transport==="stdio")return`Runs \`${e.command}\` on this computer`;const s=Fn(e.url);return s?`${s} (web service)`:`${e.url} (web service)`}function Fn(e){try{return new URL(e).host}catch{return null}}const Dn={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"},_n={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."},Ln=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:e=>({pluginName:e[1],displayName:e[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:e=>({pluginName:e[1],displayName:e[1]})}];function Ae(e){for(const s of Ln){const t=e.match(s.pattern);if(!t)continue;const{displayName:i,pluginName:a}=s.read(t);if(!(!i||!a))return{displayName:i,pluginName:a,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function $n(e,s){return s.pluginName?"plugin":e.scope==="project"||e.scope==="local"?"project":e.scope==="user"?"computer":null}const Kn="This agent’s runtime loads this server. Add it to manage it here.";function Te(e,s){return e==="plugin"&&s?`Comes with the ${s} plugin`:Dn[e]}function Bn(e,s){return e===null?Kn:e==="plugin"&&s?`Comes with the ${s} plugin. Add it to manage it here.`:_n[e]}const Un=ae("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}}),Vn=ae("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"}}),qn=ae("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"}}),Hn={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 Yn({status:e}){const s=ke[e];return n.jsxs(ve,{children:[n.jsx(je,{asChild:!0,children:n.jsx("span",{className:qn({chip:Hn[e]}),children:s.label})}),n.jsx(Ne,{children:s.tooltip})]})}function Gn({scope:e,pluginName:s}){return n.jsxs(ve,{children:[n.jsx(je,{asChild:!0,children:n.jsx(qe,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:e})}),n.jsx(Ne,{children:Te(e,s)})]})}function Me({displayName:e,rawName:s,scope:t,pluginName:i,status:a,sentence:r,managed:c,toggle:u,actions:h,children:x,details:p,defaultDetailsOpen:m=!1}){const[o,v]=l.useState(m),C=l.useId(),b=ke[a].tone;return n.jsxs("div",{"data-mcp-server":s,className:le(Un({managed:c,dimmed:a==="off"}),"mb-2 last:mb-0"),children:[n.jsx("span",{className:Vn({tone:b}),"aria-hidden":!0}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e}),t&&n.jsx(Gn,{scope:t,pluginName:i}),n.jsx(Yn,{status:a}),u]}),r&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:r}),x,h&&n.jsx("div",{className:"mt-2 flex items-center gap-1",children:h}),p&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>v(k=>!k),"aria-expanded":o,"aria-controls":C,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:le("size-3 transition-transform",o&&"rotate-90"),"aria-hidden":!0}),"Details"]}),o&&n.jsxs("div",{id:C,children:[p,n.jsxs("button",{type:"button",onClick:()=>v(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Qn=3,$="text-muted-foreground/70";function Wn({tools:e}){const[s,t]=l.useState(!1),i=s?e:e.slice(0,Qn),a=e.length-i.length;return n.jsxs("div",{className:"mt-1.5",children:[i.map(r=>n.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[n.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:r.name}),r.description&&n.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:r.description})]},r.name)),a>0&&n.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:[n.jsx(Z,{className:"size-3","aria-hidden":!0}),"Show ",a," more"]})]})}function Jn(e){const{scope:s,pluginName:t,connection:i}=e;return s==="plugin"&&t?`Comes with the ${t} plugin`:i?In(i):s?Te(s,t):null}function Oe({connection:e,authStatus:s,authClientOrigin:t,scope:i,pluginName:a,rawName:r,displayName:c,toolCount:u,tools:h,serverInfo:x,alsoUsedBy:p,error:m}){const o=Jn({scope:i,pluginName:a,connection:e});return n.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[e&&n.jsx(L,{label:"Sign-in",align:"start",wrap:!0,labelClassName:$,children:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(He,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Rn({connection:e,authStatus:s,clientOrigin:t})]})}),o&&n.jsx(L,{label:"Source",align:"start",wrap:!0,labelClassName:$,children:o}),r!==c&&n.jsx(L,{label:"Raw id",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono",children:r})}),x&&n.jsx(L,{label:"Server",align:"start",wrap:!0,labelClassName:$,children:x}),p&&n.jsx(L,{label:"Also used by",align:"start",wrap:!0,labelClassName:$,children:p}),typeof u=="number"&&n.jsx(L,{label:"Tools",align:"start",labelClassName:$,children:u}),h&&h.length>0&&n.jsx(Wn,{tools:h}),m&&n.jsx(L,{label:"Error",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:m})})]})}function Xn({flow:e,serverName:s}){return n.jsxs(n.Fragment,{children:[n.jsx(fe,{flow:e,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>e.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(e.state.step==="disclosure"||e.state.step==="waiting")&&n.jsx("div",{className:"mt-2",children:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),"aria-label":`Cancel signing in to ${s}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function Zn({server:e,agentId:s,live:t,testResult:i,rosterUpdatedAt:a,testing:r,busy:c,onToggle:u,onTest:h,onRemove:x}){const p=pe(s,e.name),m=p.state.step==="connected",o=Cn({stamped:i,signedInNow:m,authStatus:e.authStatus,rosterUpdatedAt:a}),v=Ce(e.connection),C=we({enabled:e.enabled,testedOk:(o==null?void 0:o.ok)===!0,signedInNow:m,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.error,authStatus:e.authStatus,ownKey:v}),b=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||b,j=k?"signing-in":C,E=yn({statusKey:C,testResult:o,signedInNow:m})&&(p.state.step==="idle"||b),y=Ae(e.name),M=o!=null&&o.ok?o.toolCount??null:p.state.toolCount,P=k?j:wn({status:j,probe:o}),A=Pn(P,{displayName:y.displayName,toolCount:M,justSignedIn:m}),O=k?"none":zn(P),R=Sn({connection:e.connection,authStatus:e.authStatus});return n.jsx(Me,{displayName:y.displayName,rawName:e.name,scope:"agent",pluginName:y.pluginName,status:j,sentence:A,managed:!0,toggle:n.jsx(Ze,{checked:e.enabled,onCheckedChange:T=>u(e.name,T),disabled:c,"aria-label":`Enable ${e.name}`}),actions:n.jsxs(n.Fragment,{children:[E&&n.jsxs(f,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:c||b,"aria-label":`Sign in to ${e.name}`,className:"gap-1.5 focus-visible:ring-2",children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!E&&O==="try-again"&&n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>h(e.name),disabled:r||c,"aria-label":`Try ${e.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?n.jsx(ee,{size:"xs"}):null,"Try again"]}),!E&&O==="test"&&n.jsx(f,{variant:"outline",size:"sm",onClick:()=>h(e.name),disabled:r||c,className:"focus-visible:ring-2",children:r?n.jsx(ee,{size:"xs"}):"Test"}),n.jsxs(Ye,{children:[n.jsx(Ge,{asChild:!0,children:n.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${e.name}`,className:"ml-auto focus-visible:ring-2",children:n.jsx(Qe,{className:"size-4","aria-hidden":!0})})}),n.jsxs(We,{align:"end",children:[n.jsxs(X,{onSelect:()=>h(e.name),disabled:r||c,children:[n.jsx(Je,{className:"size-3.5","aria-hidden":!0}),"Test"]}),R&&n.jsxs(X,{onSelect:()=>p.start(),disabled:c,children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(Xe,{}),n.jsx(X,{variant:"destructive",onSelect:()=>x(e.name),disabled:c,children:"Remove"})]})]})]}),details:n.jsx(Oe,{connection:e.connection,authStatus:e.authStatus,authClientOrigin:e.authClientOrigin,scope:"agent",pluginName:y.pluginName,rawName:y.rawName,displayName:y.displayName,toolCount:M,error:(o==null?void 0:o.ok)===!1?o.error:t==null?void 0:t.error}),children:n.jsx(Xn,{flow:p,serverName:y.displayName})})}function es(e){switch(e.status){case"connected":return"connected";case"failed":return ie(e.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function ns(e){const{displayName:s,scope:t,pluginName:i}=e,a=ss(t,i);return`${s} ${a}. Manage it here to enable, disable, or sign in from DorkOS.`}function ss(e,s){return e==="plugin"&&s?`comes with the ${s} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded by this agent’s runtime"}function ts({entry:e,agentId:s,agentLabel:t,canImport:i}){const a=dn(),[r,c]=l.useState(null),[u,h]=l.useState(null),x=l.useCallback(async()=>{h(null);try{const j=await a.mutateAsync({input:{agentId:s,name:e.name}});j.status==="approval_required"&&c(j.approval)}catch(j){h(j instanceof Error?j.message:"Couldn’t add the server.")}},[a,s,e.name]),p=l.useCallback(async()=>{if(r){h(null);try{(await a.mutateAsync({input:{agentId:s,name:e.name},approval:r})).status!=="ok"&&h("Adding it still needs approval. Try again.")}catch(j){h(j instanceof Error?j.message:"Couldn’t add the server.")}}},[a,s,e.name,r]),m=Ae(e.name),o=$n(e,m),v=o!==null,C=m.rawName!==m.displayName,b=e.error!==void 0,k=v||C||b;return r?n.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add “",m.displayName,"” to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:ns({displayName:m.displayName,scope:o,pluginName:m.pluginName})})]})]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>c(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):n.jsx(Me,{displayName:m.displayName,rawName:e.name,scope:o,pluginName:m.pluginName,status:es(e),sentence:Bn(o,m.pluginName),managed:!1,actions:i?n.jsxs(n.Fragment,{children:[n.jsxs(f,{variant:"outline",size:"sm",onClick:x,disabled:a.isPending,"aria-label":`Add ${e.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?n.jsx(ee,{size:"xs"}):n.jsx(xe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u})]}):void 0,details:k?n.jsx(Oe,{scope:o,pluginName:m.pluginName,rawName:m.rawName,displayName:m.displayName,error:e.error}):void 0})}function as(e,s){return{agentId:e,name:s.server.name,connection:s.server.connection}}function rs(e){const s=e.sites.filter(t=>!t.expired).map(t=>t.site);return s.length<=3?s.join(", "):`${s.slice(0,3).join(", ")} and ${s.length-3} more`}function is({agentId:e,agentLabel:s}){const t=en(),i=ye(),[a,r]=l.useState(null),[c,u]=l.useState(null),h=l.useCallback(async o=>{if(t.data){u(null);try{const v=await i.mutateAsync({input:as(e,t.data),...o?{approval:o}:{}});v.status!=="approval_required"?r(null):o?u("The browser still needs approval. Try again."):r(v.approval)}catch(v){u(v instanceof Error?v.message:"Couldn’t add the browser.")}}},[i,e,t.data]);if(!t.data)return null;const x=t.data,p=rs(x),m=`${x.loginCommand} <site>`;return n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[a?n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}):n.jsx(nn,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"min-w-0 space-y-1",children:[n.jsx("p",{className:"text-sm font-medium",children:a?`Confirm the signed-in browser for ${s}`:"Signed-in browser"}),n.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."}),x.saved?n.jsxs("p",{className:"text-xs",children:["Signed in to ",p,"."]}):n.jsxs("p",{className:"text-status-warning-fg text-xs",children:["No sign-ins saved yet, so it starts signed out. Run"," ",n.jsx("code",{className:"font-mono",children:m}),n.jsx(sn,{value:m,label:"Copy the sign-in command",size:"xs",className:"mx-0.5 inline-flex align-middle"})," ","in a terminal first."]})]})]}),a&&n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:[x.server.connection.command,...x.server.connection.args].join(" ")}),c&&n.jsx("p",{className:"text-destructive text-xs",children:c}),n.jsxs("div",{className:"flex justify-end gap-2",children:[a&&n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{variant:a?"default":"outline",size:"sm",onClick:()=>void h(a??void 0),disabled:i.isPending,className:"focus-visible:ring-2",children:i.isPending?"Adding…":a?"Confirm & add":"Give it the browser"})]})]})})}const os={codex:["stdio","http"],opencode:["stdio","http"]};function he(e){return os[e]??fn}function cs(){const{open:e}=rn();return n.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."," ",n.jsx(f,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>e("tools","external-mcp"),children:"See Settings → Tools"})]})}function ls({agent:e,projectPath:s}){var q;const t=tn(e.id),i=ln(s,e.runtime),a=i.data,r=an(e.runtime),c=(r==null?void 0:r.supportsManagedMcpServers)??!0,u=mn(),h=hn(),x=un(),p=gn(),[m,o]=l.useState({}),[v,C]=l.useState(null),[b,k]=l.useState(null),j=Mn(),E=l.useCallback((d,N)=>{(N?u:h).mutate({agentId:e.id,name:d})},[e.id,u,h]),y=l.useCallback(d=>{x.mutate({agentId:e.id,name:d}),o(N=>{const w={...N};return delete w[d],w})},[e.id,x]),M=l.useCallback(async d=>{C(d);try{const N=await p.mutateAsync({agentId:e.id,name:d});o(w=>({...w,[d]:{result:N,at:Date.now()}}))}finally{C(null)}},[e.id,p]),P=l.useCallback(({name:d,transport:N})=>{k(d),N!=="stdio"&&M(d).catch(()=>{})},[M]),A=t.data??[],O=new Set(A.map(d=>d.name)),R=new Map(((a==null?void 0:a.servers)??[]).map(d=>[d.name,d])),T=((a==null?void 0:a.servers)??[]).filter(d=>!O.has(d.name)),I=u.isPending||h.isPending||x.isPending,J=A.some(d=>cn(d.connection)!==void 0),U=c&&!t.isPending&&!J&&he(e.runtime).includes("stdio"),K=new Map;A.forEach((d,N)=>K.set(d.name,{kind:"managed",index:N})),T.forEach((d,N)=>K.set(d.name,{kind:"discovered",index:N}));const V=j({bothSettled:!t.isPending&&!i.isPending,managed:A,live:R,discovered:T,present:[...A.map(d=>d.name),...T.map(d=>d.name)]});function B(d){const N=K.get(d);if(!N)return null;if(N.kind==="managed"){const z=A[N.index];return n.jsx(Zn,{server:z,agentId:e.id,live:R.get(z.name),testResult:m[z.name],rosterUpdatedAt:t.dataUpdatedAt,testing:v===z.name,busy:I,onToggle:E,onTest:M,onRemove:y},z.name)}const w=T[N.index];return n.jsx(ts,{entry:w,agentId:e.id,agentLabel:e.displayName??e.name,canImport:c},w.name)}return n.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),c&&n.jsx(jn,{agentId:e.id,agentLabel:e.displayName??e.name,supportedTransports:he(e.runtime),onAdded:P,oauthDetectedFor:b&&((q=m[b])==null?void 0:q.result.needsAuth)===!0?b:null})]}),n.jsx(cs,{}),U&&n.jsx(is,{agentId:e.id,agentLabel:e.displayName??e.name}),!c&&n.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?n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsx(ne,{className:"h-5 w-full"}),n.jsx(ne,{className:"h-5 w-3/4"})]})}):t.isError?n.jsx(F,{children:n.jsxs(D,{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),n.jsx(f,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Retry"})]})}):V.length===0?n.jsx(F,{children:n.jsx(D,{children:n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",c?"Add one to give this agent tools from an external server.":"This runtime can’t run managed servers."]})})}):n.jsx(F,{children:n.jsx(D,{children:V.map(B)})})]})}function ms({member:e}){const{agent:s,projectPath:t,isPending:i}=on(e);return i?n.jsx(ne,{className:"h-32 w-full"}):!s||t===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(ls,{agent:s,projectPath:t})}export{ms as ToolsPage};
|
|
1
|
+
import{af as W,ai as Fe,dh as se,aj as ge,fx as De,fy as pe,r as l,j as n,cy as F,cz as D,fz as fe,B as f,P as xe,fA as te,eO as _,I as G,dw as _e,dx as Le,dy as $e,dz as Ke,dA as Be,fB as ce,bp as Ue,fC as Ve,C as Z,al as le,fD as ae,ct as ve,cu as je,W as qe,cv as Ne,bs as L,cX as He,fE as de,aF as ee,e9 as Ye,ea as Ge,eb as Qe,ec as We,ed as X,am as Je,ef as Xe,$ as Ze,fF as en,fG as nn,fH as sn,fI as tn,m as an,a as ne,fJ as rn,u as on}from"./index-DleaJjK-.js";import{a as cn}from"./agent-browser-CNWjB1KM.js";function ln(e,s){const t=W();return Fe({queryKey:["mcp-config",e,s??null],queryFn:()=>t.getMcpConfig(e,{runtime:s??void 0}),enabled:!!e,staleTime:3e4})}function be(e,s){e.invalidateQueries({queryKey:De.mcpServers(s)}),e.invalidateQueries({queryKey:["mcp-config"]})}function Se(e){const s=W(),t=ge();return se({mutationFn:async({input:i,approval:a})=>a?(await s.grantApproval(a.approvalId),e(s,i,a.approvalToken)):e(s,i),onSuccess:(i,{input:a})=>{i.status==="ok"&&be(t,a.agentId)}})}function ye(){return Se((e,s,t)=>e.addAgentMcpServer(s,t?{approvalToken:t}:void 0))}function dn(){return Se((e,s,t)=>e.importAgentMcpServer(s,t?{approvalToken:t}:void 0))}function re(e){const s=W(),t=ge();return se({mutationFn:({agentId:i,name:a})=>e(s,i,a),onSuccess:(i,{agentId:a})=>be(t,a)})}function un(){return re((e,s,t)=>e.removeAgentMcpServer(s,t))}function mn(){return re((e,s,t)=>e.enableAgentMcpServer(s,t))}function hn(){return re((e,s,t)=>e.disableAgentMcpServer(s,t))}function gn(){const e=W();return se({mutationFn:({agentId:s,name:t})=>e.testAgentMcpServer(s,t)})}function pn({agentId:e,serverName:s,onDone:t}){const i=pe(e,s),{start:a}=i,r=l.useRef(!1);return l.useEffect(()=>{r.current||(r.current=!0,a())},[a]),n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",s]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"This server needs you to sign in before your agent can use it."}),n.jsx(fe,{flow:i,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const fn=["stdio","http","sse"],xn=/^[a-zA-Z0-9_-]+$/;function ue(e){const s={};for(const t of e.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&&(s[r]=i.slice(a+1).trim())}return s}function me(e){return e.trim().length?e.trim().split(/\s+/):[]}function vn(e,s){if(e.status!=="ok")return!1;const t=e.servers.find(a=>a.name===s),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function jn({agentId:e,agentLabel:s,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=ye(),[c,u]=l.useState(!1),[h,x]=l.useState(""),[p,m]=l.useState(t[0]??"stdio"),o=t.includes(p)?p:t[0]??"stdio",[v,C]=l.useState(""),[b,k]=l.useState(""),[j,E]=l.useState(""),[y,M]=l.useState(""),[P,A]=l.useState(""),[O,R]=l.useState(null),[T,I]=l.useState(null),[J,U]=l.useState(null),[K,V]=l.useState(null),B=xn.test(h)&&h.length<=64,q=o==="stdio"?v.trim().length>0:y.trim().length>0,d=B&&q&&!r.isPending,N=l.useCallback(()=>o==="stdio"?{transport:"stdio",command:v.trim(),args:me(b),env:ue(j)}:{transport:o,url:y.trim(),headers:ue(P)},[o,v,b,j,y,P]),w=l.useCallback(()=>({agentId:e,name:h.trim(),connection:N()}),[e,h,N]),z=l.useCallback(()=>{u(!1),R(null),I(null),x(""),m(t[0]??"stdio"),C(""),k(""),E(""),M(""),A("")},[t]),oe=l.useCallback(g=>{i({name:g.name,transport:g.connection.transport}),z()},[i,z]),H=l.useCallback((g,S)=>{const Ie=vn(g,S.name);oe(S),Ie&&U(S.name)},[oe]),ze=l.useCallback(async()=>{I(null);const g=w();try{const S=await r.mutateAsync({input:g});S.status==="approval_required"?R(S.approval):H(S,g)}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,H]),Ee=l.useCallback(async()=>{if(!O)return;I(null);const g=w();try{const S=await r.mutateAsync({input:g,approval:O});S.status==="ok"?H(S,g):I("The server still needs approval. Try again.")}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,O,H]),Y=J??(a&&a!==K?a:null),Pe=l.useCallback(()=>{V(Y),U(null)},[Y]),Re=l.useMemo(()=>[v.trim(),...me(b)].filter(Boolean).join(" "),[v,b]);return Y?n.jsx(pn,{agentId:e,serverName:Y,onDone:Pe}):c?O?n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Confirm this server for ",s]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:o==="stdio"?"This command runs on your machine whenever the agent starts a session.":"The agent connects to this URL whenever it starts a session."})]})]}),n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:o==="stdio"?Re:y.trim()}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>R(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{size:"sm",onClick:Ee,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Confirm & add"})]})]})}):n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-name",children:"Name"}),n.jsx(G,{id:"mcp-name",value:h,onChange:g=>x(g.target.value),placeholder:"my-server","aria-invalid":h.length>0&&!B}),h.length>0&&!B&&n.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(_e,{value:o,onValueChange:g=>m(g),children:[n.jsx(Le,{id:"mcp-transport",className:"w-full",children:n.jsx($e,{})}),n.jsx(Ke,{children:t.map(g=>n.jsx(Be,{value:g,children:g},g))})]})]}),o==="stdio"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-command",children:"Command"}),n.jsx(G,{id:"mcp-command",value:v,onChange:g=>C(g.target.value),placeholder:"npx",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(G,{id:"mcp-args",value:b,onChange:g=>k(g.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-env",value:j,onChange:g=>E(g.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-url",children:"URL"}),n.jsx(G,{id:"mcp-url",value:y,onChange:g=>M(g.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-headers",value:P,onChange:g=>A(g.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsx(Ue,{}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:z,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:ze,disabled:!d,className:"focus-visible:ring-2",children:"Continue"})]})]})}):n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>u(!0),className:"focus-visible:ring-2",children:[n.jsx(xe,{className:"size-4"}),"Add server"]})}const Nn={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},bn=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function ie(e){if(!e)return"cant-reach";const s=e.toLowerCase();return bn.some(t=>s.includes(t))?"setup-problem":"cant-reach"}function Ce(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(s=>s.toLowerCase()==="authorization")}function Sn(e){const{connection:s,authStatus:t}=e;return s.transport!=="stdio"&&s.authKind==="oauth2"?!0:t!==void 0}function we(e){const{enabled:s,testedOk:t,signedInNow:i,runtimeStatus:a,runtimeError:r,authStatus:c,ownKey:u}=e;return s?t?"connected":i?"signed-in":a==="failed"?ie(r):c==="connected"&&a==="needs-auth"?"signed-in":c==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Nn[a]:c==="connected"?"signed-in":c==="needs-auth"?"needs-sign-in":u?"uses-your-key":"not-checked":"off"}function yn(e){const{statusKey:s,testResult:t,signedInNow:i}=e;return s==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:s==="needs-sign-in"}function Cn(e){const{stamped:s,signedInNow:t,authStatus:i,rosterUpdatedAt:a}=e;if(!s)return;const{result:r}=s;if(!(t&&r.needsAuth===!0)&&!(s.at<=a&&(i==="needs-auth"&&r.ok||i==="connected"&&r.needsAuth===!0)))return r}function wn(e){const{status:s,probe:t}=e;return s==="off"||!t||t.ok?s:t.needsAuth===!0?"needs-sign-in":ie(t.error)}const Q={attention:0,working:1,elsewhere:2,off:3};function kn(e){return e==="off"?Q.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?Q.attention:Q.working}function An(e){const{managed:s,live:t,discovered:i}=e;return[...s.map(r=>{var c,u;return{name:r.name,band:kn(we({enabled:r.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(c=t.get(r.name))==null?void 0:c.status,runtimeError:(u=t.get(r.name))==null?void 0:u.error,authStatus:r.authStatus,ownKey:Ce(r.connection)}))}}),...i.map(r=>({name:r.name,band:Q.elsewhere}))].map((r,c)=>({entry:r,index:c})).sort((r,c)=>r.entry.band-c.entry.band||r.index-c.index).map(({entry:r})=>r.name)}function Tn(e){const{frozen:s,present:t}=e,i=new Set(t),a=new Set(s);return{ordered:s.filter(r=>i.has(r)),added:t.filter(r=>!a.has(r))}}function Mn(){const e=Ve(null);return({bothSettled:s,managed:t,live:i,discovered:a,present:r})=>{e.read()===null&&s&&r.length>0&&e.write(An({managed:t,live:i,discovered:a}));const{ordered:c,added:u}=Tn({frozen:e.read()??[],present:r});return u.length>0&&e.read()!==null&&e.write([...c,...u]),[...c,...u]}}const ke={"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"}},On={"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 zn(e){return On[e]}function En({toolCount:e,justSignedIn:s}){const t=s?"Signed in just now. ":"";return e===null?`${t||"This server answered. "}Its tools are available.`:`${t}${e} tool${e===1?"":"s"} available.`}function Pn(e,s){switch(e){case"needs-sign-in":return`Sign in to ${s.displayName} so this agent can use its tools.`;case"signing-in":return null;case"connected":return En(s);case"signed-in":return s.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 Rn(e){const{connection:s,authStatus:t,clientOrigin:i}=e;return s.transport==="stdio"?"None. This server doesn’t need one.":s.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(s.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 In(e){if(e.transport==="stdio")return`Runs \`${e.command}\` on this computer`;const s=Fn(e.url);return s?`${s} (web service)`:`${e.url} (web service)`}function Fn(e){try{return new URL(e).host}catch{return null}}const Dn={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"},_n={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."},Ln=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:e=>({pluginName:e[1],displayName:e[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:e=>({pluginName:e[1],displayName:e[1]})}];function Ae(e){for(const s of Ln){const t=e.match(s.pattern);if(!t)continue;const{displayName:i,pluginName:a}=s.read(t);if(!(!i||!a))return{displayName:i,pluginName:a,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function $n(e,s){return s.pluginName?"plugin":e.scope==="project"||e.scope==="local"?"project":e.scope==="user"?"computer":null}const Kn="This agent’s runtime loads this server. Add it to manage it here.";function Te(e,s){return e==="plugin"&&s?`Comes with the ${s} plugin`:Dn[e]}function Bn(e,s){return e===null?Kn:e==="plugin"&&s?`Comes with the ${s} plugin. Add it to manage it here.`:_n[e]}const Un=ae("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}}),Vn=ae("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"}}),qn=ae("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"}}),Hn={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 Yn({status:e}){const s=ke[e];return n.jsxs(ve,{children:[n.jsx(je,{asChild:!0,children:n.jsx("span",{className:qn({chip:Hn[e]}),children:s.label})}),n.jsx(Ne,{children:s.tooltip})]})}function Gn({scope:e,pluginName:s}){return n.jsxs(ve,{children:[n.jsx(je,{asChild:!0,children:n.jsx(qe,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:e})}),n.jsx(Ne,{children:Te(e,s)})]})}function Me({displayName:e,rawName:s,scope:t,pluginName:i,status:a,sentence:r,managed:c,toggle:u,actions:h,children:x,details:p,defaultDetailsOpen:m=!1}){const[o,v]=l.useState(m),C=l.useId(),b=ke[a].tone;return n.jsxs("div",{"data-mcp-server":s,className:le(Un({managed:c,dimmed:a==="off"}),"mb-2 last:mb-0"),children:[n.jsx("span",{className:Vn({tone:b}),"aria-hidden":!0}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e}),t&&n.jsx(Gn,{scope:t,pluginName:i}),n.jsx(Yn,{status:a}),u]}),r&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:r}),x,h&&n.jsx("div",{className:"mt-2 flex items-center gap-1",children:h}),p&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>v(k=>!k),"aria-expanded":o,"aria-controls":C,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:le("size-3 transition-transform",o&&"rotate-90"),"aria-hidden":!0}),"Details"]}),o&&n.jsxs("div",{id:C,children:[p,n.jsxs("button",{type:"button",onClick:()=>v(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Qn=3,$="text-muted-foreground/70";function Wn({tools:e}){const[s,t]=l.useState(!1),i=s?e:e.slice(0,Qn),a=e.length-i.length;return n.jsxs("div",{className:"mt-1.5",children:[i.map(r=>n.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[n.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:r.name}),r.description&&n.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:r.description})]},r.name)),a>0&&n.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:[n.jsx(Z,{className:"size-3","aria-hidden":!0}),"Show ",a," more"]})]})}function Jn(e){const{scope:s,pluginName:t,connection:i}=e;return s==="plugin"&&t?`Comes with the ${t} plugin`:i?In(i):s?Te(s,t):null}function Oe({connection:e,authStatus:s,authClientOrigin:t,scope:i,pluginName:a,rawName:r,displayName:c,toolCount:u,tools:h,serverInfo:x,alsoUsedBy:p,error:m}){const o=Jn({scope:i,pluginName:a,connection:e});return n.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[e&&n.jsx(L,{label:"Sign-in",align:"start",wrap:!0,labelClassName:$,children:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(He,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Rn({connection:e,authStatus:s,clientOrigin:t})]})}),o&&n.jsx(L,{label:"Source",align:"start",wrap:!0,labelClassName:$,children:o}),r!==c&&n.jsx(L,{label:"Raw id",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono",children:r})}),x&&n.jsx(L,{label:"Server",align:"start",wrap:!0,labelClassName:$,children:x}),p&&n.jsx(L,{label:"Also used by",align:"start",wrap:!0,labelClassName:$,children:p}),typeof u=="number"&&n.jsx(L,{label:"Tools",align:"start",labelClassName:$,children:u}),h&&h.length>0&&n.jsx(Wn,{tools:h}),m&&n.jsx(L,{label:"Error",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:m})})]})}function Xn({flow:e,serverName:s}){return n.jsxs(n.Fragment,{children:[n.jsx(fe,{flow:e,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>e.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(e.state.step==="disclosure"||e.state.step==="waiting")&&n.jsx("div",{className:"mt-2",children:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),"aria-label":`Cancel signing in to ${s}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function Zn({server:e,agentId:s,live:t,testResult:i,rosterUpdatedAt:a,testing:r,busy:c,onToggle:u,onTest:h,onRemove:x}){const p=pe(s,e.name),m=p.state.step==="connected",o=Cn({stamped:i,signedInNow:m,authStatus:e.authStatus,rosterUpdatedAt:a}),v=Ce(e.connection),C=we({enabled:e.enabled,testedOk:(o==null?void 0:o.ok)===!0,signedInNow:m,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.error,authStatus:e.authStatus,ownKey:v}),b=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||b,j=k?"signing-in":C,E=yn({statusKey:C,testResult:o,signedInNow:m})&&(p.state.step==="idle"||b),y=Ae(e.name),M=o!=null&&o.ok?o.toolCount??null:p.state.toolCount,P=k?j:wn({status:j,probe:o}),A=Pn(P,{displayName:y.displayName,toolCount:M,justSignedIn:m}),O=k?"none":zn(P),R=Sn({connection:e.connection,authStatus:e.authStatus});return n.jsx(Me,{displayName:y.displayName,rawName:e.name,scope:"agent",pluginName:y.pluginName,status:j,sentence:A,managed:!0,toggle:n.jsx(Ze,{checked:e.enabled,onCheckedChange:T=>u(e.name,T),disabled:c,"aria-label":`Enable ${e.name}`}),actions:n.jsxs(n.Fragment,{children:[E&&n.jsxs(f,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:c||b,"aria-label":`Sign in to ${e.name}`,className:"gap-1.5 focus-visible:ring-2",children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!E&&O==="try-again"&&n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>h(e.name),disabled:r||c,"aria-label":`Try ${e.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?n.jsx(ee,{size:"xs"}):null,"Try again"]}),!E&&O==="test"&&n.jsx(f,{variant:"outline",size:"sm",onClick:()=>h(e.name),disabled:r||c,className:"focus-visible:ring-2",children:r?n.jsx(ee,{size:"xs"}):"Test"}),n.jsxs(Ye,{children:[n.jsx(Ge,{asChild:!0,children:n.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${e.name}`,className:"ml-auto focus-visible:ring-2",children:n.jsx(Qe,{className:"size-4","aria-hidden":!0})})}),n.jsxs(We,{align:"end",children:[n.jsxs(X,{onSelect:()=>h(e.name),disabled:r||c,children:[n.jsx(Je,{className:"size-3.5","aria-hidden":!0}),"Test"]}),R&&n.jsxs(X,{onSelect:()=>p.start(),disabled:c,children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(Xe,{}),n.jsx(X,{variant:"destructive",onSelect:()=>x(e.name),disabled:c,children:"Remove"})]})]})]}),details:n.jsx(Oe,{connection:e.connection,authStatus:e.authStatus,authClientOrigin:e.authClientOrigin,scope:"agent",pluginName:y.pluginName,rawName:y.rawName,displayName:y.displayName,toolCount:M,error:(o==null?void 0:o.ok)===!1?o.error:t==null?void 0:t.error}),children:n.jsx(Xn,{flow:p,serverName:y.displayName})})}function es(e){switch(e.status){case"connected":return"connected";case"failed":return ie(e.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function ns(e){const{displayName:s,scope:t,pluginName:i}=e,a=ss(t,i);return`${s} ${a}. Manage it here to enable, disable, or sign in from DorkOS.`}function ss(e,s){return e==="plugin"&&s?`comes with the ${s} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded by this agent’s runtime"}function ts({entry:e,agentId:s,agentLabel:t,canImport:i}){const a=dn(),[r,c]=l.useState(null),[u,h]=l.useState(null),x=l.useCallback(async()=>{h(null);try{const j=await a.mutateAsync({input:{agentId:s,name:e.name}});j.status==="approval_required"&&c(j.approval)}catch(j){h(j instanceof Error?j.message:"Couldn’t add the server.")}},[a,s,e.name]),p=l.useCallback(async()=>{if(r){h(null);try{(await a.mutateAsync({input:{agentId:s,name:e.name},approval:r})).status!=="ok"&&h("Adding it still needs approval. Try again.")}catch(j){h(j instanceof Error?j.message:"Couldn’t add the server.")}}},[a,s,e.name,r]),m=Ae(e.name),o=$n(e,m),v=o!==null,C=m.rawName!==m.displayName,b=e.error!==void 0,k=v||C||b;return r?n.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add “",m.displayName,"” to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:ns({displayName:m.displayName,scope:o,pluginName:m.pluginName})})]})]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>c(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):n.jsx(Me,{displayName:m.displayName,rawName:e.name,scope:o,pluginName:m.pluginName,status:es(e),sentence:Bn(o,m.pluginName),managed:!1,actions:i?n.jsxs(n.Fragment,{children:[n.jsxs(f,{variant:"outline",size:"sm",onClick:x,disabled:a.isPending,"aria-label":`Add ${e.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?n.jsx(ee,{size:"xs"}):n.jsx(xe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u})]}):void 0,details:k?n.jsx(Oe,{scope:o,pluginName:m.pluginName,rawName:m.rawName,displayName:m.displayName,error:e.error}):void 0})}function as(e,s){return{agentId:e,name:s.server.name,connection:s.server.connection}}function rs(e){const s=e.sites.filter(t=>!t.expired).map(t=>t.site);return s.length<=3?s.join(", "):`${s.slice(0,3).join(", ")} and ${s.length-3} more`}function is({agentId:e,agentLabel:s}){const t=en(),i=ye(),[a,r]=l.useState(null),[c,u]=l.useState(null),h=l.useCallback(async o=>{if(t.data){u(null);try{const v=await i.mutateAsync({input:as(e,t.data),...o?{approval:o}:{}});v.status!=="approval_required"?r(null):o?u("The browser still needs approval. Try again."):r(v.approval)}catch(v){u(v instanceof Error?v.message:"Couldn’t add the browser.")}}},[i,e,t.data]);if(!t.data)return null;const x=t.data,p=rs(x),m=`${x.loginCommand} <site>`;return n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[a?n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}):n.jsx(nn,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"min-w-0 space-y-1",children:[n.jsx("p",{className:"text-sm font-medium",children:a?`Confirm the signed-in browser for ${s}`:"Signed-in browser"}),n.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."}),x.saved?n.jsxs("p",{className:"text-xs",children:["Signed in to ",p,"."]}):n.jsxs("p",{className:"text-status-warning-fg text-xs",children:["No sign-ins saved yet, so it starts signed out. Run"," ",n.jsx("code",{className:"font-mono",children:m}),n.jsx(sn,{value:m,label:"Copy the sign-in command",size:"xs",className:"mx-0.5 inline-flex align-middle"})," ","in a terminal first."]})]})]}),a&&n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:[x.server.connection.command,...x.server.connection.args].join(" ")}),c&&n.jsx("p",{className:"text-destructive text-xs",children:c}),n.jsxs("div",{className:"flex justify-end gap-2",children:[a&&n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{variant:a?"default":"outline",size:"sm",onClick:()=>void h(a??void 0),disabled:i.isPending,className:"focus-visible:ring-2",children:i.isPending?"Adding…":a?"Confirm & add":"Give it the browser"})]})]})})}const os={codex:["stdio","http"],opencode:["stdio","http"]};function he(e){return os[e]??fn}function cs(){const{open:e}=rn();return n.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."," ",n.jsx(f,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>e("tools","external-mcp"),children:"See Settings → Advanced → Tools"})]})}function ls({agent:e,projectPath:s}){var q;const t=tn(e.id),i=ln(s,e.runtime),a=i.data,r=an(e.runtime),c=(r==null?void 0:r.supportsManagedMcpServers)??!0,u=mn(),h=hn(),x=un(),p=gn(),[m,o]=l.useState({}),[v,C]=l.useState(null),[b,k]=l.useState(null),j=Mn(),E=l.useCallback((d,N)=>{(N?u:h).mutate({agentId:e.id,name:d})},[e.id,u,h]),y=l.useCallback(d=>{x.mutate({agentId:e.id,name:d}),o(N=>{const w={...N};return delete w[d],w})},[e.id,x]),M=l.useCallback(async d=>{C(d);try{const N=await p.mutateAsync({agentId:e.id,name:d});o(w=>({...w,[d]:{result:N,at:Date.now()}}))}finally{C(null)}},[e.id,p]),P=l.useCallback(({name:d,transport:N})=>{k(d),N!=="stdio"&&M(d).catch(()=>{})},[M]),A=t.data??[],O=new Set(A.map(d=>d.name)),R=new Map(((a==null?void 0:a.servers)??[]).map(d=>[d.name,d])),T=((a==null?void 0:a.servers)??[]).filter(d=>!O.has(d.name)),I=u.isPending||h.isPending||x.isPending,J=A.some(d=>cn(d.connection)!==void 0),U=c&&!t.isPending&&!J&&he(e.runtime).includes("stdio"),K=new Map;A.forEach((d,N)=>K.set(d.name,{kind:"managed",index:N})),T.forEach((d,N)=>K.set(d.name,{kind:"discovered",index:N}));const V=j({bothSettled:!t.isPending&&!i.isPending,managed:A,live:R,discovered:T,present:[...A.map(d=>d.name),...T.map(d=>d.name)]});function B(d){const N=K.get(d);if(!N)return null;if(N.kind==="managed"){const z=A[N.index];return n.jsx(Zn,{server:z,agentId:e.id,live:R.get(z.name),testResult:m[z.name],rosterUpdatedAt:t.dataUpdatedAt,testing:v===z.name,busy:I,onToggle:E,onTest:M,onRemove:y},z.name)}const w=T[N.index];return n.jsx(ts,{entry:w,agentId:e.id,agentLabel:e.displayName??e.name,canImport:c},w.name)}return n.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),c&&n.jsx(jn,{agentId:e.id,agentLabel:e.displayName??e.name,supportedTransports:he(e.runtime),onAdded:P,oauthDetectedFor:b&&((q=m[b])==null?void 0:q.result.needsAuth)===!0?b:null})]}),n.jsx(cs,{}),U&&n.jsx(is,{agentId:e.id,agentLabel:e.displayName??e.name}),!c&&n.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?n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsx(ne,{className:"h-5 w-full"}),n.jsx(ne,{className:"h-5 w-3/4"})]})}):t.isError?n.jsx(F,{children:n.jsxs(D,{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),n.jsx(f,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Retry"})]})}):V.length===0?n.jsx(F,{children:n.jsx(D,{children:n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",c?"Add one to give this agent tools from an external server.":"This runtime can’t run managed servers."]})})}):n.jsx(F,{children:n.jsx(D,{children:V.map(B)})})]})}function ms({member:e}){const{agent:s,projectPath:t,isPending:i}=on(e);return i?n.jsx(ne,{className:"h-32 w-full"}):!s||t===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(ls,{agent:s,projectPath:t})}export{ms as ToolsPage};
|