@promptowl/contextnest-community 1.26.0 → 1.27.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/API.md +34 -1
- package/CONFIGURATION.md +32 -1
- package/dist/{chunk-TRSGPS27.js → chunk-H3W72HN3.js} +28 -0
- package/dist/{chunk-DGPTJXIV.js → chunk-MB52DWWP.js} +4 -4
- package/dist/{chunk-IEAWRHMV.js → chunk-NFFUZF2B.js} +23 -2
- package/dist/{chunk-PICUHQEM.js → chunk-O3JEI33N.js} +2 -2
- package/dist/{chunk-SWA5M5XX.js → chunk-QMQDWRHN.js} +128 -22
- package/dist/{chunk-I5EDEZBQ.js → chunk-RXCVXG34.js} +1 -1
- package/dist/{chunk-2QOJE7A5.js → chunk-SE5U4J4T.js} +4 -4
- package/dist/{chunk-RPGFHESR.js → chunk-VHEMGQ3I.js} +1 -1
- package/dist/{chunk-M6PGYMBD.js → chunk-VRLAP4HB.js} +33 -15
- package/dist/{engine-QNMFDIBV.js → engine-HLYQLP5T.js} +3 -3
- package/dist/{external-edit-service-4MEGPT4D.js → external-edit-service-3DFQ4EZZ.js} +4 -4
- package/dist/{grants-service-24GLUBY4.js → grants-service-WICV4Y2J.js} +2 -2
- package/dist/index.js +804 -304
- package/dist/{invited-user-AM6A3WGO.js → invited-user-XEBX6BM4.js} +3 -3
- package/dist/{review-service-2EWN7WWO.js → review-service-GB43UQVH.js} +7 -7
- package/dist/{stewardship-service-TDZUC2Q6.js → stewardship-service-KDBPWRZI.js} +4 -4
- package/dist/{version-service-C3JTZLJH.js → version-service-JYHFPSYP.js} +8 -4
- package/dist/web3/assets/{ActivityTracePage-DzwWIjjx.js → ActivityTracePage-CkRoyIc-.js} +1 -1
- package/dist/web3/assets/AgentDocsPage-BTRXmliv.js +1 -0
- package/dist/web3/assets/CollaboratorManager-CqJIkvs-.js +1 -0
- package/dist/web3/assets/CollaboratorsTab-JcO1P-qm.js +1 -0
- package/dist/web3/assets/DocumentEditor-D1GLeeEP.js +36 -0
- package/dist/web3/assets/DocumentsTab-BAgSxTX1.js +6 -0
- package/dist/web3/assets/ExternalEditsTab-DuuTXZap.js +1 -0
- package/dist/web3/assets/{MarkdownEditor-CKh4WSn-.js → MarkdownEditor-BELFww9q.js} +116 -126
- package/dist/web3/assets/{NestPageHeader-Cizo8nUi.js → NestPageHeader-Bbje2ncY.js} +1 -1
- package/dist/web3/assets/NestView-D4OMXPQ7.js +73 -0
- package/dist/web3/assets/OverviewTab-FIDGjR3Q.js +6 -0
- package/dist/web3/assets/{PersonCombobox-BKI7dff4.js → PersonCombobox-D52m_jhc.js} +1 -1
- package/dist/web3/assets/{ReviewActions-CS8JXgXF.js → ReviewActions-DYqBcWlv.js} +2 -2
- package/dist/web3/assets/ReviewTab-DoxfygOb.js +1 -0
- package/dist/web3/assets/StewardsTab-CFsYjbEn.js +1 -0
- package/dist/web3/assets/{SubmitForReviewModal-Biq3m79i.js → SubmitForReviewModal-AW2OLNAE.js} +1 -1
- package/dist/web3/assets/{alert-dialog-BvF3NFr7.js → alert-dialog-p-fBLSWx.js} +2 -2
- package/dist/web3/assets/{arrow-left-CWIsv-sG.js → arrow-left-CiErCCTG.js} +1 -1
- package/dist/web3/assets/{backlinks-Cqcn7n1J.js → backlinks-DaVSYvhV.js} +2 -2
- package/dist/web3/assets/{boxes-ClbgQqG2.js → boxes-VWrCCMzW.js} +1 -1
- package/dist/web3/assets/{chevron-left-CK_ZPFm9.js → chevron-left-CsD8gZwL.js} +1 -1
- package/dist/web3/assets/{circle-check-Bw_aTXiH.js → circle-check-BBCXd9LI.js} +1 -1
- package/dist/web3/assets/{circle-x-DkIG68H7.js → circle-x-C9LsnORQ.js} +1 -1
- package/dist/web3/assets/{code-xml-BlR7EN6l.js → code-xml-BaoV7HiQ.js} +1 -1
- package/dist/web3/assets/{corner-down-right-DSVxK3tf.js → corner-down-right-DgiTXrtw.js} +1 -1
- package/dist/web3/assets/{count-skeleton-DToLM74B.js → count-skeleton-CnEE4uF-.js} +1 -1
- package/dist/web3/assets/{earth-BXhVPvCR.js → earth-BmMbVt9k.js} +1 -1
- package/dist/web3/assets/{file-exclamation-point-BevGZgtj.js → file-exclamation-point-qJeca9-A.js} +1 -1
- package/dist/web3/assets/{folder-input-m8UBV4fA.js → folder-input-D7R93LJ6.js} +1 -1
- package/dist/web3/assets/index-DNmWTxN7.css +1 -0
- package/dist/web3/assets/index-DvuUIUP6.js +451 -0
- package/dist/web3/assets/{page-DzKwP5Ds.js → page-BJQuaTRW.js} +2 -2
- package/dist/web3/assets/{page-B6pkc9cd.js → page-Bb8xGOPQ.js} +2 -2
- package/dist/web3/assets/{page-Deq6IKiN.js → page-BtM-qDzr.js} +2 -2
- package/dist/web3/assets/{page-DPY01SOj.js → page-Bxd0EG25.js} +1 -1
- package/dist/web3/assets/page-C3QCO6IR.js +1 -0
- package/dist/web3/assets/{page-CptuAPJc.js → page-CfoR0khy.js} +2 -2
- package/dist/web3/assets/page-D7Zr5tAI.js +1 -0
- package/dist/web3/assets/{page-Dwbp4Seu.js → page-DATSlHCW.js} +2 -2
- package/dist/web3/assets/page-DTjPQizZ.js +45 -0
- package/dist/web3/assets/{page-Bgy9Ng9p.js → page-DspptlWr.js} +1 -1
- package/dist/web3/assets/{page-Dh57L0RG.js → page-I6vAFJOj.js} +4 -4
- package/dist/web3/assets/page-QxI4Ud2s.js +9 -0
- package/dist/web3/assets/{page-BJrFCKXB.js → page-YcNNg-dX.js} +1 -1
- package/dist/web3/assets/page-kM7eO5Kj.js +1 -0
- package/dist/web3/assets/{page-title-DVq4qvMR.js → page-title-Dn5jANiU.js} +1 -1
- package/dist/web3/assets/{play-CXhS6Pgq.js → play-B2k_Ix-L.js} +1 -1
- package/dist/web3/assets/{send-DdfwnIrj.js → send-DPNxv3As.js} +1 -1
- package/dist/web3/assets/{settings-DKX0Q4gO.js → settings-DZjq-OQA.js} +1 -1
- package/dist/web3/assets/{share-2-CxmXRt58.js → share-2-C-OnE2ru.js} +1 -1
- package/dist/web3/assets/{tag-DeYC_mRv.js → tag-CwJl7FdI.js} +1 -1
- package/dist/web3/assets/{trash-2-B0HyPTnI.js → trash-2-aljmIff4.js} +1 -1
- package/dist/web3/assets/{user-plus-Ckm_Isyc.js → user-plus-DPerZexX.js} +1 -1
- package/dist/web3/assets/{zap-D2ifcnYb.js → zap-CHZtiN7P.js} +1 -1
- package/dist/web3/index.html +2 -2
- package/package.json +6 -2
- package/dist/web3/assets/AgentDocsPage-ixP2UdAE.js +0 -1
- package/dist/web3/assets/CollaboratorManager-C9VAXZ0h.js +0 -1
- package/dist/web3/assets/CollaboratorsTab-tq4ZTexH.js +0 -1
- package/dist/web3/assets/DocumentEditor-C2CP2fiE.js +0 -36
- package/dist/web3/assets/DocumentsTab-Mh7KxUoB.js +0 -6
- package/dist/web3/assets/ExternalEditsTab-B_CWKXZ_.js +0 -1
- package/dist/web3/assets/NestView-EW-sraEb.js +0 -73
- package/dist/web3/assets/OverviewTab-CjidsMX_.js +0 -6
- package/dist/web3/assets/ReviewTab-CwVrXzw5.js +0 -1
- package/dist/web3/assets/StewardsTab-C-iP6gnh.js +0 -1
- package/dist/web3/assets/index-BOVYgMvj.js +0 -29
- package/dist/web3/assets/index-DVnaYqj9.css +0 -1
- package/dist/web3/assets/index-WYDmEOfO.js +0 -404
- package/dist/web3/assets/page-C2zoxumw.js +0 -1
- package/dist/web3/assets/page-CJWO06dN.js +0 -1
- package/dist/web3/assets/page-Dea2SblF.js +0 -9
- package/dist/web3/assets/page-Dfjg8p7Z.js +0 -1
- package/dist/web3/assets/page-YxjrE5b5.js +0 -45
- package/dist/web3/assets/x-mNtADYHc.js +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./index-WYDmEOfO.js";import{ActivityTracePage as r}from"./ActivityTracePage-DzwWIjjx.js";import"./page-title-DVq4qvMR.js";import"./client-attribution-BraarYaP.js";import"./arrow-left-CWIsv-sG.js";import"./chevron-left-CK_ZPFm9.js";function s(){return t.jsx(r,{})}export{s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as ue,u as me,r as o,aS as ge,aT as fe,a2 as xe,l as pe,aU as K,aV as he,aW as ye,aX as je,i as v,an as ve,n as be,aY as x,aJ as Y,aZ as Ne,j as e,I as U,B as q,a_ as Ce,R as we,L as ke,a$ as De,b0 as I,a6 as Se,b1 as Fe,F as Ae,b2 as Oe}from"./index-WYDmEOfO.js";import{N as Ee}from"./NestPageHeader-Cizo8nUi.js";import{s as Te}from"./folder-target-CUSWqImF.js";import{X as $e}from"./x-mNtADYHc.js";import{G as Me,Z as Re,F as Be}from"./zap-D2ifcnYb.js";import"./arrow-left-CWIsv-sG.js";const ee="cn.board.";function Le(n){try{const u=localStorage.getItem(ee+n);if(u){const m=JSON.parse(u),b=m.dimension==="status"||m.dimension==="tag"?m.dimension:"folder",k=typeof m.tagNamespace=="string"?m.tagNamespace:"",p=l=>Array.isArray(l)?l.filter(f=>typeof f=="string"):void 0,g={};for(const[l,f]of Object.entries(m.layouts??{}))f&&typeof f=="object"&&(g[l]=I(l,{columnOrder:p(f.columnOrder),hiddenColumns:p(f.hiddenColumns)}));const h={columnOrder:p(m.columnOrder),hiddenColumns:p(m.hiddenColumns)};if(h.columnOrder||h.hiddenColumns){const l=K({dimension:b,tagNamespace:k});g[l]??(g[l]=I(l,h))}return{dimension:b,tagNamespace:k,layouts:g}}}catch{}return{dimension:"folder",tagNamespace:"",layouts:{}}}function W(n,u){try{localStorage.setItem(ee+n,JSON.stringify(u))}catch{}}function Pe({type:n}){const u="h-3.5 w-3.5 shrink-0";return n==="skill"?e.jsx(Re,{className:`${u} text-blue-500`}):n==="agent"?e.jsx(Se,{className:`${u} text-violet-500`}):n==="table"?e.jsx(Fe,{className:`${u} text-emerald-500`}):n==="pdf"?e.jsx(Be,{className:`${u} text-rose-500`}):e.jsx(Ae,{className:`${u} text-muted-foreground`})}function Ge({nestId:n,nestName:u,isOwner:m,isArchived:b,onBack:k,onOpenDocument:p}){var J,Q,V;const{isAdmin:g}=ue(),h=me(),[l,f]=o.useState([]),[O,P]=o.useState(!0),[G,z]=o.useState(null),[d,X]=o.useState(()=>Le(n)),[E,T]=o.useState(null),[Z,$]=o.useState(null),[se,D]=o.useState(null),[te,_]=o.useState(!1),[S,ae]=o.useState(!1);o.useEffect(()=>{let s=!1;return ge(n).then(t=>{s||ae(fe({roles:(t==null?void 0:t.roles)??[],permission:(t==null?void 0:t.permission)??null,myStewards:(t==null?void 0:t.myStewards)??[],isOwner:m,isAdmin:g,isArchived:b||xe(t==null?void 0:t.nest)}).canEditDocs)}).catch(()=>{}),()=>{s=!0}},[n,m,g,b]);const N=o.useCallback(async()=>{P(!0),z(null);try{const{nodes:s}=await h.fetchQuery(pe.nodesMeta(n));f(s.map(t=>({id:t.id,title:t.title??t.id,type:t.type??"document",tags:Array.isArray(t.tags)?t.tags:[],status:t.status??""})))}catch(s){z((s==null?void 0:s.message)||"Failed to load nodes")}finally{P(!1)}},[n,h]);o.useEffect(()=>{N()},[N]);const H=o.useCallback(s=>{X(t=>{const i={...t,...s};return W(n,i),i})},[n]),y=o.useCallback(s=>{X(t=>{const i=K(t),a={...t,layouts:{...t.layouts,[i]:{...t.layouts[i],...s}}};return W(n,a),a})},[n]),r=o.useMemo(()=>he(d),[d]),{columns:C,byColumn:ne}=o.useMemo(()=>ye(l,r),[l,r]),re=o.useCallback(async s=>{const t=E,i=Z;if(T(null),$(null),D(null),!t)return;const a=l.find(w=>w.id===t);if(!a)return;const c=je(a,s,r,i??void 0);if(c.kind==="unsupported"){c.reason!=="Already in this column."&&v(c.reason);return}_(!0);try{c.kind==="move-folder"?(await ve(n,t,c.folder),v.success("Moved")):c.kind==="retag"&&(await be(n,t,{tags:c.tags}),v.success("Retagged")),await N()}catch(w){v.error((w==null?void 0:w.message)||"Move failed")}finally{_(!1)}},[E,Z,l,r,n,N]),F=(r.dimension==="folder"||r.dimension==="tag")&&S,[M,R]=o.useState(null),[oe,A]=o.useState(null),[B,L]=o.useState(""),j=o.useMemo(()=>C.map(s=>s.key).filter(s=>s!==x),[C]),ie=o.useCallback((s,t)=>{if(s===t)return;const i=[...j],a=i.indexOf(s),c=i.indexOf(t);a<0||c<0||(i.splice(a,1),i.splice(c,0,s),y({columnOrder:i}))},[j,y]),le=o.useCallback(s=>y({...r.explicitColumns?{columnOrder:j.filter(t=>t!==s)}:{},hiddenColumns:[...new Set([...r.hiddenColumns??[],s])]}),[j,r.explicitColumns,r.hiddenColumns,y]),de=o.useCallback(s=>{const t=r.dimension==="folder"?Te(s):s.trim().replace(/^#/,"");if(r.dimension==="folder"&&!t){s.trim()&&v("A folder name needs at least one letter or digit.");return}if(t){if(r.dimension==="folder"&&t.split("/").length>Y){v(`Folders may nest at most ${Y} levels deep.`);return}y({columnOrder:[...new Set([...j,t])],hiddenColumns:(r.hiddenColumns??[]).filter(i=>i!==t)}),L("")}},[j,r.dimension,r.hiddenColumns,y]),ce=o.useMemo(()=>{if(r.dimension!=="tag")return[];const s=new Set;for(const t of l)for(const i of Ne(t,r))i!==x&&s.add(i);return[...s].sort()},[l,r]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ee,{nestName:u,onBack:k,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm text-muted-foreground",children:"Columns by"}),e.jsxs("select",{value:d.dimension,onChange:s=>{L(""),H({dimension:s.target.value})},className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[e.jsx("option",{value:"folder",children:"Folder"}),e.jsx("option",{value:"status",children:"Status"}),e.jsx("option",{value:"tag",children:"Tag namespace"})]}),d.dimension==="tag"&&e.jsx(U,{value:d.tagNamespace??"",onChange:s=>H({tagNamespace:s.target.value}),placeholder:"all tags",className:"h-8 w-32",title:"Optional. Empty groups by every tag; a namespace like 'stage' groups by stage:<value> tags only."}),(d.dimension==="tag"||r.dimension==="folder"&&S)&&e.jsxs("form",{onSubmit:s=>{s.preventDefault(),de(B)},className:"flex items-center gap-1",children:[e.jsx(U,{value:B,onChange:s=>L(s.target.value),placeholder:d.dimension==="tag"?"add column…":"new folder…",list:d.dimension==="tag"?"board-tag-values":void 0,className:"h-8 w-32",title:d.dimension==="tag"?"Add a tag column — pick an existing tag or type a new value":"Add a folder column — drag a card into it to file the document there (nest with parent/child)"}),d.dimension==="tag"&&e.jsx("datalist",{id:"board-tag-values",children:ce.map(s=>e.jsx("option",{value:s},s))}),e.jsx(q,{type:"submit",variant:"outline",size:"sm",disabled:!B.trim(),title:d.dimension==="tag"?"Add column":"Add folder column",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})})]}),e.jsx(q,{variant:"outline",size:"sm",onClick:N,disabled:O,children:e.jsx(we,{className:`h-3.5 w-3.5 ${O?"animate-spin":""}`})})]})}),e.jsx("ul",{className:"max-w-2xl list-disc space-y-1 pl-5 text-xs text-muted-foreground",children:d.dimension==="status"?e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Status is"," ",e.jsx("span",{className:"font-medium text-foreground",children:"read-only"})," ","here — move a doc through review in the document view."]}),e.jsxs("li",{children:["Switch to"," ",e.jsx("span",{className:"font-medium text-foreground",children:"Folder"})," for a draggable board."]}),e.jsx("li",{children:"Drag a column header to reorder."})]}):d.dimension==="tag"?e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Grouped by"," ",e.jsx("span",{className:"font-medium text-foreground",children:(J=d.tagNamespace)!=null&&J.trim()?`${d.tagNamespace.trim().split(":")[0]}:`:"tag"}),(Q=d.tagNamespace)!=null&&Q.trim()?" — only documents carrying one show up.":" — one column per tag, so a document with several tags appears in each."]}),e.jsx("li",{children:(V=d.tagNamespace)!=null&&V.trim()?"Clear the box to group by every tag.":"Type a namespace (e.g. stage) to group by stage: values only."}),e.jsx("li",{children:S?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium text-foreground",children:"Drag a card"})," ","between columns to swap its tag; drag a header to reorder."]}):e.jsxs(e.Fragment,{children:["You have"," ",e.jsx("span",{className:"font-medium text-foreground",children:"read-only"})," ","access, so cards can't be retagged. Drag a header to reorder."]})}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"+"})," to add a column, ",e.jsx("span",{className:"font-medium text-foreground",children:"×"})," to remove one."]})]}):S?C.length<2?e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["Every document is in"," ",e.jsx("span",{className:"font-medium text-foreground",children:"Root"}),". Type a name in"," ",e.jsx("span",{className:"font-medium text-foreground",children:"new folder"})," ","above to add a column."]}),e.jsxs("li",{children:["Then ",e.jsx("span",{className:"font-medium text-foreground",children:"drag a card"})," ","into it — that files the document in the folder."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"Drag a card"})," ","between columns to move it to that folder."]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"Drag a column header"})," ","to reorder."]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"new folder"})," ","adds a column; it sticks once a card lands in it."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("li",{children:["You have"," ",e.jsx("span",{className:"font-medium text-foreground",children:"read-only"})," ","access to this nest, so cards can't be moved."]}),e.jsx("li",{children:"Ask the nest owner for write access to rearrange the board."})]})}),O?e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground py-12 justify-center",children:[e.jsx(ke,{className:"h-4 w-4 animate-spin"})," Loading board…"]}):G?e.jsx("div",{className:"text-sm text-destructive py-8",children:G}):C.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-8",children:r.dimension==="tag"?"No tag columns yet — add one above to start sorting documents into it.":"No documents to show."}):e.jsx("div",{className:"flex gap-3 overflow-x-auto pb-4",children:C.map(s=>{const t=ne[s.key]??[],i=se===s.key;return e.jsxs("div",{onDragOver:a=>{if(M){a.preventDefault(),A(s.key);return}F&&(a.preventDefault(),D(s.key))},onDragLeave:()=>{D(a=>a===s.key?null:a),A(a=>a===s.key?null:a)},onDrop:a=>{if(a.preventDefault(),M){ie(M,s.key),R(null),A(null);return}re(s.key)},className:`flex-shrink-0 w-64 rounded-lg border bg-muted/30 flex flex-col max-h-[70vh] transition-colors ${i?"border-primary ring-1 ring-primary":"border-border"}`,children:[e.jsxs("div",{className:`flex items-center justify-between gap-1 px-3 py-2 border-b border-border sticky top-0 ${s.key!==x?"cursor-grab active:cursor-grabbing":""} ${oe===s.key?"bg-primary/10":""}`,draggable:s.key!==x,onDragStart:a=>{s.key!==x&&(R(s.key),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",`col:${s.key}`))},onDragEnd:()=>{R(null),A(null)},title:s.title,children:[e.jsx("span",{className:`min-w-0 text-sm font-medium truncate ${De(r.dimension)?"capitalize":""} ${s.key===x?"text-muted-foreground":""}`,children:s.label}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:t.length}),s.key!==x&&(r.dimension==="tag"||r.dimension==="folder"&&t.length===0)&&e.jsx("button",{type:"button",onClick:()=>le(s.key),className:"text-muted-foreground/50 hover:text-foreground",title:r.dimension==="folder"?"Remove this empty column":"Remove this column — its cards drop off the board; their tags aren't changed",children:e.jsx($e,{className:"h-3.5 w-3.5"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-2",children:[t.map(a=>e.jsxs("div",{draggable:F,onDragStart:c=>{T(a.id),$(s.key),c.dataTransfer.effectAllowed="move",c.dataTransfer.setData("text/plain",a.id)},onDragEnd:()=>{T(null),$(null),D(null)},onClick:()=>p(a.id),className:`group rounded-md border border-border bg-card px-2.5 py-2 text-sm cursor-pointer hover:border-primary/60 hover:shadow-sm transition ${E===a.id?"opacity-50":""} ${te?"pointer-events-none":""}`,children:[e.jsxs("div",{className:"flex items-start gap-1.5",children:[F&&e.jsx(Me,{className:"h-3.5 w-3.5 mt-0.5 text-muted-foreground/40 group-hover:text-muted-foreground shrink-0"}),e.jsx(Pe,{type:a.type}),e.jsx("span",{className:"min-w-0 flex-1 leading-snug break-words",children:a.title})]}),a.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5 pl-5",children:a.tags.slice(0,4).map(c=>e.jsx("span",{className:"text-[10px] px-1 py-0.5 rounded bg-muted text-muted-foreground",children:c},c))})]},a.id)),t.length===0&&e.jsx("div",{className:"text-xs text-muted-foreground/60 text-center py-6",children:F?"Drop here":"Empty"})]})]},s.key)})})]})}function Ve(){const n=Oe();return e.jsx(Ge,{nestId:n.nestId,nestName:n.nestName,isOwner:n.isOwner,isArchived:n.isArchived,onBack:n.leaveNest,onOpenDocument:n.openDocument})}export{Ve as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as l,j as e,b_ as m,b$ as u,c1 as p,c0 as x,B as b,az as se,aE as te,c2 as g,h as Fe,e as Ae,Q as Te,u as Oe,dE as He,dF as qe,l as ne,i as R,bE as X,L as O,S as We,V as Ke,W as Ve,X as P,a_ as ve,Z as _,U as Qe,cG as Ye,C as Je,c$ as Xe,aq as Ze,D as _e,z as be,G as je,H as ke,J as we,M as q,I as E,K as Ne,cH as es,E as ss,dG as Ce,dH as ts,dI as ns,dJ as as}from"./index-WYDmEOfO.js";import{P as rs}from"./page-title-DVq4qvMR.js";import{M as is,r as os}from"./index-BOVYgMvj.js";import{E as ls}from"./earth-BXhVPvCR.js";import{T as cs}from"./trash-2-B0HyPTnI.js";function Pe(n){return`${n.replace(/["'`\\$;|&<>(){}\s]/g,"").replace(/\/+$/,"")}/mcp`}function S(...n){return n.filter(i=>i!==null).join(`
|
|
2
|
-
`)}const W="<your ContextNest API key>",I="CONTEXTNEST_API_KEY";function ds(n,i,t,d){return[`**Not connectable yet.** ${t}`,"",n.openMode?`This server needs no credential at all, but ${i} still wants an OAuth client to authorize against, and this server runs no authorization server to offer it. There is no header field to fall back to either.`:`This server authenticates with API keys and does not run an OAuth authorization server, so ${i} has nothing to complete its consent flow against. There is no header field to fall back to.`,"",`The endpoint it would point at is \`${d}\`, so nothing here changes once an authorization server ships.`,"","Until then, the workable routes are:","","- Use one of the other harnesses in this panel.","- Or drive the nest through the REST API directly."].join(`
|
|
3
|
-
`)}const K=[{id:"claude-desktop",name:"Claude (claude.ai and Claude Desktop)",kind:"chat",where:"Customize → Connectors → Add custom connector",open:"https://claude.ai/customize/connectors",docs:"https://claude.com/docs/connectors/custom/remote-mcp",support:"header",body:(n,i)=>S("1. Open **Customize → Connectors** and click **Add custom connector**. On Team and Enterprise plans an Owner adds it once under **Organization settings → Connectors → Add → Custom → Web**; members then find it under **Customize → Connectors** and click **Connect**.",`2. Set the MCP server URL to \`${i}\`.`,n.openMode?"3. For **Authentication**, choose **No sign-in** — this server needs no credential.":`3. For **Authentication**, choose **No sign-in**, then open **Request headers**, pick the \`authorization\` header and enter \`Bearer ${W}\` as its value. Enter the value only — Claude adds the header name itself and sends the value exactly as typed, so the \`Bearer \` prefix and its trailing space have to be there.`,"4. Click **Add**. Authentication settings can't be changed afterwards; changing them means removing the connector and adding it again.",n.openMode?null:"",n.openMode?null:"> **Request headers are in beta, and the credential is organization-wide.** If the dialog has no **Request headers** section, your organization doesn't have access yet. Everyone on the connector shares the one credential, so on this surface they all reach this server as the key's owner and see that person's nests. Per-user visibility here needs OAuth, which this server doesn't run yet — for per-user nests today, use one of the command-line harnesses.","","> The MCP client runs on Anthropic's servers, not the user's machine, so this URL must resolve on the public internet and present a valid TLS certificate. A `localhost` or internal-DNS address will not work here.")},{id:"chatgpt",name:"ChatGPT",kind:"chat",where:"Settings → Security and login → Developer mode",docs:"https://developers.openai.com/plugins/deploy/connect-chatgpt",support:"header",body:(n,i)=>S("1. Open **Settings → Security and login** and turn on **Developer mode**.","2. Go to the **Plugins** page and click the **+** button.","3. Give it a name and description you'll recognise in the tools menu later.",`4. Under **Connection**, paste the MCP server URL \`${i}\` — including the \`/mcp\` path.`,"5. Create the connection, then add it from the **tools menu** in a new conversation.","","Developer mode is available on Plus, Pro, Business, Enterprise and Edu — not on the free tier. Public HTTPS is required.",n.openMode?null:"",n.openMode?null:"> **This surface may not connect yet.** The connection step takes a URL and discovers the server's own authentication; OpenAI documents no field for a fixed API key or `Authorization` header. If the connection fails asking you to sign in, this server has no OAuth authorization server to offer it — use one of the command-line harnesses instead.","","> ChatGPT renamed this surface in July 2026. Older guides point at **Settings → Connectors → Advanced**, which no longer exists.")},{id:"grok",name:"Grok",kind:"chat",where:"grok.com/connectors → New Connector → Custom",open:"https://grok.com/connectors",docs:"https://docs.x.ai/grok/connectors",support:"header",body:(n,i)=>S("1. Go to **grok.com/connectors** and choose **New Connector → Custom**.",`2. Enter the MCP server URL \`${i}\`.`,n.openMode?"3. Leave authentication empty.":`3. Complete any authentication the form asks for, supplying \`Bearer ${W}\` where it wants a credential.`,"4. Grok discovers the exposed tools and offers them alongside its built-in connectors.","","The server must be reachable over the public internet; Grok has no tunnel of its own.",n.openMode?null:"",n.openMode?null:"> xAI documents the connector form but not which credentials it accepts, so the authentication step isn't verified here. If it only offers OAuth, this server has none to offer yet — use a command-line harness instead.")},{id:"perplexity",name:"Perplexity",kind:"chat",where:"All settings → Connectors (perplexity.ai/account/connectors)",open:"https://www.perplexity.ai/account/connectors",docs:"https://www.perplexity.ai/help-center/en/articles/13915507-adding-custom-remote-connectors",support:"oauth-only",body:(n,i)=>ds(n,"Perplexity","Under **All settings → Connectors**, Perplexity's custom-connector form asks for an OAuth client ID under **Advanced**, over Streamable HTTP, on a Pro, Max or Enterprise plan.",i)},{id:"claude-code",name:"Claude Code",kind:"cli",where:"one command in any terminal",docs:"https://code.claude.com/docs/en/mcp-quickstart",support:"header",body:(n,i)=>S("```bash",n.openMode?`claude mcp add --transport http contextnest ${i}`:`claude mcp add --transport http contextnest ${i} \\
|
|
4
|
-
--header "Authorization: Bearer $${I}"`,"```","",n.openMode?"By default this registers at `local` scope — only you, only this project. Add `--scope user` for every project, or `--scope project` to write `.mcp.json` in the repo; that file is safe to commit.":`By default this registers at \`local\` scope — only you, only this project. Add \`--scope user\` for every project, or \`--scope project\` to write \`.mcp.json\` in the repo — that file is safe to commit because it can reference \`\${${I}}\` rather than the value.`,"","A session started before the server was added must be restarted; a fresh session picks it up automatically.")},{id:"codex",name:"OpenAI Codex CLI",kind:"cli",where:"codex mcp add, or ~/.codex/config.toml",docs:"https://learn.chatgpt.com/docs/extend/mcp?surface=cli",support:"header",body:(n,i)=>S("```bash",n.openMode?`codex mcp add contextnest --url ${i}`:`codex mcp add contextnest --url ${i} --bearer-token-env-var ${I}`,"```","","Or write it into `~/.codex/config.toml` directly:","","```toml","[mcp_servers.contextnest]",`url = "${i}"`,n.openMode?null:`bearer_token_env_var = "${I}"`,"```","",n.openMode?null:"Codex reads the token from the environment and sends it as an `Authorization: Bearer` header, so the value never lands in the config file.")},{id:"hermes",name:"Hermes (Nous Research)",kind:"cli",where:"~/.hermes/config.yaml",docs:"https://hermes-agent.nousresearch.com/docs/reference/mcp-config-reference",support:"header",body:(n,i)=>S("```yaml","mcp_servers:"," contextnest:",` url: "${i}"`,n.openMode?null:" headers:",n.openMode?null:` Authorization: "Bearer \${env:${I}}"`," enabled: true","```","",n.openMode?null:`Values support \`\${env:VAR}\` interpolation against \`~/.hermes/.env\`, so put the key in that file as \`${I}\` and keep it out of the YAML.`,n.openMode?null:"",'A `url` entry speaks Streamable HTTP — set `transport: "sse"` only if you need the older one.')},{id:"gemini-cli",name:"Gemini CLI",kind:"cli",where:"~/.gemini/settings.json",docs:"https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md",support:"header",body:(n,i)=>S("```json","{",' "mcpServers": {',' "contextnest": {',` "httpUrl": "${i}"${n.openMode?"":","}`,n.openMode?null:` "headers": { "Authorization": "Bearer ${W}" }`," }"," }","}","```","","Gemini CLI picks the transport from the property name: `httpUrl` is Streamable HTTP, `url` would be SSE, `command` would be stdio. Use `httpUrl` here.")},{id:"cursor",name:"Cursor",kind:"editor",where:"~/.cursor/mcp.json (or .cursor/mcp.json in a project)",docs:"https://cursor.com/docs/mcp",support:"header",body:(n,i)=>S("```json","{",' "mcpServers": {',' "contextnest": {',` "url": "${i}"${n.openMode?"":","}`,n.openMode?null:` "headers": { "Authorization": "Bearer ${W}" }`," }"," }","}","```","","Cursor expands variables inside `url` and `headers`, so the key can come from the environment rather than the file.")}],Se=K[0];function hs(n){return K.find(i=>i.id===n)}function Ie(n,i){const t=[n.open?`[Open the settings page](${n.open})`:null,`[${n.name} docs](${n.docs})`].filter(d=>d!==null).join(" · ");return`${n.body(i,Pe(i.serverUrl))}
|
|
5
|
-
|
|
6
|
-
${t}`}const ms=[{kind:"chat",heading:"# Chat"},{kind:"cli",heading:"# Command line"},{kind:"editor",heading:"# Editors"}];function us(n){const t=[`**Connect once.** All of these point at the same endpoint — \`${Pe(n.serverUrl)}\` — and that one connection reads across every nest the caller can see: the public ones, plus whatever private nests they have been given access to. There is no per-nest setup, and nothing to redo when someone is added to another nest.`,"","What comes back is decided by who the caller authenticates as, not by which tool they are running.","",n.openMode?"This deployment runs in open mode, so no credential is involved and every caller is the same anonymous user.":["Two things to get right about the credential:","","- **Use a user-level key, not a nest-scoped one.** A key scoped to a single nest narrows this endpoint back down to that nest, which looks exactly like the connect-once promise being broken. Mint a user-level key in the Connect dialog.","- **Each person uses their own key.** A key shared across a team makes all of them the same user to this server, so they would all see the key owner's nests instead of their own."].join(`
|
|
7
|
-
`),""];for(const{kind:d,heading:f}of ms){const c=K.filter(y=>y.kind===d);if(c.length!==0){t.push(f,"");for(const y of c)t.push(`## ${y.name}`,"",`*${y.where}*`,"",Ie(y,n),"")}}return t.join(`
|
|
8
|
-
`).trimEnd()+`
|
|
9
|
-
`}const ps={chat:"Chat",cli:"Command line",editor:"Editors"},xs=["chat","cli","editor"];function gs({publicBaseUrl:n,openMode:i}){const[t,d]=l.useState(Se.id),f=n.trim(),c=f||window.location.origin,y=l.useMemo(()=>({serverUrl:c,openMode:i}),[c,i]),v=hs(t)??Se,M=l.useMemo(()=>Ie(v,y),[v,y]);return e.jsxs(m,{children:[e.jsx(u,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(p,{className:"text-base",children:"Connecting agents"}),e.jsxs(x,{children:["Setup steps for each AI tool your people are likely to use. Every one of them connects ",e.jsx("strong",{children:"once"}),", to the same server-level MCP endpoint, and that single connection reads across every nest the caller can see — the public ones plus whatever private nests they have access to. There is no per-nest setup, and nothing to redo when someone is added to another nest."]})]}),e.jsxs(b,{size:"sm",variant:"outline",onClick:()=>te(us(y),"All connection instructions copied"),children:[e.jsx(se,{className:"h-4 w-4 mr-1.5"}),"Copy all"]})]})}),e.jsxs(g,{className:"space-y-4",children:[!f&&e.jsxs("div",{role:"alert",className:"flex gap-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs",children:[e.jsx(Fe,{className:"h-4 w-4 shrink-0 mt-0.5 text-amber-600"}),e.jsxs("span",{children:["No public base URL is set, so these steps use"," ",e.jsx("code",{children:c})," — the address of"," ",e.jsx("em",{children:"this browser's"})," connection. Most of these tools run the MCP client on the vendor's servers, not the user's machine, so a private or proxied address will fail for them. Set the public base URL on the ",e.jsx("strong",{children:"General"})," tab."]})]}),!i&&e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Use a user-level key, not a nest-scoped one."})," A key scoped to a single nest narrows this endpoint back down to that nest, which looks exactly like the connect-once promise being broken."]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Each person uses their own key."})," A key shared across a team makes all of them the same user to this server, so they would all see the key owner's nests instead of their own."]})]}),xs.map(C=>{const U=K.filter(N=>N.kind===C);return U.length===0?null:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:ps[C]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:U.map(N=>e.jsxs(b,{size:"sm",variant:N.id===t?"default":"outline","aria-pressed":N.id===t,onClick:()=>d(N.id),children:[N.name,N.support==="oauth-only"&&e.jsx(Ae,{variant:"secondary",className:"ml-1.5",children:"OAuth"})]},N.id))})]},C)}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 mb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:v.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:v.where})]}),e.jsxs(b,{size:"sm",variant:"ghost",onClick:()=>te(M,`${v.name} steps copied`),children:[e.jsx(se,{className:"h-4 w-4 mr-1.5"}),"Copy"]})]}),e.jsx("article",{className:"prose prose-sm dark:prose-invert max-w-none",children:e.jsx(is,{remarkPlugins:[os],components:{a:({...C})=>e.jsx("a",{...C,target:"_blank",rel:"noopener noreferrer"})},children:M})})]})]})]})}const fs=[{value:"open",label:"Everyone",hint:"Anyone can sign in with PromptOwl."},{value:"admin-only",label:"Admins only",hint:"Only the server admin can use PromptOwl sign-in."},{value:"disabled",label:"Off",hint:"Hide PromptOwl sign-in."}],ys=[{value:"open",label:"Everyone",hint:"Anyone can sign in and create their own account."},{value:"invite-only",label:"Invite only",hint:"Invited users sign in and set a password; no self sign-up."},{value:"disabled",label:"Off",hint:"No email & password sign-in — PromptOwl only."}],Z=[{id:"general",label:"General",keys:["promptowl_sign_in_gate","manual_sign_in","public_base_url","logo_url","anthropic_api_key","nest_creation","people_suggest_all_users","shared_deployment"]},{id:"sso",label:"Single sign-on",keys:["oidc_enabled","oidc_issuer","oidc_client_id","oidc_client_secret","oidc_allowed_domains","oidc_auto_provision","oidc_department_tagging","sso_token_exchange_enabled","mcp_signing_secret","mcp_token_ttl_seconds","ms_token_exchange_enabled","ms_client_id","ms_tenant_id","google_token_exchange_enabled","google_client_id"]},{id:"notifications",label:"Notifications",keys:["slack_webhook_url","msteams_webhook_url","email_provider","smtp_url","ses_region","ses_access_key_id","ses_secret_access_key","notify_email_from","notify_email_to"]},{id:"community-sites",label:"Community sites",keys:[]},{id:"agents",label:"Connecting agents",keys:[]},{id:"advanced",label:"Advanced",keys:["telemetry_enabled","posthog_key","posthog_host","max_body_bytes","trace_retention_days","type_artifact_enabled","type_table_enabled","workflow_plane_enabled","promptowl_teams_enabled","subagent_runs_enabled","subagent_max_depth","subagent_max_children"]}],V=n=>({autoComplete:n==="password"?"new-password":"off","data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"});function h({value:n,placeholder:i,onChange:t,type:d="text"}){const f=d==="password",[c,y]=l.useState(!1);return e.jsxs("div",{className:"relative flex-1",children:[e.jsx(E,{value:n,type:f&&c?"text":d,placeholder:i,onChange:v=>t(v.target.value),className:f?"flex-1 pr-9":"flex-1",...V(d)}),f&&e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>y(v=>!v),className:"absolute inset-y-0 right-0 flex items-center px-2.5 text-muted-foreground hover:text-foreground",title:c?"Hide":"Show","aria-label":c?"Hide value":"Show value",children:c?e.jsx(es,{className:"h-4 w-4"}):e.jsx(ss,{className:"h-4 w-4"})})]})}function vs({bytes:n,onChange:i}){const[t,d]=l.useState(String(Math.round(n/1048576)));return l.useEffect(()=>d(String(Math.round(n/(1024*1024)))),[n]),e.jsxs("div",{className:"flex items-center gap-2 max-w-xs",children:[e.jsx(E,{type:"number",value:t,onChange:f=>{d(f.target.value);const c=Number(f.target.value);Number.isFinite(c)&&c>0&&i(Math.floor(c*1024*1024))},...V("number")}),e.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"MB"})]})}function ee({value:n,onChange:i,min:t,max:d}){const[f,c]=l.useState(String(n));return l.useEffect(()=>c(String(n)),[n]),e.jsx(E,{type:"number",min:t,max:d,value:f,className:"max-w-[7rem]",onChange:y=>{c(y.target.value);const v=Number(y.target.value);Number.isInteger(v)&&i(v)},...V("number")})}function _s({settings:n,onUpdate:i}){var ge,fe;const[t,d]=l.useState(n),[f,c]=l.useState(!1),y=Oe(),{authMode:v}=Te(),[M,C]=l.useState(null),[U,N]=l.useState("general"),[ae,re]=l.useState(!1);l.useEffect(()=>{n&&d(n)},[n]);const[Q,Ee]=l.useState(null),[ie,oe]=l.useState(null),z=async()=>{try{await y.invalidateQueries({queryKey:ne.communitySites().queryKey});const s=await y.fetchQuery(ne.communitySites());Ee(s.community_sites),oe(null)}catch(s){oe(s.message)}};l.useEffect(()=>{z()},[]);const[j,L]=l.useState(null),[k,A]=l.useState({name:"",url:"",secret:"",is_active:!0}),[le,ce]=l.useState(!1),[de,B]=l.useState(null),[T,G]=l.useState(null),[he,me]=l.useState(!1),Me=()=>{A({name:"",url:"",secret:"",is_active:!0}),B(null),L({mode:"add"})},Le=s=>{A({name:s.name,url:s.url,secret:"",is_active:s.is_active}),B(null),L({mode:"edit",site:s})},$e=async()=>{if(j){ce(!0),B(null);try{if(j.mode==="add")await ts({name:k.name.trim(),url:k.url.trim(),secret:k.secret.trim(),is_active:k.is_active});else{const s={name:k.name.trim(),url:k.url.trim(),is_active:k.is_active};k.secret.trim()&&(s.secret=k.secret.trim()),await Ce(j.site.id,s)}L(null),await z()}catch(s){B(s.message)}finally{ce(!1)}}},De=async s=>{try{await Ce(s.id,{is_active:!s.is_active}),await z()}catch(a){R.error(a.message)}},Re=async()=>{if(T){me(!0);try{await ns(T.id),G(null),await z()}catch(s){R.error(s.message)}finally{me(!1)}}},r=s=>{d(a=>a&&{...a,...s}),C(null)},$=l.useMemo(()=>{if(!t||!n)return[];const s=n;return Object.keys(t).filter(a=>{if(a==="anthropic_api_key"||a==="oidc_client_secret"||a==="mcp_signing_secret"||a==="ses_secret_access_key"){const o=t[a];return typeof o=="string"&&o.trim()!==""||o===null}return(t[a]??"")!==(s[a]??"")})},[t,n]),F=$.length>0,Ue=s=>s.some(a=>$.includes(a)),ze=async()=>{var a;if(!t||!F)return;const s={};for(const o of $)s[o]=t[o];c(!0),C(null);try{await i(s)}catch(o){C((o==null?void 0:o.message)||"Failed to save settings");const w=((a=o==null?void 0:o.body)==null?void 0:a.fieldErrors)??{},D=Object.keys(w),H=Y=>D.some(J=>Y.keys.includes(J)),ye=D.length?Z.find(H):Z.find(Y=>Y.keys.some(J=>$.includes(J)));ye&&N(ye.id)}finally{c(!1)}},Be=()=>{n&&d(n),C(null)},[ue,pe]=l.useState(null),Ge=async s=>{pe(s);try{await as(s),R.success(`Test ${s==="slack"?"Slack":"Teams"} notification sent — check the channel.`)}catch(a){R.error((a==null?void 0:a.message)||"Test notification failed.")}finally{pe(null)}},xe=(s,a)=>e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsxs(b,{type:"button",variant:"outline",size:"sm",disabled:ue===s||!(n!=null&&n[a]),onClick:()=>Ge(s),children:[ue===s&&e.jsx(O,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Send test"]}),$.includes(a)&&e.jsx("span",{className:"text-xs text-muted-foreground",children:"Save first — the test uses the saved URL."})]});return e.jsxs("div",{children:[e.jsx(rs,{icon:X,title:"Server settings",description:"Server-wide options. Changes apply on Save and persist across restarts.",className:"mb-6",actions:n&&e.jsxs(e.Fragment,{children:[F&&e.jsx("span",{className:"text-xs text-muted-foreground mr-1",children:"Unsaved changes"}),e.jsx(b,{variant:"ghost",size:"sm",onClick:Be,disabled:!F||f,children:"Discard"}),e.jsxs(b,{size:"sm",onClick:ze,disabled:!F||f,children:[f&&e.jsx(O,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Save changes"]})]})}),M&&e.jsxs("div",{role:"alert",className:"mb-4 rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[e.jsx("div",{className:"font-medium",children:"Couldn't save settings"}),e.jsx("div",{className:"mt-0.5 text-destructive/90",children:M})]}),t?e.jsxs(We,{value:U,onValueChange:N,children:[e.jsx(Ke,{children:Z.map(s=>e.jsxs(Ve,{value:s.id,className:"gap-1.5",children:[s.label,Ue(s.keys)&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary","aria-label":"unsaved changes"})]},s.id))}),e.jsxs(P,{value:"general",className:"space-y-4",children:[e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsxs(p,{className:"flex items-center gap-2 text-base",children:[e.jsx(X,{className:"h-4 w-4 text-muted-foreground"}),"PromptOwl sign-in"]}),e.jsx(x,{children:"Who can sign in to this server using their PromptOwl account."})]}),e.jsx(g,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:fs.map(s=>{const a=t.promptowl_sign_in_gate===s.value,o=s.value==="disabled"&&t.manual_sign_in==="disabled";return e.jsxs("button",{type:"button",disabled:o,onClick:()=>!a&&!o&&r({promptowl_sign_in_gate:s.value}),className:`text-left rounded-lg border p-3 transition-colors ${a?"border-primary bg-primary/5 ring-1 ring-primary":o?"opacity-50 cursor-not-allowed":"hover:bg-muted/50"}`,"aria-pressed":a,children:[e.jsx("div",{className:"text-sm font-medium",children:s.label}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:s.hint})]},s.value)})})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsxs(p,{className:"flex items-center gap-2 text-base",children:[e.jsx(X,{className:"h-4 w-4 text-muted-foreground"}),"Manual sign-in"]}),e.jsx(x,{children:"Email & password sign-in. Independent of PromptOwl — you can't turn this fully off while PromptOwl sign-in is also off."})]}),e.jsx(g,{children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:ys.map(s=>{const a=t.manual_sign_in===s.value,o=s.value==="disabled"&&t.promptowl_sign_in_gate==="disabled";return e.jsxs("button",{type:"button",disabled:o,onClick:()=>!a&&!o&&r({manual_sign_in:s.value}),className:`text-left rounded-lg border p-3 transition-colors ${a?"border-primary bg-primary/5 ring-1 ring-primary":o?"opacity-50 cursor-not-allowed":"hover:bg-muted/50"}`,"aria-pressed":a,children:[e.jsx("div",{className:"text-sm font-medium",children:s.label}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:s.hint})]},s.value)})})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Public base URL"}),e.jsx(x,{children:"This server's public address — used for share links and SSO redirects. Leave empty if unsure."})]}),e.jsx(g,{children:e.jsx(h,{value:t.public_base_url??"",placeholder:"https://nest.yourcompany.com",onChange:s=>r({public_base_url:s})})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Logo"}),e.jsx(x,{children:"URL of the logo shown in the header. Leave empty for the default."})]}),e.jsx(g,{children:e.jsx(h,{value:t.logo_url??"",placeholder:"https://example.com/logo.svg",onChange:s=>r({logo_url:s})})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Anthropic API key"}),e.jsx(x,{children:"The server-wide model key. Runners pick it up automatically (every nest, unless a nest overrides it in its Tool environment). No key, no LLM calls. Stored server-side; shown masked."})]}),e.jsxs(g,{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:t.anthropic_api_key===null?"Will be cleared when you save.":n!=null&&n.anthropic_api_key_masked?`Current: ${n.anthropic_api_key_masked}`:"Not set — runs can't execute until a key exists here or in a nest's Tool environment."}),e.jsx(h,{type:"password",value:typeof t.anthropic_api_key=="string"?t.anthropic_api_key:"",placeholder:"sk-ant-… (paste to set or replace)",onChange:s=>r({anthropic_api_key:s})}),(n==null?void 0:n.anthropic_api_key_masked)&&t.anthropic_api_key!==null&&e.jsx("button",{type:"button",className:"mt-2 text-xs text-destructive hover:underline",onClick:()=>r({anthropic_api_key:null}),children:"Clear key"}),t.anthropic_api_key===null&&e.jsx("button",{type:"button",className:"mt-2 text-xs text-muted-foreground hover:underline",onClick:()=>r({anthropic_api_key:void 0}),children:"Keep current key"})]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsxs(p,{className:"flex items-center gap-2 text-base",children:[e.jsx(ve,{className:"h-4 w-4 text-muted-foreground"}),"Nest creation"]}),e.jsx(x,{children:"Who can create and import nests on this server."})]}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"pr-4",children:[e.jsx("div",{className:"text-sm font-medium",children:"Let everyone create nests"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Off, only server admins can create or import nests, and everyone else works in the nests shared with them. On, any signed-in user can create their own."})]}),e.jsx(_,{checked:t.nest_creation==="everyone",onCheckedChange:s=>r({nest_creation:s?"everyone":"admins"})})]})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsxs(p,{className:"flex items-center gap-2 text-base",children:[e.jsx(Qe,{className:"h-4 w-4 text-muted-foreground"}),"People directory"]}),e.jsx(x,{children:'What the "add a person" fields suggest when inviting someone to a nest, a team, or a stewardship role.'})]}),e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"pr-4",children:[e.jsx("div",{className:"text-sm font-medium",children:"Suggest everyone on this server"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Off, the pickers only suggest people the inviter already shares a nest or team with. On, they suggest every registered account — right when this server is one organisation, wrong when it hosts several, because it shows them each other's email addresses. Either way anyone can still be invited by typing their address."})]}),e.jsx(_,{checked:t.people_suggest_all_users,onCheckedChange:s=>r({people_suggest_all_users:s})})]}),e.jsxs("div",{className:"flex items-start justify-between gap-4 pt-4 border-t",children:[e.jsxs("div",{className:"pr-4",children:[e.jsx("div",{className:"text-sm font-medium",children:"This server hosts several organizations"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"A nest's Organization tier is readable by every account on this server. Off, that is one company and the tier applies in one click. On — the PromptOwl-hosted service, or any install shared by unrelated customers — opening a nest to Organization asks for the same acknowledgement as Public (enforced by the server, not only the UI), and the visibility picker says who the tier really reaches."})]}),e.jsx(_,{checked:t.shared_deployment,onCheckedChange:s=>r({shared_deployment:s}),"data-testid":"settings-shared-deployment"})]})]})]})]}),e.jsxs(P,{value:"sso",className:"space-y-4",children:[e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsxs(p,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ye,{className:"h-4 w-4 text-muted-foreground"}),"Single sign-on (OIDC)"]}),e.jsx(x,{children:"Let teammates sign in with your identity provider — Microsoft Entra ID, Google, or any OpenID Connect issuer. Fill in the issuer and app credentials below, then turn it on."})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:[t.oidc_enabled?"On":"Off",!t.oidc_enabled&&!(t.oidc_issuer&&t.oidc_client_id)&&e.jsxs("span",{className:"text-muted-foreground",children:[" ","· configure the issuer and app credentials first"]})]}),e.jsx(_,{checked:t.oidc_enabled,onCheckedChange:s=>r({oidc_enabled:s})})]}),(()=>{var o,w;const s=t.oidc_client_secret===null?!1:typeof t.oidc_client_secret=="string"&&t.oidc_client_secret.trim()!==""?!0:!!(n!=null&&n.oidc_client_secret_set),a=t.oidc_enabled&&!!((o=t.oidc_issuer)!=null&&o.trim())&&!!((w=t.oidc_client_id)!=null&&w.trim())&&s;return!t.oidc_enabled||a?null:e.jsx("div",{role:"alert",className:"rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-400",children:"Enabled but not configured — the SSO sign-in button stays hidden until the issuer, client ID, and client secret are all set."})})(),(()=>{var o;const s=((o=t.oidc_issuer)==null?void 0:o.trim())??"",a=/^https:\/\/login\.microsoftonline\.com\/[^/]+\/v2\.0$/.test(s)?"entra":s==="https://accounts.google.com"?"google":null;return e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Issuer URL"}),e.jsxs("div",{className:"flex gap-2 mb-2",role:"group","aria-label":"Identity provider preset",children:[e.jsx(b,{type:"button",variant:a==="entra"?"default":"outline",size:"sm","aria-pressed":a==="entra",onClick:()=>{const w=window.prompt("Microsoft Entra tenant ID (Directory ID) — find it on your app registration's Overview page:");w&&w.trim()&&r({oidc_issuer:`https://login.microsoftonline.com/${w.trim()}/v2.0`})},children:"Microsoft Entra ID"}),e.jsx(b,{type:"button",variant:a==="google"?"default":"outline",size:"sm","aria-pressed":a==="google",onClick:()=>r({oidc_issuer:"https://accounts.google.com"}),children:"Google"}),a===null&&s!==""&&e.jsx("span",{className:"self-center text-xs text-muted-foreground",children:"Custom issuer"})]}),e.jsx(h,{value:t.oidc_issuer??"",placeholder:"https://login.microsoftonline.com/{tenant}/v2.0",onChange:w=>r({oidc_issuer:w})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"https:// only. Must serve /.well-known/openid-configuration."})]})})(),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Client ID"}),e.jsx(h,{value:t.oidc_client_id??"",placeholder:"Application (client) ID from your IdP app registration",onChange:s=>r({oidc_client_id:s})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Client secret"}),e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:t.oidc_client_secret===null?"Will be cleared when you save.":n!=null&&n.oidc_client_secret_set?"A client secret is set. Paste a new one to replace it.":"Not set."}),e.jsx(h,{type:"password",value:typeof t.oidc_client_secret=="string"?t.oidc_client_secret:"",placeholder:"Paste to set or replace",onChange:s=>r({oidc_client_secret:s})}),(n==null?void 0:n.oidc_client_secret_set)&&t.oidc_client_secret!==null&&e.jsx("button",{type:"button",className:"mt-2 text-xs text-destructive hover:underline",onClick:()=>r({oidc_client_secret:null}),children:"Clear secret"}),t.oidc_client_secret===null&&e.jsx("button",{type:"button",className:"mt-2 text-xs text-muted-foreground hover:underline",onClick:()=>r({oidc_client_secret:void 0}),children:"Keep current secret"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Redirect URI"}),(()=>{const a=`${(t.public_base_url||window.location.origin).replace(/\/$/,"")}/auth/oidc/callback`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 bg-muted/40 border rounded px-2 py-1.5 text-xs font-mono break-all",children:a}),e.jsxs(b,{type:"button",variant:"outline",size:"sm",onClick:async()=>{await te(a)&&(re(!0),setTimeout(()=>re(!1),1500))},children:[ae?e.jsx(Je,{className:"h-3.5 w-3.5"}):e.jsx(se,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1.5",children:ae?"Copied":"Copy"})]})]})})(),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Register this exact URI in your IdP's app registration (Entra: Authentication → Web redirect URIs; Google: Authorized redirect URIs)."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Allowed email domains"}),e.jsx(h,{value:t.oidc_allowed_domains??"",placeholder:"acme.com, contractors.acme.com — empty allows any",onChange:s=>r({oidc_allowed_domains:s})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Only accounts whose email domain is listed may sign in. Leave empty to allow any domain your IdP asserts."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Auto-provision new users"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Create an account on first SSO sign-in. Turn off to allow only users you've already invited."})]}),e.jsx(_,{checked:t.oidc_auto_provision,onCheckedChange:s=>r({oidc_auto_provision:s})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Department auto-tagging"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tag new documents with the creator's directory department (requires the department claim from your IdP)."})]}),e.jsx(_,{checked:t.oidc_department_tagging,onCheckedChange:s=>r({oidc_department_tagging:s})})]}),t.oidc_enabled&&t.oidc_auto_provision&&!((ge=t.oidc_allowed_domains)!=null&&ge.trim())&&e.jsx("div",{role:"alert",className:"rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-400",children:"Anyone your issuer can authenticate will get an account on first sign-in — with a consumer or multi-tenant issuer (e.g. Google), that's any account on the internet, and it applies even when manual sign-in is invite-only. Set allowed email domains above, or turn auto-provision off."})]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{children:"Agent SSO — token exchange"}),e.jsx(x,{children:"Let an external agent, acting for a user your IdP already authenticated (Microsoft Entra / Google), exchange that IdP's ID token for a short-lived MCP bearer — no second login. Uses the domain allowlist and auto-provision settings above."})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm",children:t.sso_token_exchange_enabled?"On":"Off"}),e.jsx(_,{checked:t.sso_token_exchange_enabled,onCheckedChange:s=>r({sso_token_exchange_enabled:s})})]}),(t.ms_token_exchange_enabled||t.google_token_exchange_enabled)&&t.oidc_auto_provision&&!((fe=t.oidc_allowed_domains)!=null&&fe.trim())&&e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"Blocked: with auto-provision on and no allowed email domains, anyone with an account at that provider could sign themselves up and mint a token. Set allowed email domains above, or turn auto-provision off."}),(()=>{var w,D,H;const s=t.mcp_signing_secret===null?!1:typeof t.mcp_signing_secret=="string"&&t.mcp_signing_secret.trim()!==""?!0:!!(n!=null&&n.mcp_signing_secret_set),a=t.ms_token_exchange_enabled&&!!((w=t.ms_client_id)!=null&&w.trim())&&!!((D=t.ms_tenant_id)!=null&&D.trim()),o=t.google_token_exchange_enabled&&!!((H=t.google_client_id)!=null&&H.trim());return!t.sso_token_exchange_enabled||s&&(a||o)?null:e.jsx("div",{role:"alert",className:"rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-400",children:"Enabled but not ready — the endpoint needs a signing secret and at least one provider turned on with its client ID filled in (plus the tenant ID for Microsoft)."})})(),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"MCP signing secret"}),e.jsx("div",{className:"text-xs text-muted-foreground mb-2",children:t.mcp_signing_secret===null?"Will be cleared when you save.":n!=null&&n.mcp_signing_secret_set?"A signing secret is set. Paste a new one to replace it.":"Not set. Use a long random string — this signs the MCP tokens the exchange mints."}),e.jsx(h,{type:"password",value:typeof t.mcp_signing_secret=="string"?t.mcp_signing_secret:"",placeholder:"Paste to set or replace (16+ characters)",onChange:s=>r({mcp_signing_secret:s})}),(n==null?void 0:n.mcp_signing_secret_set)&&t.mcp_signing_secret!==null&&e.jsx("button",{type:"button",className:"mt-2 text-xs text-destructive hover:underline",onClick:()=>r({mcp_signing_secret:null}),children:"Clear secret"}),t.mcp_signing_secret===null&&e.jsx("button",{type:"button",className:"mt-2 text-xs text-muted-foreground hover:underline",onClick:()=>r({mcp_signing_secret:void 0}),children:"Keep current secret"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Token lifetime (seconds)"}),e.jsx(h,{type:"number",value:String(t.mcp_token_ttl_seconds??300),placeholder:"300",onChange:s=>r({mcp_token_ttl_seconds:s.trim()===""?300:Number(s)})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"30–3600. Short by design — a minted token expires quickly."})]}),e.jsxs("div",{className:"border-t pt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:"Microsoft Entra"}),e.jsx(_,{checked:t.ms_token_exchange_enabled,onCheckedChange:s=>r({ms_token_exchange_enabled:s})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Client (application) ID"}),e.jsx(h,{value:t.ms_client_id??"",placeholder:"Entra app (client) ID — the token audience",onChange:s=>r({ms_client_id:s})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Tenant ID"}),e.jsx(h,{value:t.ms_tenant_id??"",placeholder:"Directory (tenant) ID — builds the issuer",onChange:s=>r({ms_tenant_id:s})})]})]}),e.jsxs("div",{className:"border-t pt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:"Google"}),e.jsx(_,{checked:t.google_token_exchange_enabled,onCheckedChange:s=>r({google_token_exchange_enabled:s})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"OAuth client ID"}),e.jsx(h,{value:t.google_client_id??"",placeholder:"Google OAuth client ID — the token audience",onChange:s=>r({google_client_id:s})})]})]}),e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:["Your agent calls"," ",e.jsx("code",{className:"text-[11px]",children:"POST /auth/token-exchange"})," ","with the IdP ID token and receives a short-lived MCP bearer for"," ",e.jsx("code",{className:"text-[11px]",children:"/mcp"})," and"," ",e.jsx("code",{className:"text-[11px]",children:"/index"}),". The token is verified by signature, issuer, audience (the client id above) and expiry. Security-critical — keep it off until reviewed. For a public IdP like Google, set the allowed email domains above so only your organization can exchange."]})]})]})]}),e.jsxs(P,{value:"notifications",className:"space-y-4",children:[e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Slack notifications"}),e.jsx(x,{children:"Post governance events (review requested, approved, rejected, nest shared) to a Slack channel via an incoming-webhook URL. Leave empty to turn the connector off. The URL contains a secret — treat it like a password."})]}),e.jsxs(g,{children:[e.jsx(h,{type:"password",value:t.slack_webhook_url??"",placeholder:"https://hooks.slack.com/services/…",onChange:s=>r({slack_webhook_url:s})}),xe("slack","slack_webhook_url")]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Microsoft Teams notifications"}),e.jsx(x,{children:'Post the same governance events to a Microsoft Teams channel as Adaptive Cards via an incoming-webhook URL (create one in Teams with the Workflows app: "Post to a channel when a webhook request is received"). Leave empty to turn the connector off. The URL contains a secret — treat it like a password.'})]}),e.jsxs(g,{children:[e.jsx(h,{type:"password",value:t.msteams_webhook_url??"",placeholder:"https://….logic.azure.com/workflows/…",onChange:s=>r({msteams_webhook_url:s})}),xe("teams","msteams_webhook_url")]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Email notifications"}),e.jsx(x,{children:"Invites, shares and governance events by email. Send through SMTP, or through AWS SES when this server can't use SMTP. Set a From address and one or more team recipients (comma-separated). Leave the SMTP URL or AWS region empty to turn email off."})]}),e.jsxs(g,{className:"space-y-3",children:[e.jsx("div",{role:"radiogroup",className:"flex gap-4 text-sm",children:[["smtp","SMTP"],["ses","AWS SES"]].map(([s,a])=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"email_provider",checked:(t.email_provider??"smtp")===s,onChange:()=>r({email_provider:s})}),a]},s))}),(t.email_provider??"smtp")==="smtp"?e.jsx(h,{type:"password",value:t.smtp_url??"",placeholder:"smtps://user:pass@smtp.example.com:465",onChange:s=>r({smtp_url:s})}):e.jsxs(e.Fragment,{children:[e.jsx(h,{value:t.ses_region??"",placeholder:"AWS region — us-east-1",onChange:s=>r({ses_region:s})}),e.jsx(h,{value:t.ses_access_key_id??"",placeholder:"Access key ID — leave empty to use the server's IAM role",onChange:s=>r({ses_access_key_id:s})}),e.jsx(h,{type:"password",value:typeof t.ses_secret_access_key=="string"?t.ses_secret_access_key:"",placeholder:t.ses_secret_access_key===null?"Secret access key — will be cleared when you save":n!=null&&n.ses_secret_access_key_set?"Secret access key is set — paste to replace":"Secret access key — leave empty to use the server's IAM role",onChange:s=>r({ses_secret_access_key:s})}),(n==null?void 0:n.ses_secret_access_key_set)&&t.ses_secret_access_key!==null&&e.jsx("button",{type:"button",className:"text-xs text-destructive hover:underline",onClick:()=>r({ses_secret_access_key:null,ses_access_key_id:""}),children:"Clear keys"})]}),e.jsx(h,{value:t.notify_email_from??"",placeholder:"From — nest@yourcompany.com",onChange:s=>r({notify_email_from:s})}),e.jsx(h,{value:t.notify_email_to??"",placeholder:"To — team@yourcompany.com, ops@yourcompany.com",onChange:s=>r({notify_email_to:s})})]})]})]}),e.jsxs(P,{value:"advanced",className:"space-y-4",children:[e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Usage telemetry"}),e.jsx(x,{children:"Send anonymous usage counts to PromptOwl. Turn off to keep all usage data on this server."})]}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm",children:t.telemetry_enabled?"On":"Off"}),e.jsx(_,{checked:t.telemetry_enabled,onCheckedChange:s=>r({telemetry_enabled:s})})]})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Product analytics"}),e.jsx(x,{children:"Send usage events to your own PostHog project. Leave the key empty to keep analytics off. Also off whenever usage telemetry above is off."})]}),e.jsxs(g,{className:"space-y-3",children:[e.jsx(h,{value:t.posthog_key??"",placeholder:"Project API key — phc_...",onChange:s=>r({posthog_key:s})}),e.jsx(h,{value:t.posthog_host??"",placeholder:"Host — https://us.i.posthog.com",onChange:s=>r({posthog_host:s})})]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Max upload size"}),e.jsx(x,{children:"Largest request/file accepted, in megabytes. Raise this if big HTML artifacts (decks, dashboards) get rejected."})]}),e.jsx(g,{children:e.jsx(vs,{bytes:t.max_body_bytes,onChange:s=>r({max_body_bytes:s})})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Activity trace retention"}),e.jsx(x,{children:"How many days of activity-trace rows (API requests and MCP tool calls) to keep. Older rows are pruned opportunistically. Set 0 to keep activity forever."})]}),e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{value:t.trace_retention_days,min:0,max:3650,onChange:s=>r({trace_retention_days:s})}),e.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"days"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"0–3650 — 0 disables pruning entirely."})]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Content types"}),e.jsx(x,{children:"Which node types can be created on this server. Turning one off hides it from the editor and refuses new creations — existing nodes of that type stay readable and versioned. Runnable types (agent, skill, tool) are governed by the workflow plane below."})]}),e.jsxs(g,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:["Artifacts (hosted HTML) —"," ",t.type_artifact_enabled?"On":"Off"]}),e.jsx(_,{checked:t.type_artifact_enabled,onCheckedChange:s=>r({type_artifact_enabled:s})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:["Tables (CSV fact stores) —"," ",t.type_table_enabled?"On":"Off"]}),e.jsx(_,{checked:t.type_table_enabled,onCheckedChange:s=>r({type_table_enabled:s})})]})]})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsxs(p,{className:"text-base",children:["Workflow plane ",e.jsx(Xe,{className:"ml-1 align-middle"})]}),e.jsx(x,{children:"Typed edges, an edge-type registry, and governed runs — the automation layer. Optional; off by default. Turning it on adds API surface and UI views but changes nothing until someone creates an edge."})]}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm",children:t.workflow_plane_enabled?"On":"Off"}),e.jsx(_,{checked:t.workflow_plane_enabled,onCheckedChange:s=>r({workflow_plane_enabled:s,...s?{}:{subagent_runs_enabled:!1}})})]})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Import teams from PromptOwl"}),e.jsx(x,{children:"Lets users who signed in with PromptOwl pull their PromptOwl teams in as local teams. Off by default. When off, the PromptOwl Teams panel is hidden and the import API is unavailable."})]}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm",children:t.promptowl_teams_enabled?"On":"Off"}),e.jsx(_,{checked:t.promptowl_teams_enabled,onCheckedChange:s=>r({promptowl_teams_enabled:s})})]})})]}),e.jsxs(m,{children:[e.jsxs(u,{children:[e.jsx(p,{className:"text-base",children:"Sub-agent runs (recursion)"}),e.jsx(x,{children:"Lets a run spawn nested sub-agent runs (a call tree). Bounded by depth, fan-out and re-entrancy caps so the tree stays finite. This opens a recursion surface — enable it only after reviewing the caps for your deployment. Requires the workflow plane."})]}),e.jsxs(g,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm",children:[t.subagent_runs_enabled?"On":"Off",!t.workflow_plane_enabled&&e.jsxs("span",{className:"text-muted-foreground",children:[" ","· enable the workflow plane first"]})]}),e.jsx(_,{checked:t.subagent_runs_enabled,disabled:!t.workflow_plane_enabled,onCheckedChange:s=>r({subagent_runs_enabled:s})})]}),t.subagent_runs_enabled&&e.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Max depth"}),e.jsx(ee,{value:t.subagent_max_depth,min:1,max:32,onChange:s=>r({subagent_max_depth:s})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"1–32 — how deep the sub-agent call tree may nest."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-1",children:"Max sub-agents per run"}),e.jsx(ee,{value:t.subagent_max_children,min:1,max:128,onChange:s=>r({subagent_max_children:s})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"1–128 — fan-out a single run may spawn."})]})]})]})]})]}),e.jsx(P,{value:"community-sites",className:"space-y-4",children:e.jsxs(m,{children:[e.jsx(u,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs(p,{className:"flex items-center gap-2 text-base",children:[e.jsx(ls,{className:"h-4 w-4 text-muted-foreground"}),"Official community sites"]}),e.jsx(x,{children:"Sites trusted for one-click SSO auto-login. A visitor arriving with a ticket signed by one of these sites' secrets is signed in automatically — the ticket's audience is also checked against this server's own base URL, so a ticket minted for a different deployment can't be replayed here."})]}),e.jsxs(b,{size:"sm",onClick:Me,children:[e.jsx(ve,{className:"h-4 w-4 mr-1.5"}),"Add site"]})]})}),e.jsxs(g,{children:[ie&&e.jsx("div",{role:"alert",className:"mb-4 rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:ie}),Q?Q.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-6",children:"No community sites configured yet. Add one to enable SSO auto-login from it."}):e.jsx("div",{className:"divide-y",children:Q.map(s=>e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.name}),e.jsx(Ae,{variant:"outline",className:s.is_active?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-muted-foreground/20 text-muted-foreground",children:s.is_active?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[s.url," · secret ",s.secret_set?"set":"not set"]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(_,{checked:s.is_active,onCheckedChange:()=>De(s),"aria-label":`Enable ${s.name}`,title:"Enabled sites can sign visitors in with an SSO ticket. This is the admin switch, not a reachability check."}),e.jsx(b,{variant:"outline",size:"sm",onClick:()=>Le(s),title:"Edit this community site",children:e.jsx(Ze,{className:"h-4 w-4"})}),e.jsx(b,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>G(s),title:"Remove this community site",children:e.jsx(cs,{className:"h-4 w-4"})})]})]},s.id))}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-6",children:[e.jsx(O,{className:"h-4 w-4 animate-spin"})," Loading community sites…"]})]})]})}),e.jsx(P,{value:"agents",className:"space-y-4",children:e.jsx(gs,{publicBaseUrl:t.public_base_url,openMode:v==="open"})})]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-10",children:[e.jsx(O,{className:"h-4 w-4 animate-spin"})," Loading settings…"]}),e.jsx(_e,{open:!!j,onOpenChange:s=>!s&&L(null),children:e.jsxs(be,{children:[e.jsxs(je,{children:[e.jsx(ke,{children:(j==null?void 0:j.mode)==="edit"?"Edit community site":"Add community site"}),e.jsx(we,{children:"The secret is write-only — leave it blank when editing to keep the current one."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"site-name",children:"Name"}),e.jsx(E,{id:"site-name",value:k.name,onChange:s=>A(a=>({...a,name:s.target.value})),placeholder:"Main community site"})]}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"site-url",children:"Site URL"}),e.jsx(E,{id:"site-url",value:k.url,onChange:s=>A(a=>({...a,url:s.target.value})),placeholder:"https://community.example.com"})]}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"site-secret",children:"Secret key"}),e.jsx(E,{id:"site-secret",type:"password",value:k.secret,onChange:s=>A(a=>({...a,secret:s.target.value})),placeholder:(j==null?void 0:j.mode)==="edit"?"Leave blank to keep the current secret":"Shared secret (16+ characters)",...V("password")})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(q,{htmlFor:"site-active",children:"Auto-login enabled"}),e.jsx(_,{id:"site-active",checked:k.is_active,onCheckedChange:s=>A(a=>({...a,is_active:s}))})]}),de&&e.jsx("div",{role:"alert",className:"text-sm text-destructive",children:de})]}),e.jsxs(Ne,{children:[e.jsx(b,{variant:"outline",onClick:()=>L(null),children:"Cancel"}),e.jsxs(b,{onClick:$e,disabled:le,children:[le&&e.jsx(O,{className:"h-4 w-4 mr-1.5 animate-spin"}),(j==null?void 0:j.mode)==="edit"?"Save changes":"Add site"]})]})]})}),e.jsx(_e,{open:!!T,onOpenChange:s=>!s&&G(null),children:e.jsxs(be,{children:[e.jsxs(je,{children:[e.jsxs(ke,{children:["Remove ",T==null?void 0:T.name,"?"]}),e.jsx(we,{children:"Visitors arriving from this site will no longer be auto-signed-in. This can't be undone from here — you'll need to re-add the site and its secret to restore it."})]}),e.jsxs(Ne,{children:[e.jsx(b,{variant:"outline",onClick:()=>G(null),children:"Cancel"}),e.jsxs(b,{variant:"destructive",onClick:Re,disabled:he,children:[he&&e.jsx(O,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Remove"]})]})]})})]})}function Cs(){const{isAdmin:n,refreshHealth:i}=Te(),t=Oe(),[d,f]=l.useState(null);l.useEffect(()=>{n&&He().then(f).catch(()=>{})},[n]);const c=l.useCallback(async y=>{try{const v=await qe(y);f(v.settings),await i(),await t.invalidateQueries({queryKey:ne.health().queryKey}),R.success("Settings saved")}catch(v){throw v}},[i,t]);return e.jsx(_s,{settings:d,onUpdate:c})}export{Cs as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as o,dQ as Be,dR as ze,dS as Ge,dt as ue,dT as Ue,dU as Ye,dw as k,dV as xe,dW as he,dX as Xe,dB as qe,dY as Ke,dZ as Qe,d_ as We,d$ as Ze,w as Je,u as pe,l as fe,e0 as oe,A as L,N as Z,a as I,L as A,B as C,R as je,b_ as B,c2 as z,e1 as es,D as G,z as U,G as Y,H as X,h as ss,K as q,C as ge,b$ as ve,e as M,cn as ts,af as ns,e2 as as,i as E,Q as rs,e3 as os,U as ls,a_ as is,S as cs,V as ds,W as le,X as ie,e4 as ms,aq as us,I as we,ah as ye,ai as Ne,aj as Ce,ak as be,e5 as se,al as Te,e6 as xs,e7 as Pe,bB as hs,e8 as ps,e9 as fs,ea as js}from"./index-WYDmEOfO.js";import{P as gs}from"./page-title-DVq4qvMR.js";import{P as vs}from"./PersonCombobox-BKI7dff4.js";import{T as Ee}from"./trash-2-B0HyPTnI.js";import{C as Se}from"./circle-check-Bw_aTXiH.js";import{C as Re}from"./circle-x-DkIG68H7.js";import{X as ws}from"./x-mNtADYHc.js";import{U as ys}from"./user-plus-Ckm_Isyc.js";var Ns=Symbol("radix.slottable");function Cs(s){const n=({children:t})=>e.jsx(e.Fragment,{children:t});return n.displayName=`${s}.Slottable`,n.__radixId=Ns,n}var[K]=qe("Tooltip",[xe]),Q=xe(),ke="TooltipProvider",bs=700,J="tooltip.open",[Ts,te]=K(ke),Oe=s=>{const{__scopeTooltip:n,delayDuration:t=bs,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:m}=s,u=o.useRef(!0),p=o.useRef(!1),d=o.useRef(0);return o.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),e.jsx(Ts,{scope:n,isOpenDelayedRef:u,delayDuration:t,onOpen:o.useCallback(()=>{window.clearTimeout(d.current),u.current=!1},[]),onClose:o.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>u.current=!0,r)},[r]),isPointerInTransitRef:p,onPointerInTransitChange:o.useCallback(f=>{p.current=f},[]),disableHoverableContent:a,children:m})};Oe.displayName=ke;var H="Tooltip",[Ps,F]=K(H),_e=s=>{const{__scopeTooltip:n,children:t,open:r,defaultOpen:a,onOpenChange:m,disableHoverableContent:u,delayDuration:p}=s,d=te(H,s.__scopeTooltip),f=Q(n),[l,h]=o.useState(null),i=Be(),c=o.useRef(0),j=u??d.disableHoverableContent,g=p??d.delayDuration,v=o.useRef(!1),[w,y]=ze({prop:r,defaultProp:a??!1,onChange:b=>{b?(d.onOpen(),document.dispatchEvent(new CustomEvent(J))):d.onClose(),m==null||m(b)},caller:H}),T=o.useMemo(()=>w?v.current?"delayed-open":"instant-open":"closed",[w]),P=o.useCallback(()=>{window.clearTimeout(c.current),c.current=0,v.current=!1,y(!0)},[y]),x=o.useCallback(()=>{window.clearTimeout(c.current),c.current=0,y(!1)},[y]),S=o.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>{v.current=!0,y(!0),c.current=0},g)},[g,y]);return o.useEffect(()=>()=>{c.current&&(window.clearTimeout(c.current),c.current=0)},[]),e.jsx(Ge,{...f,children:e.jsx(Ps,{scope:n,contentId:i,open:w,stateAttribute:T,trigger:l,onTriggerChange:h,onTriggerEnter:o.useCallback(()=>{d.isOpenDelayedRef.current?S():P()},[d.isOpenDelayedRef,S,P]),onTriggerLeave:o.useCallback(()=>{j?x():(window.clearTimeout(c.current),c.current=0)},[x,j]),onOpen:P,onClose:x,disableHoverableContent:j,children:t})})};_e.displayName=H;var ee="TooltipTrigger",Ae=o.forwardRef((s,n)=>{const{__scopeTooltip:t,...r}=s,a=F(ee,t),m=te(ee,t),u=Q(t),p=o.useRef(null),d=ue(n,p,a.onTriggerChange),f=o.useRef(!1),l=o.useRef(!1),h=o.useCallback(()=>f.current=!1,[]);return o.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),e.jsx(Ue,{asChild:!0,...u,children:e.jsx(Ye.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:d,onPointerMove:k(s.onPointerMove,i=>{i.pointerType!=="touch"&&!l.current&&!m.isPointerInTransitRef.current&&(a.onTriggerEnter(),l.current=!0)}),onPointerLeave:k(s.onPointerLeave,()=>{a.onTriggerLeave(),l.current=!1}),onPointerDown:k(s.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:k(s.onFocus,()=>{f.current||a.onOpen()}),onBlur:k(s.onBlur,a.onClose),onClick:k(s.onClick,a.onClose)})})});Ae.displayName=ee;var ne="TooltipPortal",[Es,Ss]=K(ne,{forceMount:void 0}),De=s=>{const{__scopeTooltip:n,forceMount:t,children:r,container:a}=s,m=F(ne,n);return e.jsx(Es,{scope:n,forceMount:t,children:e.jsx(he,{present:t||m.open,children:e.jsx(Xe,{asChild:!0,container:a,children:r})})})};De.displayName=ne;var D="TooltipContent",Le=o.forwardRef((s,n)=>{const t=Ss(D,s.__scopeTooltip),{forceMount:r=t.forceMount,side:a="top",...m}=s,u=F(D,s.__scopeTooltip);return e.jsx(he,{present:r||u.open,children:u.disableHoverableContent?e.jsx(Ie,{side:a,...m,ref:n}):e.jsx(Rs,{side:a,...m,ref:n})})}),Rs=o.forwardRef((s,n)=>{const t=F(D,s.__scopeTooltip),r=te(D,s.__scopeTooltip),a=o.useRef(null),m=ue(n,a),[u,p]=o.useState(null),{trigger:d,onClose:f}=t,l=a.current,{onPointerInTransitChange:h}=r,i=o.useCallback(()=>{p(null),h(!1)},[h]),c=o.useCallback((j,g)=>{const v=j.currentTarget,w={x:j.clientX,y:j.clientY},y=Ds(w,v.getBoundingClientRect()),T=Ls(w,y),P=Is(g.getBoundingClientRect()),x=Hs([...T,...P]);p(x),h(!0)},[h]);return o.useEffect(()=>()=>i(),[i]),o.useEffect(()=>{if(d&&l){const j=v=>c(v,l),g=v=>c(v,d);return d.addEventListener("pointerleave",j),l.addEventListener("pointerleave",g),()=>{d.removeEventListener("pointerleave",j),l.removeEventListener("pointerleave",g)}}},[d,l,c,i]),o.useEffect(()=>{if(u){const j=g=>{const v=g.target,w={x:g.clientX,y:g.clientY},y=(d==null?void 0:d.contains(v))||(l==null?void 0:l.contains(v)),T=!Ms(w,u);y?i():T&&(i(),f())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[d,l,u,f,i]),e.jsx(Ie,{...s,ref:m})}),[ks,Os]=K(H,{isInside:!1}),_s=Cs("TooltipContent"),Ie=o.forwardRef((s,n)=>{const{__scopeTooltip:t,children:r,"aria-label":a,onEscapeKeyDown:m,onPointerDownOutside:u,...p}=s,d=F(D,t),f=Q(t),{onClose:l}=d;return o.useEffect(()=>(document.addEventListener(J,l),()=>document.removeEventListener(J,l)),[l]),o.useEffect(()=>{if(d.trigger){const h=i=>{const c=i.target;c!=null&&c.contains(d.trigger)&&l()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,l]),e.jsx(Ke,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:m,onPointerDownOutside:u,onFocusOutside:h=>h.preventDefault(),onDismiss:l,children:e.jsxs(Qe,{"data-state":d.stateAttribute,...f,...p,ref:n,style:{...p.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[e.jsx(_s,{children:r}),e.jsx(ks,{scope:t,isInside:!0,children:e.jsx(We,{id:d.contentId,role:"tooltip",children:a||r})})]})})});Le.displayName=D;var Me="TooltipArrow",As=o.forwardRef((s,n)=>{const{__scopeTooltip:t,...r}=s,a=Q(t);return Os(Me,t).isInside?null:e.jsx(Ze,{...a,...r,ref:n})});As.displayName=Me;function Ds(s,n){const t=Math.abs(n.top-s.y),r=Math.abs(n.bottom-s.y),a=Math.abs(n.right-s.x),m=Math.abs(n.left-s.x);switch(Math.min(t,r,a,m)){case m:return"left";case a:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ls(s,n,t=5){const r=[];switch(n){case"top":r.push({x:s.x-t,y:s.y+t},{x:s.x+t,y:s.y+t});break;case"bottom":r.push({x:s.x-t,y:s.y-t},{x:s.x+t,y:s.y-t});break;case"left":r.push({x:s.x+t,y:s.y-t},{x:s.x+t,y:s.y+t});break;case"right":r.push({x:s.x-t,y:s.y-t},{x:s.x-t,y:s.y+t});break}return r}function Is(s){const{top:n,right:t,bottom:r,left:a}=s;return[{x:a,y:n},{x:t,y:n},{x:t,y:r},{x:a,y:r}]}function Ms(s,n){const{x:t,y:r}=s;let a=!1;for(let m=0,u=n.length-1;m<n.length;u=m++){const p=n[m],d=n[u],f=p.x,l=p.y,h=d.x,i=d.y;l>r!=i>r&&t<(h-f)*(r-l)/(i-l)+f&&(a=!a)}return a}function Hs(s){const n=s.slice();return n.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),$s(n)}function $s(s){if(s.length<=1)return s.slice();const n=[];for(let r=0;r<s.length;r++){const a=s[r];for(;n.length>=2;){const m=n[n.length-1],u=n[n.length-2];if((m.x-u.x)*(a.y-u.y)>=(m.y-u.y)*(a.x-u.x))n.pop();else break}n.push(a)}n.pop();const t=[];for(let r=s.length-1;r>=0;r--){const a=s[r];for(;t.length>=2;){const m=t[t.length-1],u=t[t.length-2];if((m.x-u.x)*(a.y-u.y)>=(m.y-u.y)*(a.x-u.x))t.pop();else break}t.push(a)}return t.pop(),n.length===1&&t.length===1&&n[0].x===t[0].x&&n[0].y===t[0].y?n:n.concat(t)}var Fs=Oe,Vs=_e,Bs=Ae,zs=De,He=Le;const Gs=({children:s,delayDuration:n=0})=>e.jsx(Fs,{delayDuration:n,children:s}),O=Vs,_=Bs,R=o.forwardRef(({className:s,sideOffset:n=4,...t},r)=>e.jsx(zs,{children:e.jsx(He,{ref:r,sideOffset:n,className:Je("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...t})}));R.displayName=He.displayName;const Us={Owner:"Admin",Editor:"Editor",Viewer:"Viewer",User:"Viewer"},ce=s=>Us[s]??"Viewer";function Ys({localTeams:s,onImported:n}){const[t,r]=o.useState([]),a=pe(),[m,u]=o.useState(!0),[p,d]=o.useState(null),[f,l]=o.useState(!1),[h,i]=o.useState(null),[c,j]=o.useState(null),[g,v]=o.useState(null),w=new Map(s.filter(x=>x.source==="promptowl"&&x.external_id).map(x=>[x.external_id,x]));o.useEffect(()=>{y()},[]);const y=async()=>{u(!0),d(null);try{const x=await a.fetchQuery(fe.promptowlTeams());r(x.teams)}catch(x){oe(x)?l(!0):d((x==null?void 0:x.message)||"Could not reach PromptOwl")}finally{u(!1)}},T=async x=>{var S;i(x.id),d(null);try{const b=await as([x.id]);v(b.results[0]??null),n(),E.success((S=b.results[0])!=null&&S.created?`Imported ${x.name}`:`Synced ${x.name}`)}catch(b){oe(b)?l(!0):d((b==null?void 0:b.message)||"Sync failed")}finally{i(null),j(null)}},P=x=>{w.has(x.id)?j(x):T(x)};return f?e.jsxs(L,{children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(I,{children:"Your PromptOwl session has ended. Sign out and sign back in with PromptOwl to import teams."})]}):m?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(A,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"space-y-4",children:[p&&e.jsxs(L,{variant:"destructive",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(I,{children:p})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground flex-1",children:"Your PromptOwl teams. Syncing one copies it here with its members — people without an account are invited automatically. Teams you're view-only on can't be imported, since the copy would be yours to control."}),e.jsx(C,{size:"sm",variant:"ghost",onClick:y,"aria-label":"Refresh",children:e.jsx(je,{className:"h-4 w-4"})})]}),g&&e.jsx(qs,{result:g}),t.length===0?e.jsx(B,{children:e.jsx(z,{className:"py-10 text-center text-sm text-muted-foreground",children:"You're not in any teams in PromptOwl."})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:t.map(x=>e.jsx(Xs,{team:x,imported:w.has(x.id),syncing:h===x.id,canImport:es(x),onSync:()=>P(x)},x.id))}),e.jsx(G,{open:!!c,onOpenChange:x=>!x&&j(null),children:e.jsxs(U,{className:"sm:max-w-[460px]",children:[e.jsx(Y,{children:e.jsxs(X,{children:['Sync "',c==null?void 0:c.name,'" from PromptOwl?']})}),e.jsxs(L,{children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(I,{className:"text-xs",children:"PromptOwl is the source of truth. This team's roster here will be made to match PromptOwl exactly: roles are reset, and anyone you added by hand in ContextNest is removed."})]}),e.jsxs(q,{children:[e.jsx(C,{variant:"outline",onClick:()=>j(null),children:"Cancel"}),e.jsxs(C,{disabled:!!h,onClick:()=>c&&T(c),children:[h&&e.jsx(A,{className:"h-4 w-4 mr-1 animate-spin"}),"Sync"]})]})]})})]})}function Xs({team:s,imported:n,syncing:t,canImport:r,onSync:a}){return e.jsxs(B,{className:`flex flex-col${r?"":" opacity-70"}`,children:[e.jsx(ve,{className:"space-y-1 pb-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold truncate",children:s.name}),e.jsx(M,{variant:"secondary",className:"shrink-0",children:s.members.length}),n&&e.jsxs(O,{children:[e.jsx(_,{asChild:!0,children:e.jsxs(M,{variant:"outline",className:"shrink-0 gap-1",children:[e.jsx(ge,{className:"h-3 w-3"}),"Synced"]})}),e.jsx(R,{children:"Already imported. Syncing again updates it in place."})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["You're ",s.your_role," in PromptOwl",s.enterprise?` · ${s.enterprise.name}`:""]})]}),r?e.jsxs(C,{size:"sm",variant:n?"outline":"default",className:"shrink-0",disabled:t,onClick:a,children:[t?e.jsx(A,{className:"h-3.5 w-3.5 animate-spin"}):n?e.jsx(je,{className:"h-3.5 w-3.5"}):e.jsx(ts,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"ml-1",children:n?"Sync":"Import"})]}):e.jsxs(O,{children:[e.jsx(_,{asChild:!0,children:e.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 text-xs text-muted-foreground border rounded-md px-2 py-1.5",children:[e.jsx(ns,{className:"h-3 w-3"}),"View-only"]})}),e.jsx(R,{className:"max-w-xs",children:"Importing a team makes you the owner of the copy here, which is more than you can do with this team in PromptOwl. Ask an owner or editor of it to import it."})]})]})}),e.jsx(z,{className:"space-y-1.5",children:s.members.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No members."}):s.members.map(m=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"flex-1 truncate",children:m.email}),e.jsxs(O,{children:[e.jsx(_,{asChild:!0,children:e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:ce(m.role)})}),e.jsxs(R,{children:[m.role," in PromptOwl → ",ce(m.role)," here"]})]})]},m.email))})]})}function qs({result:s}){const n=!s.added.length&&!s.updated.length&&!s.removed.length;return e.jsxs(L,{children:[e.jsx(ge,{className:"h-4 w-4"}),e.jsxs(I,{className:"text-xs space-y-0.5",children:[e.jsxs("div",{className:"font-medium",children:[s.name," — ",s.created?"imported":"synced"]}),n?e.jsx("div",{children:"Already up to date."}):e.jsxs(e.Fragment,{children:[s.added.length>0&&e.jsxs("div",{children:["Added: ",s.added.join(", ")]}),s.updated.length>0&&e.jsxs("div",{children:["Role changed: ",s.updated.join(", ")]}),s.removed.length>0&&e.jsxs("div",{children:["Removed: ",s.removed.join(", ")]})]})]})]})}const de=5,W=s=>{var n;return((n=se.find(t=>t.value===s))==null?void 0:n.label)??s},$={viewer:1,editor:2,admin:3},V=4;function me(s,n,t){if(t||s.owner_email&&s.owner_email.toLowerCase()===n)return V;const r=s.members.find(a=>(a.email||"").toLowerCase()===n);return r?$[r.role]??0:0}function lt(){var ae;const{adminStatus:s,isAdmin:n,promptowlTeamsEnabled:t}=rs(),r=(((ae=s==null?void 0:s.me)==null?void 0:ae.email)||"").toLowerCase(),[a]=o.useState(()=>os()),m=t&&a,[u,p]=o.useState([]),[d,f]=o.useState(!0),l=pe(),[h,i]=o.useState(null),[c,j]=o.useState(!1),[g,v]=o.useState(null),[w,y]=o.useState(null),[T,P]=o.useState(!1),x=async()=>{i(null);try{const N=await l.fetchQuery(fe.teamList());p(N.teams),v(re=>re?N.teams.find(Ve=>Ve.id===re.id)??null:null)}catch(N){i((N==null?void 0:N.message)||"Failed to load teams")}finally{f(!1)}};o.useEffect(()=>{x()},[]);const S=async()=>{if(w){P(!0);try{await ms(w.id),E.success("Team deleted"),y(null),await x()}catch(N){E.error((N==null?void 0:N.message)||"Failed to delete team")}finally{P(!1)}}},b=d?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(A,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):u.length===0?e.jsx(B,{children:e.jsx(z,{className:"py-10 text-center text-sm text-muted-foreground",children:"No teams yet. Create one to share a nest with a whole group at once."})}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:u.map(N=>e.jsx(Qs,{team:N,rank:me(N,r,n),onEdit:()=>v(N),onDelete:()=>y(N)},N.id))});return e.jsxs(Gs,{delayDuration:150,children:[e.jsxs("div",{className:"w-full mx-auto space-y-4",children:[e.jsx(gs,{icon:ls,title:"Teams",description:e.jsxs(e.Fragment,{children:["A team is a reusable group. Give each member a role, then share the team with a nest from its ",e.jsx("strong",{children:"Share"})," dialog — every member gets their role on that nest."]}),actions:e.jsxs(C,{size:"sm",onClick:()=>j(!0),children:[e.jsx(is,{className:"h-4 w-4 mr-1"}),"New Team"]})}),h&&e.jsxs(L,{variant:"destructive",children:[e.jsx(Z,{className:"h-4 w-4"}),e.jsx(I,{children:h})]}),m?e.jsxs(cs,{defaultValue:"cn",children:[e.jsxs(ds,{children:[e.jsx(le,{value:"cn",children:"ContextNest Teams"}),e.jsx(le,{value:"po",children:"PromptOwl Teams"})]}),e.jsx(ie,{value:"cn",className:"mt-4",children:b}),e.jsx(ie,{value:"po",className:"mt-4",children:e.jsx(Ys,{localTeams:u,onImported:x})})]}):b]}),c&&e.jsx(Ws,{onClose:()=>j(!1),onCreated:x}),g&&e.jsx(Zs,{team:g,rank:me(g,r,n),onClose:()=>v(null),onChanged:x}),e.jsx(G,{open:!!w,onOpenChange:N=>!N&&y(null),children:e.jsxs(U,{className:"sm:max-w-[420px]",children:[e.jsx(Y,{children:e.jsxs(X,{children:['Delete team "',w==null?void 0:w.name,'"?']})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Members lose access to every nest this team is shared with. This can't be undone."}),e.jsxs(q,{children:[e.jsx(C,{variant:"outline",onClick:()=>y(null),children:"Cancel"}),e.jsxs(C,{variant:"destructive",disabled:T,onClick:S,children:[T&&e.jsx(A,{className:"h-4 w-4 mr-1 animate-spin"}),"Delete"]})]})]})})]})}function $e({registered:s}){return e.jsxs(O,{children:[e.jsx(_,{asChild:!0,children:e.jsx("span",{className:"shrink-0 flex items-center",children:s?e.jsx(Se,{className:"h-3.5 w-3.5 text-green-600"}):e.jsx(Re,{className:"h-3.5 w-3.5 text-red-500"})})}),e.jsx(R,{children:s?"Registered account":"Invited — hasn't signed up yet"})]})}function Ks({member:s}){return e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx($e,{registered:s.registered}),e.jsx("span",{className:"flex-1 truncate",children:s.email}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:W(s.role)})]})}function Qs({team:s,rank:n,onEdit:t,onDelete:r}){const a=s.members.slice(0,de),m=s.members.slice(de),u=n>=$.editor,p=n>=V;return e.jsxs(B,{className:"flex flex-col",children:[e.jsx(ve,{className:"space-y-1 pb-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"font-semibold truncate",children:s.name}),e.jsx(M,{variant:"secondary",className:"shrink-0",children:s.members.length}),s.source==="promptowl"&&e.jsxs(O,{children:[e.jsx(_,{asChild:!0,children:e.jsx(M,{variant:"outline",className:"shrink-0",children:"PromptOwl"})}),e.jsx(R,{children:"Imported from PromptOwl. Re-syncing makes this roster match PromptOwl exactly."})]})]}),s.owner_email&&e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["Created by ",s.owner_email]})]}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[u&&e.jsx(C,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,"aria-label":"Edit team",children:e.jsx(us,{className:"h-3.5 w-3.5"})}),p&&e.jsx(C,{size:"icon",variant:"ghost",className:"h-7 w-7 text-destructive",onClick:r,"aria-label":"Delete team",children:e.jsx(Ee,{className:"h-3.5 w-3.5"})})]})]})}),e.jsx(z,{className:"space-y-1.5",children:s.members.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No members yet."}):e.jsxs(e.Fragment,{children:[a.map(d=>e.jsx(Ks,{member:d},d.userId)),m.length>0&&e.jsxs(O,{children:[e.jsx(_,{asChild:!0,children:e.jsxs("button",{className:"text-xs text-muted-foreground hover:text-foreground text-left",children:["+",m.length," more member",m.length===1?"":"s"]})}),e.jsx(R,{className:"max-w-xs",children:e.jsx("div",{className:"space-y-1",children:m.map(d=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[d.registered?e.jsx(Se,{className:"h-3 w-3 text-green-600 shrink-0"}):e.jsx(Re,{className:"h-3 w-3 text-red-500 shrink-0"}),e.jsx("span",{className:"truncate",children:d.email}),e.jsxs("span",{className:"opacity-70",children:["· ",W(d.role)]})]},d.userId))})})]})]})})]})}function Fe({onAdd:s,busy:n,maxRank:t=V,members:r=[]}){var i;const a=se.filter(c=>$[c.value]<=t),[m,u]=o.useState(""),[p,d]=o.useState(((i=a[0])==null?void 0:i.value)??"viewer"),[f,l]=o.useState(null),h=()=>{const c=m.trim();if(c){if(!hs(c)){l("Enter a valid email address.");return}l(null),Promise.resolve(s(c,p)).then(()=>{var j;u(""),d(((j=a[0])==null?void 0:j.value)??"viewer")})}};return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[e.jsx(vs,{value:m,onChange:c=>{u(c),f&&l(null)},onSubmit:h,placeholder:"person@company.com",exclude:r,className:"flex-1",testId:"team-member-input"}),e.jsxs(ye,{value:p,onValueChange:c=>d(c),children:[e.jsx(Ne,{className:"w-full sm:w-[130px] h-8",children:e.jsx(Ce,{})}),e.jsx(be,{children:a.map(c=>e.jsx(Te,{value:c.value,children:c.label},c.value))})]}),e.jsxs(C,{size:"sm",onClick:h,disabled:n||!m.trim(),children:[e.jsx(ys,{className:"h-4 w-4 mr-1"}),"Add"]})]}),f&&e.jsx("p",{className:"text-xs text-destructive",children:f})]})}function Ws({onClose:s,onCreated:n}){const[t,r]=o.useState(""),[a,m]=o.useState([]),[u,p]=o.useState(!1),d=(l,h)=>{if(a.some(i=>i.email.toLowerCase()===l.toLowerCase())){E.error("Already added");return}m(i=>[...i,{email:l,role:h}])},f=async()=>{const l=t.trim();if(l){p(!0);try{const{team:h}=await xs(l);for(const i of a)try{await Pe(h.id,{email:i.email,role:i.role})}catch(c){E.error(`${i.email}: ${(c==null?void 0:c.message)||"could not add"}`)}E.success(`Team "${l}" created`),n(),s()}catch(h){E.error((h==null?void 0:h.message)||"Failed to create team")}finally{p(!1)}}};return e.jsx(G,{open:!0,onOpenChange:l=>!l&&s(),children:e.jsxs(U,{className:"sm:max-w-[480px]",children:[e.jsx(Y,{children:e.jsx(X,{children:"New team"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(we,{autoFocus:!0,placeholder:"Team name (e.g. Platform)",value:t,onChange:l=>r(l.target.value)}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Members (optional)"}),a.length>0&&e.jsx("div",{className:"space-y-1.5",children:a.map(l=>e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"flex-1 truncate",children:l.email}),e.jsx("span",{className:"text-xs text-muted-foreground",children:W(l.role)}),e.jsx(C,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:()=>m(h=>h.filter(i=>i.email!==l.email)),"aria-label":`Remove ${l.email}`,children:e.jsx(ws,{className:"h-3.5 w-3.5"})})]},l.email))}),e.jsx(Fe,{onAdd:d,members:a.map(l=>l.email)})]})]}),e.jsxs(q,{children:[e.jsx(C,{variant:"outline",onClick:s,children:"Cancel"}),e.jsxs(C,{onClick:f,disabled:u||!t.trim(),children:[u&&e.jsx(A,{className:"h-4 w-4 mr-1 animate-spin"}),"Create"]})]})]})})}function Zs({team:s,rank:n,onClose:t,onChanged:r}){const a=n>=$.admin,m=n>=$.editor,[u,p]=o.useState(s.name),[d,f]=o.useState(!1),l=async(i,c)=>{f(!0);try{await i(),c&&E.success(c),r()}catch(j){E.error((j==null?void 0:j.message)||"Something went wrong")}finally{f(!1)}},h=async()=>{if(!a)return;const i=u.trim();!i||i===s.name||await l(()=>ps(s.id,i),"Team renamed")};return e.jsx(G,{open:!0,onOpenChange:i=>!i&&t(),children:e.jsxs(U,{className:"sm:max-w-[480px]",children:[e.jsx(Y,{children:e.jsx(X,{children:"Edit team"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(we,{value:u,onChange:i=>p(i.target.value),onBlur:h,onKeyDown:i=>i.key==="Enter"&&h(),className:"h-9",disabled:!a})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Members"}),s.members.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No members yet."}):e.jsx("div",{className:"space-y-2",children:s.members.map(i=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($e,{registered:i.registered}),e.jsx("span",{className:"text-sm flex-1 truncate",children:i.email}),a?e.jsxs(ye,{value:i.role,onValueChange:c=>l(()=>fs(s.id,i.userId,c),"Role updated"),children:[e.jsx(Ne,{className:"w-[120px] h-8",children:e.jsx(Ce,{})}),e.jsx(be,{children:se.map(c=>e.jsx(Te,{value:c.value,children:c.label},c.value))})]}):e.jsx(M,{variant:"secondary",className:"text-[11px]",children:W(i.role)}),a&&e.jsx(C,{size:"icon",variant:"ghost",className:"h-8 w-8",disabled:d,onClick:()=>l(()=>js(s.id,i.userId),"Member removed"),"aria-label":`Remove ${i.email}`,children:e.jsx(Ee,{className:"h-3.5 w-3.5"})})]},i.userId))}),m&&e.jsx("div",{className:"pt-1 border-t",children:e.jsx("div",{className:"pt-2",children:e.jsx(Fe,{busy:d,maxRank:n,members:s.members.map(i=>i.email),onAdd:(i,c)=>l(()=>Pe(s.id,{email:i,role:c}),"Member added")})})})]})]}),e.jsx(q,{children:e.jsx(C,{variant:"outline",onClick:t,children:"Done"})})]})})}export{lt as default};
|