dorkos 0.88.0 → 0.89.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/core-extensions/linear-issues/index.ts +1 -1
- package/dist/bin/cli.js +610 -48
- package/dist/client/assets/{AboutPage-xqba6OSc.js → AboutPage-BXOwVTO0.js} +1 -1
- package/dist/client/assets/{AdapterIcon-BfxdKjYz.js → AdapterIcon-Bs0C7eSH.js} +1 -1
- package/dist/client/assets/{AppearancePage-MXRyK6j4.js → AppearancePage-C0FZ72U0.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-D6lj5D9_.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BRr08I-_.js} +3 -3
- package/dist/client/assets/{BlintzCanvas-BmTo8WiT.js → BlintzCanvas-DCLSn9jx.js} +23 -23
- package/dist/client/assets/{CanvasCsvContent-C57uDWEL.js → CanvasCsvContent-CGQsl4FY.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-1qt_NtYW.js → CanvasFileContent-CqLAG04I.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-CJ2bwQjt.js → CanvasModel3dContent-DkPwdlTD.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-6LU4OiJj.js → CodeMirrorDiff-BkTLxJoa.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-Jq49Np0j.js → CodeMirrorEditor-CIgTB7Sa.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-BNgZnsD7.js +1 -0
- package/dist/client/assets/{ConnectionsPage-BAcGLK2V.js → ConnectionsPage-BlE8iku_.js} +2 -2
- package/dist/client/assets/{ConventionPage-DdKmGIcU.js → ConventionPage-DQZsWbi1.js} +3 -3
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-9LderCq4.js → FloatingTanStackRouterDevtools-CqogiFob-De2qH2l6.js} +1 -1
- package/dist/client/assets/HandlePage-BXDfRIy3.js +1 -0
- package/dist/client/assets/{LexicalField-DsPLNKLN.js → LexicalField-C_3WYQGQ.js} +1 -1
- package/dist/client/assets/{ManagesPage-C34dzjEv.js → ManagesPage-DFFt9mh7.js} +1 -1
- package/dist/client/assets/{Model3dViewer-PXpUR_oW.js → Model3dViewer-CqkgfgBg.js} +1 -1
- package/dist/client/assets/NamePage-Qtv820fs.js +1 -0
- package/dist/client/assets/{NotificationsPage-CTPdo_E9.js → NotificationsPage-CX4b6MCK.js} +1 -1
- package/dist/client/assets/{PermissionsPage-Ij8O_uFN.js → PermissionsPage-B7CCInRo.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-D0pS2YVR.js → PersonalityPopover-BOphzXEY.js} +1 -1
- package/dist/client/assets/PhotoPage-DgXAydiI.js +1 -0
- package/dist/client/assets/{RoomsPage-C_jMQGJC.js → RoomsPage-_DIjKTpi.js} +1 -1
- package/dist/client/assets/RunsOnPopover-DOsGV_7l.js +1 -0
- package/dist/client/assets/SessionsPage-BOsRKUqZ.js +6 -0
- package/dist/client/assets/{SkillsPage-CSUclnmu.js → SkillsPage-seFT2etr.js} +1 -1
- package/dist/client/assets/{TasksPage-COCsTj5k.js → TasksPage-Imt9oPoi.js} +1 -1
- package/dist/client/assets/{ToolsPage-CIgwvhZM.js → ToolsPage-CGM0Jiil.js} +2 -2
- package/dist/client/assets/{TopologyGraph-BOcP_UPd.js → TopologyGraph-vhFyjSzJ.js} +1 -1
- package/dist/client/assets/{agent-browser-Cm6bXvCt.js → agent-browser-B6WqW-og.js} +1 -1
- package/dist/client/assets/airtable-B7_XMoPM.png +0 -0
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CmLzbGDT.js → highlighted-body-KPVGNVTW-DkoFzbOS.js} +1 -1
- package/dist/client/assets/hubspot-BQJQ5DfV.png +0 -0
- package/dist/client/assets/{index-C7jBVjvK.js → index-BFoejqZA.js} +1 -1
- package/dist/client/assets/{index-BndjtRZA.js → index-BMUNBDCe.js} +1 -1
- package/dist/client/assets/index-BY3yxmfx.js +1 -0
- package/dist/client/assets/index-BiDsr32v.js +1 -0
- package/dist/client/assets/{index-Cd9I6lUD.js → index-BmbhktM1.js} +1 -1
- package/dist/client/assets/{index-CQzyikQJ.js → index-Br_-H83G.js} +1 -1
- package/dist/client/assets/{index-D1Y7OlGq.js → index-BsXXogDR.js} +2 -2
- package/dist/client/assets/{index-DArP7LVM.js → index-C55PP6X5.js} +1 -1
- package/dist/client/assets/{index-CLJKvTfN.js → index-C79__bWb.js} +1 -1
- package/dist/client/assets/{index-wIEie2VH.js → index-CCelL1vs.js} +1 -1
- package/dist/client/assets/{index-CRom-Nt5.js → index-CMh3FD3Q.js} +1 -1
- package/dist/client/assets/{index-B5b98af8.js → index-CbAiJmOw.js} +1 -1
- package/dist/client/assets/{index-r8MCK2Zn.js → index-Ciuu1JwG.js} +1 -1
- package/dist/client/assets/{index-D_3Gtukh.js → index-CmezFzDD.js} +1 -1
- package/dist/client/assets/{index-CqP01Nbn.js → index-D-IcFrZb.js} +1 -1
- package/dist/client/assets/{index-B9kyvuKW.js → index-D0Q-sDBn.js} +1 -1
- package/dist/client/assets/{index-DOZ6l8Os.js → index-D7L3s5xT.js} +1 -1
- package/dist/client/assets/{index-mHL0gmHU.js → index-D8qzXtVa.js} +3 -3
- package/dist/client/assets/{index-D6Noae7w.js → index-DA2x36Z1.js} +1 -1
- package/dist/client/assets/{index-DrRfKYSH.js → index-DAogWPwG.js} +1 -1
- package/dist/client/assets/{index-DIAn8UxO.js → index-DBI4lgHw.js} +1 -1
- package/dist/client/assets/index-DDftPKpL.js +1 -0
- package/dist/client/assets/{index-Gs10j_MB.js → index-D_qmPmef.js} +1 -1
- package/dist/client/assets/{index-wpJKx9Mi.js → index-DcrgiH5I.js} +1 -1
- package/dist/client/assets/{index-_1qDsPCM.js → index-DgM6zNKn.js} +426 -435
- package/dist/client/assets/{index-vlk24smC.js → index-Dj4UMRJj.js} +1 -1
- package/dist/client/assets/index-DmX9plz6.js +38 -0
- package/dist/client/assets/{index-BxfmjO0b.js → index-Dt1n757u.js} +1 -1
- package/dist/client/assets/{index-DpN4Unzc.js → index-DwX-1WZf.js} +1 -1
- package/dist/client/assets/{index-C4GR43mL.js → index-DxBAUxqG.js} +1 -1
- package/dist/client/assets/{index-noUdLKRN.js → index-Dzt17e2e.js} +1 -1
- package/dist/client/assets/{index-rEcs1cWl.js → index-GqFxPMLJ.js} +1 -1
- package/dist/client/assets/{index-DWOxbvGH.js → index-HGlT1rGv.js} +1 -1
- package/dist/client/assets/index-fh0Br4xv.js +17 -0
- package/dist/client/assets/{index-BvuOztsk.js → index-mnHv12yO.js} +1 -1
- package/dist/client/assets/index-ojjbEHz5.css +1 -0
- package/dist/client/assets/{index-20DQ0WIE.js → index-yQNEOaWT.js} +1 -1
- package/dist/client/assets/linear-BihyrT6v.svg +1 -0
- package/dist/client/assets/notion-egi6fb2a.png +0 -0
- package/dist/client/assets/room-files-source-Cyx8H6V6.js +6 -0
- package/dist/client/assets/{soul-file-BWnNRUqb.js → soul-file-DUY5SyDc.js} +1 -1
- package/dist/client/assets/{use-personality-commit-CKnXk3oQ.js → use-personality-commit-D1Go4jUE.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/0118_session_context.sql +6 -0
- package/dist/drizzle/0119_session_continue.sql +5 -0
- package/dist/drizzle/0120_session_limit_history.sql +24 -0
- package/dist/drizzle/0121_session_auto_resume.sql +1 -0
- package/dist/drizzle/meta/0118_snapshot.json +9264 -0
- package/dist/drizzle/meta/0119_snapshot.json +9299 -0
- package/dist/drizzle/meta/0120_snapshot.json +9430 -0
- package/dist/drizzle/meta/0121_snapshot.json +9437 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/server/index.js +181119 -172125
- package/dist/server/index.js.map +2 -2
- package/package.json +4 -4
- package/dist/client/assets/ConnectionAccessLists-uBJL31Ay.js +0 -1
- package/dist/client/assets/HandlePage-C6lAHsBo.js +0 -1
- package/dist/client/assets/NamePage-C0Mhnk4v.js +0 -1
- package/dist/client/assets/PhotoPage-DK8jrI66.js +0 -1
- package/dist/client/assets/RunsOnPopover-Dj0c45ua.js +0 -1
- package/dist/client/assets/SessionsPage-BMABy-lt.js +0 -6
- package/dist/client/assets/index-CV_tZl11.js +0 -1
- package/dist/client/assets/index-D5zhwLA1.js +0 -1
- package/dist/client/assets/index-DBrS_qK1.js +0 -1
- package/dist/client/assets/index-DtWF2VPM.css +0 -1
- package/dist/client/assets/index-GxKQ7usg.js +0 -33
- package/dist/client/assets/index-irBM12M1.js +0 -17
- package/dist/client/assets/room-files-source-Tt08gsJM.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Hh=Object.defineProperty;var Vh=(n,t,e)=>t in n?Hh(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var k=(n,t,e)=>Vh(n,typeof t!="symbol"?t+"":t,e);import{r as z,j as lt,
|
|
1
|
+
var Hh=Object.defineProperty;var Vh=(n,t,e)=>t in n?Hh(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var k=(n,t,e)=>Vh(n,typeof t!="symbol"?t+"":t,e);import{r as z,j as lt,gt as qh,gF as Gh,gG as Yh,gr as Xh,gH as Qh}from"./index-DgM6zNKn.js";function w(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);throw e.search=r.toString(),Error(`Minified Lexical error #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Nu(n,...t){const e=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",n);for(const o of t)r.append("v",o);e.search=r.toString(),console.warn(`Minified Lexical warning #${n}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Zh(){return typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0}const ee=Zh();function tg(){return ee&&"documentMode"in document?document.documentMode:null}const eg=tg();function ng(n){return ee&&n.test(navigator.platform)}function ro(n){return ee&&n.test(navigator.userAgent)}const Yn=ng(/Mac|iPod|iPhone|iPad/),Oe=ro(/^(?!.*Seamonkey)(?=.*Firefox).*/i);function rg(){return!(!ee||!("InputEvent"in window)||eg)&&"getTargetRanges"in new window.InputEvent("input")}const Xn=rg();function og(){return ee&&!window.MSStream&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||/Macintosh/.test(navigator.userAgent)&&navigator.maxTouchPoints>1)}const $e=og(),Eu=ro(/Android/),oo=ro(/Version\/[\d.]+.*Safari/)&&!Eu,wu=ro(/^(?=.*Chrome).*/i),Wo=ee&&Eu&&wu,io=ro(/AppleWebKit\/[\d.]+/)&&Yn&&!wu,Ou=128;function ig(){return 2047}const sg=ig(),Br=oo||$e||io?" ":"",cn=`
|
|
2
2
|
|
|
3
3
|
`,ol=Oe?" ":Br,Ct={bold:1,capitalize:1024,code:16,highlight:Ou,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},$u={directionless:1,unmergeable:2},Qn={center:2,end:6,justify:4,left:1,right:3,start:5};function Mu(n){const t={};for(const e of Object.keys(n))t[n[e]]=e;return t}const Fu=Mu(Qn),il={normal:0,segmented:2,token:1},Au=Mu(il),sl="$",lg=Symbol.for("@lexical/ctrlOrOtherKey"),Ui="$config";function ji(){return gt()._blockCursorElement}function Ji(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-slot")}const cg=io||$e||oo;function ec(){const n=ot().createElement("img");n.setAttribute("data-lexical-decorator-boundary","true"),n.alt="";for(const[t,e]of[["position","absolute"],["width","0px"],["height","0px"],["border","0px"],["margin","0px"],["padding","0px"]])n.style.setProperty(t,e,"important");return n}function Uo(n){return n!==null&&n.nodeType===1&&n.hasAttribute("data-lexical-decorator-boundary")}let Du=class $o{constructor(t,e,r){k(this,"element");k(this,"before");k(this,"after");this.element=t,this.before=e||null,this.after=r||null}withBefore(t){return new $o(this.element,t,this.after)}withAfter(t){return new $o(this.element,this.before,t)}withElement(t){return this.element===t?this:new $o(t,this.before,this.after)}insertChild(t){const e=this.getInsertionAnchor();return e!==null&&e.parentElement!==this.element&&w(357),this.element.insertBefore(t,e),this}removeChild(t){return t.parentElement!==this.element&&w(358),this.element.removeChild(t),this}replaceChild(t,e){return e.parentElement!==this.element&&w(359),this.element.replaceChild(t,e),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,r){if(this.element===t)return e===t&&r===0?"before":"after";const o=nc(t,this.element);if(o===null)return"after";const i=Array.prototype.indexOf.call(t.childNodes,o);if(i<0)return"after";if(e===t)return r<=i?"before":"after";const s=nc(t,e);if(s===null)return"after";const l=Array.prototype.indexOf.call(t.childNodes,s);return l>=0&&l<=i?"before":"after"}getInsertionAnchor(){return this.before}};function nc(n,t){let e=t;for(;e!==null&&e.parentNode!==n;)e=e.parentNode;return e}let Pu=class Mo extends Du{withBefore(t){return new Mo(this.element,t,this.after)}withAfter(t){return new Mo(this.element,this.before,t)}withElement(t){return this.element===t?this:new Mo(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()||this.getDecoratorBoundaryAnchor("trailing")}getFirstChildAnchor(){let t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;for(;Ji(e);)t=e,e=e.nextSibling;Uo(e)&&(t=e,e=e.nextSibling);const r=t?t.nextSibling:this.element.firstChild;return r!==null&&r===ji()?r:t}getDecoratorBoundaryAnchor(t){let e;if(t==="leading"){const r=super.getFirstChildAnchor();for(e=r?r.nextSibling:this.element.firstChild;Ji(e);)e=e.nextSibling}else e=this.before?this.before.previousSibling:this.element.lastChild,e!==null&&e===ji()&&(e=e.previousSibling);return Uo(e)?e:null}setDecoratorBoundaryAnchor(t,e){const r=this.getDecoratorBoundaryAnchor(t);if(e!==(r!==null))if(r!==null)this.element.removeChild(r);else if(t==="leading"){const o=this.getFirstChildAnchor();this.element.insertBefore(ec(),o?o.nextSibling:this.element.firstChild)}else this.element.insertBefore(ec(),this.before)}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){const e=this.element,r=this.after===null?e.firstChild:this.after.nextSibling,o=t==="empty"&&Ji(r)?null:t;if(e.__lexicalLastChildKind!==o)if(e.__lexicalLastChildKind=o,o===null)this.removeManagedLineBreak();else{const i=o==="decorator"&&cg;this.insertManagedLineBreak(i)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,r=t.nodeName==="IMG"?t.nextSibling:null;r&&e.removeChild(r),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===(e.nodeName==="IMG"))return;this.removeManagedLineBreak()}const r=this.element,o=this.before||this.getDecoratorBoundaryAnchor("trailing"),i=ot().createElement("br");if(i.setAttribute("data-lexical-managed-linebreak","true"),r.insertBefore(i,o),t){const s=ot().createElement("img");s.setAttribute("data-lexical-managed-linebreak","true"),s.style.setProperty("display","inline","important"),s.style.setProperty("border","0px","important"),s.style.setProperty("margin","0px","important"),s.alt="",r.insertBefore(s,i),r.__lexicalLineBreak=s}else r.__lexicalLineBreak=i}getFirstChildOffset(){const t=this.getFirstChild(),e=this.getInsertionAnchor();let r=0;for(let o=this.element.firstChild;o!==null&&o!==t&&o!==e;o=o.nextSibling)r++;return r}resolveChildIndex(t,e,r,o){if(r===this.element){const c=this.getFirstChildOffset(),a=ji(),u=this.element.childNodes,f=Math.min(o,u.length);let d=0;for(let h=c;h<f;h++)u[h]!==a&&d++;return[t,Math.min(d,t.getChildrenSize())]}const i=rc(e,r);i.push(o);const s=rc(e,this.element);let l=t.getIndexWithinParent();for(let c=0;c<s.length;c++){const a=i[c],u=s[c];if(a===void 0||a<u)break;if(a>u){l+=1;break}}return[t.getParentOrThrow(),l]}};function rc(n,t){const e=[];let r=t;for(;r!==n&&r!==null;r=r.parentNode){let o=0;for(let i=r.previousSibling;i!==null;i=i.previousSibling)o++;e.push(o)}return r!==n&&w(225),e.reverse()}function ag(){let n;try{n="0.51.0+prod.esm"}catch{}return n??'"<unknown>+source"'}const Iu=ag();let vr=class{constructor(){k(this,"_front",new Set);k(this,"_back",new Set);k(this,"_cache")}get size(){return this._front.size+this._back.size}addBack(t){return delete this._cache,this._front.has(t)||this._back.add(t),this}addFront(t){return delete this._cache,this._back.has(t)||this._front.add(t),this}delete(t){return delete this._cache,this._front.delete(t)||this._back.delete(t)}toArray(){const t=Array.from(this._front).reverse();for(const e of this._back)t.push(e);return t}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};const en=null;function Lu(n,t=1e3){return n instanceof ps?n.clone():n.size<t?new Map(n):new ps().init(new Map(n),void 0,n.size)}let ps=class Ru{constructor(){k(this,"_mutable",!1);k(this,"_old");k(this,"_nursery");k(this,"_size",0)}clone(){return this._mutable=!1,new Ru().init(this._old,this._nursery,this._size)}init(t,e,r){return this._old=t,this._nursery=e,this._size=r,this}get size(){return this._size}has(t){return this.get(t)!==void 0}getWithTombstone(t){const e=this._nursery&&this._nursery.get(t);return e!==void 0?e:this._old&&this._old.get(t)}get(t){const e=this.getWithTombstone(t);return e===en?void 0:e}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(t=!1){if(this._nursery&&this._nursery.size>0&&(t||this.shouldCompact())){const e=new Map(this._old);for(const[r,o]of this._nursery)o!==en?e.set(r,o):e.delete(r);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(t,e){const r=this.getWithTombstone(t);if(r===e)return this;const o=this.getNursery();return r!==en&&r!==void 0||(this._size++,r===en&&o.delete(t)),o.set(t,e),this}delete(t){const e=this.has(t);return e&&(this.getNursery().set(t,en),this._size--),e}getOrInsert(t,e){const r=this.get(t);return r!==void 0?r:(this.set(t,e),e)}getOrInsertComputed(t,e){const r=this.get(t);if(r!==void 0)return r;const o=e(t);return this.set(t,o),o}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(const t of this.entries())yield t[0]}*values(){for(const t of this.entries())yield t[1]}*entries(){const t=this._nursery,e=this._old;if(t){if(e)for(const r of e){const o=r[0],i=t.get(o);i!==en&&(i!==void 0&&(r[1]=i),yield r)}for(const r of t)r[1]===en||e&&e.has(r[0])||(yield r)}else e&&(yield*e)}forEach(t,e){e!==void 0&&(t=t.bind(e));for(const[r,o]of this.entries())t(o,r,this)}get[Symbol.toStringTag](){return"GenMap"}[Symbol.iterator](){return this.entries()}},Or=!1;function ug(n,t,...e){const r=Or;let o;try{Or=n,o=t()}finally{Or=r}var i;return(i=o)===null||typeof i!="object"&&typeof i!="function"||typeof i.then!="function"||w(421),o}function fg(){return Or}function zu(n){const t=n.exportJSON(Or),e=n.constructor;return t.type!==e.getType()&&w(130,e.name),b(n)&&!Array.isArray(t.children)&&w(59,e.name),t}function jo(n,t,e,r,o,i){if(b(n)){let s=n.getFirstChild();for(;s!==null;){const l=s.__key;s.__parent===t&&((b(s)||un(s)&&s.__slots!==null)&&jo(s,l,e,r,o,i),e.has(l)||i.delete(l),o.push(l)),s=s.getNextSibling()}}for(const s of un(n)&&n.__slots!==null?n.__slots.values():[]){const l=r.get(s);l!==void 0&&Sn(l)&&l.__slotHost===t&&((b(l)||un(l)&&l.__slots!==null)&&jo(l,s,e,r,o,i),e.has(s)||i.delete(s),o.push(s))}}let _s=!1,ll=0;function dg(n){ll=n.timeStamp}function Hi(n,t,e){const r=n.nodeName==="BR",o=t.__lexicalLineBreak;return o&&(n===o||r&&n.previousSibling===o)||r&&gr(n,e)!==void 0}function hg(n,t,e){const r=Lt(Kt(e)),o=r&&Bt(r,e._rootElement);let i=null,s=null;o!==null&&o.anchorNode===n&&(i=o.anchorOffset,s=o.focusOffset);const l=n.nodeValue;l!==null&&Fl(t,l,i,s,!1)}function gg(n,t,e){if(O(n)){const r=n.anchor.getNode();if(r.is(e)&&n.format!==r.getFormat())return!1}return ve(t)&&e.isAttached()}function pg(n,t,e){for(let r=n;r&&!Td(r);r=$n(r)){const o=gr(r,t);if(o!==void 0){const i=nt(o,e);if(i)return J(i)||!q(r)?void 0:[r,i]}}}function Bu(n,t,e){_s=!0;const r=performance.now()-ll>100;try{te(n,()=>{const o=A()||(function(f){return f.read("latest",()=>{const d=A();return d!==null?d.clone():null})})(n),i=new Map,s=n._editorState,l=n._blockCursorElement;let c=!1,a="";for(let f=0;f<t.length;f++){const d=t[f],h=d.type,g=d.target,_=pg(g,n,s);if(!_)continue;const[m,p]=_;if(h==="characterData")r&&M(p)&&ve(g)&&gg(o,g,p)&&hg(g,p,n);else if(h==="childList"){c=!0;const y=d.addedNodes;for(let S=0;S<y.length;S++){const C=y[S],N=ud(C),T=C.parentNode;if(!(T==null||C===l||N!==null||Hi(C,T,n)||Uo(C)||n._slotsUsed&&q(C)&&C.hasAttribute("data-lexical-slot")||Td(C))){if(Oe){const E=(q(C)?C.innerText:null)||C.nodeValue;E&&(a+=E)}T.removeChild(C)}}const x=d.removedNodes,v=x.length;if(v>0){let S=0;for(let C=0;C<v;C++){const N=x[C];Hi(N,g,n)||l===N?(g.appendChild(N),S++):Uo(N)&&S++}v!==S&&i.set(m,p)}}}if(i.size>0)for(const[f,d]of i)d.reconcileObservedMutation(f,n);const u=e.takeRecords();if(u.length>0){for(let f=0;f<u.length;f++){const d=u[f],h=d.addedNodes,g=d.target;for(let _=0;_<h.length;_++){const m=h[_],p=m.parentNode;p==null||m.nodeName!=="BR"||Hi(m,g,n)||p.removeChild(m)}}e.takeRecords()}o!==null&&(c&&St(o),Oe&&_d(n)&&o.insertRawText(a))})}finally{_s=!1}}function Ku(n){const t=n._observer;t!==null&&Bu(n,t.takeRecords(),t)}function Wu(n){(function(t){ll===0&&Kt(t).addEventListener("textInput",dg,!0)})(n),n._observer=new MutationObserver((t,e)=>{Bu(n,t,e)})}function Uu(n,t,e){const{isEqual:r}=n;return t===e||r!==void 0&&r(t,e)}function cl(n,t){return Uu(n,t,n.defaultValue)}function Je(n){return typeof n=="object"&&n!==null}function ne(n,t){const e=Ni(n,t).getter;return Je(e)&&e.getterTable!==void 0||w(405,t),al(e.getterTable)}function ce(n,t){const e=Ni(n,t).setter;return Je(e)&&e.setterTable!==void 0||w(406,t),al(e.setterTable)}function Zn(n,t,e){let{meta:r}=Ni(n,t);for(let o=0;;){if(r.kind==="aliased")return al(r.aliases);r.kind==="nullable"||r.kind==="optional"?r=r.inner.meta:r.kind==="array"?r=r.item.meta:w(407,t,String(e))}}function ae(n,t){const e=Ni(n,t),{setter:r}=e;Je(r)&&r.setterTable!==void 0||w(408,t);const o=String(e.defaultValue);return Ke(r.setterTable,o)||w(409,t,o),r.setterTable[o]}function al(n){return Object.assign(Object.create(null),n)}function Ni(n,t){const e=n.get(t);return e===void 0&&w(410,t),e}function Nn(n,t,e,r,o){o!==void 0&&_g.add(o);const i=e===void 0,s=i?n(void 0):e;return i&&Ju(s),Object.assign(n,{accepts:o,defaultValue:s,isEqual:r,meta:t})}const _g=new WeakSet,ju=new WeakSet;function mg(n){return n!==null&&typeof n=="object"&&ju.add(n),n}function Ju(n){if(n!==null&&typeof n=="object"&&!Object.isFrozen(n)&&!ju.has(n)){Object.freeze(n);for(const t of Object.values(n))Ju(t)}}function Hu(n){const{isEqual:t}=n;return t===void 0?void 0:(e,r)=>e==null||r==null?e===r:t(e,r)}function Vu(n,t){return e=>t(e)||ul(n,e)}function ul(n,t){const{accepts:e}=n;return e!==void 0?e.call(n,t):(function(r,o){const{accepts:i}=r;if(i!==void 0)return ul(r,o)?{parsed:r(o)}:void 0;const s=r(o);return cl(r,s)&&o!==r.defaultValue?void 0:{parsed:s}})(n,t)!==void 0}function Ke(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function re(n=""){return Nn(t=>typeof t=="string"?t:n,{kind:"string"},void 0,void 0,t=>typeof t=="string")}const yg=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function He(n=0,t={}){const{integer:e,clamp:r}=t,o=e&&t.min!==void 0?Math.ceil(t.min):t.min,i=e&&t.max!==void 0?Math.floor(t.max):t.max,s=a=>typeof a=="string"&&yg.test(a)?Number(a):a,l=a=>typeof a=="number"&&Number.isFinite(a)&&(!e||Number.isInteger(a)),c=a=>l(a)&&(o===void 0||a>=o)&&(i===void 0||a<=i);return Nn(a=>{const u=s(a);return r&&l(u)?o!==void 0&&u<o?o:i!==void 0&&u>i?i:u:c(u)?u:n},{clamp:r,integer:e,kind:"number",max:i,min:o},void 0,void 0,a=>r?l(s(a)):c(s(a)))}function fl(n=!1){return Nn(t=>typeof t=="boolean"?t:n,{kind:"boolean"},void 0,void 0,t=>typeof t=="boolean")}function dn(n,...t){const e=mg(t.length!==0?t[0]:n[0]),r=new Set(n);return Nn(o=>o!==void 0&&r.has(o)?o:e,{kind:"enum",values:n},e,void 0,o=>r.has(o)&&(o!==void 0||e===void 0))}function $r(n,t={}){const{defaultAsNull:e}=t;return Nn(r=>{if(r==null)return null;const o=n(r);return e&&cl(n,o)?null:o},{defaultAsNull:e,inner:n,kind:"nullable"},void 0,Hu(n),Vu(n,r=>r==null))}function Jo(n,t={}){const{omitDefault:e}=t;return Nn(r=>{if(r===void 0)return;const o=n(r);return e&&cl(n,o)?void 0:o},{inner:n,kind:"optional",omitDefault:e},void 0,Hu(n),Vu(n,r=>r===void 0))}function xe(){return n=>(function(t){return{meta:{fields:t,kind:"node"}}})(n)}function ms(n,t){const e=r=>typeof r=="string"&&Ke(t,r);return Nn(r=>e(r)?t[r]:n(r),{aliases:t,inner:n,kind:"aliased"},n.defaultValue,n.isEqual,r=>e(r)||ul(n,r))}function Mt(n,t){return qu("withField",n,{getter:{field:t.field,getterTable:t.getterTable,method:t.getter,when:t.when},setter:{field:t.field,method:t.setter,setterTable:t.setterTable}})}function ie(n,t){return qu("withAccessors",n,t)}function qu(n,t,e){return Object.assign(r=>t(r),{accepts:t.accepts,defaultValue:t.defaultValue,getter:e.getter,isEqual:t.isEqual,meta:t.meta,setter:e.setter})}const oc="latest";class xg{constructor(t,e){k(this,"key");k(this,"parse");k(this,"unparse");k(this,"isEqual");k(this,"defaultValue");k(this,"resetOnCopyNode");k(this,"schema");this.key=t;const r="meta"in(o=e.parse)&&typeof o.meta=="object"&&o.meta!==null&&"kind"in o.meta&&typeof o.meta.kind=="string"&&"defaultValue"in o?e.parse:void 0;var o;this.schema=r,this.parse=e.parse.bind(e),this.unparse=(e.unparse||Cg).bind(e),this.isEqual=e.isEqual?e.isEqual.bind(e):r!==void 0&&r.isEqual!==void 0?(i,s)=>Uu(r,i,s):Object.is,this.defaultValue=r!==void 0?r.defaultValue:this.parse(void 0),this.resetOnCopyNode=e.resetOnCopyNode||!1}}function ur(n,t){return new xg(n,t)}function Kr(n,t,e=oc){const r=(e===oc?n.getLatest():n).__state;return r?r.getValue(t):t.defaultValue}function fr(n,t,e){let r;if(xt(),typeof e=="function"){const i=n.getLatest(),s=Kr(i,t);if(r=e(s),t.isEqual(s,r))return i}else r=e;const o=n.getWritable();return Yu(o).updateFromKnown(t,r),o}function vg(n){const t=new Map,e=new Set;for(const{ownNodeConfig:r}of vn(typeof n=="function"?n:n.replace))if(r&&r.stateConfigs)for(const o of r.stateConfigs){let i;"stateConfig"in o?(i=o.stateConfig,o.flat&&e.add(i.key)):i=o,t.set(i.key,i)}return{flatKeys:e,sharedConfigMap:t}}const ic=new Set(["__proto__","constructor","prototype"]);let Sg=class Gu{constructor(t,e,r=void 0,o=new Map,i=void 0){k(this,"node");k(this,"knownState");k(this,"unknownState");k(this,"sharedNodeState");k(this,"size");this.node=t,this.sharedNodeState=e,this.unknownState=r,this.knownState=o;const{sharedConfigMap:s}=this.sharedNodeState,l=i!==void 0?i:(function(c,a,u){let f=u.size;if(a)for(const d in a){const h=c.get(d);h&&u.has(h)||f++}return f})(s,r,o);this.size=l}getValue(t){const e=this.knownState.get(t);if(e!==void 0)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let r=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const o=this.unknownState[t.key];o!==void 0&&(r=t.parse(o)),this.updateFromKnown(t,r)}return r}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[r,o]of this.knownState)r.isEqual(o,r.defaultValue)?delete t[r.key]:t[r.key]=r.unparse(o);for(const r of this.sharedNodeState.flatKeys)r in t&&(e[r]=t[r],delete t[r]);return sc(t)&&(e[sl]=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:r}=this,o=new Map(this.knownState);return new Gu(t,e,(function(i,s,l){let c;if(l)for(const[a,u]of Object.entries(l)){if(ic.has(a))continue;const f=i.get(a);f?s.has(f)||s.set(f,f.parse(u)):(c=c||{},c[a]=u)}return c})(e.sharedConfigMap,o,r),o,this.size)}resetOnCopyNode(){for(const t of this.knownState.keys())t.resetOnCopyNode&&this.knownState.set(t,t.defaultValue);return this}updateFromKnown(t,e){const r=t.key;this.sharedNodeState.sharedConfigMap.set(r,t);const{knownState:o,unknownState:i}=this;o.has(t)||i&&r in i||(i&&(delete i[r],this.unknownState=sc(i)),this.size++),o.set(t,e)}updateFromUnknown(t,e){if(ic.has(t))return;const r=this.sharedNodeState.sharedConfigMap.get(t);r?this.updateFromKnown(r,r.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e)}updateFromJSON(t){const{knownState:e}=this;for(const r of e.keys())e.set(r,r.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[r,o]of Object.entries(t))this.updateFromUnknown(r,o)}};function Yu(n){const t=n.getWritable(),e=t.__state?t.__state.getWritable(t):new Sg(t,(function(r){return r.__state?r.__state.sharedNodeState:ld(gt(),r.getType()).sharedNodeState})(t));return t.__state=e,e}function Xu(n,t){const e=n.getWritable(),r=t[sl];return(e.__state||r)&&Yu(n).updateFromJSON(r),e}function sc(n){if(n)for(const t in n)return n}function Cg(n){return n}function lc(n,t,e){for(const[r,o]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const i=e?e.getValue(r):r.defaultValue;if(i!==o&&!r.isEqual(i,o))return!0}return!1}function cc(n,t,e){const{unknownState:r}=t,o=e?e.unknownState:void 0;if(r){for(const[i,s]of Object.entries(r))if(!n.has(i)&&(n.add(i),s!==(o?o[i]:void 0)))return!0}return!1}function ac(n,t){const e=n.__state;return e&&e.node===n?e.getWritable(t):e}function uc(n,t){const e=n.__mode,r=n.__format,o=n.__style,i=t.__mode,s=t.__format,l=t.__style,c=n.__state,a=t.__state;return(e===null||e===i)&&(r===null||r===s)&&(o===null||o===l)&&(n.__state===null||c===a||(function(u,f){if(u===f)return!0;const d=new Set;return!(u&&lc(d,u,f)||f&&lc(d,f,u)||u&&cc(d,u,f)||f&&cc(d,f,u))})(c,a))}function fc(n,t){const e=n.mergeWithSibling(t),r=G()._normalizedNodes;return r.add(n.__key),r.add(t.__key),e}function dc(n){let t,e,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&M(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if(uc(t,r)){r=fc(t,r);break}break}t.remove()}for(;(e=r.getNextSibling())!==null&&M(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if(uc(r,e)){r=fc(r,e);break}break}e.remove()}}else r.remove()}function dl(n){return hc(n.anchor),hc(n.focus),n}function hc(n){for(;n.type==="element";){const t=n.getNode(),e=n.offset;let r,o;if(e===t.getChildrenSize()?(r=t.getChildAtIndex(e-1),o=!0):(r=t.getChildAtIndex(e),o=!1),M(r)){n.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!b(r))break;n.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}const Ho=Symbol.for("@lexical/CachedTextSize");function gc(n,t){return xs.read(()=>{let e=0,r=n;for(let o=0;o<t&&r!==null;o++){const i=oe.get(r);if(i===void 0&&w(345,r),b(i)){const s=st.get(r);if(s!==void 0&&b(s)&&s.__parent!==i.__parent)e+=i.getTextContentSize();else{const l=hn.get(r),c=l&&l.__lexicalTextContent;typeof c!="string"&&w(346,i.getType()),e+=c.length}o<t-1&&!i.isInline()&&(e+=2)}else{const s=i[Ho];s===void 0&&w(347,i.getType(),r),e+=s}r=i.__next}return e},{editor:V})}function Qu(n){b(n)||n[Ho]===void 0&&(n[Ho]=M(n)?n.__text.length:n.getTextContentSize())}const bg=4;let Wr,V,Ur,j="",ht=null,$t=null,wt=null;function he(){return{firstTextKey:wt,format:ht,style:$t}}function Vt(n){n.firstTextKey!==null&&(ht=n.format,$t=n.style,wt=n.firstTextKey)}function ys(n){if(wt!==null)return;const t=n.__lexicalFirstTextKey;if(t===void 0&&w(348),t===null)return;const e=st.get(t);M(e)&&(ht=e.getFormat(),$t=e.getStyle(),wt=t)}let Ei,Mr,Fr,oe,xs,st,hn,vs,jr,gn,ke=!1,Vo=!1;function We(n,t){const e=oe.get(n),r=st.has(n);if(t!==null){const o=ks(n);o.parentNode===t&&t.removeChild(o)}if(!r){if(V._keyToDOMMap.delete(n),b(e)){const o=_i(e,oe);Ss(o,0,o.length-1,null)}if(e!==void 0){for(const o of qt(e).values()){const i=bs(o);We(o,null),i!==null&&i.remove()}Al(jr,Ur,Ei,e,"destroyed")}}}function Ss(n,t,e,r){for(let o=t;o<=e;++o){const i=n[o];i!==void 0&&We(i,r)}}function nn(n,t){n.setProperty("text-align",t)}const Tg="40px";function Zu(n,t){const e=Wr.theme.indent;if(typeof e=="string"){const r=n.classList.contains(e);t>0&&!r?n.classList.add(e):t<1&&r&&n.classList.remove(e)}n.style.setProperty("padding-inline-start",t===0?"":`calc(${t} * var(--lexical-indent-base-value, ${Tg}))`),Xr(n,"class"),Xr(n,"style")}function tf(n,t){const e=n.style;t===0?nn(e,""):t===1?nn(e,"left"):t===2?nn(e,"center"):t===3?nn(e,"right"):t===4?nn(e,"justify"):t===5?nn(e,"start"):t===6&&nn(e,"end"),Xr(n,"style")}function Cs(n,t){const e=(function(r){const o=r.__dir;if(o!==null)return o;if(ut(r))return null;const i=r.getParent();return i===null||Z(i)&&i.__dir===null?"auto":null})(t);e!==null?n.dir=e:n.removeAttribute("dir")}function ef(n){const t=ot().createElement("div");return t.setAttribute("data-lexical-slot",n),t.style.display="none",t}function nf(n,t,e){t||n.contentEditable==="false"?__(e,V):e.removeAttribute("contenteditable")}function pc(n,t,e){const r=j,o=he();j="";let i="";const s=J(n);for(const[l,c]of e){const a=ef(l);nf(t,s,a),t.appendChild(a),j="";const u=he();Ue(c,Ut(n,a,V)),Vt(u),rf(n,l,t,a),i+=j}return Vt(o),j=r,i}function qt(n){return un(n)&&n.__slots!==null?n.__slots:Od}function rf(n,t,e,r){const o=gn.$getSlotTargetElement(n,t,e,V);o!==null&&(r.parentElement!==o&&o.appendChild(r),r.style.display="")}function bs(n){const t=hn.get(n);return t!==void 0?t.parentElement:null}function _c(n,t,e){const r=qt(n),o=qt(t);for(const[u,f]of r)if(!o.has(u)){const d=bs(f);We(f,null),d!==null&&d.remove()}const i=j,s=he();let l="",c=null;const a=J(t);for(const[u,f]of o){const d=r.get(u);let h=d!==void 0?bs(d):null;j="";const g=he();if(h===null){h=ef(u);let _=null;for(const m of e.children)if(!m.hasAttribute("data-lexical-slot")){_=m;break}e.insertBefore(h,_),Ue(f,Ut(t,h,V))}else d===f?Te(f,h):(d!==void 0&&We(d,h),Ue(f,Ut(t,h,V)));if(Vt(g),nf(e,a,h),rf(t,u,e,h),l+=j,h.parentElement===e){const _=c===null?e.firstChild:c.nextSibling;_!==h&&e.insertBefore(h,_),c=h}}return Vt(s),j=i,l}function Ue(n,t){const e=st.get(n);if(e===void 0&&w(60),t!==null){const o=oe.get(n);if(o!==void 0){const i=hn.get(n);if(i!==void 0){const s=Sn(o)?o.__slotHost:null,l=Sn(e)?e.__slotHost:null,c=o.__parent!==e.__parent||s!==l,a=l!==null&&i.parentElement!==t.element;if(c||a)return t.insertChild(i),Te(n,t.element)}}}const r=gn.$createDOM(e,V);if((function(o,i,s){const l=s._keyToDOMMap;fd(i,s,o),l.set(o,i)})(n,r,V),M(e)?r.setAttribute("data-lexical-text","true"):J(e)&&(r.setAttribute("data-lexical-decorator","true"),p_(r,{captureSelection:!0})),b(e)){const o=e.__indent,i=e.__size;Cs(r,e),o!==0&&Zu(r,o);const s=qt(e),l=s.size>0?pc(e,r,s):"";if(i===0)r.__lexicalTextContent=l,r.__lexicalFirstTextKey=null,j+=l,s.size>0&&(r.__lexicalSlotTextLength=l.length);else{const a=j,u=i-1;if(Ts(_i(e,st),e,0,u,Ut(e,r,V)),l!==""){const f=r.__lexicalTextContent||"";r.__lexicalTextContent=l+f,j=a+l+f}s.size>0&&(r.__lexicalSlotTextLength=l.length)}const c=e.__format;c!==0&&tf(r,c),e.isInline()||(sf(null,e,r),of(e,r))}else{const o=e.getTextContent();if(J(e)){const i=e.decorate(V,Wr);i!==null&&lf(n,i),r.contentEditable="false";const s=qt(e);s.size>0&&pc(e,r,s)}j+=o}return t!==null&&t.insertChild(r),gn.$decorateDOM(e,null,r,V),Qu(e),Al(jr,Ur,Ei,e,"created"),r}function Ts(n,t,e,r,o){const i=j,s=he();j="",ht=null,$t=null,wt=null;let l=e;for(;l<=r;++l){const a=he();Ue(n[l],o);const u=st.get(n[l]);u!==null&&M(u)?ht===null&&(ht=u.getFormat(),$t=u.getStyle(),wt=u.__key):b(u)&&l<r&&!u.isInline()&&(j+=cn),Vt(a)}const c=V._keyToDOMMap.get(t.__key);c===void 0&&w(349,t.__key),c.__lexicalTextContent=j,c.__lexicalFirstTextKey=wt,j=i+j,Vt(s)}function mc(n,t){if(!n)return!1;const e=t.get(n);return J(e)&&!e.isInline()}function of(n,t){const e=Ut(n,t,V);e.setDecoratorBoundaryAnchor("leading",mc(n.__first,st)),e.setDecoratorBoundaryAnchor("trailing",mc(n.__last,st))}function sf(n,t,e){const r=Ut(t,e,V),o=(function(i,s){if(i){const l=i.__last;if(l){const c=s.get(l);if(c)return Nt(c)?"line-break":J(c)&&c.isInline()?"decorator":null}return"empty"}return null})(t,st);r.setManagedLineBreak(o)}function kg(n,t,e){var r;ht=null,$t=null,wt=null,(function(o,i,s){const l=j,c=o.__size,a=i.__size;j="";const u=s.element,f=V._keyToDOMMap.get(i.__key);f===void 0&&w(351,i.__key);const d=a-c;if(!ke&&Math.abs(d)<=1&&c>=bg&&o.__first===i.__first&&(d!==0||!V._cloneNotNeeded.has(o.__key))){const h=f.__lexicalTextContent,g=vs.get(o.__key);if(!ke&&typeof h=="string"&&g!==void 0){const _=(function(m,p){const y=p.size;if(y===0||y>=m.__size)return null;let x=m.__last,v=null,S=0;for(;x!==null&&S<y;){if(!p.has(x))return null;v=x;const C=st.get(x);if(C===void 0)return null;x=C.__prev,S++}return S!==y||x!==null&&p.has(x)?null:v})(i,g);if(_!==null){const m=g.size;if(d===0){const p=gc(_,m);let y=_,x=0;for(;y!==null&&x<m;){const T=st.get(y);if(T===void 0)break;const E=he();Te(y,u),M(T)&&ht===null&&(ht=T.getFormat(),$t=T.getStyle(),wt=T.__key),Vt(E),y=T.__next,x++}let v="";for(y=_,x=0;y!==null&&x<m;){const T=st.get(y);if(T===void 0)break;let E;if(b(T)){const $=V._keyToDOMMap.get(y),F=$&&$.__lexicalTextContent;typeof F!="string"&&w(352,T.getType()),E=F}else E=T.getTextContent();v+=E,x<m-1&&b(T)&&!T.isInline()&&(v+=cn),y=T.__next,x++}const S=f.__lexicalSlotTextLength||0,C=S>0?h.slice(S):h,N=C.slice(0,C.length-p)+v;return f.__lexicalTextContent=N,j=l+N,void yc(i,f,g)}if((function(p,y,x,v,S,C,N,T){if(T!==1&&T!==-1||N!==(T===1?2:1))return!1;const $=N-T;let F=p.__last;for(let it=0;it<$-1;it++){if(F===null)return!1;const _t=oe.get(F);if(_t===void 0)return!1;F=_t.__prev}if(F===null)return!1;const D=st.get(C),L=oe.get(F);if(D===void 0||L===void 0||D.__prev!==L.__prev)return!1;const B=[];let U=C;for(let it=0;it<N;it++){if(U===null)return!1;B.push(U);const _t=st.get(U);U=_t?_t.__next:null}const Q=[];U=F;for(let it=0;it<$;it++){if(U===null)return!1;Q.push(U);const _t=oe.get(U);U=_t?_t.__next:null}const H=new Set(Q),Et=new Set(B),et=[];let ft=0,dt=0;for(;ft<$&&dt<N;)if(B[dt]===Q[ft])et.push({key:B[dt],kind:"reconcile"}),ft++,dt++;else if(Et.has(Q[ft])){if(H.has(B[dt]))return!1;et.push({key:B[dt],kind:"create",nextIndex:dt}),dt++}else et.push({key:Q[ft],kind:"destroy"}),ft++;for(;ft<$;)et.push({key:Q[ft++],kind:"destroy"});for(;dt<N;)et.push({key:B[dt],kind:"create",nextIndex:dt}),dt++;const Se=gc(F,$);for(const it of et){const _t=he();if(it.kind==="reconcile")Te(it.key,x.element);else if(it.kind==="destroy")We(it.key,x.element);else{let Ht=null;for(let Fn=it.nextIndex+1;Fn<N;Fn++){const xr=V._keyToDOMMap.get(B[Fn]);if(xr!==void 0){Ht=xr;break}}Ue(it.key,x.withBefore(Ht??x.before))}if(it.kind!=="destroy"){const Ht=st.get(it.key);Ht&&M(Ht)&&ht===null&&(ht=Ht.getFormat(),$t=Ht.getStyle(),wt=Ht.__key)}Vt(_t)}let Jt="";for(let it=0;it<N;it++){const _t=st.get(B[it]);if(_t===void 0)return!1;let Ht;if(b(_t)){const Fn=V._keyToDOMMap.get(B[it]),xr=Fn&&Fn.__lexicalTextContent;typeof xr!="string"&&w(350,_t.getType()),Ht=xr}else Ht=_t.getTextContent();Jt+=Ht,it<N-1&&b(_t)&&!_t.isInline()&&(Jt+=cn)}const Ae=v.__lexicalSlotTextLength||0,yr=Ae>0?S.slice(Ae):S;return v.__lexicalTextContent=yr.slice(0,yr.length-Se)+Jt,!0})(o,0,s,f,h,_,m,d)){const p=f.__lexicalTextContent;return typeof p!="string"&&w(353),j=l+p,void yc(i,f,g)}}}if(d===0){let _=o.__first,m=0;for(;_!==null;){const p=st.get(_);if(p===void 0)break;const y=ke||Fr.has(_)||Mr.has(_),x=he();if(y)Te(_,u);else{let v,S;if(b(p)){S=hn.get(_);const C=S&&S.__lexicalTextContent;typeof C!="string"&&w(354,p.getType()),v=C}else v=p.getTextContent();j+=v,S!==void 0&&ys(S)}M(p)?ht===null&&(ht=p.getFormat(),$t=p.getStyle(),wt=p.__key):b(p)&&m<a-1&&!p.isInline()&&(j+=cn),Vt(x),_=p.__next,m++}return f.__lexicalTextContent=j,f.__lexicalFirstTextKey=wt,void(j=l+j)}}if(c===1&&a===1){const h=o.__first,g=i.__first;if(h===g)Te(h,u);else{const m=ks(h),p=Ue(g,null);try{m.parentNode===u?u.replaceChild(p,m):s.insertChild(p)}catch(y){if(typeof y=="object"&&y!=null){const x=`${y.toString()} Parent: ${u.tagName}, new child: {tag: ${p.tagName} key: ${g}}, old child: {tag: ${m.tagName}, key: ${h}}.`;throw new Error(x)}throw y}We(h,null)}const _=st.get(g);M(_)&&ht===null&&(ht=_.getFormat(),$t=_.getStyle(),wt=_.__key)}else{const h=_i(o,oe),g=_i(i,st);if(h.length!==c&&w(227),g.length!==a&&w(228),c===0)a!==0&&Ts(g,i,0,a-1,s);else if(a===0){if(c!==0){const _=s.after==null&&s.before==null&&qt(i).size===0&&s.element.__lexicalLineBreak==null;Ss(h,0,c-1,_?null:u),_&&(u.textContent="")}}else(function(_,m,p,y,x,v){const S=y-1,C=x-1;let N,T,E=v.getFirstChild(),$=0,F=0;for(;$<=S&&F<=C;){const B=m[$],U=p[F],Q=he();if(B===U)E=Vi(Te(U,v.element)),$++,F++;else{if(T===void 0&&(T=xc(p,F)),N===void 0)N=xc(m,$);else if(!N.has(B)){$++,Vt(Q);continue}if(!T.has(B)){E=Vi(ks(B)),We(B,v.element),$++,N.delete(B),Vt(Q);continue}if(N.has(U)){const Et=rr(V,U);Et!==E&&v.withBefore(E??v.before).insertChild(Et),E=Vi(Te(U,v.element)),$++,F++}else Ue(U,v.withBefore(E??v.before)),F++}const H=st.get(U);H!==null&&M(H)?ht===null&&(ht=H.getFormat(),$t=H.getStyle(),wt=H.__key):b(H)&&F<=C&&!H.isInline()&&(j+=cn),Vt(Q)}const D=$>S,L=F>C;if(D&&!L){const B=p[C+1],U=B===void 0?null:V.getElementByKey(B);Ts(p,_,F,C,v.withBefore(U??v.before))}else L&&!D&&Ss(m,$,S,v.element)})(i,h,g,c,a,s)}f.__lexicalTextContent=j,f.__lexicalFirstTextKey=wt,j=l+j})(n,t,Ut(t,e,V)),Z(t)||(r=t,ht==null||ht===r.__textFormat||Vo||r.setTextFormat(ht),(function(o){$t==null||$t===o.__textStyle||Vo||o.setTextStyle($t)})(t))}function yc(n,t,e){const r=t.__lexicalFirstTextKey;if(r!=null){const o=n.__key;let i=r;for(;i!==null;){const s=st.get(i);if(s===void 0){i=null;break}if(s.__parent===o)break;i=s.__parent}if(i!==null&&!e.has(i)){const s=st.get(r);if(M(s))return ht=s.getFormat(),void($t=s.getStyle())}}t.__lexicalFirstTextKey=wt}function Te(n,t){const e=oe.get(n);let r=st.get(n);e!==void 0&&r!==void 0||w(61);const o=ke||Fr.has(n)||Mr.has(n),i=rr(V,n);if(e===r&&!o){let s;if(b(e)){const l=i.__lexicalTextContent;typeof l!="string"&&w(355,e.getType()),s=l,ys(i)}else s=e.getTextContent();return j+=s,i}if(e!==r&&o&&Al(jr,Ur,Ei,r,"updated"),gn.$updateDOM(r,e,i,V)){const s=Ue(n,null);return t===null&&w(62),t.replaceChild(s,i),We(n,null),s}if(b(e)){b(r)||w(334,n);const s=r.__indent;(ke||s!==e.__indent)&&Zu(i,s);const l=r.__format;(ke||l!==e.__format)&&tf(i,l);const c=o&&(qt(r).size>0||qt(e).size>0)?_c(e,r,i):"";if(o){const a=j;if(kg(e,r,i),r.isInline()||(ut(r)||sf(0,r,i),of(r,i)),c!==""){const u=i.__lexicalTextContent||"";i.__lexicalTextContent=c+u,j=a+c+u,i.__lexicalSlotTextLength=c.length}else(qt(r).size>0||qt(e).size>0)&&(i.__lexicalSlotTextLength=0)}else{const a=i.__lexicalTextContent;typeof a!="string"&&w(356,e.getType()),j+=a,ys(i)}if((ke||r.__dir!==e.__dir||r.__parent!==e.__parent)&&(Cs(i,r),ut(r)&&!ke))for(const a of r.getChildren())b(a)&&Cs(rr(V,a.getKey()),a)}else{const s=r.getTextContent();if(J(r)){const l=r.decorate(V,Wr);l!==null&&lf(n,l),o&&(qt(r).size>0||qt(e).size>0)&&_c(e,r,i)}j+=s}if(!Vo&&ut(r)){const s=r.getLatest();if(s.__cachedText!==j){const l=s.getWritable();l.__cachedText=j,r=l}}return gn.$decorateDOM(r,e,i,V),Qu(r),i}function lf(n,t){let e=V._pendingDecorators;const r=V._decorators;if(e===null){if(r[n]===t)return;e=dd(V)}e[n]=t}function Vi(n){let t=n.nextSibling;return t!==null&&t===V._blockCursorElement&&(t=t.nextSibling),t}function xc(n,t){const e=new Set;for(let r=t;r<n.length;r++)e.add(n[r]);return e}function Ng(n,t,e,r,o,i){j="",ht=null,$t=null,wt=null,ke=r===2,V=e,Wr=e._config,gn=e._config.dom||ci,Ur=e._nodes,Ei=V._listeners.mutation,Mr=o,Fr=i,oe=n._nodeMap,xs=n,st=t._nodeMap,Vo=t._readOnly,hn=Lu(e._keyToDOMMap),vs=(function(){const l=new Map,c=a=>{for(const u of a){const f=st.get(u);if(f===void 0)continue;const d=f.__parent;if(d===null)continue;let h=l.get(d);h===void 0&&(h=new Set,l.set(d,h)),h.add(u)}};return c(Mr.keys()),c(Fr),l})();const s=new Map;return jr=s,Te("root",null),V=void 0,Ur=void 0,Mr=void 0,Fr=void 0,oe=void 0,xs=void 0,st=void 0,Wr=void 0,hn=void 0,vs=void 0,jr=void 0,gn=ci,s}function ks(n){const t=hn.get(n);return t===void 0&&w(75,n),t}function P(n){return{type:n}}const cf=P("SELECTION_CHANGE_COMMAND"),Eg=P("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),af=P("CLICK_COMMAND"),uf=P("BEFORE_INPUT_COMMAND"),ff=P("INPUT_COMMAND"),df=P("COMPOSITION_START_COMMAND"),hf=P("COMPOSITION_END_COMMAND"),an=P("DELETE_CHARACTER_COMMAND"),zn=P("INSERT_LINE_BREAK_COMMAND"),Jr=P("INSERT_PARAGRAPH_COMMAND"),Bn=P("CONTROLLED_TEXT_INSERTION_COMMAND"),wi=P("PASTE_COMMAND"),Fo=P("REMOVE_TEXT_COMMAND"),Hr=P("DELETE_WORD_COMMAND"),Kn=P("DELETE_LINE_COMMAND"),Le=P("FORMAT_TEXT_COMMAND"),wg=P("SET_TEXT_FORMAT_COMMAND"),qo=P("UNDO_COMMAND"),Vr=P("REDO_COMMAND"),gf=P("KEYDOWN_COMMAND"),pf=P("KEY_ARROW_RIGHT_COMMAND"),Ns=P("MOVE_TO_END"),_f=P("KEY_ARROW_LEFT_COMMAND"),Es=P("MOVE_TO_START"),hl=P("KEY_ARROW_UP_COMMAND"),gl=P("KEY_ARROW_DOWN_COMMAND"),so=P("KEY_ENTER_COMMAND"),mf=P("KEY_SPACE_COMMAND"),pl=P("KEY_BACKSPACE_COMMAND"),_l=P("KEY_ESCAPE_COMMAND"),yf=P("KEY_DELETE_COMMAND"),ml=P("KEY_TAB_COMMAND"),Og=P("INSERT_TAB_COMMAND"),$g=P("INDENT_CONTENT_COMMAND"),vc=P("OUTDENT_CONTENT_COMMAND"),yl=P("DROP_COMMAND"),Mg=P("FORMAT_ELEMENT_COMMAND"),xf=P("DRAGSTART_COMMAND"),xl=P("DRAGOVER_COMMAND"),Fg=P("DRAGEND_COMMAND"),Oi=P("COPY_COMMAND"),vl=P("CUT_COMMAND"),vf=P("SELECT_ALL_COMMAND"),Ag=P("CLEAR_EDITOR_COMMAND"),Dg=P("CLEAR_HISTORY_COMMAND"),po=P("CAN_REDO_COMMAND"),_o=P("CAN_UNDO_COMMAND"),Pg=P("FOCUS_COMMAND"),Ig=P("BLUR_COMMAND"),Lg=P("KEY_MODIFIER_COMMAND");function Sf(n,t){return{...t,[lg]:n}}const rn=Sf("metaKey",{ctrlKey:!Yn,metaKey:Yn}),Sc=Sf("altKey",{altKey:Yn,ctrlKey:!Yn}),Cc=[["altKey",1],["ctrlKey",2],["metaKey",4],["shiftKey",8]];function qi(n,t,e){const r=n.get(t);r?r.push(e):n.set(t,[e])}class Rg{constructor(){k(this,"byKey",new Map);k(this,"byCode",new Map)}add(t){const{key:e,modifiers:r={}}=t;e.length>0||w(399);const o=e.toLowerCase();for(const i of(function(s){let l=[0];for(const[c,a]of Cc){const u=s[c]||!1;u==="any"?l=l.concat(l.map(f=>f|a)):u&&(l=l.map(f=>f|a))}return l})(r))qi(this.byKey,`${i}:${o}`,t),e.length===1&&(/[0-9]/.test(e)?qi(this.byCode,`${i}:Digit${e}`,t):/[a-z]/.test(o)&&qi(this.byCode,`${i}:Key${o.toUpperCase()}`,t));return this}matches(t){const e=t.key;if(!e)return[];const r=(function(s){let l=0;for(const[c,a]of Cc)s[c]&&(l|=a);return l})(t),o=this.byKey.get(`${r}:${e.toLowerCase()}`),i=o?o.slice():[];if(this.byCode.size>0&&!(e.length===1&&e.charCodeAt(0)<=127)){const s=this.byCode.get(`${r}:${t.code}`);s&&i.push(...s)}return i}match(t){return this.matches(t)[0]}}function zg(n){const t=new Rg;for(const e of n)t.add(e);return t}function Bg(n){const t=new Map;return{dispose(){for(const e of t.values())e.dispose();t.clear()},register(e,r){let o=t.get(e);o===void 0&&(o={dispose:n(e,r),holders:new Set},t.set(e,o));const i=()=>{const s=t.get(e);s&&s.holders.delete(i)&&s.holders.size===0&&(t.delete(e),s.dispose())};return o.holders.add(i),i}}}function Kg(n,t,e,r){return n.addEventListener(t,e,r),n.removeEventListener.bind(n,t,e,r)}const Ce=Object.freeze({});let Gi;function Wg(){if(Gi!==void 0)return Gi;const n=[["keydown",Zg],["pointerdown",Jg],["compositionstart",Gg],["compositionend",Qg],["input",Vg],["click",jg],["cut",Ce],["copy",Ce],["dragstart",Ce],["dragover",Ce],["dragend",Ce],["paste",Ce],["focus",Ce],["blur",Ce],["drop",Ce]];return Xn&&n.push(["beforeinput",(t,e)=>(function(r,o){const i=r.inputType;i==="deleteCompositionText"||Oe&&_d(o)||i!=="insertCompositionText"&&te(o,()=>{kf(r,o)||R(o,uf,r)},{event:r})})(t,e)]),Gi=n,n}const ws=new WeakMap,Go=new WeakMap,Ug=Bg(n=>(n.addEventListener("selectionchange",Oc),()=>n.removeEventListener("selectionchange",Oc)));function Cf(n,t,e,r,o,i){const s=n.anchor,l=n.focus,c=s.getNode(),a=G();let u;if(i!==void 0)u=i;else{const _=Lt(Kt(a));u=_!==null?Bt(_,a._rootElement):null}const f=u!==null?u.anchorNode:null,d=s.key,h=a.getElementByKey(d),g=e.length;return d!==l.key||!M(c)||(!o&&(!Xn||a._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&g<2||hd(e))&&s.offset!==l.offset&&!c.isComposing()||Yt(c)||c.isDirty()&&g>1||(o||!Xn)&&h!==null&&!c.isComposing()&&f!==je(c,h,a)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==n.format||c.getStyle()!==n.style)||(function(_,m){if(m.isSegmented())return!0;if(!_.isCollapsed())return!1;const p=_.anchor.offset,y=m.getParentOrThrow(),x=ai(m);return p===0?!m.canInsertTextBefore()||!y.canInsertTextBefore()&&!m.isComposing()||x||(function(v){const S=v.getPreviousSibling();return(M(S)||b(S)&&S.isInline())&&!S.canInsertTextAfter()})(m):p===m.getTextContentSize()&&(!m.canInsertTextAfter()||!y.canInsertTextAfter()&&!m.isComposing()||x)})(n,c)}function bc(n,t){return ve(n)&&n.nodeValue!==null&&t!==0&&t!==n.nodeValue.length}function Tc(n,t,e){const{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=Bt(n,t._rootElement),l=t._inputState,c=l.isSelectionChangeFromDOMUpdate;if(c){l.isSelectionChangeFromDOMUpdate=!1;const a=l.selectionChangeFromDOMUpdatePoints;if(l.selectionChangeFromDOMUpdatePoints=null,bc(r,o)&&bc(i,s)&&!l.postDeleteSelectionToRestore&&(a===null||a.anchorNode===r&&a.anchorOffset===o&&a.focusNode===i&&a.focusOffset===s))return}te(t,()=>{if(!e)return void St(null);if(!uo(t,r,i))return;let a=A();if(l.postDeleteSelectionToRestore&&O(a)&&a.isCollapsed()){const f=a.anchor,d=l.postDeleteSelectionToRestore.anchor;(f.key===d.key&&f.offset===d.offset+1||f.offset===1&&d.getNode().is(f.getNode().getPreviousSibling()))&&(a=l.postDeleteSelectionToRestore.clone(),St(a))}if(l.postDeleteSelectionToRestore=null,O(a)){const f=a.anchor,d=f.getNode();if(a.isCollapsed()){n.type==="Range"&&r===i&&(a.dirty=!0);const h=Kt(t).event,g=h?h.timeStamp:performance.now(),{format:_,style:m,offset:p,key:y,timeStamp:x}=l.collapsedSelectionFormat,v=Y(),S=t.isComposing()===!1&&v.getTextContent()==="";if(g<x+200&&f.offset===p&&f.key===y)Ao(a,_,m);else if(f.type==="text")M(d)||w(141),bf(a,d);else if(f.type==="element"&&!S){b(d)||w(259);const C=f.getNode();C.isEmpty()?(function(N,T){const E=T.getTextFormat(),$=T.getTextStyle();Ao(N,E,$)})(a,C):Ao(a,a.format,"")}}else{const h=f.key,g=a.focus.key,_=a.getNodes(),m=_.length,p=a.isBackward(),y=p?s:o,x=p?o:s,v=p?g:h,S=p?h:g;let C=sg,N=!1;for(let T=0;T<m;T++){const E=_[T],$=E.getTextContentSize();if(M(E)&&$!==0&&!(T===0&&E.__key===v&&y===$||T===m-1&&E.__key===S&&x===0)&&(N=!0,C&=E.getFormat(),C===0))break}a.format=N?C:0}}const u=wn();(c||(a!==null?a.dirty||!O(a)||!a.is(u):u!==null))&&R(t,cf)})}function Ao(n,t,e){n.format===t&&n.style===e||(n.format=t,n.style=e,n.dirty=!0)}function bf(n,t){Ao(n,t.getFormat(),t.getStyle())}function jg(n,t){te(t,()=>{const e=A(),r=Lt(Kt(t)),o=wn();if(r){if(O(e)){const i=e.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&e.isCollapsed()&&!ut(s)&&Y().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&o!==null&&e.is(o)&&(r.removeAllRanges(),e.dirty=!0)}else if(n.pointerType==="touch"||n.pointerType==="pen"){const i=Bt(r,t._rootElement).anchorNode;(q(i)||ve(i))&&St(ei(o,r,t,n))}}if(Oe&&r!==null&&r.rangeCount===0){const i=t._rootElement;if(i!==null&&n.target===i){const s=n.clientY;let l=i.childNodes.length;for(let a=0;a<i.childNodes.length;a++){const u=i.childNodes[a];if(q(u)){const f=u.getBoundingClientRect();if(s<=(f.top+f.bottom)/2){l=a;break}}}r.setBaseAndExtent(i,l,i,l);const c=ei(o,r,t,n);c!==null?St(c):r.removeAllRanges()}}R(t,af,n)})}function Jg(n,t){const e=Sd(n),r=n.pointerType;pr(e)&&r!=="touch"&&r!=="pen"&&n.button===0&&te(t,()=>{gi(e,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}function Tf(n){if(!n.getTargetRanges)return null;const t=n.getTargetRanges();return t.length===0?null:t[0]}function kc(n){const{lastKeyCode:t}=G()._inputState;if(n==null||n.length<=1||t==null)return;const e=t.length===1?t:t==="Enter"?`
|
|
4
4
|
`:t==="Tab"?" ":null;if(!e)return;const r=A();if(!O(r)||!r.isCollapsed())return;const o=r.anchor.getNode();if(!M(o))return;const{offset:i}=r.anchor;if(o.getTextContentSize()===i){const s=o.getNextSibling();if(e===`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,t as o,p as r,b as l,C as d}from"./index-
|
|
1
|
+
import{j as e,t as o,p as r,b as l,C as d}from"./index-DgM6zNKn.js";function c({member:a,onOpen:i}){const t=o(a),n=r(a);return e.jsxs("button",{type:"button",onClick:i,"data-slot":"profile-managed-row",className:"focus-ring hover:bg-muted/50 flex h-11 w-full items-center gap-2.5 rounded-md px-2 text-left transition-colors",children:[e.jsx(l,{size:"sm",kind:t.kind,color:t.color,emoji:t.emoji,imageUrl:t.imageUrl,fallback:t.fallback,origin:t.origin}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate text-sm",children:a.displayName}),e.jsx("span",{className:"text-muted-foreground truncate text-xs",children:n.text})]}),e.jsx(d,{"aria-hidden":!0,className:"text-muted-foreground/70 ml-auto size-3.5 shrink-0"})]})}function x({member:a,roster:i,onPush:t}){const n=i.filter(s=>s.kind==="agent"&&s.ownerId===a.id);return n.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[a.isSelf?"You manage":`${a.displayName} manages`," no agents yet."]}):e.jsx("div",{className:"flex flex-col",children:n.map(s=>e.jsx(c,{member:s,onOpen:()=>t({kind:"profile",memberId:s.id})},s.id))})}export{x as ManagesPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var i_=Object.defineProperty;var s_=(r,e,t)=>e in r?i_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var jt=(r,e,t)=>s_(r,typeof e!="symbol"?e+"":e,t);import{r as Xc,j as Kc}from"./index-
|
|
1
|
+
var i_=Object.defineProperty;var s_=(r,e,t)=>e in r?i_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var jt=(r,e,t)=>s_(r,typeof e!="symbol"?e+"":e,t);import{r as Xc,j as Kc}from"./index-DgM6zNKn.js";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r,h as o}from"./index-DgM6zNKn.js";function a({member:e}){return r.jsx(o,{member:e})}export{a as NamePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,l as s}from"./index-
|
|
1
|
+
import{j as t,l as s}from"./index-DgM6zNKn.js";function o({member:i}){var e;const n=((e=i.agent)==null?void 0:e.manifestId)??null;return n===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are kept per agent, and this profile is not one."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:n},emptyLabel:`${i.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as i,j as s,n as r,o as a}from"./index-
|
|
1
|
+
import{m as i,j as s,n as r,o as a}from"./index-DgM6zNKn.js";function d({member:t}){var n;const e=i((n=t.agent)==null?void 0:n.runtime),o=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[o?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s runtime can’t use DorkOS tools, so these settings don’t change anything for it."}),s.jsx(r,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(a,{agentId:t.id})]})]})}export{d as PermissionsPage};
|
package/dist/client/assets/{PersonalityPopover-D0pS2YVR.js → PersonalityPopover-BOphzXEY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o,j as t,a as i,z as u}from"./index-
|
|
1
|
+
import{u as o,j as t,a as i,z as u}from"./index-DgM6zNKn.js";import{u as l}from"./use-personality-commit-D1Go4jUE.js";import"./soul-file-DUY5SyDc.js";function f({member:r}){const{agent:e,isPending:a,update:n}=o(r),s=l(e,n);return a?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(u,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{f as PersonalityPopover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,k as r}from"./index-DgM6zNKn.js";function i({member:o}){return t.jsx(r,{member:o})}export{i as PhotoPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,f as l,j as e,a as m,g as u,C as c,M as x,H as f}from"./index-
|
|
1
|
+
import{e as d,f as l,j as e,a as m,g as u,C as c,M as x,H as f}from"./index-DgM6zNKn.js";function h({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(x,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function g(s){return s===1?"1 member":`${s} members`}function j({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You are":`${s.displayName} is`," not in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(h,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:g(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({to:"/channels",search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{j as RoomsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as E,j as e,aN as de,cG as ce,J as ue,aj as j,d4 as X,d5 as J,d6 as Y,d7 as F,d8 as Z,d9 as fe,ad as me,ah as pe,da as xe,db as ee,dc as he,dd as te,de as be,df as je,dg as ge,dh as ve,di as Ne,dj as T,dk as Se,dl as S,dm as Ee,dn as se,aP as ye,u as Ce,a as ke,dp as we,dq as Ae,dr as Te,ds as Le,dt as Ie,du as Pe}from"./index-DgM6zNKn.js";const $e={duration:.12,ease:"easeOut"},_e={type:"spring",stiffness:320,damping:28};function ae({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:n,"data-testid":c}){const[f,p]=E.useState(!1),o=a?"set here":`server default · ${l??"none"}`,s=a&&!!i,m=e.jsxs("span",{className:j("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?X.warning:X.neutral,s&&"hover:bg-accent hover:text-accent-foreground transition-colors",n),"data-testid":c,children:[r&&e.jsx(de,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(ce,{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:o},o)})]});return s?e.jsxs(J,{open:f,onOpenChange:p,children:[e.jsx(Y,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:m})}),e.jsxs(F,{className:"w-64 p-2",align:"start",children:[e.jsx(Z,{children:"Where this value comes from"}),r&&e.jsx("p",{className:j("px-2 pt-1 text-xs",fe.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),p(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":c?`${c}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"the runtime picks, nothing is set"})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:m}):m}const Me=["agents"];function Oe(a){const l=me(),i=pe();return xe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.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 w({label:a,valueLabel:l,options:i,selected:r,isSetHere:n,serverDefault:c,warning:f,onSelect:p,onInherit:o,testId:s,showHeader:m=!0,className:y,describedBy:h}){const N=ee(),[b,d]=E.useState(!1);return e.jsxs("div",{className:j("space-y-1",y),children:[m&&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:c,warning:f,onUseServerDefault:o,"data-testid":`${s}-chip`})]}),e.jsxs(J,{open:b,onOpenChange:d,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:j("truncate",f?"text-amber-700 dark:text-amber-400":n?"md:text-foreground text-amber-700 dark:text-amber-400":"md:text-foreground text-emerald-700 dark:text-emerald-400"),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:()=>{p(u.value),d(!1)},className:j("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",u.value===r&&"bg-accent"),children:[u.label,u.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:u.hint})]},u.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),d(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${s}-inherit`,children:c?`Using server default: ${c}. Tap to restore`:"Use server default: the runtime picks"})]})]})]})}function He({agent:a,onUpdate:l,className:i}){var z,K,Q,V,B,G;const r=ee(),{data:n}=he(),{data:c,isPending:f}=te(),p=((z=n==null?void 0:n.executionDefaults)==null?void 0:z.runtime)??"claude-code",o=a.runtime??p,s=(K=n==null?void 0:n.executionDefaults)==null?void 0:K.perRuntime.find(t=>t.runtime===o),{data:m}=be({runtime:o}),y=a.model!=null,h=a.effort!=null,N=(s==null?void 0:s.model)??null,b=a.model??N,d=b?(m??[]).find(t=>t.value===b):void 0,u=(s==null?void 0:s.supportsEffort)??((Q=je(c,o))==null?void 0:Q.supportsEffort),L=u===void 0&&f,I=u!==!1,P=d?d.supportsEffort??!1:void 0,C=(V=n==null?void 0:n.claudeCode)==null?void 0:V.accounts,{nameFor:$}=ge(),x=C==null?void 0:C.flatMap(t=>t.id===null?[]:[{id:t.id,label:$(t.path),path:t.path}]),g=a.account??null,_=g!==null,M=n!=null&&n.claudeCode?$(n.claudeCode.resolvedAccount):null,O=Oe({errorLabel:"Couldn’t change this agent’s account"}),H=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:p,serverDefaultModel:N,knownModels:Ne(m),knownAccounts:x,accountsUnavailable:(B=n==null?void 0:n.claudeCode)==null?void 0:B.accountsUnavailable,modelSupportsEffort:P,runtimeSupportsEffort:u,runtimeLabel:t=>T(t).label}),v=t=>{var W;return((W=le.breakages.find(ie=>t.includes(ie.kind)))==null?void 0:W.message)??null},k=!L&&I&&P!==!1,U=a.effort??(s==null?void 0:s.effort)??null,D=T(o).label,re=o==="claude-code"&&x!==void 0&&(x.length>1||_),oe=v(["account-unregistered"]),R=(m??[]).some(t=>t.unverified),q=E.useId();return e.jsxs("div",{className:j("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(w,{label:"Model",valueLabel:(d==null?void 0:d.displayName)??b??"Automatic",options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:b,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"}),(!r||!k)&&(h||k)&&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?k?e.jsx(w,{label:"Effort",valueLabel:S(U),options:Ee.filter(t=>!(d!=null&&d.supportedEffortLevels)||d.supportedEffortLevels.includes(t)).map(t=>({value:t,label:S(t)})),selected:U,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"])})]}),re&&e.jsx(w,{label:"Account",valueLabel:g!==null?((G=x==null?void 0:x.find(t=>t.id===g))==null?void 0:G.label)??g:M??"Default account",options:(x??[]).map(t=>({value:t.id,label:t.label,hint:se(t.path)})),selected:g,isSetHere:_,serverDefault:M,warning:oe,onSelect:t=>H(t),onInherit:()=>H(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-xs text-amber-700 dark:text-amber-400",children:l})]})}const Ue="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function Re({member:a}){const{agent:l,projectPath:i,isPending:r,update:n}=Ce(a),{data:c}=te();if(r)return e.jsx(ke,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const f=c?Object.keys(c.capabilities):[l.runtime],p=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:Ue,children:"Runtime"}),e.jsxs(we,{value:l.runtime??"claude-code",onValueChange:o=>n({runtime:o}),children:[e.jsx(Ae,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Te,{})}),e.jsx(Le,{children:p.map(o=>e.jsx(Ie,{value:o,responsive:!1,children:T(o).label},o))})]})]}),e.jsx(He,{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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{dM as de,eK as me,eL as xe,ad as O,r as x,eM as pe,eN as fe,eO as ge,eP as he,bk as M,eQ as ve,m as je,eR as be,eS as ye,eT as Se,dg as _,eU as Ne,eV as Ce,eW as we,eX as ke,j as t,eY as Re,eZ as Ae,e_ as Me,e$ as z,am as V,f0 as Te,cG as Ie,J as R,f1 as Le,f2 as Pe,bJ as w,dj as Ee,f3 as De,aj as A,f4 as B,f5 as ze,f6 as Fe,f7 as K,aE as G,f8 as U,f9 as T,cH as I,cI as L,fa as $,fb as Oe,fc as Q,aP as _e,fd as W,fe as q,cJ as P,d4 as H,ff as Ve,fg as Be,fh as Ke,ax as Ge,fi as Ue,ay as $e,az as Qe,aA as We,aB as qe,fj as He,e as Je,ah as Xe,fk as Ye,fl as Ze,a as et,fm as tt,I as nt,fn as at,fo as st,fp as it,aY as ot}from"./index-DgM6zNKn.js";/**
|
|
2
|
+
* @license lucide-react v1.47.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const J={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};J.node;const X=de(J);function rt(){const e=me(),n=xe(s=>s.contextReadings),a=O(),o=x.useMemo(()=>Array.from(new Set(e.map(s=>s.runtime))),[e]),i=x.useCallback(s=>{const u={};return o.forEach((l,f)=>{var m;const d=(m=s[f])==null?void 0:m.data;if(!d)return;const b={};for(const p of d)p.contextWindow!=null&&(b[p.value]=p.contextWindow);u[l]=b}),u},[o]),r=pe({queries:o.map(s=>fe(a,{runtime:s})),combine:i});return x.useMemo(()=>{var u;const s={total:0,known:0,unknown:0,warning:0,critical:0,autoCompacted:0};for(const l of e){s.total+=1;const f=l.model?(u=r[l.runtime])==null?void 0:u[l.model]:void 0,d=ge(l,{reading:n[l.id]??null,window:f});d.autoCompactedAt&&(s.autoCompacted+=1),d.status==="known"?(s.known+=1,d.severity==="warning"?s.warning+=1:d.severity==="critical"&&(s.critical+=1)):s.unknown+=1}return s},[e,n,r])}function lt(e,n,a){return e&&n!==void 0&&!a}function Y(e,n,a,o="borderLeftColor"){const i=he()??!1,r=lt(e,a,i);return x.useMemo(()=>!r||!a?{animate:void 0,transition:void 0,pulsing:!1}:{animate:{[o]:[n,a,n]},transition:{[o]:{duration:2,repeat:1/0,ease:"easeInOut"}},pulsing:!0},[r,n,a,o])}function Z({value:e,onCommit:n,onEnd:a}){const[o,i]=x.useState(!1),[r,s]=x.useState(""),u=x.useRef(null),l=x.useRef(!1),f=M(e),d=M(n),b=M(a);x.useEffect(()=>{if(!o)return;l.current=!1;const c=requestAnimationFrame(()=>{var h,v;(h=u.current)==null||h.focus(),(v=u.current)==null||v.select()});return()=>cancelAnimationFrame(c)},[o]);const m=x.useCallback(()=>{var c;i(!1),(c=b.read())==null||c()},[b]),p=x.useCallback(()=>{s(f.read()),i(!0)},[f]),g=x.useCallback(()=>{if(l.current)return;l.current=!0,m();const c=r.trim();c.length===0||c===f.read()||d.read()(c)},[m,r,f,d]),y=x.useCallback(()=>{l.current=!0,m()},[m]),N=x.useCallback(c=>{c.key==="Enter"?(c.preventDefault(),g()):c.key==="Escape"&&(c.preventDefault(),y())},[g,y]);return{isRenaming:o,renameValue:r,setRenameValue:s,inputRef:u,start:p,commit:g,cancel:y,handleKeyDown:N}}function ee(e){const n=ve(e.id,{enabled:!1,fallback:e.permissionMode})??e.permissionMode,a=je(e.runtime),o=a==null?void 0:a.permissionModes.values.find(r=>r.id===n),i=o?be(o):ye(n);return{permissionMode:n,isFullPower:i}}function te(e){var p,g;const n=Se(e.runtime),{accounts:a,nameFor:o,colorFor:i}=_(),r=Ne(e.id),s=e.accountId??null,u=e.account??null,l=Ce(n?e.runtime:null,{accountId:s,path:u}),{name:f,color:d}=we({accountId:s,path:u,accounts:a,usage:l,nameFor:o,colorFor:i});if(!n)return{visible:n,name:f,color:d,limitStatus:null,limitDisplay:null};const b=r?r.limit:((p=e.status)==null?void 0:p.limit)??null,m=(r==null?void 0:r.lifecycle)??((g=e.status)==null?void 0:g.lifecycle)??"idle";return{visible:n,name:f,color:d,limitStatus:{lifecycle:m,limit:b},limitDisplay:ke(b)}}function ne({children:e,onRename:n,onFork:a}){return!n&&!a?t.jsx(t.Fragment,{children:e}):t.jsxs(Re,{children:[t.jsx(Ae,{asChild:!0,children:e}),t.jsxs(Me,{className:"w-44",children:[n&&t.jsxs(z,{onClick:n,children:[t.jsx(V,{className:"mr-2 size-4"}),"Rename"]}),n&&a&&t.jsx(Te,{}),a&&t.jsxs(z,{onClick:a,children:[t.jsx(X,{className:"mr-2 size-4"}),"Fork session"]})]})]})}const k="font-mono select-all";function F(e){try{return new Date(e).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function ct({session:e,expanded:n,onFork:a,className:o}){var f;const{permissionMode:i,isFullPower:r}=ee(e),s=r?"Full power":ze(i),{nameFor:u}=_(),l=e.account?u(e.account):null;return t.jsx(Ie,{initial:!1,children:n&&t.jsx(R.div,{variants:Pe,initial:"initial",animate:"animate",exit:"exit",transition:Le,className:"relative z-10 overflow-hidden","data-slot":"session-details-panel",children:t.jsxs("div",{className:A("text-muted-foreground text-2xs mx-2 space-y-1.5 px-3 pt-2 pb-2",o),children:[t.jsx(w,{label:"Session ID",align:"start",copyValue:e.id,valueClassName:k,children:e.id}),t.jsx(w,{label:"Created",align:"start",valueClassName:k,children:F(e.createdAt)}),t.jsx(w,{label:"Updated",align:"start",valueClassName:k,children:F(e.updatedAt)}),t.jsx(w,{label:"Runtime",align:"start",valueClassName:k,children:Ee(e.runtime).label}),l&&t.jsx(w,{label:"Account",align:"start",copyValue:e.account,valueClassName:k,children:l}),t.jsx(w,{label:"Origin",align:"start",valueClassName:k,children:e.originLabel??((f=De(e.origin))==null?void 0:f.label)??"You"}),t.jsx(w,{label:"Permissions",align:"start",valueClassName:A(k,r&&B.power),children:s}),a&&t.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),a(e.id)},className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground mt-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors duration-100","aria-label":"Fork session",children:[t.jsx(X,{className:"size-(--size-icon-xs)"}),t.jsx("span",{children:"Fork"})]})]})})})}function ae({account:e,tooltip:n=!0,className:a}){return!e.visible||!e.name||!e.color?null:t.jsx(Fe,{color:e.color,name:e.name,tooltip:n,className:a})}function ut({session:e,isActive:n,onClick:a,onFork:o,onRename:i,isNew:r=!1}){const[s,u]=x.useState(!1),{isRenaming:l,renameValue:f,setRenameValue:d,inputRef:b,start:m,commit:p,handleKeyDown:g}=Z({value:e.title,onCommit:j=>i==null?void 0:i(e.id,j)}),{isFullPower:y}=ee(e),N=K(6e4),c=x.useMemo(()=>G(e.updatedAt),[e.updatedAt,N]),h=te(e),v=h.limitDisplay,S=U(e.id,h.limitStatus),C=h.visible&&h.color?h.name:null,E=[C,S.kind==="idle"?null:S.label].filter(Boolean).join(" · "),se=[`Session: ${T(e.title)}`,C,v==null?void 0:v.text,S.label].filter(Boolean).map(j=>`${j}.`).join(" "),ie=x.useCallback(j=>{j.stopPropagation(),u(ue=>!ue)},[]),oe=x.useCallback(j=>{j.stopPropagation(),m()},[m]),{animate:re,transition:le,initial:ce,pulsing:D}=mt({isNew:r,borderState:S});return t.jsx(I,{children:t.jsxs(R.div,{"data-testid":"session-row",initial:ce,animate:re,transition:le,"data-pulsing":D?"true":"false","data-limit":v?v.needsAction?"action":"waiting":void 0,style:D?void 0:{borderLeftColor:S.color},className:A("group relative rounded-lg border-l-2 transition-colors duration-150",(v==null?void 0:v.needsAction)&&H.error,n?"text-foreground":"hover:bg-secondary/60"),children:[n&&t.jsx(R.div,{layoutId:"active-session-bg",className:"bg-secondary absolute inset-0 rounded-lg",transition:{type:"spring",stiffness:280,damping:32}}),t.jsx(ne,{onRename:i?m:void 0,onFork:o?()=>o(e.id):void 0,children:t.jsx(L,{asChild:!0,disabled:!E,children:t.jsxs(R.div,{role:"button",tabIndex:0,"aria-current":n?"page":void 0,"aria-label":se,onClick:a,onKeyDown:j=>{l||(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),a())},whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[t.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[v?t.jsx("span",{className:A("min-w-0 flex-1 truncate",v.needsAction&&$),children:v.text}):t.jsx("span",{className:"min-w-0 flex-1",children:c}),t.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[t.jsx(Oe,{session:e}),S.kind==="pendingApproval"&&t.jsx(Q,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting your approval"}),y&&t.jsx(dt,{}),i&&!l&&t.jsx("button",{type:"button",onClick:oe,className:"text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 max-md:p-1.5 max-md:opacity-100","aria-label":"Rename session",children:t.jsx(V,{className:"size-(--size-icon-xs)"})}),t.jsx("button",{type:"button",onClick:ie,className:A("rounded p-0.5 transition-opacity duration-150 max-md:p-1.5",s?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 max-md:opacity-100"),"aria-label":"Session details","aria-expanded":s,children:t.jsx(R.div,{animate:{rotate:s?180:0},transition:{type:"spring",stiffness:400,damping:30},children:t.jsx(_e,{className:"size-(--size-icon-sm)"})})})]})]}),l?t.jsx("input",{ref:b,autoFocus:!0,value:f,onChange:j=>d(j.target.value),onBlur:p,onKeyDown:g,onClick:j=>j.stopPropagation(),className:"bg-background text-foreground mt-0.5 w-full rounded border px-1 text-xs outline-none","aria-label":"Session title"}):t.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[t.jsx(W,{origin:e.origin,label:e.originLabel,className:"text-muted-foreground/50"}),t.jsx(q,{type:e.runtime,model:e.model,className:"text-muted-foreground/50"}),t.jsx(ae,{account:h,tooltip:!1}),t.jsx("div",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",title:i?"Click the pencil icon to rename":void 0,children:T(e.title)})]})]})})}),t.jsx(P,{side:"right",sideOffset:8,children:E||S.label}),t.jsx(ct,{session:e,expanded:s,className:"border-border/30 border-t",...o?{onFork:o}:{}})]})})}function dt(){return t.jsxs(I,{children:[t.jsx(L,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex cursor-help","aria-label":Ve,onClick:e=>e.stopPropagation(),children:t.jsx(Be,{className:`size-(--size-icon-xs) ${B.power}`})})}),t.jsx(P,{side:"top",sideOffset:4,children:"This chat runs commands without stopping for approval."})]})}function mt({isNew:e,borderState:n}){const{animate:a,transition:o,pulsing:i}=Y(n.pulse,n.color,n.dimColor);return x.useMemo(()=>{if(!(e||i))return{initial:void 0,animate:void 0,transition:void 0,pulsing:i};const s={...e?{opacity:1,y:0}:{},...a},u={...e?{opacity:{duration:.2,ease:[0,0,.2,1]},y:{duration:.2,ease:[0,0,.2,1]}}:{},...o};return{initial:e?{opacity:0,y:-8}:void 0,animate:s,transition:u,pulsing:i}},[e,i,a,o])}function xt({session:e,isActive:n,onClick:a,onFork:o,onRename:i}){const{isRenaming:r,renameValue:s,setRenameValue:u,inputRef:l,start:f,commit:d,handleKeyDown:b}=Z({value:e.title,onCommit:C=>i==null?void 0:i(e.id,C)}),m=te(e),p=m.limitDisplay,g=U(e.id,m.limitStatus),y=[m.visible&&m.color?m.name:null,g.kind==="idle"?null:g.label].filter(Boolean).join(" · "),N=K(6e4),c=x.useMemo(()=>G(e.updatedAt),[e.updatedAt,N]),{animate:h,transition:v,pulsing:S}=Y(g.pulse,g.color,g.dimColor,"backgroundColor");return t.jsxs(I,{children:[t.jsx(ne,{onRename:i?f:void 0,onFork:o?()=>o(e.id):void 0,children:t.jsx(L,{asChild:!0,children:t.jsxs("button",{type:"button","data-testid":"session-row","data-limit":p?p.needsAction?"action":"waiting":void 0,onClick:a,className:A("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs",Ke,(p==null?void 0:p.needsAction)&&H.error,n?"bg-secondary text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[t.jsx(R.span,{"aria-hidden":!0,"data-pulsing":S?"true":"false",animate:h,transition:v,style:S?void 0:{backgroundColor:g.color},className:"size-1.5 shrink-0 rounded-full"}),t.jsx(ae,{account:m,tooltip:!1}),r?t.jsx("input",{ref:l,autoFocus:!0,value:s,onChange:C=>u(C.target.value),onBlur:d,onKeyDown:b,onClick:C=>C.stopPropagation(),className:"bg-background text-foreground min-w-0 flex-1 rounded border px-1 text-xs outline-none","aria-label":"Session title"}):t.jsx("span",{className:"min-w-0 flex-1 truncate",children:T(e.title)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[g.kind==="pendingApproval"&&t.jsx(Q,{className:"size-(--size-icon-xs) text-amber-500","aria-label":"Awaiting approval"}),t.jsx(W,{origin:e.origin,label:e.originLabel,className:"text-muted-foreground/50"}),t.jsx(q,{type:e.runtime,model:e.model,className:"text-muted-foreground/50"}),p?t.jsx("span",{className:A("text-3xs whitespace-nowrap",p.needsAction?$:"text-muted-foreground"),children:p.text}):t.jsx("span",{className:"text-muted-foreground text-3xs",children:c})]})]})})}),y&&t.jsx(P,{side:"right",sideOffset:8,children:y})]})}function pt({variant:e,session:n,isActive:a,onClick:o,onFork:i,onRename:r,isNew:s}){return e==="compact"?t.jsx(xt,{session:n,isActive:a,onClick:o,onFork:i,onRename:r}):t.jsx(ut,{session:n,isActive:a,onClick:o,onFork:i,onRename:r,isNew:s})}function ft(){const{known:e,warning:n,critical:a,autoCompacted:o}=rt(),i=n+a;if(e===0&&i===0&&o===0)return null;const r=i>0||o>0,s=r?a>0?"bg-red-500":i>0?"bg-amber-500":"bg-muted-foreground/40":"bg-emerald-500",u=r?[i>0?`${i} near full`:null,o>0?`${o} auto-compacted`:null].filter(Boolean).join(" · "):"All sessions have room.";return t.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1.5 text-xs","data-testid":"fleet-context-bar",children:[t.jsx("span",{className:`size-2 shrink-0 rounded-full ${s}`,"aria-hidden":"true"}),t.jsx("span",{className:"truncate",children:u})]})}function gt({activeSessionId:e,groupedSessions:n,onSessionClick:a,onForkSession:o,onRenameSession:i}){const r=x.useId();return t.jsxs(Ge,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:[t.jsx(ft,{}),t.jsx(R.div,{layout:!0,children:t.jsx(Ue,{id:r,children:n.length>0?t.jsx(t.Fragment,{children:n.map(s=>{const u=n.length===1&&s.label==="Today";return t.jsxs($e,{children:[!u&&t.jsx(Qe,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:s.label}),t.jsx(We,{children:s.sessions.map(l=>t.jsx(qe,{children:t.jsx(pt,{variant:"full",session:l,isActive:l.id===e,onClick:()=>a(l.id),onFork:o,onRename:i})},l.id))})]},s.label)})}):t.jsx("div",{className:"flex h-32 items-center justify-center",children:t.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})]})}function ht(e,n){return n===""?!0:(e.title??"").toLowerCase().includes(n)}function jt({member:e}){var N;const n=((N=e.agent)==null?void 0:N.projectPath)??null,{sessions:a,isLoading:o,isError:i,activeSessionId:r}=He(n),s=Je(),u=O(),l=Xe(),f=Ye(n),[d,b]=x.useState(""),m=d.trim().toLowerCase(),p=x.useMemo(()=>Ze(a.filter(c=>ht(c,m))),[a,m]);function g(c){!s||n===null||(at.getState().recordOpened("agent",n),s(st({dir:n,session:c})))}async function y(c){try{const h=await u.forkSession(c,void 0,n??void 0);await l.invalidateQueries({queryKey:it.listRoot}),g(h.id)}catch(h){ot.error("Couldn’t branch off this conversation.",{description:h instanceof Error?h.message:"The original is untouched."})}}return o?t.jsx(et,{className:"h-16 w-full"}):i?t.jsxs("p",{className:"text-muted-foreground text-sm",children:["Couldn’t read ",e.displayName,"’s conversations."]}):a.length===0?t.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversations yet. ",e.displayName," starts one the first time you message it."]}):t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"relative shrink-0",children:[t.jsx(tt,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"}),t.jsx(nt,{value:d,onChange:c=>b(c.target.value),placeholder:"Search conversations","aria-label":"Search conversations",className:"h-8 pl-7 text-sm"})]}),p.length===0?t.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversation matches “",d.trim(),"”."]}):t.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:t.jsx(gt,{activeSessionId:r,groupedSessions:p,onSessionClick:g,onForkSession:c=>void y(c),onRenameSession:(c,h)=>f.mutate({sessionId:c,title:h})})})]})}export{jt as SessionsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ad as b,ag as B,eo as p,ep as g,ah as w,cZ as A,aY as z,eq as M,j as e,er as O,r as d,aP as E,aj as N,B as j,aN as q,cT as y,es as C,dZ as I,d_ as W,d$ as K,e0 as Q,e1 as U,e2 as Y,e3 as G,e4 as Z,e as H,et as R,eu as J,aR as V,a as $,ev as X,ew as L,W as P}from"./index-_1qDsPCM.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(q,{"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(I,{open:c,onOpenChange:u,children:e.jsxs(W,{children:[e.jsxs(K,{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(Y,{children:[e.jsx(G,{children:"Cancel"}),e.jsx(Z,{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(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(J,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(V,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx($e,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},_(i)))})]})}function 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(X,{href:Ae,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Re({group:s}){const[t,n]=d.useState(!1);return e.jsxs(L,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:oe(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ce(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Le({rows:s,enabled:t}){const n=ue(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Re,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(L,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:fe(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function _e({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function 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(Le,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Pe,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({to:"/marketplace",search:{type:"skill-pack"}}),children:[e.jsx(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function ze({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Fe,{projectPath:t})}export{ze as SkillsPage};
|
|
1
|
+
import{ad as b,ag as B,eB as p,eC as g,ah as w,da as A,aY as z,eD as M,j as e,eE as O,r as d,aP as E,aj as N,B as j,aN as I,d4 as y,eF as C,ea as W,eb as q,ec as K,ed as Q,ee as U,ef as G,eg as Y,eh as J,e as H,eG as R,eH as V,aR as X,a as $,eI as Z,eJ as L,W as P}from"./index-DgM6zNKn.js";function D(s){const t=b();return B({queryKey:p.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const ee={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},se={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",te=new Set(["native","projected"]);function _(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function ne(s,t){return`${g[s]} ${ee[t]}`}function ae(s){return s.reason??s.target}function F(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function re(s,t){if(t.length===0)return!1;const n=F(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return te.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function le(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function ie(s){return`Shared with all ${s}`}function oe(s){return s===1?"1 agent file":`${s} agent files`}function ce(s){return`Every agent file ${s} cannot see — skills, rules, commands and more.`}function de(s){return s===1?"1 entry":`${s} entries`}function ue(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:_(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const xe={drop:"Not shared",warning:"Could not read",write:"Will be written",notice:"Notice"};function fe(s){return`${xe[s.kind]} · ${s.artifact} ${s.name}`}function me(s){const t=b(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),z.success("Agent files updated.")}})}function he(s){const t=w();M("approval_resolved",()=>{t.invalidateQueries({queryKey:p.status(s)})})}function pe({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(O,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:le(r.length)})]})})}function ge(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something else is in the way.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills live where only a few of your agents look.",variant:"info",actionable:!1}:null}function je({projectPath:s}){return he(s),null}function ve({projectPath:s}){const{data:t}=D(s),n=me(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(je,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(pe,{result:n.data,onDismiss:()=>c(!0)})]});const o=ge(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(O,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(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=F(s,t),m=re(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:De}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:h})=>g[h]).join(" · "),onClick:()=>l(h=>!h),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[ie(x.length),e.jsx(E,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:T})=>e.jsx(ke,{harness:h,cell:T},h))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||Se(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:be(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:we})}),e.jsx(W,{open:c,onOpenChange:u,children:e.jsxs(q,{children:[e.jsxs(K,{children:[e.jsxs(Q,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(U,{children:Ce(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(G,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(J,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const Ae="https://dorkos.ai/docs/guides/cli-usage#agent-files";function Oe(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{className:"h-3 w-32"}),e.jsx($,{className:"h-3 w-48"})]},s))})]})}function 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(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(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 Re({group:s}){const[t,n]=d.useState(!1);return e.jsxs(L,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:oe(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ce(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Le({rows:s,enabled:t}){const n=ue(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Re,{group:a},a.harness))})}function Pe({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(L,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(P,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:fe(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function _e({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but this folder isn’t sharing to it.`:`${g[t]} files are in this folder, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(_e,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Te({projectPath:s}){const t=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(Fe,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Le,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Pe,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({to:"/marketplace",search:{type:"skill-pack"}}),children:[e.jsx(R,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function ze({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Te,{projectPath:t})}export{ze as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aq as F,ae as w,ar as U,as as D,at as L,au as B,av as G,r as o,j as e,aw as $,ax as O,ay as p,az as f,aA as j,aB as g,aC as k,aD as E,aE as N,aF as P,aG as X,aH as _,aI as q,aJ as H,aK as J,aL as K}from"./index-
|
|
1
|
+
import{aq as F,ae as w,ar as U,as as D,at as L,au as B,av as G,r as o,j as e,aw as $,ax as O,ay as p,az as f,aA as j,aB as g,aC as k,aD as E,aE as N,aF as P,aG as X,aH as _,aI as q,aJ as H,aK as J,aL as K}from"./index-DgM6zNKn.js";const V=5;function W({status:t}){switch(t){case"running":return e.jsx(E,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(J,{className:"size-3 shrink-0 text-green-500","aria-hidden":!0});case"failed":return e.jsx(H,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(q,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(_,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"blocked":return e.jsx(X,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function Q(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),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(W,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:Q(t.durationMs)}),t.finishedAt&&e.jsx("span",{children: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:b,recentRuns:C}=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,V)}},[A]),M=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:[b.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:b.map(s=>e.jsx(Y,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),M.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:M.map(s=>e.jsx(Z,{schedule:s,onEdit:z},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:"Recent Runs"}),e.jsx(j,{children:C.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=K(),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{ad as W,ag as Fe,
|
|
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:"mt-0.5 size-4 shrink-0 text-amber-500"}),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(L,{htmlFor:"mcp-name",children:"Name"}),n.jsx(Q,{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(L,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(Le,{value:o,onValueChange:g=>m(g),children:[n.jsx(_e,{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(L,{htmlFor:"mcp-command",children:"Command"}),n.jsx(Q,{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(L,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(Q,{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(L,{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(L,{htmlFor:"mcp-url",children:"URL"}),n.jsx(Q,{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(L,{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 G={attention:0,working:1,elsewhere:2,off:3};function kn(e){return e==="off"?G.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?G.attention:G.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:G.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"},Ln={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."},_n=[{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 _n){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.`:Ln[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 Qn({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(Qn,{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(X,{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(X,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Gn=3,$="text-muted-foreground/70";function Wn({tools:e}){const[s,t]=l.useState(!1),i=s?e:e.slice(0,Gn),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(X,{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(_,{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(_,{label:"Source",align:"start",wrap:!0,labelClassName:$,children:o}),r!==c&&n.jsx(_,{label:"Raw id",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono",children:r})}),x&&n.jsx(_,{label:"Server",align:"start",wrap:!0,labelClassName:$,children:x}),p&&n.jsx(_,{label:"Also used by",align:"start",wrap:!0,labelClassName:$,children:p}),typeof u=="number"&&n.jsx(_,{label:"Tools",align:"start",labelClassName:$,children:u}),h&&h.length>0&&n.jsx(Wn,{tools:h}),m&&n.jsx(_,{label:"Error",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:m})})]})}function Zn({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 Xn({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(Xe,{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(Qe,{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(Ge,{className:"size-4","aria-hidden":!0})})}),n.jsxs(We,{align:"end",children:[n.jsxs(Z,{onSelect:()=>h(e.name),disabled:r||c,children:[n.jsx(Je,{className:"size-3.5","aria-hidden":!0}),"Test"]}),R&&n.jsxs(Z,{onSelect:()=>p.start(),disabled:c,children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(Ze,{}),n.jsx(Z,{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(Zn,{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:"mt-0.5 size-4 shrink-0 text-amber-500"}):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-xs text-amber-600 dark:text-amber-500",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(Xn,{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{ad as W,ag as Fe,da as se,ah as ge,fq as De,fr as pe,r as l,j as n,cM as F,cN as D,fs as fe,B as f,P as xe,ft as te,eH as _,I as Q,dp as _e,dq as Le,dr as $e,ds as Ke,dt as Be,fu as ce,bG as Ue,fv as Ve,C as X,aj as le,fw as ae,cH as ve,cI as je,W as qe,cJ as Ne,bJ as L,aQ as He,fx as de,aD as ee,e2 as Ye,e3 as Qe,e4 as Ge,e5 as We,e6 as Z,ak as Je,e8 as Ze,aR as Xe,fy as en,fz as nn,fA as sn,fB as tn,m as an,a as ne,fC as rn,u as on}from"./index-DgM6zNKn.js";import{a as cn}from"./agent-browser-B6WqW-og.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:"mt-0.5 size-4 shrink-0 text-amber-500"}),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(Q,{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(Q,{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(Q,{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(Q,{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 G={attention:0,working:1,elsewhere:2,off:3};function kn(e){return e==="off"?G.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?G.attention:G.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:G.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 Qn({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(Qn,{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(X,{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(X,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Gn=3,$="text-muted-foreground/70";function Wn({tools:e}){const[s,t]=l.useState(!1),i=s?e:e.slice(0,Gn),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(X,{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 Zn({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 Xn({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(Xe,{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(Qe,{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(Ge,{className:"size-4","aria-hidden":!0})})}),n.jsxs(We,{align:"end",children:[n.jsxs(Z,{onSelect:()=>h(e.name),disabled:r||c,children:[n.jsx(Je,{className:"size-3.5","aria-hidden":!0}),"Test"]}),R&&n.jsxs(Z,{onSelect:()=>p.start(),disabled:c,children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(Ze,{}),n.jsx(Z,{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(Zn,{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:"mt-0.5 size-4 shrink-0 text-amber-500"}):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-xs text-amber-600 dark:text-amber-500",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(Xn,{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,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dM as PRn,h7 as ORn,gR as NRn,r as on,j as de,gt as Kan,gi as $Rn,h8 as DRn,h9 as LRn,ha as _Rn,J as MN,cG as A2e,B as Wan,hb as Van,aj as r2,fg as M2e,aF as C2e,aE as FRn,W as jN,hc as wK,P as RRn,hd as BRn,X as JRn,he as GRn,hf as HRn,hg as Fhn,dI as qRn,hh as zRn,hi as URn,eD as XRn,hj as KRn,hk as WRn,em as VRn,hl as QRn,en as YRn,ep as ZRn,eq as eBn,bk as VX,fv as nBn,aD as Rhn,Q as tBn,hm as iBn,fz as rBn,hn as cBn,eu as uBn,ea as oBn,eb as sBn,ec as fBn,ed as lBn,ee as hBn,ef as aBn,eg as dBn,eh as bBn}from"./index-DgM6zNKn.js";import{a as e2e,A as wBn}from"./AdapterIcon-Bs0C7eSH.js";/**
|
|
2
2
|
* @license lucide-react v1.47.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|