@whoz-oss/coday-client 0.0.0-workstream-forge.146 → 0.0.0-workstream-forge.147
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/browser/{chunk-CkycsChJ.js → chunk-BM_L_QbZ.js} +1 -1
- package/browser/{chunk-BOfTZNaN.js → chunk-BSnPoXoJ.js} +1 -1
- package/browser/{chunk-DADWBVZU.js → chunk-BWRVARO3.js} +1 -1
- package/browser/{chunk-CsVq4Wgk.js → chunk-BX0hlno3.js} +1 -1
- package/browser/{chunk-Cm7YUhR9.js → chunk-BaZaIb4Z.js} +1 -1
- package/browser/{chunk-D_09lHY6.js → chunk-Bg3Dd1xZ.js} +1 -1
- package/browser/{chunk-qTBcysPS.js → chunk-Bl4KO3rW.js} +1 -1
- package/browser/{chunk-dBTdoZpz.js → chunk-Bn2w_P98.js} +1 -1
- package/browser/{chunk-HFHTkEEX.js → chunk-BrjEFLGx.js} +1 -1
- package/browser/{chunk-CHWXfthx.js → chunk-C-tDaEcF.js} +1 -1
- package/browser/{chunk-CytlJaIW.js → chunk-C3fhxpRe.js} +1 -1
- package/browser/{chunk-CHK113py.js → chunk-C5DhQBjK.js} +1 -1
- package/browser/chunk-CBRg4AXS.js +1 -0
- package/browser/{chunk-B0NSFqtq.js → chunk-CDwgL-Hg.js} +1 -1
- package/browser/{chunk-NudixG5j.js → chunk-CTOSnkKV.js} +1 -1
- package/browser/{chunk-CaMqhzbm.js → chunk-CWOEh5VN.js} +1 -1
- package/browser/{chunk-CKtPMfms.js → chunk-CWW2jfsJ.js} +1 -1
- package/browser/{chunk-w6u50zFI.js → chunk-CYWcBmdb.js} +1 -1
- package/browser/{chunk-DZdN-sZJ.js → chunk-CYtIAXbN.js} +1 -1
- package/browser/{chunk-R66pQQrs.js → chunk-CgHdhxbB.js} +1 -1
- package/browser/{chunk-BKqYXPTt.js → chunk-CiaMnEa7.js} +1 -1
- package/browser/{chunk-k8PbFrkB.js → chunk-Cl9QPnKf.js} +1 -1
- package/browser/{chunk-_kWYeaqu.js → chunk-Co43ilpY.js} +1 -1
- package/browser/{chunk-BntRV6_D.js → chunk-DCm2h443.js} +1 -1
- package/browser/{chunk-BbZZePZu.js → chunk-DINJkva-.js} +1 -1
- package/browser/{chunk-rY_JS-5f.js → chunk-DJpa3mrs.js} +1 -1
- package/browser/{chunk-BQ-wILak.js → chunk-DKaLlDQi.js} +1 -1
- package/browser/{chunk-PMd8U2N5.js → chunk-DKh5yOVa.js} +1 -1
- package/browser/{chunk-Dw1MiQSw.js → chunk-DjP1CBpd.js} +1 -1
- package/browser/{chunk-B6qwmM8h.js → chunk-DkTnFTiK.js} +1 -1
- package/browser/{chunk-B-XWbTY1.js → chunk-DtNl3Rj2.js} +1 -1
- package/browser/{chunk-U6mlTUgf.js → chunk-FAGYnPUh.js} +1 -1
- package/browser/{chunk-DPHJH2Hu.js → chunk-IedWKNs9.js} +5 -5
- package/browser/{chunk-aUhj8YJ0.js → chunk-J_m540mg.js} +1 -1
- package/browser/{chunk-cagwVBQ7.js → chunk-KFlFY4M-.js} +1 -1
- package/browser/{chunk-CqFmub-i.js → chunk-LD3lFPMG.js} +1 -1
- package/browser/{chunk-Cn1RyYsw.js → chunk-OP96ru3Q.js} +1 -1
- package/browser/{chunk-DXdjO2ny.js → chunk-Qn-am4t0.js} +1 -1
- package/browser/{chunk-Dl55Unir.js → chunk-R3WSpR3A.js} +1 -1
- package/browser/{chunk-DeCdY4Td.js → chunk-Vk5k4fDI.js} +1 -1
- package/browser/{chunk-DMycMzpY.js → chunk-Wsr-yWs0.js} +1 -1
- package/browser/{chunk-DDuaoeuY.js → chunk-XJIylUMO.js} +1 -1
- package/browser/{chunk-DyUhTcrA.js → chunk-fd1iFDd2.js} +1 -1
- package/browser/{chunk-B93ZuZhA.js → chunk-ommOgDX8.js} +1 -1
- package/browser/{chunk-D8FBwChK.js → chunk-x0uELaJK.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-5ZHT6SOL.js → main-HYOTHQER.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-CTVzARpj.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O,h as vi,x as xi,C as Ci,P}from'./chunk-
|
|
1
|
+
import {O,h as vi,x as xi,C as Ci,P}from'./chunk-IedWKNs9.js';import {p,$ as $t,f as It,F as Me,ap as N,aj as k,a7 as De,d as ie,a8 as Ae,U as U$1,D as Df,ae as pw,af as Wn,a3 as _,z as za,K as dc,b as bf,r as r_,h as hT,y as yb,O as tv,a as pT,e as yT,N as NT,v as vT,A as Af,I as Iv,k as bT,o as ig,s as sg}from'./main-HYOTHQER.js';var H=(o,e)=>e.key;function J(o,e){o&1&&(za(0,"p",3),r_(1,"Loading AI models\u2026"),bf());}function U(o,e){o&1&&(za(0,"p",4),r_(1,"No AI models configured."),bf());}function G(o,e){o&1&&(za(0,"p",3),r_(1,"No AI models match the current filter."),bf());}function K(o,e){o&1&&(za(0,"ds-tag",17),r_(1,"Read-only"),bf());}function Q(o,e){if(o&1){let t=bT();za(0,"button",20),dc("click",function(){ig(t);let c=NT().$implicit,s=NT(2);return sg(s.edit(c))}),r_(1,"Edit"),bf(),za(2,"button",21),dc("click",function(){ig(t);let c=NT().$implicit,s=NT(2);return sg(s.delete(c))}),r_(3,"Delete"),bf();}}function W(o,e){o&1&&(za(0,"button",19),r_(1,"Inherited"),bf());}function X(o,e){if(o&1&&(za(0,"tr",8)(1,"td",11),r_(2),bf(),za(3,"td",12),r_(4),bf(),za(5,"td",13),r_(6),bf(),za(7,"td",14)(8,"div",15)(9,"ds-tag",16),r_(10),bf(),hT(11,K,2,0,"ds-tag",17),bf()(),za(12,"td",18),hT(13,Q,4,0)(14,W,2,0,"button",19),bf()()),o&2){let t=e.$implicit;yb(2),Af(" ",t.model.alias??t.model.apiModelName," "),yb(2),Iv(t.providerName),yb(2),Iv(t.model.apiModelName),yb(3),tv("variant",t.scope==="platform"?"neutral":"accent"),yb(),Iv(t.scope==="platform"?"Platform":"Namespace"),yb(),pT(t.scope==="platform"?11:-1),yb(2),pT(t.scope==="namespace"?13:14);}}function Y(o,e){if(o&1&&(za(0,"div",5)(1,"table",6)(2,"thead",7)(3,"tr",8)(4,"th",9),r_(5,"Name"),bf(),za(6,"th",9),r_(7,"Provider"),bf(),za(8,"th",9),r_(9,"API model name"),bf(),za(10,"th",9),r_(11,"Scope"),bf(),za(12,"th",9)(13,"span",10),r_(14,"Actions"),bf()()()(),za(15,"tbody",7),yT(16,X,15,7,"tr",8,H),bf()()()),o&2){let t=NT();yb(16),vT(t.rowFilter.filteredRows());}}var B=class o{route=p($t);router=p(It);destroyRef=p(Me);aiModelController=p(N);aiProviderController=p(k);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new De(void 0);isLoading=ie(true);rows=ie([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),pw({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(Wn(()=>_([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(Ae(({namespace:e,platform:t,providers:r})=>{let c=[...new Set([...t,...e].map(s=>s.aiProviderId))];return pw({namespace:_(e),platform:_(t),providers:_(r),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:c,withRemoved:false}).pipe(Wn(()=>_([])))})})))));constructor(){this.data$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:r,referencedProviders:c})=>{let s=new Map([...c,...r].map(l=>[l.id??"",l.name]));this.rows.set([...t.map((l,C)=>({key:`platform:${l.id??C}`,model:l,providerName:s.get(l.aiProviderId)??l.aiProviderId,scope:"platform"})),...e.map((l,C)=>({key:`namespace:${l.id??C}`,model:l,providerName:s.get(l.aiProviderId)??l.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}delete(e){e.scope==="platform"||!e.model.id||!confirm(`Delete AI model \u201C${e.model.alias??e.model.apiModelName}\u201D?`)||this.aiModelController.deleteAiModel(e.model.id).pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Df({type:o,selectors:[["agentos-namespace-ai-models"]],decls:8,vars:2,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["type","button",1,"ai-models__new",3,"click"],["role","status",1,"ai-models__status"],[1,"ai-models__status"],[1,"ai-models__table-wrap"],["dsTable","","role","table","aria-label","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"ai-models__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"ai-models__secondary"],["role","cell","data-label","Scope"],[1,"ai-models__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions","",1,"ai-models__actions"],["type","button","disabled",""],["type","button",3,"click"],["type","button",1,"ai-models__delete",3,"click"]],template:function(t,r){t&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(s){return r.rowFilter.query.set(s)}),bf(),za(2,"button",2),dc("click",function(){return r.openCreateForm()}),r_(3,"New AI model"),bf()(),hT(4,J,2,0,"p",3)(5,U,2,0,"p",4)(6,G,2,0,"p",3)(7,Y,18,0,"div",5)),t&2&&(yb(),tv("query",r.rowFilter.query()),yb(3),pT(r.isLoading()?4:r.rows().length===0?5:r.rowFilter.filteredRows().length===0?6:7));},dependencies:[vi,xi,Ci,P],styles:['.ai-models__new[_ngcontent-%COMP%]{white-space:nowrap;padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.ai-models__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.ai-models__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.ai-models__name[_ngcontent-%COMP%]{font-weight:500}.ai-models__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.ai-models__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.ai-models__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:4px;white-space:nowrap}.ai-models__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.ai-models__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.ai-models__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.ai-models__actions[_ngcontent-%COMP%] .ai-models__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}']})};export{B as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CKtPMfms.js';import {R}from'./chunk-rY_JS-5f.js';import {p,$ as $t,f as It,F as Me,d as ie,U as U$1,aA as j,a8 as Ae,D as Df,a3 as _,z as za,K as dc,b as bf,r as r_,h as hT,y as yb,O as tv,a as pT,N as NT,I as Iv,e as yT,v as vT,k as bT,o as ig,s as sg}from'./main-5ZHT6SOL.js';import {i,O,h as vi,x as xi,C as Ci,P,M}from'./chunk-DPHJH2Hu.js';import'./chunk-CTVzARpj.js';var G=(n,t)=>t.key;function K(n,t){if(n&1&&(za(0,"p",3),r_(1),bf()),n&2){let e=NT();yb(),Iv(e.deletion.error());}}function H(n,t){n&1&&(za(0,"p",4),r_(1,"Loading auth settings\u2026"),bf());}function U(n,t){n&1&&(za(0,"p",5),r_(1,"No auth settings available."),bf());}function B(n,t){n&1&&(za(0,"p",4),r_(1,"No auth settings match the current filter."),bf());}function J(n,t){n&1&&(za(0,"ds-tag",17),r_(1,"Read-only"),bf());}function Q(n,t){if(n&1){let e=bT();za(0,"button",19),dc("click",function(){ig(e);let l=NT(2).$implicit,d=NT(2);return sg(d.edit(l))}),r_(1,"Edit"),bf();}}function W(n,t){if(n&1){let e=bT();hT(0,Q,2,0,"button",21),za(1,"agentos-row-delete-action",22),dc("deleteRequested",function(){ig(e);let l=NT().$implicit,d=NT(2);return sg(d.deletion.request(l.key))})("deleteConfirmed",function(){ig(e);let l=NT().$implicit,d=NT(2);return sg(d.confirmDelete(l))})("deleteCancelled",function(){ig(e);let l=NT(3);return sg(l.deletion.cancel())}),bf();}if(n&2){let e=NT().$implicit,a=NT(2);pT(a.deletion.confirmingId()!==e.key?0:-1),yb(),tv("rowKey",e.key)("rowLabel",e.config.name)("state",a.deletion);}}function X(n,t){n&1&&(za(0,"button",20),r_(1,"Inherited"),bf());}function Y(n,t){if(n&1){let e=bT();za(0,"tr",9)(1,"td",12),r_(2),bf(),za(3,"td",13),r_(4),bf(),za(5,"td",14)(6,"div",15)(7,"ds-tag",16),r_(8),bf(),hT(9,J,2,0,"ds-tag",17),bf()(),za(10,"td",18)(11,"button",19),dc("click",function(){let l=ig(e).$implicit,d=NT(2);return sg(d.duplicate(l))}),r_(12,"Duplicate"),bf(),hT(13,W,2,4)(14,X,2,0,"button",20),bf()();}if(n&2){let e=t.$implicit;yb(2),Iv(e.config.name),yb(2),Iv(e.config.authType),yb(3),tv("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),yb(),Iv(e.scopeLabel),yb(),pT(e.canMutate?-1:9),yb(4),pT(e.canMutate?13:14);}}function Z(n,t){if(n&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),bf(),za(6,"th",10),r_(7,"Authentication type"),bf(),za(8,"th",10),r_(9,"Scope"),bf(),za(10,"th",10)(11,"span",11),r_(12,"Actions"),bf()()()(),za(13,"tbody",8),yT(14,Y,15,6,"tr",9,G),bf()()()),n&2){let e=NT();yb(14),vT(e.rowFilter.filteredRows());}}var z=class n$1{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=ie(false);isLoading=ie(true);rows=ie([]);deletion=i();rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(j(t=>t.get("namespaceId")??""),Ae(t=>t?this.namespaceRole.isAdminOfNamespace$(t):_(false)),U$1(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,a,l){return t.map((d,j)=>({key:`${e}:${d.id??j}`,config:d,scope:e,scopeLabel:a,canMutate:l}))}static \u0275fac=function(e){return new(e||n$1)};static \u0275cmp=Df({type:n$1,selectors:[["agentos-auth-settings-all-scopes"]],decls:9,vars:3,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["type","button",1,"auth-settings__new",3,"click"],["role","alert",1,"auth-settings__error"],["role","status",1,"auth-settings__status"],[1,"auth-settings__status"],[1,"auth-settings__table-wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"auth-settings__name"],["role","cell","data-label","Authentication type",1,"auth-settings__type"],["role","cell","data-label","Scope"],[1,"auth-settings__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions","",1,"auth-settings__actions"],["type","button",3,"click"],["type","button","disabled",""],["type","button"],["deleteClass","auth-settings__delete",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,a){e&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(d){return a.rowFilter.query.set(d)}),bf(),za(2,"button",2),dc("click",function(){return a.openCreateForm()}),r_(3,"New auth setting"),bf()(),hT(4,K,2,1,"p",3),hT(5,H,2,0,"p",4)(6,U,2,0,"p",5)(7,B,2,0,"p",4)(8,Z,16,0,"div",6)),e&2&&(yb(),tv("query",a.rowFilter.query()),yb(3),pT(a.deletion.error()?4:-1),yb(),pT(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,Ci,P,M],styles:['.auth-settings__new[_ngcontent-%COMP%]{white-space:nowrap;padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.auth-settings__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.auth-settings__error[_ngcontent-%COMP%]{margin:0 0 .75rem;color:var(--color-error)}.auth-settings__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.auth-settings__name[_ngcontent-%COMP%]{font-weight:500}.auth-settings__type[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.auth-settings__tags[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.auth-settings__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:4px;white-space:nowrap}.auth-settings__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.auth-settings__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.auth-settings__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.auth-settings__actions[_ngcontent-%COMP%] .auth-settings__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}']})};export{z as AuthSettingsAllScopesComponent};
|
|
1
|
+
import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CWW2jfsJ.js';import {R}from'./chunk-DJpa3mrs.js';import {p,$ as $t,f as It,F as Me,d as ie,U as U$1,aA as j,a8 as Ae,D as Df,a3 as _,z as za,K as dc,b as bf,r as r_,h as hT,y as yb,O as tv,a as pT,N as NT,I as Iv,e as yT,v as vT,k as bT,o as ig,s as sg}from'./main-HYOTHQER.js';import {i,O,h as vi,x as xi,C as Ci,P,M}from'./chunk-IedWKNs9.js';import'./chunk-CBRg4AXS.js';var G=(n,t)=>t.key;function K(n,t){if(n&1&&(za(0,"p",3),r_(1),bf()),n&2){let e=NT();yb(),Iv(e.deletion.error());}}function H(n,t){n&1&&(za(0,"p",4),r_(1,"Loading auth settings\u2026"),bf());}function U(n,t){n&1&&(za(0,"p",5),r_(1,"No auth settings available."),bf());}function B(n,t){n&1&&(za(0,"p",4),r_(1,"No auth settings match the current filter."),bf());}function J(n,t){n&1&&(za(0,"ds-tag",17),r_(1,"Read-only"),bf());}function Q(n,t){if(n&1){let e=bT();za(0,"button",19),dc("click",function(){ig(e);let l=NT(2).$implicit,d=NT(2);return sg(d.edit(l))}),r_(1,"Edit"),bf();}}function W(n,t){if(n&1){let e=bT();hT(0,Q,2,0,"button",21),za(1,"agentos-row-delete-action",22),dc("deleteRequested",function(){ig(e);let l=NT().$implicit,d=NT(2);return sg(d.deletion.request(l.key))})("deleteConfirmed",function(){ig(e);let l=NT().$implicit,d=NT(2);return sg(d.confirmDelete(l))})("deleteCancelled",function(){ig(e);let l=NT(3);return sg(l.deletion.cancel())}),bf();}if(n&2){let e=NT().$implicit,a=NT(2);pT(a.deletion.confirmingId()!==e.key?0:-1),yb(),tv("rowKey",e.key)("rowLabel",e.config.name)("state",a.deletion);}}function X(n,t){n&1&&(za(0,"button",20),r_(1,"Inherited"),bf());}function Y(n,t){if(n&1){let e=bT();za(0,"tr",9)(1,"td",12),r_(2),bf(),za(3,"td",13),r_(4),bf(),za(5,"td",14)(6,"div",15)(7,"ds-tag",16),r_(8),bf(),hT(9,J,2,0,"ds-tag",17),bf()(),za(10,"td",18)(11,"button",19),dc("click",function(){let l=ig(e).$implicit,d=NT(2);return sg(d.duplicate(l))}),r_(12,"Duplicate"),bf(),hT(13,W,2,4)(14,X,2,0,"button",20),bf()();}if(n&2){let e=t.$implicit;yb(2),Iv(e.config.name),yb(2),Iv(e.config.authType),yb(3),tv("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),yb(),Iv(e.scopeLabel),yb(),pT(e.canMutate?-1:9),yb(4),pT(e.canMutate?13:14);}}function Z(n,t){if(n&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),bf(),za(6,"th",10),r_(7,"Authentication type"),bf(),za(8,"th",10),r_(9,"Scope"),bf(),za(10,"th",10)(11,"span",11),r_(12,"Actions"),bf()()()(),za(13,"tbody",8),yT(14,Y,15,6,"tr",9,G),bf()()()),n&2){let e=NT();yb(14),vT(e.rowFilter.filteredRows());}}var z=class n$1{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=ie(false);isLoading=ie(true);rows=ie([]);deletion=i();rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(j(t=>t.get("namespaceId")??""),Ae(t=>t?this.namespaceRole.isAdminOfNamespace$(t):_(false)),U$1(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,a,l){return t.map((d,j)=>({key:`${e}:${d.id??j}`,config:d,scope:e,scopeLabel:a,canMutate:l}))}static \u0275fac=function(e){return new(e||n$1)};static \u0275cmp=Df({type:n$1,selectors:[["agentos-auth-settings-all-scopes"]],decls:9,vars:3,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["type","button",1,"auth-settings__new",3,"click"],["role","alert",1,"auth-settings__error"],["role","status",1,"auth-settings__status"],[1,"auth-settings__status"],[1,"auth-settings__table-wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"auth-settings__name"],["role","cell","data-label","Authentication type",1,"auth-settings__type"],["role","cell","data-label","Scope"],[1,"auth-settings__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions","",1,"auth-settings__actions"],["type","button",3,"click"],["type","button","disabled",""],["type","button"],["deleteClass","auth-settings__delete",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,a){e&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(d){return a.rowFilter.query.set(d)}),bf(),za(2,"button",2),dc("click",function(){return a.openCreateForm()}),r_(3,"New auth setting"),bf()(),hT(4,K,2,1,"p",3),hT(5,H,2,0,"p",4)(6,U,2,0,"p",5)(7,B,2,0,"p",4)(8,Z,16,0,"div",6)),e&2&&(yb(),tv("query",a.rowFilter.query()),yb(3),pT(a.deletion.error()?4:-1),yb(),pT(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,Ci,P,M],styles:['.auth-settings__new[_ngcontent-%COMP%]{white-space:nowrap;padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600}.auth-settings__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.auth-settings__error[_ngcontent-%COMP%]{margin:0 0 .75rem;color:var(--color-error)}.auth-settings__table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.auth-settings__name[_ngcontent-%COMP%]{font-weight:500}.auth-settings__type[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.auth-settings__tags[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.auth-settings__actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:4px;white-space:nowrap}.auth-settings__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.auth-settings__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.auth-settings__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.auth-settings__actions[_ngcontent-%COMP%] .auth-settings__delete[_ngcontent-%COMP%]{color:var(--color-error)}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}']})};export{z as AuthSettingsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-CHWXfthx.js';import {u as s,o as Vi,r as qe,s as gi}from'./chunk-DPHJH2Hu.js';import {p,$ as $t,f as It,F as Me,a7 as De,d as ie$1,a8 as Ae,aE as gw,aA as j,U,D as Df,ak as mc,al as R$,M as Mi,z as za,r as r_,b as bf,h as hT,q as gv,y as yb,I as Iv,a as pT,ae as pw,af as Wn,a3 as _,aT as kM,au as v_,K as dc,am as Jy,an as PT,O as tv,av as E_,g as g_,N as NT,ar as Cv,k as bT,o as ig,s as sg,ao as I_}from'./main-5ZHT6SOL.js';function ne(n,t){n&1&&(za(0,"span",4),r_(1,"SKILL.md"),bf());}function ie(n,t){if(n&1&&(za(0,"span",5),r_(1),bf()),n&2){let e=NT();yb(),Iv(e.skill().description);}}function ae(n,t){if(n&1&&(za(0,"span",6),r_(1),bf()),n&2){let e=NT();yb(),Cv(" ",e.resourceCount()," ",e.resourceCount()===1?"resource":"resources"," ");}}function oe(n,t){if(n&1&&(za(0,"span",6),r_(1),bf()),n&2){let e=NT();yb(),Cv(" named by ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," ");}}function le(n,t){if(n&1&&r_(0),n&2){let e=NT(2);Cv(" Delete? ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," would be left naming it. ");}}function re(n,t){n&1&&r_(0," Delete? ");}function se(n,t){if(n&1){let e=bT();za(0,"span",9),hT(1,le,1,2)(2,re,1,0),bf(),za(3,"ds-icon-button",10),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteConfirmed())}),bf(),za(4,"ds-icon-button",11),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteCancelled())}),bf();}if(n&2){let e=NT();yb(),pT(e.namedByAgents()>0?1:2);}}function me(n,t){if(n&1){let e=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(a){ig(e);let g=NT();return sg(g.onMenuAction(a))}),bf();}if(n&2){let e=NT();tv("items",e.isImmutable()?e.readOnlyMenuItems:e.menuItems);}}var w=class n{router=p(It);skill=mc.required();namespaceId=mc(void 0);platformMode=mc(false);readOnly=mc(false);namedByAgents=mc(0);deleteRequested=R$();pendingDelete=ie$1(false);isImmutable=Mi(()=>this.readOnly()||this.skill().readOnly===true);resourceCount=Mi(()=>Object.keys(this.skill().resources??{}).length);menuItems=[{key:"inspect",label:"View skill",icon:"search"},{key:"edit",label:"Edit skill",icon:"edit"},{key:"delete",label:"Delete skill",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"View skill",icon:"search"}];onMenuAction(t){switch(t){case "inspect":this.router.navigate(this.route("inspect"));break;case "edit":this.router.navigate(this.route("edit"));break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.skill());}onDeleteCancelled(){this.pendingDelete.set(false);}route(t){let e=this.skill().id??"";return this.platformMode()?["/agentos","admin","skills",e,t]:["/agentos",this.namespaceId()??"","skills",e,t]}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Df({type:n,selectors:[["agentos-skill-item"]],inputs:{skill:[1,"skill"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"],namedByAgents:[1,"namedByAgents"]},outputs:{deleteRequested:"deleteRequested"},decls:12,vars:8,consts:[["role","listitem",1,"skill-item"],[1,"skill-item__body"],[1,"skill-item__name-row"],[1,"skill-item__name"],["data-variant","neutral","aria-label","Skill defined by a SKILL.md file, read-only through the API",1,"skill-item__badge"],[1,"skill-item__description"],[1,"skill-item__meta"],[1,"skill-item__actions"],[3,"items"],[1,"skill-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),bf(),hT(5,ne,2,0,"span",4),bf(),hT(6,ie,2,1,"span",5),hT(7,ae,2,2,"span",6),hT(8,oe,2,2,"span",6),bf(),za(9,"div",7),hT(10,se,5,1)(11,me,1,1,"ds-kebab-menu",8),bf()()),e&2&&(gv("skill-item--pending-delete",i.pendingDelete()),yb(4),Iv(i.skill().name),yb(),pT(i.skill().readOnly?5:-1),yb(),pT(i.skill().description?6:-1),yb(),pT(i.resourceCount()>0?7:-1),yb(),pT(i.namedByAgents()>0?8:-1),yb(2),pT(i.pendingDelete()?10:11));},dependencies:[Vi,qe],styles:[".skill-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.skill-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.skill-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.skill-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.skill-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:none;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.skill-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73);background:transparent}.skill-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__meta[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-tertiary, #8e8e93)}.skill-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.skill-item[_ngcontent-%COMP%]:hover .skill-item__actions[_ngcontent-%COMP%], .skill-item[_ngcontent-%COMP%]:focus-within .skill-item__actions[_ngcontent-%COMP%], .skill-item--pending-delete[_ngcontent-%COMP%] .skill-item__actions[_ngcontent-%COMP%]{opacity:1}.skill-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};var de=()=>[];function ce(n,t){if(n&1&&(za(0,"p",1),r_(1),bf()),n&2){let e=NT();yb(),Iv(e.errorMessage());}}function pe(n,t){if(n&1){let e=bT();za(0,"agentos-skill-item",5),dc("deleteRequested",function(a){ig(e);let g=NT(2);return sg(g.deleteSkill(a))}),bf();}if(n&2){let e=t,i=NT().$implicit,a=NT();tv("skill",e)("namespaceId",a.namespaceId)("readOnly",a.isPlatformSkill(i.id))("namedByAgents",a.namedByAgents(e));}}function ue(n,t){if(n&1&&hT(0,pe,1,4,"agentos-skill-item",4),n&2){let e,i=t.$implicit,a=NT();pT((e=a.resolveSkill(i.id))?0:-1,e);}}var ge="platform",_e="namespace",Y=class n{route=p($t);router=p(It);destroyRef=p(Me);skillState=p(o);agentState=p(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new De(void 0);isLoading=ie$1(true);errorMessage=ie$1(null);allSkills$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),pw({platform:this.skillState.listPlatform().pipe(Wn(()=>_([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:pw({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(Wn(()=>_([])))}).pipe(j(({namespace:t,platform:e})=>[...t,...e]),Wn(()=>_([])))}))),gw({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(j(({platform:t,namespace:e})=>[...t.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:ge,groupLabel:"Platform (read-only)"})),...e.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:_e,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e,agents:i})=>{this.platformSkillsById=new Map(t.map(a=>[a.id??"",a])),this.namespaceSkillsById=new Map(e.map(a=>[a.id??"",a])),this.namedByAgentsByName=this.countNamedBy([...t,...e],i),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(t,e){let i=new Map;for(let a$1 of t){let g=e.filter(Z=>a(Z.skillSelectors,a$1.name)==="named").length;g>0&&i.set(a$1.name.toLowerCase(),g);}return i}namedByAgents(t){return this.namedByAgentsByName.get(t.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(t){this.errorMessage.set(null),this.skillState.delete(t.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:e=>this.errorMessage.set(e.status===400?`"${t.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${t.name}" failed.`)});}resolveSkill(t){return this.platformSkillsById.get(t)??this.namespaceSkillsById.get(t)??null}isPlatformSkill(t){return this.platformSkillsById.has(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Df({type:n,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(e,i){if(e&1&&(hT(0,ce,2,1,"p",1),za(1,"ds-entity-list",2),v_(2,"async"),dc("createRequested",function(){return i.openCreateForm()}),za(3,"button",3),dc("click",function(){return i.goBack()}),r_(4,"\u2190 Namespaces"),bf()(),Jy(5,ue,1,1,"ng-template",null,0,I_)),e&2){let a=PT(6);pT(i.errorMessage()?0:-1),yb(),tv("items",E_(2,5,i.skillItems$)??g_(7,de))("loading",i.isLoading())("showCreate",true)("itemTemplate",a);}},dependencies:[gi,w,kM],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{Y as NamespaceSkillsComponent};
|
|
1
|
+
import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-C-tDaEcF.js';import {u as s,o as Vi,r as qe,s as gi}from'./chunk-IedWKNs9.js';import {p,$ as $t,f as It,F as Me,a7 as De,d as ie$1,a8 as Ae,aE as gw,aA as j,U,D as Df,ak as mc,al as R$,M as Mi,z as za,r as r_,b as bf,h as hT,q as gv,y as yb,I as Iv,a as pT,ae as pw,af as Wn,a3 as _,aT as kM,au as v_,K as dc,am as Jy,an as PT,O as tv,av as E_,g as g_,N as NT,ar as Cv,k as bT,o as ig,s as sg,ao as I_}from'./main-HYOTHQER.js';function ne(n,t){n&1&&(za(0,"span",4),r_(1,"SKILL.md"),bf());}function ie(n,t){if(n&1&&(za(0,"span",5),r_(1),bf()),n&2){let e=NT();yb(),Iv(e.skill().description);}}function ae(n,t){if(n&1&&(za(0,"span",6),r_(1),bf()),n&2){let e=NT();yb(),Cv(" ",e.resourceCount()," ",e.resourceCount()===1?"resource":"resources"," ");}}function oe(n,t){if(n&1&&(za(0,"span",6),r_(1),bf()),n&2){let e=NT();yb(),Cv(" named by ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," ");}}function le(n,t){if(n&1&&r_(0),n&2){let e=NT(2);Cv(" Delete? ",e.namedByAgents()," ",e.namedByAgents()===1?"agent":"agents"," would be left naming it. ");}}function re(n,t){n&1&&r_(0," Delete? ");}function se(n,t){if(n&1){let e=bT();za(0,"span",9),hT(1,le,1,2)(2,re,1,0),bf(),za(3,"ds-icon-button",10),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteConfirmed())}),bf(),za(4,"ds-icon-button",11),dc("action",function(){ig(e);let a=NT();return sg(a.onDeleteCancelled())}),bf();}if(n&2){let e=NT();yb(),pT(e.namedByAgents()>0?1:2);}}function me(n,t){if(n&1){let e=bT();za(0,"ds-kebab-menu",12),dc("itemSelected",function(a){ig(e);let g=NT();return sg(g.onMenuAction(a))}),bf();}if(n&2){let e=NT();tv("items",e.isImmutable()?e.readOnlyMenuItems:e.menuItems);}}var w=class n{router=p(It);skill=mc.required();namespaceId=mc(void 0);platformMode=mc(false);readOnly=mc(false);namedByAgents=mc(0);deleteRequested=R$();pendingDelete=ie$1(false);isImmutable=Mi(()=>this.readOnly()||this.skill().readOnly===true);resourceCount=Mi(()=>Object.keys(this.skill().resources??{}).length);menuItems=[{key:"inspect",label:"View skill",icon:"search"},{key:"edit",label:"Edit skill",icon:"edit"},{key:"delete",label:"Delete skill",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"View skill",icon:"search"}];onMenuAction(t){switch(t){case "inspect":this.router.navigate(this.route("inspect"));break;case "edit":this.router.navigate(this.route("edit"));break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.skill());}onDeleteCancelled(){this.pendingDelete.set(false);}route(t){let e=this.skill().id??"";return this.platformMode()?["/agentos","admin","skills",e,t]:["/agentos",this.namespaceId()??"","skills",e,t]}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Df({type:n,selectors:[["agentos-skill-item"]],inputs:{skill:[1,"skill"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"],namedByAgents:[1,"namedByAgents"]},outputs:{deleteRequested:"deleteRequested"},decls:12,vars:8,consts:[["role","listitem",1,"skill-item"],[1,"skill-item__body"],[1,"skill-item__name-row"],[1,"skill-item__name"],["data-variant","neutral","aria-label","Skill defined by a SKILL.md file, read-only through the API",1,"skill-item__badge"],[1,"skill-item__description"],[1,"skill-item__meta"],[1,"skill-item__actions"],[3,"items"],[1,"skill-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(za(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),r_(4),bf(),hT(5,ne,2,0,"span",4),bf(),hT(6,ie,2,1,"span",5),hT(7,ae,2,2,"span",6),hT(8,oe,2,2,"span",6),bf(),za(9,"div",7),hT(10,se,5,1)(11,me,1,1,"ds-kebab-menu",8),bf()()),e&2&&(gv("skill-item--pending-delete",i.pendingDelete()),yb(4),Iv(i.skill().name),yb(),pT(i.skill().readOnly?5:-1),yb(),pT(i.skill().description?6:-1),yb(),pT(i.resourceCount()>0?7:-1),yb(),pT(i.namedByAgents()>0?8:-1),yb(2),pT(i.pendingDelete()?10:11));},dependencies:[Vi,qe],styles:[".skill-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.skill-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.skill-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.skill-item__name-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.skill-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:none;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.skill-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider, rgba(0, 0, 0, .12));color:var(--color-neutral-600, #6e6e73);background:transparent}.skill-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.skill-item__meta[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-tertiary, #8e8e93)}.skill-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.skill-item[_ngcontent-%COMP%]:hover .skill-item__actions[_ngcontent-%COMP%], .skill-item[_ngcontent-%COMP%]:focus-within .skill-item__actions[_ngcontent-%COMP%], .skill-item--pending-delete[_ngcontent-%COMP%] .skill-item__actions[_ngcontent-%COMP%]{opacity:1}.skill-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};var de=()=>[];function ce(n,t){if(n&1&&(za(0,"p",1),r_(1),bf()),n&2){let e=NT();yb(),Iv(e.errorMessage());}}function pe(n,t){if(n&1){let e=bT();za(0,"agentos-skill-item",5),dc("deleteRequested",function(a){ig(e);let g=NT(2);return sg(g.deleteSkill(a))}),bf();}if(n&2){let e=t,i=NT().$implicit,a=NT();tv("skill",e)("namespaceId",a.namespaceId)("readOnly",a.isPlatformSkill(i.id))("namedByAgents",a.namedByAgents(e));}}function ue(n,t){if(n&1&&hT(0,pe,1,4,"agentos-skill-item",4),n&2){let e,i=t.$implicit,a=NT();pT((e=a.resolveSkill(i.id))?0:-1,e);}}var ge="platform",_e="namespace",Y=class n{route=p($t);router=p(It);destroyRef=p(Me);skillState=p(o);agentState=p(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new De(void 0);isLoading=ie$1(true);errorMessage=ie$1(null);allSkills$=this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),pw({platform:this.skillState.listPlatform().pipe(Wn(()=>_([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:pw({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(Wn(()=>_([])))}).pipe(j(({namespace:t,platform:e})=>[...t,...e]),Wn(()=>_([])))}))),gw({bufferSize:1,refCount:true}));skillItems$=this.allSkills$.pipe(j(({platform:t,namespace:e})=>[...t.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:ge,groupLabel:"Platform (read-only)"})),...e.map(i=>({id:i.id??"",name:i.name,description:i.description,groupKey:_e,groupLabel:"Namespace"}))]));namespaceSkillsById=new Map;platformSkillsById=new Map;namedByAgentsByName=new Map;constructor(){this.allSkills$.pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e,agents:i})=>{this.platformSkillsById=new Map(t.map(a=>[a.id??"",a])),this.namespaceSkillsById=new Map(e.map(a=>[a.id??"",a])),this.namedByAgentsByName=this.countNamedBy([...t,...e],i),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}countNamedBy(t,e){let i=new Map;for(let a$1 of t){let g=e.filter(Z=>a(Z.skillSelectors,a$1.name)==="named").length;g>0&&i.set(a$1.name.toLowerCase(),g);}return i}namedByAgents(t){return this.namedByAgentsByName.get(t.name.toLowerCase())??0}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}deleteSkill(t){this.errorMessage.set(null),this.skillState.delete(t.id??"").pipe(U(this.destroyRef)).subscribe({next:()=>this.refresh$.next(),error:e=>this.errorMessage.set(e.status===400?`"${t.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${t.name}" failed.`)});}resolveSkill(t){return this.platformSkillsById.get(t)??this.namespaceSkillsById.get(t)??null}isPlatformSkill(t){return this.platformSkillsById.has(t)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Df({type:n,selectors:[["agentos-namespace-skills"]],decls:7,vars:8,consts:[["skillItemTpl",""],["role","alert",1,"namespace-skills__error"],["title","Skills","emptyMessage","No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path.","cardMinWidth","400px",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-skills__back",3,"click"],[3,"skill","namespaceId","readOnly","namedByAgents"],[3,"deleteRequested","skill","namespaceId","readOnly","namedByAgents"]],template:function(e,i){if(e&1&&(hT(0,ce,2,1,"p",1),za(1,"ds-entity-list",2),v_(2,"async"),dc("createRequested",function(){return i.openCreateForm()}),za(3,"button",3),dc("click",function(){return i.goBack()}),r_(4,"\u2190 Namespaces"),bf()(),Jy(5,ue,1,1,"ng-template",null,0,I_)),e&2){let a=PT(6);pT(i.errorMessage()?0:-1),yb(),tv("items",E_(2,5,i.skillItems$)??g_(7,de))("loading",i.isLoading())("showCreate",true)("itemTemplate",a);}},dependencies:[gi,w,kM],styles:[".namespace-skills__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-skills__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-skills__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error, var(--red, #dc2626))}"]})};export{Y as NamespaceSkillsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i,O,h as vi,x as xi,P,M}from'./chunk-DPHJH2Hu.js';import {p,f as It,F as Me,aj as k,a7 as De,d as ie,a8 as Ae,U as U$1,D as Df,z as za,K as dc,b as bf,r as r_,h as hT,y as yb,O as tv,a as pT,N as NT,I as Iv,e as yT,v as vT,k as bT,u as uc,o as ig,s as sg}from'./main-5ZHT6SOL.js';var $=(n,e)=>e.id??e.name;function V(n,e){if(n&1&&(za(0,"p",3),r_(1),bf()),n&2){let t=NT();yb(),Iv(t.deletion.error());}}function N(n,e){n&1&&(za(0,"p",4),r_(1,"Loading AI providers\u2026"),bf());}function z(n,e){n&1&&(za(0,"p",5),r_(1,"No platform AI providers defined yet."),bf());}function j(n,e){n&1&&(za(0,"p",4),r_(1,"No AI providers match the current filter."),bf());}function U(n,e){if(n&1){let t=bT();za(0,"button",19),dc("click",function(){ig(t);let d=NT().$implicit,c=NT(2);return sg(c.edit(d))}),r_(1," Edit "),bf();}if(n&2){let t=NT().$implicit;uc("aria-label","Edit "+t.name);}}function B(n,e){if(n&1){let t=bT();za(0,"agentos-row-delete-action",20),dc("deleteRequested",function(){ig(t);let d=NT().$implicit,c=NT(2);return sg(c.deletion.request(d.id))})("deleteConfirmed",function(){ig(t);let d=NT().$implicit,c=NT(2);return sg(c.confirmDelete(d))})("deleteCancelled",function(){ig(t);let d=NT(3);return sg(d.deletion.cancel())}),bf();}if(n&2){let t=NT().$implicit,r=NT(2);tv("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function K(n,e){if(n&1&&(za(0,"tr",9)(1,"td",12),r_(2),bf(),za(3,"td",13),r_(4),bf(),za(5,"td",14),r_(6),bf(),za(7,"td",15)(8,"div",16),hT(9,U,2,1,"button",17),hT(10,B,1,3,"agentos-row-delete-action",18),bf()()()),n&2){let t=e.$implicit,r=NT(2);yb(2),Iv(t.name),yb(2),Iv(t.apiType),yb(2),Iv(t.baseUrl||"\u2014"),yb(3),pT(r.deletion.confirmingId()!==t.id?9:-1),yb(),pT(t.id?10:-1);}}function H(n,e){if(n&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),bf(),za(6,"th",10),r_(7,"API type"),bf(),za(8,"th",10),r_(9,"Base URL"),bf(),za(10,"th",10)(11,"span",11),r_(12,"Actions"),bf()()()(),za(13,"tbody",8),yT(14,K,11,5,"tr",9,$),bf()()()),n&2){let t=NT();yb(14),vT(t.rowFilter.filteredRows());}}var q=class n{router=p(It);destroyRef=p(Me);aiProviderController=p(k);refresh$=new De(void 0);isLoading=ie(true);deletion=i();providers=ie([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Df({type:n,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(c){return r.rowFilter.query.set(c)}),bf(),za(2,"button",2),dc("click",function(){return r.openCreateForm()}),r_(3,"New AI provider"),bf()(),hT(4,V,2,1,"p",3),hT(5,N,2,0,"p",4)(6,z,2,0,"p",5)(7,j,2,0,"p",4)(8,H,16,0,"div",6)),t&2&&(yb(),tv("query",r.rowFilter.query()),yb(3),pT(r.deletion.error()?4:-1),yb(),pT(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,P,M],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{q as PlatformAiProvidersComponent};
|
|
1
|
+
import {i,O,h as vi,x as xi,P,M}from'./chunk-IedWKNs9.js';import {p,f as It,F as Me,aj as k,a7 as De,d as ie,a8 as Ae,U as U$1,D as Df,z as za,K as dc,b as bf,r as r_,h as hT,y as yb,O as tv,a as pT,N as NT,I as Iv,e as yT,v as vT,k as bT,u as uc,o as ig,s as sg}from'./main-HYOTHQER.js';var $=(n,e)=>e.id??e.name;function V(n,e){if(n&1&&(za(0,"p",3),r_(1),bf()),n&2){let t=NT();yb(),Iv(t.deletion.error());}}function N(n,e){n&1&&(za(0,"p",4),r_(1,"Loading AI providers\u2026"),bf());}function z(n,e){n&1&&(za(0,"p",5),r_(1,"No platform AI providers defined yet."),bf());}function j(n,e){n&1&&(za(0,"p",4),r_(1,"No AI providers match the current filter."),bf());}function U(n,e){if(n&1){let t=bT();za(0,"button",19),dc("click",function(){ig(t);let d=NT().$implicit,c=NT(2);return sg(c.edit(d))}),r_(1," Edit "),bf();}if(n&2){let t=NT().$implicit;uc("aria-label","Edit "+t.name);}}function B(n,e){if(n&1){let t=bT();za(0,"agentos-row-delete-action",20),dc("deleteRequested",function(){ig(t);let d=NT().$implicit,c=NT(2);return sg(c.deletion.request(d.id))})("deleteConfirmed",function(){ig(t);let d=NT().$implicit,c=NT(2);return sg(c.confirmDelete(d))})("deleteCancelled",function(){ig(t);let d=NT(3);return sg(d.deletion.cancel())}),bf();}if(n&2){let t=NT().$implicit,r=NT(2);tv("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function K(n,e){if(n&1&&(za(0,"tr",9)(1,"td",12),r_(2),bf(),za(3,"td",13),r_(4),bf(),za(5,"td",14),r_(6),bf(),za(7,"td",15)(8,"div",16),hT(9,U,2,1,"button",17),hT(10,B,1,3,"agentos-row-delete-action",18),bf()()()),n&2){let t=e.$implicit,r=NT(2);yb(2),Iv(t.name),yb(2),Iv(t.apiType),yb(2),Iv(t.baseUrl||"\u2014"),yb(3),pT(r.deletion.confirmingId()!==t.id?9:-1),yb(),pT(t.id?10:-1);}}function H(n,e){if(n&1&&(za(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),r_(5,"Name"),bf(),za(6,"th",10),r_(7,"API type"),bf(),za(8,"th",10),r_(9,"Base URL"),bf(),za(10,"th",10)(11,"span",11),r_(12,"Actions"),bf()()()(),za(13,"tbody",8),yT(14,K,11,5,"tr",9,$),bf()()()),n&2){let t=NT();yb(14),vT(t.rowFilter.filteredRows());}}var q=class n{router=p(It);destroyRef=p(Me);aiProviderController=p(k);refresh$=new De(void 0);isLoading=ie(true);deletion=i();providers=ie([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ae(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=Df({type:n,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["type","button",1,"settings-table__new",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(za(0,"ds-section-header",0)(1,"agentos-table-filter",1),dc("queryChange",function(c){return r.rowFilter.query.set(c)}),bf(),za(2,"button",2),dc("click",function(){return r.openCreateForm()}),r_(3,"New AI provider"),bf()(),hT(4,V,2,1,"p",3),hT(5,N,2,0,"p",4)(6,z,2,0,"p",5)(7,j,2,0,"p",4)(8,H,16,0,"div",6)),t&2&&(yb(),tv("query",r.rowFilter.query()),yb(3),pT(r.deletion.error()?4:-1),yb(),pT(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[vi,xi,P,M],styles:['.settings-table__new[_ngcontent-%COMP%]{padding:7px 12px;border:1px solid var(--color-accent);border-radius:0;background:var(--color-accent);color:var(--color-bg);cursor:pointer;font-family:var(--font-heading);font-size:14px;font-weight:600;white-space:nowrap}.settings-table__new[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}.settings-table__toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 1rem}.settings-table__toolbar[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{margin:0;flex:0 1 240px;min-width:80px}.settings-table__toolbar[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-left:auto}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:0 1 240px;min-width:80px}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{margin-left:0;white-space:nowrap}.settings-table__status[_ngcontent-%COMP%]{margin:20px 8px;color:var(--color-text-secondary)}.settings-table__error[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:.875rem;color:var(--color-error)}.settings-table__wrap[_ngcontent-%COMP%]{overflow-x:auto}table.ds-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;font-size:14px}table.ds-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid var(--color-divider);color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-align:left;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:7px;border-bottom:1px solid color-mix(in srgb,var(--color-text) 8%,transparent)}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.settings-table__name[_ngcontent-%COMP%]{font-weight:500}.settings-table__secondary[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.settings-table__stacked[_ngcontent-%COMP%]{display:block}.settings-table__tags[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.settings-table__actions[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:4px;white-space:nowrap}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{padding:4px 7px;border:1px solid transparent;background:transparent;color:var(--color-accent);cursor:pointer;font:inherit}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-100)}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:1px}.settings-table__actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:disabled{color:var(--color-neutral-600);cursor:default}.settings-table__actions[_ngcontent-%COMP%] .settings-table__delete[_ngcontent-%COMP%]{color:var(--color-error)}@media(max-width:760px){.settings-table__toolbar[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;gap:12px}.settings-table__toolbar-actions[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch;width:100%;margin-left:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] agentos-table-filter[_ngcontent-%COMP%]{flex:none;width:100%;min-width:0}.settings-table__toolbar-actions[_ngcontent-%COMP%] .settings-table__new[_ngcontent-%COMP%]{width:100%;min-height:44px}}@media(max-width:760px){table.ds-table[_ngcontent-%COMP%]{position:relative;display:block;width:100%}table.ds-table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding-top:12px}table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%], table.ds-table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{display:flex;flex-direction:column;padding:12px;background:var(--color-surface);border:1px solid var(--color-divider)}table.ds-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(88px,30%) minmax(0,1fr);align-items:baseline;gap:4px 12px;padding:5px 0;border-bottom:0;overflow-wrap:anywhere;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-label][_ngcontent-%COMP%]:before{content:attr(data-label);content:attr(data-label) / "";color:var(--color-neutral-600);font-size:11px;letter-spacing:.08em;text-transform:uppercase}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]{display:block;margin-bottom:4px;padding:0 0 6px;border-bottom:0;font-size:15px}table.ds-table[_ngcontent-%COMP%] td[data-title][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px;margin-top:6px;padding:10px 0 0;border-top:1px solid var(--color-divider);text-align:right}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%]:before{display:none}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] .settings-table__actions[_ngcontent-%COMP%]{flex-wrap:wrap;width:100%;white-space:normal}table.ds-table[_ngcontent-%COMP%] td[data-actions][_ngcontent-%COMP%] button[_ngcontent-%COMP%]{min-width:44px;min-height:44px;padding:0 12px}}.settings-table__confirm-label[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:13px}.sr-only[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}']})};export{q as PlatformAiProvidersComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-CKtPMfms.js';import {R,q,J}from'./chunk-rY_JS-5f.js';import {p,$ as $t,f as It,F as Me,d as ie,a2 as F,M as Mi,j as Sg,U,J as x,H as w,D as Df,z as za,K as dc,r as r_,b as bf,h as hT,y as yb,I as Iv,a as pT,k as bT,e as yT,a5 as mT,L as sS,l as lc,N as NT,O as tv,Q as cS,v as vT,A as Af,a4 as dT,o as ig,s as sg,m as WT,u as uc}from'./main-5ZHT6SOL.js';import {v as vt,a as ve,$,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,e as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-DPHJH2Hu.js';import'./chunk-CTVzARpj.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),bf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),bf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),bf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),bf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),bf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),bf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),bf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),bf(),hT(4,ge,2,9),bf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Af(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),bf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),bf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),bf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),bf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),bf(),sS(),bf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),bf()(),lc(15,"input",15),sS(),bf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),bf(),lc(19,"input",17),sS(),bf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),bf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),bf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Af(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Df({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),bf(),r_(5," Auth Settings "),bf(),za(6,"h1",4),r_(7),bf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),bf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
1
|
+
import {v}from'./chunk-CWW2jfsJ.js';import {R,q,J}from'./chunk-DJpa3mrs.js';import {p,$ as $t,f as It,F as Me,d as ie,a2 as F,M as Mi,j as Sg,U,J as x,H as w,D as Df,z as za,K as dc,r as r_,b as bf,h as hT,y as yb,I as Iv,a as pT,k as bT,e as yT,a5 as mT,L as sS,l as lc,N as NT,O as tv,Q as cS,v as vT,A as Af,a4 as dT,o as ig,s as sg,m as WT,u as uc}from'./main-HYOTHQER.js';import {v as vt,a as ve,$,K as Kn,z as zn,Z as Zn,X as Xn,Y as Ye,c as bt,e as fn,L as Ln,W as Wn,b as pn,V as Vn}from'./chunk-IedWKNs9.js';import'./chunk-CBRg4AXS.js';function se(i,t){i&1&&(za(0,"p",5),r_(1,"Loading\u2026"),bf());}function ce(i,t){if(i&1&&(za(0,"label",23),lc(1,"input",24),sS(),za(2,"span"),r_(3),bf()()),i&2){let e=t.$implicit,o=NT(3);yb(),tv("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),cS(),yb(2),Iv(e.label);}}function de(i,t){if(i&1&&(za(0,"fieldset",8)(1,"legend",22),r_(2,"Configuration scope"),bf(),yT(3,ce,4,4,"label",23,dT().trackByScope,true),bf()),i&2){let e=NT(2);tv("disabled",e.isEditMode()),yb(3),vT(e.scopeOptions);}}function ue(i,t){if(i&1&&(za(0,"option",13),r_(1),bf()),i&2){let e=t.$implicit,o=NT(2);tv("value",e),yb(),Iv(o.authTypeLabel[e]);}}function pe(i,t){i&1&&r_(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(za(0,"span",11),r_(1,"*"),bf());}function me(i,t){if(i&1&&(za(0,"p",28),r_(1),bf()),i&2){let e=NT(2).$implicit;tv("id","as-hint-"+e.key),yb(),Iv(e.hint);}}function ge(i,t){if(i&1&&(lc(0,"input",27),sS(),hT(1,me,2,2,"p",28)),i&2){let e=NT().$implicit;WT("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),tv("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),uc("aria-describedby",e.hint?"as-hint-"+e.key:null),cS(),yb(),pT(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(za(0,"div",9)(1,"label",26),r_(2),hT(3,he,2,0,"span",11),bf(),hT(4,ge,2,9),bf()),i&2){let e,o=t.$implicit,l=NT(3);yb(),tv("for","as-cred-"+o.key),yb(),Af(" ",o.label," "),yb(),pT(o.required?3:-1),yb(),pT((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(za(0,"fieldset",18)(1,"legend",22),r_(2,"Credentials"),bf(),za(3,"p",25),r_(4," Values are stored encrypted and masked on read. "),hT(5,pe,1,0),bf(),yT(6,Ce,5,4,"div",9,dT().trackByField,true),bf()),i&2){let e=NT(2);yb(5),pT(e.isEditMode()?5:-1),yb(),vT(e.credentialFields());}}function ye(i,t){if(i&1){let e=bT();za(0,"form",7),dc("ngSubmit",function(){ig(e);let l=NT();return sg(l.submit())}),hT(1,de,5,1,"fieldset",8),za(2,"div",9)(3,"label",10),r_(4,"Auth type "),za(5,"span",11),r_(6,"*"),bf()(),za(7,"select",12),yT(8,ue,2,2,"option",13,mT),bf(),sS(),bf(),za(10,"div",9)(11,"label",14),r_(12,"Name "),za(13,"span",11),r_(14,"*"),bf()(),lc(15,"input",15),sS(),bf(),za(16,"div",9)(17,"label",16),r_(18,"Description"),bf(),lc(19,"input",17),sS(),bf(),hT(20,fe,8,1,"fieldset",18),za(21,"div",19)(22,"button",20),r_(23),bf(),za(24,"button",21),dc("click",function(){ig(e);let l=NT();return sg(l.cancel())}),r_(25,"Cancel"),bf()()();}if(i&2){let e=NT();tv("formGroup",e.form),yb(),pT(e.isPlatformMode?-1:1),yb(6),tv("formControl",e.authTypeControl),cS(),yb(),vT(e.authTypeOptions),yb(7),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(),pT(e.credentialFields().length>0?20:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Af(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=p($t);router=p(It);destroyRef=p(Me);state=p(R);namespaceRole=p(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?ie(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]});descriptionControl=new vt(null);authTypeControl=new vt("ApiKeyAuthSetting",{nonNullable:true,validators:[ve.required]});scopeControl=new vt("namespace",{nonNullable:true});form=new $({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new vt("",{nonNullable:true});usernameControl=new vt("",{nonNullable:true});passwordControl=new vt("",{nonNullable:true});tokenControl=new vt("",{nonNullable:true});discoveryUrlControl=new vt("",{nonNullable:true});authorizationUrlControl=new vt("",{nonNullable:true});tokenUrlControl=new vt("",{nonNullable:true});clientIdControl=new vt("",{nonNullable:true});clientSecretControl=new vt("",{nonNullable:true});scopesControl=new vt("",{nonNullable:true});resourceUrlControl=new vt("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=Mi(()=>Se[this.selectedAuthType()]);isEditMode=ie(false);isSubmitting=ie(false);isLoading=ie(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Sg(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Df({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(za(0,"div",0)(1,"header",1)(2,"button",2),dc("click",function(){return o.cancel()}),za(3,"span",3),r_(4,"\u2190"),bf(),r_(5," Auth Settings "),bf(),za(6,"h1",4),r_(7),bf()(),hT(8,se,2,0,"p",5)(9,ye,26,8,"form",6),bf()),e&2&&(yb(7),Iv(o.isEditMode()?"Edit auth setting":"New auth setting"),yb(),pT(o.isLoading()?8:9));},dependencies:[Kn,zn,Zn,Xn,Ye,bt,fn,Ln,Wn,pn,Vn],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
2
2
|
export{le as AuthSettingFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f,l,$,v as vt,a as ve,K as Kn,z as zn,Y as Ye,d as dn,L as Ln,W as Wn,q as qt,b as pn,V as Vn}from'./chunk-DPHJH2Hu.js';import {p,$ as $t,f as It,G,F as Me,M as Mi,d as ie$1,j as Sg,U,H as w,J as x,D as Df,z as za,r as r_,b as bf,h as hT,y as yb,I as Iv,a as pT,k as bT,K as dc,l as lc,L as sS,N as NT,O as tv,Q as cS,u as uc,A as Af,o as ig,s as sg}from'./main-5ZHT6SOL.js';var W=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function Y(r){return W.test(r)}function J(r=()=>true){return t=>{let e=(t.value??"").trim();return !r()||e===""||Y(e)?null:{absolutePath:true}}}function ee(r,t){r&1&&(za(0,"p",3),r_(1,"Loading\u2026"),bf());}function te(r,t){r&1&&r_(0," Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location. ");}function ne(r,t){r&1&&r_(0," Only a super-admin can change this folder. ");}function oe(r,t){r&1&&(za(0,"span",21),r_(1," Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty. "),bf());}function ae(r,t){r&1&&(za(0,"span",28),r_(1," Enter a whole number of at least 1, or leave the field empty. "),bf());}function re(r,t){if(r&1){let e=bT();za(0,"form",5),dc("ngSubmit",function(){ig(e);let f=NT();return sg(f.submit())}),za(1,"div",6)(2,"label",7),r_(3,"Name "),za(4,"span",8),r_(5,"*"),bf()(),lc(6,"input",9),sS(),bf(),za(7,"div",6)(8,"label",10),r_(9,"Description"),bf(),lc(10,"textarea",11),sS(),bf(),za(11,"div",6)(12,"label",12),r_(13,"External ID"),bf(),lc(14,"input",13),sS(),bf(),za(15,"div",6)(16,"label",14),r_(17,"Default agent"),bf(),lc(18,"input",15),sS(),bf(),za(19,"div",6)(20,"label",16),r_(21,"Config path"),bf(),lc(22,"input",17),sS(),bf(),za(23,"div",6)(24,"label",18),r_(25,"Shared files folder"),bf(),lc(26,"input",19),sS(),za(27,"span",20),hT(28,te,1,0)(29,ne,1,0),bf(),hT(30,oe,2,0,"span",21),bf(),za(31,"div",6)(32,"label",22),r_(33,"Run cost threshold"),bf(),lc(34,"input",23),sS(),za(35,"span",24),r_(36),bf()(),za(37,"div",6)(38,"label",25),r_(39,"Maximum tool rounds"),bf(),za(40,"input",26),dc("input",function(f){ig(e);let Q=NT();return sg(Q.onMaxToolRoundsInput(f))}),bf(),sS(),za(41,"span",27),r_(42," Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run. "),bf(),hT(43,ae,2,0,"span",28),bf(),za(44,"div",29)(45,"button",30),r_(46),bf(),za(47,"button",31),dc("click",function(){ig(e);let f=NT();return sg(f.cancel())}),r_(48,"Cancel"),bf()()();}if(r&2){let e=NT();tv("formGroup",e.form),yb(6),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(4),tv("formControl",e.externalIdControl),cS(),yb(4),tv("formControl",e.defaultAgentNameControl),cS(),yb(4),tv("formControl",e.configPathControl),cS(),yb(4),tv("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),uc("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),cS(),yb(2),pT(e.canEditSharedExchangePath()?28:29),yb(2),pT(e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?30:-1),yb(4),tv("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),cS(),yb(2),Iv(e.runCostThresholdHint()),yb(4),tv("formControl",e.maxToolRoundsControl),uc("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),cS(),yb(3),pT(e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?43:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Af(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ie=1,le=2147483647,K=class r{route=p($t);router=p(It);namespaceController=p(G);destroyRef=p(Me);usageConfiguration=p(f);userState=p(l);canEditSharedExchangePath=Mi(()=>this.userState.currentUser()?.isAdmin===true);runCostThresholdPlaceholder=Mi(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=Mi(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new $({name:new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]}),description:new vt("",{nonNullable:true}),configPath:new vt("",{nonNullable:true}),sharedExchangePath:new vt("",{nonNullable:true,validators:[J(()=>this.canEditSharedExchangePath())]}),externalId:new vt("",{nonNullable:true}),defaultAgentName:new vt("",{nonNullable:true}),runCostThreshold:new vt(null),maxToolRounds:new vt(null,{validators:[ve.min(ie),ve.max(le),ve.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=ie$1(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=ie$1(false);isSubmitting=ie$1(false);isLoading=ie$1(false);existingNamespace=null;constructor(){Sg(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Df({type:r,selectors:[["agentos-namespace-form"]],decls:6,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-shared-exchange-path",1,"namespace-form__label"],["id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",1,"namespace-form__input",3,"readOnly","formControl"],["id","ns-shared-exchange-path-hint",1,"namespace-form__hint"],["id","ns-shared-exchange-path-error","role","alert",1,"namespace-form__error"],["for","ns-run-cost-threshold",1,"namespace-form__label"],["id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",1,"namespace-form__input",3,"placeholder","formControl"],["id","ns-run-cost-threshold-hint",1,"namespace-form__hint"],["for","ns-max-tool-rounds",1,"namespace-form__label"],["id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",1,"namespace-form__input",3,"input","formControl"],["id","ns-max-tool-rounds-hint",1,"namespace-form__hint"],["id","ns-max-tool-rounds-error","role","alert",1,"namespace-form__error"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,h){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3),bf()(),hT(4,ee,2,0,"p",3)(5,re,49,19,"form",4),bf()),e&2&&(yb(3),Iv(h.isEditMode()?"Edit namespace":"New namespace"),yb(),pT(h.isLoading()?4:5));},dependencies:[Kn,zn,Ye,dn,Ln,Wn,qt,pn,Vn],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.namespace-form__input[_ngcontent-%COMP%], .namespace-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary)}.namespace-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #dc2626)}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{K as NamespaceFormComponent};
|
|
1
|
+
import {f,l,$,v as vt,a as ve,K as Kn,z as zn,Y as Ye,d as dn,L as Ln,W as Wn,q as qt,b as pn,V as Vn}from'./chunk-IedWKNs9.js';import {p,$ as $t,f as It,G,F as Me,M as Mi,d as ie$1,j as Sg,U,H as w,J as x,D as Df,z as za,r as r_,b as bf,h as hT,y as yb,I as Iv,a as pT,k as bT,K as dc,l as lc,L as sS,N as NT,O as tv,Q as cS,u as uc,A as Af,o as ig,s as sg}from'./main-HYOTHQER.js';var W=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function Y(r){return W.test(r)}function J(r=()=>true){return t=>{let e=(t.value??"").trim();return !r()||e===""||Y(e)?null:{absolutePath:true}}}function ee(r,t){r&1&&(za(0,"p",3),r_(1,"Loading\u2026"),bf());}function te(r,t){r&1&&r_(0," Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location. ");}function ne(r,t){r&1&&r_(0," Only a super-admin can change this folder. ");}function oe(r,t){r&1&&(za(0,"span",21),r_(1," Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty. "),bf());}function ae(r,t){r&1&&(za(0,"span",28),r_(1," Enter a whole number of at least 1, or leave the field empty. "),bf());}function re(r,t){if(r&1){let e=bT();za(0,"form",5),dc("ngSubmit",function(){ig(e);let f=NT();return sg(f.submit())}),za(1,"div",6)(2,"label",7),r_(3,"Name "),za(4,"span",8),r_(5,"*"),bf()(),lc(6,"input",9),sS(),bf(),za(7,"div",6)(8,"label",10),r_(9,"Description"),bf(),lc(10,"textarea",11),sS(),bf(),za(11,"div",6)(12,"label",12),r_(13,"External ID"),bf(),lc(14,"input",13),sS(),bf(),za(15,"div",6)(16,"label",14),r_(17,"Default agent"),bf(),lc(18,"input",15),sS(),bf(),za(19,"div",6)(20,"label",16),r_(21,"Config path"),bf(),lc(22,"input",17),sS(),bf(),za(23,"div",6)(24,"label",18),r_(25,"Shared files folder"),bf(),lc(26,"input",19),sS(),za(27,"span",20),hT(28,te,1,0)(29,ne,1,0),bf(),hT(30,oe,2,0,"span",21),bf(),za(31,"div",6)(32,"label",22),r_(33,"Run cost threshold"),bf(),lc(34,"input",23),sS(),za(35,"span",24),r_(36),bf()(),za(37,"div",6)(38,"label",25),r_(39,"Maximum tool rounds"),bf(),za(40,"input",26),dc("input",function(f){ig(e);let Q=NT();return sg(Q.onMaxToolRoundsInput(f))}),bf(),sS(),za(41,"span",27),r_(42," Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run. "),bf(),hT(43,ae,2,0,"span",28),bf(),za(44,"div",29)(45,"button",30),r_(46),bf(),za(47,"button",31),dc("click",function(){ig(e);let f=NT();return sg(f.cancel())}),r_(48,"Cancel"),bf()()();}if(r&2){let e=NT();tv("formGroup",e.form),yb(6),tv("formControl",e.nameControl),cS(),yb(4),tv("formControl",e.descriptionControl),cS(),yb(4),tv("formControl",e.externalIdControl),cS(),yb(4),tv("formControl",e.defaultAgentNameControl),cS(),yb(4),tv("formControl",e.configPathControl),cS(),yb(4),tv("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),uc("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),cS(),yb(2),pT(e.canEditSharedExchangePath()?28:29),yb(2),pT(e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?30:-1),yb(4),tv("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),cS(),yb(2),Iv(e.runCostThresholdHint()),yb(4),tv("formControl",e.maxToolRoundsControl),uc("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),cS(),yb(3),pT(e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?43:-1),yb(2),tv("disabled",e.form.invalid||e.isSubmitting()),yb(),Af(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ie=1,le=2147483647,K=class r{route=p($t);router=p(It);namespaceController=p(G);destroyRef=p(Me);usageConfiguration=p(f);userState=p(l);canEditSharedExchangePath=Mi(()=>this.userState.currentUser()?.isAdmin===true);runCostThresholdPlaceholder=Mi(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=Mi(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new $({name:new vt("",{nonNullable:true,validators:[ve.required,ve.minLength(1)]}),description:new vt("",{nonNullable:true}),configPath:new vt("",{nonNullable:true}),sharedExchangePath:new vt("",{nonNullable:true,validators:[J(()=>this.canEditSharedExchangePath())]}),externalId:new vt("",{nonNullable:true}),defaultAgentName:new vt("",{nonNullable:true}),runCostThreshold:new vt(null),maxToolRounds:new vt(null,{validators:[ve.min(ie),ve.max(le),ve.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=ie$1(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=ie$1(false);isSubmitting=ie$1(false);isLoading=ie$1(false);existingNamespace=null;constructor(){Sg(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=Df({type:r,selectors:[["agentos-namespace-form"]],decls:6,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-shared-exchange-path",1,"namespace-form__label"],["id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",1,"namespace-form__input",3,"readOnly","formControl"],["id","ns-shared-exchange-path-hint",1,"namespace-form__hint"],["id","ns-shared-exchange-path-error","role","alert",1,"namespace-form__error"],["for","ns-run-cost-threshold",1,"namespace-form__label"],["id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",1,"namespace-form__input",3,"placeholder","formControl"],["id","ns-run-cost-threshold-hint",1,"namespace-form__hint"],["for","ns-max-tool-rounds",1,"namespace-form__label"],["id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",1,"namespace-form__input",3,"input","formControl"],["id","ns-max-tool-rounds-hint",1,"namespace-form__hint"],["id","ns-max-tool-rounds-error","role","alert",1,"namespace-form__error"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,h){e&1&&(za(0,"div",0)(1,"header",1)(2,"h1",2),r_(3),bf()(),hT(4,ee,2,0,"p",3)(5,re,49,19,"form",4),bf()),e&2&&(yb(3),Iv(h.isEditMode()?"Edit namespace":"New namespace"),yb(),pT(h.isLoading()?4:5));},dependencies:[Kn,zn,Ye,dn,Ln,Wn,qt,pn,Vn],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.namespace-form__input[_ngcontent-%COMP%], .namespace-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__hint[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary)}.namespace-form__error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #dc2626)}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;transition:background .15s ease,border-color .15s ease}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{K as NamespaceFormComponent};
|