@whoz-oss/coday-client 1.1.3 → 1.1.5
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-E7Qgx1Py.js → chunk--Gzoztab.js} +1 -1
- package/browser/{chunk-PIndlztw.js → chunk-2AYsNAin.js} +1 -1
- package/browser/{chunk-C4OduJsK.js → chunk-6sWH0w7i.js} +1 -1
- package/browser/{chunk-B9tiwcGd.js → chunk-7ChKH_Xh.js} +1 -1
- package/browser/{chunk-kkUZnzqV.js → chunk-B0PruEb2.js} +1 -1
- package/browser/{chunk-aMSzn2bp.js → chunk-B9JMncej.js} +1 -1
- package/browser/{chunk-eerFYirH.js → chunk-B9XWwkAf.js} +1 -1
- package/browser/{chunk-BOODo6vl.js → chunk-BEpAVe9z.js} +1 -1
- package/browser/{chunk-B1e87EHV.js → chunk-BExjX33L.js} +1 -1
- package/browser/{chunk-B9o2w3JI.js → chunk-BOA9V0K7.js} +1 -1
- package/browser/{chunk-DqYAhU-z.js → chunk-BPYTrxrK.js} +1 -1
- package/browser/{chunk-CaKQArNh.js → chunk-BRWtLJSa.js} +1 -1
- package/browser/{chunk-Dv0QDJkQ.js → chunk-BW11TV9d.js} +1 -1
- package/browser/{chunk-CTGx3Jge.js → chunk-BXd72bu-.js} +1 -1
- package/browser/{chunk-BialWP1H.js → chunk-BXghgWIS.js} +1 -1
- package/browser/{chunk-BOyQUmLL.js → chunk-BYjxp6oV.js} +1 -1
- package/browser/{chunk-CHog9WTC.js → chunk-BesKQigE.js} +1 -1
- package/browser/{chunk-QeHqMQf7.js → chunk-Bl64TS1x.js} +1 -1
- package/browser/{chunk-C6SAWsWh.js → chunk-BmZO1mLq.js} +1 -1
- package/browser/{chunk-BvZq_CjM.js → chunk-BqZ0O3N9.js} +1 -1
- package/browser/{chunk-DxeVm4Qs.js → chunk-BrhgIAdz.js} +1 -1
- package/browser/{chunk-2wm-ymQ7.js → chunk-Bucs5HER.js} +1 -1
- package/browser/{chunk-DWQMxRwt.js → chunk-BwrrjXQW.js} +1 -1
- package/browser/{chunk-D0E73LzT.js → chunk-By5OzGd4.js} +1 -1
- package/browser/{chunk-DNUCFrvl.js → chunk-C1xmmMRX.js} +1 -1
- package/browser/{chunk-Dk-65uxm.js → chunk-C6plfGhZ.js} +1 -1
- package/browser/{chunk-Du2WwKpL.js → chunk-CHnP5DN-.js} +1 -1
- package/browser/{chunk-DxUTvYzz.js → chunk-CIVyP9hY.js} +1 -1
- package/browser/{chunk-BGG_4ZYf.js → chunk-CJYIqerW.js} +1 -1
- package/browser/{chunk-trVB7xYc.js → chunk-CK-KVYs_.js} +1 -1
- package/browser/{chunk-0cPoBixl.js → chunk-CWa1sXYe.js} +1 -1
- package/browser/{chunk-5NfwAOdQ.js → chunk-CWlncKpW.js} +1 -1
- package/browser/{chunk-BZpeyGNo.js → chunk-CdWOb2-_.js} +1 -1
- package/browser/{chunk-D79S__pD.js → chunk-ChUeFGJz.js} +1 -1
- package/browser/{chunk-DOyeSBTP.js → chunk-CiT0dfWf.js} +1 -1
- package/browser/{chunk-ChNa-tu7.js → chunk-CkH2ip5-.js} +1 -1
- package/browser/{chunk-BaYBlYlb.js → chunk-CokclFmu.js} +1 -1
- package/browser/{chunk-CFPAGufF.js → chunk-CxzLA2il.js} +1 -1
- package/browser/{chunk-DhG6eqs5.js → chunk-CzIfrMA5.js} +1 -1
- package/browser/{chunk-Cl3ZRrfW.js → chunk-D1lFAnUU.js} +1 -1
- package/browser/{chunk-DzuBpjGU.js → chunk-D7qZeLat.js} +1 -1
- package/browser/{chunk-BedM_GSi.js → chunk-D7tJOrhH.js} +1 -1
- package/browser/{chunk-CZrVPAwS.js → chunk-DDQLJIRS.js} +4 -4
- package/browser/{chunk-BIRDz36R.js → chunk-DFymy-jI.js} +1 -1
- package/browser/{chunk-D6rN_3EL.js → chunk-DLQPByHe.js} +1 -1
- package/browser/{chunk-C-OixNz-.js → chunk-DSXf0jbl.js} +1 -1
- package/browser/{chunk-CyYtRijQ.js → chunk-DVdIFywU.js} +1 -1
- package/browser/{chunk-B5KeDUKO.js → chunk-DWYfpB5Y.js} +1 -1
- package/browser/{chunk-O8HRrO0s.js → chunk-DXkZtva6.js} +1 -1
- package/browser/chunk-DbXjEO5o.js +1 -0
- package/browser/{chunk-ljtSZRGe.js → chunk-DbXxSJ1I.js} +1 -1
- package/browser/{chunk-BSSTOY6w.js → chunk-DhbFUPNS.js} +1 -1
- package/browser/{chunk-CE25GJ46.js → chunk-DjD5s922.js} +1 -1
- package/browser/{chunk-crDngsGJ.js → chunk-DoZuBPl_.js} +1 -1
- package/browser/{chunk-NESmEqs9.js → chunk-DypxtObi.js} +1 -1
- package/browser/{chunk-Cgy8z0ce.js → chunk-FknCbAmK.js} +1 -1
- package/browser/{chunk-BGjYQHAv.js → chunk-J4PHCJNc.js} +1 -1
- package/browser/{chunk-DXX7sA5a.js → chunk-MxK9wjLy.js} +1 -1
- package/browser/{chunk-D4Dqx_ip.js → chunk-MxxJir-m.js} +1 -1
- package/browser/{chunk-CfDM-x08.js → chunk-S53N7Jv7.js} +1 -1
- package/browser/{chunk-BBc1zBIH.js → chunk-YXhAzexX.js} +1 -1
- package/browser/{chunk-Clsi5w7v.js → chunk-af1_rQRU.js} +1 -1
- package/browser/{chunk-COPfOpTU.js → chunk-dULA3KZu.js} +1 -1
- package/browser/{chunk-M3D83Zfi.js → chunk-of7WeX5W.js} +1 -1
- package/browser/{chunk-Cz_UfOLH.js → chunk-utRLLCjN.js} +1 -1
- package/browser/{chunk-DEhiJkrz.js → chunk-wdkd9Gr0.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-XRUWKAYH.js → main-OWIJUFFO.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-f78wUAk6.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {R}from'./chunk-
|
|
1
|
+
import {R}from'./chunk-ChUeFGJz.js';import {c}from'./chunk-D7qZeLat.js';import {g,ao as V$1,G,w as we,H as Hi,m as mT,Q as By,a7 as ga,S as ha,b as U,A as Aw,v as vs,l as Ag,k as fl,af as Dg,T as TC,r as Tg,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-OWIJUFFO.js';import {W as Wn,S as Se}from'./chunk-CHnP5DN-.js';import'./chunk-D1lFAnUU.js';import'./chunk-BOA9V0K7.js';function V(i,e){if(i&1){let t=dC();vs(0,"agentos-scheduled-prompt-item",4),Ag("enableRequested",function(n){If(t);let s=mC(2);return wf(s.enablePrompt(n))})("disableRequested",function(n){If(t);let s=mC(2);return wf(s.disablePrompt(n))})("deleteRequested",function(n){If(t);let s=mC(2);return wf(s.deletePrompt(n))}),fl();}if(i&2){let t=mC().$implicit,o=mC();Tg("definition",e)("namespaceId",o.namespaceId)("readOnly",o.isPlatformPrompt(t.id));}}function k(i,e){if(i&1&&eC(0,V,1,3,"agentos-scheduled-prompt-item",3),i&2){let t,o=e.$implicit,n=mC();tC((t=n.resolvePrompt(o.id))?0:-1,t);}}var O="platform",B="namespace",M=class i{route=g(V$1);router=g(G);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;platformPrompts=Hi([]);namespacePrompts=Hi([]);promptItems=mT(()=>[...this.platformPrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:O,groupLabel:"Platform (read-only)",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})),...this.namespacePrompts().map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:B,groupLabel:"Namespace",badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]}))]);constructor(){By({platform:this.state.listPlatform().pipe(ga(()=>ha([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe(({platform:e,namespace:t})=>{this.platformPrompts.set(e),this.namespacePrompts.set(t);});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}enablePrompt(e){this.state.enable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t));}disablePrompt(e){this.state.disable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchNamespacePrompt(t));}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(U(this.destroyRef)).subscribe(()=>this.namespacePrompts.update(o=>o.filter(n=>n.id!==t)));}resolvePrompt(e){return this.platformPrompts().find(t=>t.id===e)??this.namespacePrompts().find(t=>t.id===e)??null}isPlatformPrompt(e){return this.platformPrompts().some(t=>t.id===e)}patchNamespacePrompt(e){this.namespacePrompts.update(t=>t.map(o=>o.id===e.id?e:o));}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-scheduled-prompt-list"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Scheduled Prompts","emptyMessage","No scheduled prompts yet. Create one to get started.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","namespaceId","readOnly"],[3,"enableRequested","disableRequested","deleteRequested","definition","namespaceId","readOnly"]],template:function(t,o){if(t&1&&(vs(0,"ds-entity-list",1),Ag("createRequested",function(){return o.openCreateForm()}),vs(1,"ds-icon-button",2),Ag("action",function(){return o.goBack()}),fl()(),Dg(2,k,1,1,"ng-template",null,0,fT)),t&2){let n=TC(3);Tg("items",o.promptItems())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,R,Se],encapsulation:2})};export{M as ScheduledPromptListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {K as Kn,Z as Zn,S as Se}from'./chunk-
|
|
1
|
+
import {K as Kn,Z as Zn,S as Se}from'./chunk-CHnP5DN-.js';import {ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,a5 as yl,t as tC,a9 as dC,l as Ag,ac as mC,r as Tg,aa as If,ab as wf}from'./main-OWIJUFFO.js';function A(o,a){if(o&1){let e=dC();vs(0,"span",7),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",8),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",9),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteCancelled())}),fl();}}function P(o,a){if(o&1){let e=dC();vs(0,"ds-kebab-menu",10),Ag("itemSelected",function(l){If(e);let O=mC();return wf(O.onMenuAction(l))}),fl();}if(o&2){let e=mC();Tg("items",e.menuItems);}}var I=class o{model=mB.required();namespaceId=mB(void 0);readOnly=mB(false);deleteRequested=gB();editRequested=gB();pendingDelete=Hi(false);menuItems=[{key:"edit",label:"Edit model",icon:"edit"},{key:"delete",label:"Delete model",icon:"delete",variant:"danger"}];get displayTitle(){return this.model().alias??this.model().apiModelName}onMenuAction(a){switch(a){case "edit":this.editRequested.emit(this.model());break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.model());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-ai-model-item"]],inputs:{model:[1,"model"],namespaceId:[1,"namespaceId"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested",editRequested:"editRequested"},decls:12,vars:4,consts:[["role","listitem","dsBlueprint","",1,"ai-model-item"],[1,"ai-model-item__body"],[1,"ai-model-item__name"],[1,"ai-model-item__api-name"],[1,"ai-model-item__params"],[1,"ai-model-item__actions"],[3,"items"],[1,"ai-model-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&&(vs(0,"div",0)(1,"div",1)(2,"span",2),WC(3),fl(),vs(4,"span",3),WC(5),fl(),vs(6,"span",4)(7,"span"),WC(8),fl()()(),vs(9,"div",5),eC(10,A,4,0)(11,P,1,1,"ds-kebab-menu",6),fl()()),e&2&&(XE(3),Zg(i.displayTitle),XE(2),Zg(i.model().apiModelName),XE(3),yl("priority: ",i.model().priority),XE(2),tC(i.pendingDelete()?10:i.readOnly()?-1:11));},dependencies:[Kn,Zn,Se],styles:[".ai-model-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.ai-model-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-model-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__api-name[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__params[_ngcontent-%COMP%]{display:flex;gap:.75rem;font-size:13px;color:var(--color-text-secondary)}.ai-model-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover .ai-model-item__actions[_ngcontent-%COMP%], .ai-model-item[_ngcontent-%COMP%]:focus-within .ai-model-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-model-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v,q,J}from'./chunk-2wm-ymQ7.js';import {v as v$1}from'./chunk-BvZq_CjM.js';import {g,ao as V,G,w as we,H as Hi,F,m as mT,cc as Hf,b as U,z as z$1,a as P$1,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,a9 as dC,q as oC,a4 as rC,a3 as HI,o as bg,ac as mC,r as Tg,a6 as $I,x as iC,a5 as yl,cG as Xw,aa as If,ab as wf,b_ as FC,C as Cg}from'./main-XRUWKAYH.js';import'./chunk-CZrVPAwS.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-B9o2w3JI.js';import'./chunk-f78wUAk6.js';import'./chunk-DhG6eqs5.js';import'./chunk-Du2WwKpL.js';import'./chunk-Cl3ZRrfW.js';function se(i,t){i&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ce(i,t){if(i&1&&(vs(0,"label",23),bg(1,"input",24),HI(),vs(2,"span"),WC(3),fl()()),i&2){let e=t.$implicit,o=mC(3);XE(),Tg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),$I(),XE(2),Zg(e.label);}}function de(i,t){if(i&1&&(vs(0,"fieldset",8)(1,"legend",22),WC(2,"Configuration scope"),fl(),oC(3,ce,4,4,"label",23,Xw().trackByScope,true),fl()),i&2){let e=mC(2);Tg("disabled",e.isEditMode()),XE(3),iC(e.scopeOptions);}}function ue(i,t){if(i&1&&(vs(0,"option",13),WC(1),fl()),i&2){let e=t.$implicit,o=mC(2);Tg("value",e),XE(),Zg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&WC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(vs(0,"span",11),WC(1,"*"),fl());}function me(i,t){if(i&1&&(vs(0,"p",28),WC(1),fl()),i&2){let e=mC(2).$implicit;Tg("id","as-hint-"+e.key),XE(),Zg(e.hint);}}function ge(i,t){if(i&1&&(bg(0,"input",27),HI(),eC(1,me,2,2,"p",28)),i&2){let e=mC().$implicit;FC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),Tg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Cg("aria-describedby",e.hint?"as-hint-"+e.key:null),$I(),XE(),tC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(vs(0,"div",9)(1,"label",26),WC(2),eC(3,he,2,0,"span",11),fl(),eC(4,ge,2,9),fl()),i&2){let e,o=t.$implicit,l=mC(3);XE(),Tg("for","as-cred-"+o.key),XE(),yl(" ",o.label," "),XE(),tC(o.required?3:-1),XE(),tC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(vs(0,"fieldset",18)(1,"legend",22),WC(2,"Credentials"),fl(),vs(3,"p",25),WC(4," Values are stored encrypted and masked on read. "),eC(5,pe,1,0),fl(),oC(6,Ce,5,4,"div",9,Xw().trackByField,true),fl()),i&2){let e=mC(2);XE(5),tC(e.isEditMode()?5:-1),XE(),iC(e.credentialFields());}}function ye(i,t){if(i&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let l=mC();return wf(l.submit())}),eC(1,de,5,1,"fieldset",8),vs(2,"div",9)(3,"label",10),WC(4,"Auth type "),vs(5,"span",11),WC(6,"*"),fl()(),vs(7,"select",12),oC(8,ue,2,2,"option",13,rC),fl(),HI(),fl(),vs(10,"div",9)(11,"label",14),WC(12,"Name "),vs(13,"span",11),WC(14,"*"),fl()(),bg(15,"input",15),HI(),fl(),vs(16,"div",9)(17,"label",16),WC(18,"Description"),fl(),bg(19,"input",17),HI(),fl(),eC(20,fe,8,1,"fieldset",18),vs(21,"div",19)(22,"button",20),WC(23),fl(),vs(24,"button",21),Ag("click",function(){If(e);let l=mC();return wf(l.cancel())}),WC(25,"Cancel"),fl()()();}if(i&2){let e=mC();Tg("formGroup",e.form),XE(),tC(e.isPlatformMode?-1:1),XE(6),Tg("formControl",e.authTypeControl),$I(),XE(),iC(e.authTypeOptions),XE(7),Tg("formControl",e.nameControl),$I(),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(),tC(e.credentialFields().length>0?20:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",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=g(V);router=g(G);destroyRef=g(we);state=g(v);namespaceRole=g(v$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Hi(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 _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{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 z$1(P$1({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return z$1(P$1({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return z$1(P$1({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return z$1(P$1({},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 z$1(P$1({},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 z$1(P$1({},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 z$1(P$1({},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=Aw({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&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return o.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5," Auth Settings "),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,se,2,0,"p",5)(9,ye,26,8,"form",6),fl()),e&2&&(XE(7),Zg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),tC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],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,q,J}from'./chunk-Bucs5HER.js';import {v as v$1}from'./chunk-BqZ0O3N9.js';import {g,ao as V,G,w as we,H as Hi,F,m as mT,cc as Hf,b as U,z as z$1,a as P$1,A as Aw,v as vs,l as Ag,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,a9 as dC,q as oC,a4 as rC,a3 as HI,o as bg,ac as mC,r as Tg,a6 as $I,x as iC,a5 as yl,cG as Xw,aa as If,ab as wf,b_ as FC,C as Cg}from'./main-OWIJUFFO.js';import'./chunk-DDQLJIRS.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-BOA9V0K7.js';import'./chunk-DbXjEO5o.js';import'./chunk-CzIfrMA5.js';import'./chunk-CHnP5DN-.js';import'./chunk-D1lFAnUU.js';function se(i,t){i&1&&(vs(0,"p",5),WC(1,"Loading\u2026"),fl());}function ce(i,t){if(i&1&&(vs(0,"label",23),bg(1,"input",24),HI(),vs(2,"span"),WC(3),fl()()),i&2){let e=t.$implicit,o=mC(3);XE(),Tg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),$I(),XE(2),Zg(e.label);}}function de(i,t){if(i&1&&(vs(0,"fieldset",8)(1,"legend",22),WC(2,"Configuration scope"),fl(),oC(3,ce,4,4,"label",23,Xw().trackByScope,true),fl()),i&2){let e=mC(2);Tg("disabled",e.isEditMode()),XE(3),iC(e.scopeOptions);}}function ue(i,t){if(i&1&&(vs(0,"option",13),WC(1),fl()),i&2){let e=t.$implicit,o=mC(2);Tg("value",e),XE(),Zg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&WC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(vs(0,"span",11),WC(1,"*"),fl());}function me(i,t){if(i&1&&(vs(0,"p",28),WC(1),fl()),i&2){let e=mC(2).$implicit;Tg("id","as-hint-"+e.key),XE(),Zg(e.hint);}}function ge(i,t){if(i&1&&(bg(0,"input",27),HI(),eC(1,me,2,2,"p",28)),i&2){let e=mC().$implicit;FC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),Tg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Cg("aria-describedby",e.hint?"as-hint-"+e.key:null),$I(),XE(),tC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(vs(0,"div",9)(1,"label",26),WC(2),eC(3,he,2,0,"span",11),fl(),eC(4,ge,2,9),fl()),i&2){let e,o=t.$implicit,l=mC(3);XE(),Tg("for","as-cred-"+o.key),XE(),yl(" ",o.label," "),XE(),tC(o.required?3:-1),XE(),tC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(vs(0,"fieldset",18)(1,"legend",22),WC(2,"Credentials"),fl(),vs(3,"p",25),WC(4," Values are stored encrypted and masked on read. "),eC(5,pe,1,0),fl(),oC(6,Ce,5,4,"div",9,Xw().trackByField,true),fl()),i&2){let e=mC(2);XE(5),tC(e.isEditMode()?5:-1),XE(),iC(e.credentialFields());}}function ye(i,t){if(i&1){let e=dC();vs(0,"form",7),Ag("ngSubmit",function(){If(e);let l=mC();return wf(l.submit())}),eC(1,de,5,1,"fieldset",8),vs(2,"div",9)(3,"label",10),WC(4,"Auth type "),vs(5,"span",11),WC(6,"*"),fl()(),vs(7,"select",12),oC(8,ue,2,2,"option",13,rC),fl(),HI(),fl(),vs(10,"div",9)(11,"label",14),WC(12,"Name "),vs(13,"span",11),WC(14,"*"),fl()(),bg(15,"input",15),HI(),fl(),vs(16,"div",9)(17,"label",16),WC(18,"Description"),fl(),bg(19,"input",17),HI(),fl(),eC(20,fe,8,1,"fieldset",18),vs(21,"div",19)(22,"button",20),WC(23),fl(),vs(24,"button",21),Ag("click",function(){If(e);let l=mC();return wf(l.cancel())}),WC(25,"Cancel"),fl()()();}if(i&2){let e=mC();Tg("formGroup",e.form),XE(),tC(e.isPlatformMode?-1:1),XE(6),Tg("formControl",e.authTypeControl),$I(),XE(),iC(e.authTypeOptions),XE(7),Tg("formControl",e.nameControl),$I(),XE(4),Tg("formControl",e.descriptionControl),$I(),XE(),tC(e.credentialFields().length>0?20:-1),XE(2),Tg("disabled",e.form.invalid||e.isSubmitting()),XE(),yl(" ",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=g(V);router=g(G);destroyRef=g(we);state=g(v);namespaceRole=g(v$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Hi(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 _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Hi(false);isSubmitting=Hi(false);isLoading=Hi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{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 z$1(P$1({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return z$1(P$1({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return z$1(P$1({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return z$1(P$1({},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 z$1(P$1({},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 z$1(P$1({},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 z$1(P$1({},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=Aw({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&&(vs(0,"div",0)(1,"header",1)(2,"button",2),Ag("click",function(){return o.cancel()}),vs(3,"span",3),WC(4,"\u2190"),fl(),WC(5," Auth Settings "),fl(),vs(6,"h1",4),WC(7),fl()(),eC(8,se,2,0,"p",5)(9,ye,26,8,"form",6),fl()),e&2&&(XE(7),Zg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),tC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],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 {g,G,ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-OWIJUFFO.js';import {K as Kn,Z as Zn,S as Se}from'./chunk-CHnP5DN-.js';function P(n,o){if(n&1&&(vs(0,"span",3),WC(1),fl()),n&2){let e=mC();XE(),Zg(e.config().modelName);}}function k(n,o){if(n&1&&(vs(0,"span",4),WC(1),fl()),n&2){let e=mC();XE(),Zg(e.config().description);}}function S(n,o){if(n&1){let e=dC();vs(0,"span",7),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",8),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",9),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteCancelled())}),fl();}}function E(n,o){if(n&1){let e=dC();vs(0,"ds-kebab-menu",10),Ag("itemSelected",function(l){If(e);let A=mC();return wf(A.onMenuAction(l))}),fl();}if(n&2){let e=mC();Tg("items",e.readOnly()?e.readOnlyMenuItems:e.menuItems);}}var O=class n{router=g(G);config=mB.required();namespaceId=mB(void 0);platformMode=mB(false);readOnly=mB(false);deleteRequested=gB();pendingDelete=Hi(false);menuItems=[{key:"edit",label:"Edit agent config",icon:"edit"},{key:"inspect",label:"Inspect definition",icon:"search"},{key:"delete",label:"Delete agent config",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"Inspect definition",icon:"search"}];onMenuAction(o){switch(o){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"edit"]);break;case "inspect":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"inspect"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"inspect"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-agent-config-item"]],inputs:{config:[1,"config"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:9,vars:4,consts:[["role","listitem","dsBlueprint","",1,"agent-config-item"],[1,"agent-config-item__body"],[1,"agent-config-item__name"],[1,"agent-config-item__model"],[1,"agent-config-item__description"],[1,"agent-config-item__actions"],[3,"items"],[1,"agent-config-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,a){e&1&&(vs(0,"div",0)(1,"div",1)(2,"span",2),WC(3),fl(),eC(4,P,2,1,"span",3),eC(5,k,2,1,"span",4),fl(),vs(6,"div",5),eC(7,S,4,0)(8,E,1,1,"ds-kebab-menu",6),fl()()),e&2&&(XE(3),Zg(a.config().name),XE(),tC(a.config().modelName?4:-1),XE(),tC(a.config().description?5:-1),XE(2),tC(a.pendingDelete()?7:8));},dependencies:[Kn,Zn,Se],styles:[".agent-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.agent-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.agent-config-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__model[_ngcontent-%COMP%], .agent-config-item__description[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover .agent-config-item__actions[_ngcontent-%COMP%], .agent-config-item[_ngcontent-%COMP%]:focus-within .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item[_ngcontent-%COMP%]:has(.agent-config-item__confirm-label) .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-DbXjEO5o.js';import {u}from'./chunk-DDQLJIRS.js';import {g,d7 as F,df as se,aI as Tr,aD as Ly,bR as ma,a7 as ga,S as ha,u as ue,cD as Rd,bT as Od,Y as x}from'./main-OWIJUFFO.js';var N="none",O="me",y=class f{nsController=g(F);exportService=g(se);userState=g(u);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Ly([this.namespaceId$,this.refresh$]).pipe(ma(([e])=>{let n=this.loadPlatformConfigs().pipe(ga(()=>ha([]))),t=this.loadUserConfigs("global").pipe(ga(()=>ha([])));return e?Ly([n,this.loadNamespaceConfigs(e).pipe(ga(()=>ha([]))),this.loadUserConfigs(e).pipe(ga(()=>ha([]))),t]).pipe(ue(([i,r,c,s])=>({platform:i,namespace:r,userOnNs:c,userGlobal:s}))):Ly([n,t]).pipe(ue(([i,r])=>({platform:i,namespace:[],userOnNs:[],userGlobal:r})))}),Rd({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadPlatformConfigs(){return this.nsController.listIntegrationConfig()}loadUserConfigs(e){let n=e==="global"?N:e;return this.nsController.listIntegrationConfig(n,O)}userGlobal$=i(this.refresh$,()=>this.loadUserConfigs("global"),[]);loadNamespaceConfigs(e){return e?this.nsController.listIntegrationConfig(e):ha([])}getById(e,n){return this.nsController.getByIdIntegrationConfig(e)}create(e,n,t){let r=this.userState.currentUser()?.id;if((n==="userOnNs"||n==="userGlobal")&&!r)throw new Error(`Cannot create ${n} config before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(n==="platform"){let s={name:e.name,integrationType:e.integrationType,description:e.description,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(Od(()=>this.refresh()))}if(n==="namespace"){if(!t)throw new Error("Cannot create namespace-scoped config without a namespaceId");let s={name:e.name,integrationType:e.integrationType,description:e.description,namespaceId:t,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(s).pipe(Od(()=>this.refresh()))}if(n==="userOnNs"&&!t)throw new Error("Cannot create userOnNs config without a namespaceId");let c={name:e.name,integrationType:e.integrationType,description:e.description,userId:r,namespaceId:n==="userOnNs"?t:void 0,parameters:e.parameters,authSettingName:e.authSettingName??void 0};return this.nsController.createIntegrationConfig(c).pipe(Od(()=>this.refresh()))}update(e,n,t,i){let r={name:n.name,integrationType:n.integrationType,description:n.description,userId:i.userId,namespaceId:i.namespaceId,parameters:n.parameters,authSettingName:n.authSettingName??void 0};return this.nsController.updateIntegrationConfig(e,r).pipe(Od(()=>this.refresh()))}delete(e,n){return this.nsController.deleteIntegrationConfig(e).pipe(Od(()=>this.refresh()))}exportAsYaml(e){return this.exportService.exportAsYaml(e)}static \u0275fac=function(n){return new(n||f)};static \u0275prov=x({token:f,factory:f.\u0275fac,providedIn:"root"})};export{y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bl as Sm,H as Hi,m as mT,cE as Fb,A as Aw,i as hr,j as Gn,v as vs,l as Ag,W as WC,k as fl,a3 as HI,n as eC,X as XE,r as Tg,a6 as $I,t as tC,w as we$1,z as z$1,a as P,Q as By,b as U,Y as x,b0 as An,be as aT,ac as mC,a8 as Zg,bh as lT,cF as dT,q as oC,cG as Xw,o as bg,x as iC,J as dy,cH as Nt,aw as pl,ax as hl,c8 as kf,b5 as Sg,cj as Ff,C as Cg,a5 as yl,a9 as dC,cI as Rg,aa as If,ab as wf,ad as Vg}from'./main-XRUWKAYH.js';import {t as ti,Q as Qn,e as ei,Y as Ye$1,A as At,Z as Zn,c as cn,y as yt,w as wt}from'./chunk-B9o2w3JI.js';var Ae=(o,t)=>t.date,He=(o,t)=>t.x,$e=(o,t)=>t.label;function Ve(o,t){o&1&&(pl(0,"div",0),WC(1,"No daily data points for this period."),hl());}function Le(o,t){if(o&1&&(kf(),Sg(0,"rect",18)),o&2){let e=mC().$implicit,n=mC(2);Cg("x",e.w+6)("y",n.yBase-e.tokensStubH)("width",e.w)("height",e.tokensStubH);}}function Ge(o,t){if(o&1&&(kf(),Sg(0,"rect",19)(1,"rect",20)),o&2){let e=mC().$implicit,n=mC(2);Cg("x",e.w+6)("y",n.yBase-(e.promptH??0))("width",e.w)("height",e.promptH??0),XE(),Cg("x",e.w+6)("y",n.yBase-((e.promptH??0)+(e.completionH??0)))("width",e.w)("height",e.completionH??0);}}function Ye(o,t){if(o&1){let e=dC();kf(),pl(0,"g",15),Rg("mouseenter",function(i){let d=If(e).$implicit,u=mC(2);return wf(u.showTooltip(i,d.point))})("mousemove",function(i){let d=If(e).$implicit,u=mC(2);return wf(u.showTooltip(i,d.point))})("mouseleave",function(){If(e);let i=mC(2);return wf(i.hideTooltip())}),Sg(1,"rect",16)(2,"rect",17),eC(3,Le,1,4,":svg:rect",18)(4,Ge,2,8),hl();}if(o&2){let e=t.$implicit,n=mC(2);Cg("transform","translate("+e.xGroup+",0)"),XE(),Cg("y",n.yTop)("width",e.groupW)("height",n.yBase-n.yTop),XE(),Cg("y",n.yBase-e.costH)("width",e.w)("height",e.costH),XE(),tC(e.tokensStubH!==null?3:4);}}function We(o,t){if(o&1&&(kf(),pl(0,"text",5),WC(1),hl()),o&2){let e=t.$implicit,n=mC(2);Cg("x",e.x)("y",n.yAxis),XE(),Zg(e.label);}}function je(o,t){if(o&1&&(pl(0,"div",24),WC(1),hl(),pl(2,"div",25),WC(3),hl()),o&2){let e=t.$implicit;XE(),Zg(e.label),XE(2),Zg(e.value);}}function ze(o,t){if(o&1&&(pl(0,"div",21)(1,"div",22),WC(2),hl(),pl(3,"div",23),oC(4,je,4,2,null,null,$e),hl()()),o&2){let e=mC(2);Vg("left",e.tooltip().x+12,"px")("top",e.tooltip().y+12,"px"),XE(2),Zg(e.tooltip().data.date),XE(2),iC(e.tooltipLines());}}function Xe(o,t){if(o&1&&(pl(0,"div",8)(1,"span",10),WC(2),hl()()),o&2){let e=mC(2);XE(2),Zg(e.tokenCoverageLabel());}}function Je(o,t){if(o&1&&(pl(0,"div",1),kf(),pl(1,"svg",2),Sg(2,"line",3)(3,"line",3),oC(4,Ye,5,8,":svg:g",4,Ae),oC(6,We,2,3,":svg:text",5,He),hl(),eC(8,ze,6,5,"div",6),Ff(),pl(9,"div",7)(10,"div",8),Sg(11,"span",9),pl(12,"span",10),WC(13,"Cost (per day)"),hl(),pl(14,"span",11),WC(15),hl()(),pl(16,"div",8),Sg(17,"span",12),pl(18,"span",10),WC(19,"Prompt tokens"),hl()(),pl(20,"div",8),Sg(21,"span",13),pl(22,"span",10),WC(23,"Completion tokens"),hl()(),pl(24,"div",8),Sg(25,"span",14),pl(26,"span",10),WC(27,"Tokens missing"),hl()(),pl(28,"div",8)(29,"span",10),WC(30,"Tokens scale"),hl(),pl(31,"span",11),WC(32),hl()(),eC(33,Xe,3,1,"div",8),hl()()),o&2){let e=mC();XE(),Cg("viewBox",e.viewBox),XE(),Cg("y1",e.yTop)("x2",720)("y2",e.yTop),XE(),Cg("y1",e.yBase)("x2",720)("y2",e.yBase),XE(),iC(e.bars()),XE(2),iC(e.axisLabels()),XE(2),tC(e.tooltip().visible&&e.tooltip().data?8:-1),XE(7),yl("max ",e.maxCostLabel()),XE(17),yl("max ",e.maxTokensLabel()),XE(),tC(e.tokenCoverageLabel()?33:-1);}}var j=class o{points=[];width=720;height=240;paddingX=12;paddingY=16;bottomAxisH=48;viewBox=`0 0 ${this.width} ${this.height}`;innerW=this.width-this.paddingX*2;innerH=this.height-this.paddingY*2-this.bottomAxisH;barGap=6;groupGap=14;safePoints=mT(()=>(this.points??[]).filter(t=>!!t.date));maxCost=mT(()=>Math.max(0,...this.safePoints().map(t=>t.cost??0)));maxTokens=mT(()=>{let t=this.safePoints().map(e=>{let n=e.promptTokens??null,i=e.completionTokens??null;return n===null&&i===null?null:(n??0)+(i??0)}).filter(e=>e!==null);return Math.max(0,...t)});tokenCoverageLabel=mT(()=>{let t=this.safePoints();return t.length===0?"":`Tokens available for ${t.filter(n=>n.promptTokens!==null||n.completionTokens!==null).length}/${t.length} days`});maxCostLabel=mT(()=>"$"+(new Fb("en-US").transform(this.maxCost(),"1.2-2")??"0.00"));maxTokensLabel=mT(()=>new Fb("en-US").transform(this.maxTokens(),"1.0-2")??"0");tooltip=Hi({visible:false,x:0,y:0,data:null});toTooltipData(t){let e=t.promptTokens,n=t.completionTokens,i=e===null&&n===null?null:(e??0)+(n??0);return {date:t.date,cost:t.cost??0,promptTokens:e,completionTokens:n,totalTokens:i,callCount:t.callCount??0}}showTooltip(t,e){let i=t.currentTarget?.closest(".chart")?.getBoundingClientRect(),d=i?t.clientX-i.left:t.clientX,u=i?t.clientY-i.top:t.clientY,f=320,k=170,U=12,C=i?Math.max(0,i.width-f-U):d,B=i?Math.max(0,i.height-k-U):u,F=i?Math.min(Math.max(0,d),C):d,ne=i?Math.min(Math.max(0,u),B):u;this.tooltip.set({visible:true,x:F,y:ne,data:this.toTooltipData(e)});}hideTooltip(){this.tooltip.update(t=>z$1(P({},t),{visible:false}));}formatTokens(t){return t===null?"\u2014":new Fb("en-US").transform(t,"1.0-2")??"0"}formatCost(t){return "$"+(new Fb("en-US").transform(t??0,"1.2-2")??"0.00")}tooltipLines=mT(()=>{let t=this.tooltip(),e=t.data;return !t.visible||!e?[]:[{label:"Cost",value:this.formatCost(e.cost)},{label:"Prompt tokens",value:this.formatTokens(e.promptTokens)},{label:"Completion tokens",value:this.formatTokens(e.completionTokens)},{label:"Total tokens",value:this.formatTokens(e.totalTokens)},{label:"Calls",value:`${e.callCount}`}]});bars=mT(()=>{let t=this.safePoints(),e=t.length;if(e===0)return [];let n=(this.innerW-(e-1)*this.groupGap)/e,i=Math.max(2,n),d=(i-this.barGap)/2,u=Math.max(1,d),f=this.maxCost()||1,k=this.maxTokens()||1,U=45;return t.map((C,B)=>{let F=this.paddingX+B*(i+this.groupGap),Ie=(C.cost??0)/f*this.innerH,oe=C.promptTokens,ae=C.completionTokens,Z=oe!==null||ae!==null,Ne=oe??0,Ue=ae??0,Be=Z?Ne/k*this.innerH:null,Fe=Z?Ue/k*this.innerH:null;return {date:C.date,point:C,xGroup:F,groupW:i,xCost:F,w:u,costH:Ie,xTokens:F+u+this.barGap,promptH:Be,completionH:Fe,tokensStubH:Z?null:U}})});axisLabels=mT(()=>{let t=this.safePoints(),e=t.length;if(e===0)return [];let i=Math.max(1,Math.ceil(e/8)),d=(this.innerW-(e-1)*this.groupGap)/e,u=Math.max(2,d);return t.map((f,k)=>({p:f,i:k})).filter(({i:f})=>f%i===0||f===e-1).map(({p:f,i:k})=>{let C=this.paddingX+k*(u+this.groupGap)+u/2,B=f.date.slice(5);return {x:C,label:B}})});yTop=this.paddingY;yBase=this.paddingY+this.innerH;yAxis=this.yBase+28;static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["app-daily-series-chart"]],inputs:{points:"points"},decls:2,vars:1,consts:[[1,"muted"],[1,"chart"],["preserveAspectRatio","none","role","img","aria-label","Daily token and cost usage",1,"chart__svg"],["x1","0",1,"chart__grid"],[1,"chart__day"],["text-anchor","middle",1,"chart__axis-label"],[1,"chart__tooltip",3,"left","top"],[1,"chart__legend"],[1,"chart__legend-item"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--cost"],[1,"chart__legend-label"],[1,"chart__legend-value"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--prompt"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--completion"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--tokens-missing"],[1,"chart__day",3,"mouseenter","mousemove","mouseleave"],["x","0",1,"chart__hover"],["x","0",1,"chart__bar","chart__bar--cost"],[1,"chart__bar","chart__bar--tokens-missing"],[1,"chart__bar","chart__bar--prompt"],[1,"chart__bar","chart__bar--completion"],[1,"chart__tooltip"],[1,"chart__tooltip-title"],[1,"chart__tooltip-grid"],[1,"chart__tooltip-label"],[1,"chart__tooltip-value"]],template:function(e,n){e&1&&eC(0,Ve,2,0,"div",0)(1,Je,34,11,"div",1),e&2&&tC(n.safePoints().length===0?0:1);},styles:[".chart[_ngcontent-%COMP%]{display:grid;gap:.5rem;position:relative}.chart__svg[_ngcontent-%COMP%]{width:100%;height:260px;display:block;border-radius:12px;background:var(--color-bg-secondary, rgba(255, 255, 255, .72));border:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.chart__grid[_ngcontent-%COMP%]{stroke:var(--color-border-light, rgba(0, 0, 0, .08));stroke-width:1}.chart__day[_ngcontent-%COMP%]{cursor:default}.chart__hover[_ngcontent-%COMP%]{fill:transparent}.chart__day[_ngcontent-%COMP%]:hover .chart__hover[_ngcontent-%COMP%]{fill:var(--color-bg-hover, rgba(0, 0, 0, .03))}.chart__tooltip[_ngcontent-%COMP%]{position:absolute;z-index:2;min-width:220px;max-width:320px;padding:10px 12px;border-radius:12px;background:rgb(var(--color-bg-secondary-rgb, 255 255 255)/1);border:1px solid var(--color-border-light, rgba(0, 0, 0, .08));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .12));pointer-events:none}.chart__tooltip-title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:6px}.chart__tooltip-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr auto;column-gap:10px;row-gap:4px}.chart__tooltip-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__tooltip-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums;text-align:right}.chart__bar[_ngcontent-%COMP%]{shape-rendering:geometricPrecision;rx:2;ry:2}.chart__bar--cost[_ngcontent-%COMP%]{fill:var(--color-primary, #007aff);opacity:.85}.chart__bar--prompt[_ngcontent-%COMP%]{fill:var(--color-success, #34c759);opacity:.85}.chart__bar--completion[_ngcontent-%COMP%]{fill:var(--color-warning, #ff9500);opacity:.85}.chart__bar--tokens-missing[_ngcontent-%COMP%]{fill:transparent;stroke:var(--color-text-secondary, rgba(29, 29, 31, .55));stroke-width:1.5;stroke-dasharray:4 3}.chart__axis-label[_ngcontent-%COMP%]{fill:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:12px;font-variant-numeric:tabular-nums}.chart__legend[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:.75rem;flex-wrap:wrap}.chart__legend-item[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:baseline}.chart__legend-swatch[_ngcontent-%COMP%]{width:10px;height:10px;border-radius:3px;align-self:center}.chart__legend-swatch--cost[_ngcontent-%COMP%]{background:var(--color-primary, #007aff)}.chart__legend-swatch--prompt[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.chart__legend-swatch--completion[_ngcontent-%COMP%]{background:var(--color-warning, #ff9500)}.chart__legend-swatch--tokens-missing[_ngcontent-%COMP%]{background:transparent;border:1px dashed var(--color-text-secondary, rgba(29, 29, 31, .55))}.chart__legend-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__legend-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}"]})};var X=class o{http=g(dy);getTokenUsage(t){let e=new Nt;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage",{params:e})}getTokenUsageSeries(t){let e=new Nt;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage/series",{params:e})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};function Pe(o){return `${o}`.padStart(2,"0")}function we(o){return `${o.getUTCFullYear()}-${Pe(o.getUTCMonth()+1)}-${Pe(o.getUTCDate())}`}function qe(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),1))}function Ke(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth()+1,1))}var J=class o{api=g(X);destroyRef=g(we$1);defaultFrom=we(qe());defaultTo=we(Ke());draftFilters=Hi({from:this.defaultFrom,to:this.defaultTo});appliedFilters=Hi({from:this.defaultFrom,to:this.defaultTo});loading=Hi(false);error=Hi(null);aggregation=Hi(null);seriesResponse=Hi(null);series=Hi(null);tokenDataPartial=Hi(false);aggregationByModelId=Hi(null);seriesByModelId=Hi(null);init(){this.reload();}setDraftFrom(t){this.draftFilters.update(e=>z$1(P({},e),{from:t}));}setDraftTo(t){this.draftFilters.update(e=>z$1(P({},e),{to:t}));}clearDraftFrom(){this.setDraftFrom(null);}clearDraftTo(){this.setDraftTo(null);}apply(){this.appliedFilters.set(this.draftFilters()),this.reload();}addNullableTokens(t,e){return t===null&&e===null?null:(t??0)+(e??0)}aggregateByModelId(t){let e=new Map;for(let n of t){let i=n.modelId,d=e.get(i);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(i,{agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0});}return [...e.values()].sort((n,i)=>(i.totalTokens??0)-(n.totalTokens??0))}aggregateSeriesByModelId(t){let e=new Map;for(let n of t){let i=`${n.date}|${n.modelId}`,d=e.get(i);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(i,{date:n.date,agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0});}return [...e.values()].sort((n,i)=>n.date<i.date?-1:1)}reload(){let{from:t,to:e}=this.appliedFilters();this.loading.set(true),this.error.set(null),By({aggregation:this.api.getTokenUsage({from:t,to:e}),series:this.api.getTokenUsageSeries({from:t,to:e})}).pipe(U(this.destroyRef)).subscribe({next:({aggregation:n,series:i})=>{this.aggregation.set(n),this.seriesResponse.set(i);let d=i.points??[];this.series.set(d),this.tokenDataPartial.set(n.tokenDataPartial||i.tokenDataPartial);let u=this.aggregateByModelId(n.models??[]);this.aggregationByModelId.set(u),this.seriesByModelId.set(this.aggregateSeriesByModelId(d)),this.loading.set(false);},error:n=>{this.loading.set(false),this.aggregation.set(null),this.seriesResponse.set(null),this.series.set(null),this.tokenDataPartial.set(false),this.aggregationByModelId.set(null),this.seriesByModelId.set(null),this.error.set(n instanceof Error?n.message:"Failed to load token usage");}});}static \u0275fac=function(e){return new(e||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var q=function(){throw new Error("DON'T USE this INSIDE A FUNCTION CALLED BY | call OR | apply IT MUST BE A PURE FUNCTION!")},De=typeof Proxy!="function"?Object.seal({}):new Proxy({},{get:q,set:q,deleteProperty:q,has:q}),K=class o{transform(t,e){if(typeof e!="function")throw new TypeError("You must pass a PURE function to | call");return e?.call(De,t)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=An({name:"call",type:o,pure:true})},Q=class o{transform(t,...e){if(typeof t!="function")throw new TypeError("You must use | apply on a PURE function");return t.apply(De,e)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=An({name:"apply",type:o,pure:true})};function Qe(o,t){o&1&&(vs(0,"div",23),WC(1," Partial data \u2014 token counts may not cover the full period "),fl());}function Ze(o,t){o&1&&(vs(0,"div",24),WC(1," No token data collected for this period "),fl());}function et(o,t){if(o&1&&(vs(0,"div",19)(1,"div",20)(2,"div",21),WC(3,"Total tokens"),fl(),vs(4,"div",22),WC(5),aT(6,"call"),fl()(),vs(7,"div",20)(8,"div",21),WC(9,"Total calls"),fl(),vs(10,"div",22),WC(11),fl()(),vs(12,"div",20)(13,"div",21),WC(14,"Total cost"),fl(),vs(15,"div",22),WC(16),aT(17,"apply"),fl()()(),eC(18,Qe,2,0,"div",23),eC(19,Ze,2,0,"div",24)),o&2){let e=mC();XE(5),Zg(lT(6,5,e.totalRow().totalTokens,e.formatTokenValue)),XE(6),Zg(e.totalRow().callCount),XE(5),Zg(dT(17,8,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)),XE(2),tC(e.isPartialPeriod()?18:-1),XE(),tC(e.isMissingPeriod()?19:-1);}}function tt(o,t){o&1&&(vs(0,"div",16)(1,"div",25),WC(2,"Loading token usage\u2026"),fl()());}function nt(o,t){if(o&1&&(vs(0,"div",17)(1,"div",26),WC(2,"Failed to load"),fl(),vs(3,"div",25),WC(4),fl()()),o&2){let e=mC();XE(4),Zg(e.state.error());}}function ot(o,t){o&1&&(vs(0,"div",16)(1,"div",26),WC(2,"No data"),fl(),vs(3,"div",25),WC(4,"No token usage recorded yet for this period."),fl()());}function at(o,t){if(o&1&&(vs(0,"div",32)(1,"div",29),WC(2),fl(),vs(3,"div",29),WC(4),fl(),vs(5,"div",29),WC(6),fl(),vs(7,"div",30),WC(8),aT(9,"call"),fl(),vs(10,"div",30),WC(11),aT(12,"call"),fl(),vs(13,"div",30),WC(14),aT(15,"call"),fl(),vs(16,"div",30),WC(17),fl(),vs(18,"div",30),WC(19),aT(20,"apply"),fl()()),o&2){let e=t.$implicit,n=mC(2);XE(2),Zg(e.agentName),XE(2),Zg(e.providerName),XE(2),Zg(e.modelId),XE(2),Zg(lT(9,8,e.promptTokens,n.formatTokenValue)),XE(3),Zg(lT(12,11,e.completionTokens,n.formatTokenValue)),XE(3),Zg(lT(15,14,e.totalTokens,n.formatTokenValue)),XE(3),Zg(e.callCount),XE(2),yl(" ",dT(20,17,n.formatCostValue,n.isMissingPeriod(),e.cost)," ");}}function it(o,t){if(o&1&&(vs(0,"div",33)(1,"div",29),WC(2),fl(),vs(3,"div",29),WC(4),fl(),vs(5,"div",29),WC(6),fl(),vs(7,"div",30),WC(8),aT(9,"call"),fl(),vs(10,"div",30),WC(11),aT(12,"call"),fl(),vs(13,"div",30),WC(14),aT(15,"call"),fl(),vs(16,"div",30),WC(17),fl(),vs(18,"div",30),WC(19),aT(20,"apply"),fl()()),o&2){let e=mC(2);XE(2),Zg(e.totalRow().agentName),XE(2),Zg(e.totalRow().providerName),XE(2),Zg(e.totalRow().modelId),XE(2),Zg(lT(9,8,e.totalRow().promptTokens,e.formatTokenValue)),XE(3),yl(" ",lT(12,11,e.totalRow().completionTokens,e.formatTokenValue)," "),XE(3),Zg(lT(15,14,e.totalRow().totalTokens,e.formatTokenValue)),XE(3),Zg(e.totalRow().callCount),XE(2),yl(" ",dT(20,17,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)," ");}}function rt(o,t){if(o&1&&(vs(0,"div",18)(1,"section",16)(2,"div",26),WC(3,"Summary"),fl(),vs(4,"div",27)(5,"div",28)(6,"div",29),WC(7,"agentName"),fl(),vs(8,"div",29),WC(9,"providerName"),fl(),vs(10,"div",29),WC(11,"modelId"),fl(),vs(12,"div",30),WC(13,"promptTokens"),fl(),vs(14,"div",30),WC(15,"completionTokens"),fl(),vs(16,"div",30),WC(17,"totalTokens"),fl(),vs(18,"div",30),WC(19,"callCount"),fl(),vs(20,"div",30),WC(21,"cost"),fl()(),vs(22,"div",31),oC(23,at,21,21,"div",32,Xw().trackRow,true),eC(25,it,21,21,"div",33),fl()()(),vs(26,"section",16)(27,"div",26),WC(28,"Daily series"),fl(),bg(29,"app-daily-series-chart",34),fl()()),o&2){let e=mC();XE(23),iC(e.rows()),XE(2),tC(e.totalRow()?25:-1),XE(4),Tg("points",e.chartPoints());}}var Ee="\u2014",Oe=class o{location=g(Sm);state=g(J);view=Hi("byModel");rowsByAgent=mT(()=>this.state.aggregation()?.models??[]);totalRow=mT(()=>this.state.aggregation()?.total??null);rowsByModel=mT(()=>this.state.aggregationByModelId()??[]);chartPointsByAgent=mT(()=>{let t=this.state.series()??[];return this.aggregateDailyPoints(t)});chartPointsByModel=mT(()=>{let t=this.state.seriesByModelId()??[];return this.aggregateDailyPoints(t)});chartPoints=mT(()=>this.view()==="byAgent"?this.chartPointsByAgent():this.chartPointsByModel());rows=mT(()=>this.view()==="byAgent"?this.rowsByAgent():this.rowsByModel());isEmpty=mT(()=>{let t=this.state.aggregation();return t?(t.models?.length??0)===0&&(t.total?.callCount??0)===0:false});ngOnInit(){this.state.init();}onFromChange(t){this.state.setDraftFrom(t||null);}onToChange(t){this.state.setDraftTo(t||null);}clearFrom(){this.state.clearDraftFrom();}clearTo(){this.state.clearDraftTo();}apply(){this.state.apply();}aggregateDailyPoints(t){let e=new Map;for(let n of t){let i=e.get(n.date);if(!i)e.set(n.date,{date:n.date,promptTokens:n.promptTokens,completionTokens:n.completionTokens,cost:n.cost??0,callCount:n.callCount??0});else {let d=(u,f)=>u===null&&f===null?null:(u??0)+(f??0);i.promptTokens=d(i.promptTokens,n.promptTokens),i.completionTokens=d(i.completionTokens,n.completionTokens),i.cost=(i.cost??0)+(n.cost??0),i.callCount=(i.callCount??0)+(n.callCount??0);}}return [...e.values()].sort((n,i)=>n.date<i.date?-1:1)}trackRow(t,e){return `${e.agentName}|${e.providerName}|${e.modelId}`}isMissingPeriod=mT(()=>{if(this.state.loading())return false;let t=this.state.aggregation()?.total;return t?t.totalTokens===null&&(t.cost===null||t.cost===void 0):false});isPartialPeriod=mT(()=>!this.isMissingPeriod()&&this.state.tokenDataPartial());navigateBack(){this.location.back();}formatTokenValue(t){return t===null?Ee:new Fb("en-US").transform(t,"1.0-2")??"0"}formatCostValue(t,e){return t?Ee:"$"+(new Fb("en-US").transform(e??0,"1.2-2")??"0.00")}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["app-token-usage"]],decls:41,vars:8,consts:[[1,"page"],[1,"page__header"],[1,"page__title-block"],["mat-icon-button","","title","Back",3,"click"],[1,"page__title"],[1,"page__subtitle"],[1,"filters"],[1,"filters__field"],[1,"filters__label"],[1,"filters__control"],["type","date",1,"filters__input",3,"ngModelChange","ngModel"],["type","button",1,"filters__clear",3,"click","disabled"],[1,"filters__select",3,"ngModelChange","ngModel"],["value","byModel"],["value","byAgent"],["type","button",1,"filters__apply",3,"click","disabled"],[1,"card"],[1,"card","card--error"],[1,"grid"],[1,"kpis"],[1,"kpi"],[1,"kpi__label"],[1,"kpi__value"],["title","Some calls in this period were recorded before token tracking was enabled. Token counts reflect only the portion where data was collected.",1,"hint"],["title","No token usage data was collected for this period.",1,"hint"],[1,"muted"],[1,"card__title"],[1,"table"],[1,"table__head"],[1,"table__cell"],[1,"table__cell","table__cell--num"],[1,"table__body"],[1,"table__row"],[1,"table__row","table__row--total"],[3,"points"]],template:function(e,n){e&1&&(vs(0,"section",0)(1,"header",1)(2,"div",2)(3,"button",3),Ag("click",function(){return n.navigateBack()}),vs(4,"mat-icon"),WC(5,"chevron_left"),fl()(),vs(6,"div")(7,"h1",4),WC(8,"Token Usage"),fl(),vs(9,"p",5),WC(10,"Track prompt and completion token usage by agent and model."),fl()()(),vs(11,"div",6)(12,"label",7)(13,"span",8),WC(14,"From"),fl(),vs(15,"div",9)(16,"input",10),Ag("ngModelChange",function(d){return n.onFromChange(d)}),fl(),HI(),vs(17,"button",11),Ag("click",function(){return n.clearFrom()}),WC(18," Clear "),fl()()(),vs(19,"label",7)(20,"span",8),WC(21,"To"),fl(),vs(22,"div",9)(23,"input",10),Ag("ngModelChange",function(d){return n.onToChange(d)}),fl(),HI(),vs(24,"button",11),Ag("click",function(){return n.clearTo()}),WC(25," Clear "),fl()()(),vs(26,"label",7)(27,"span",8),WC(28,"View"),fl(),vs(29,"select",12),Ag("ngModelChange",function(d){return n.view.set(d)}),vs(30,"option",13),WC(31,"By model"),fl(),vs(32,"option",14),WC(33,"By agent"),fl()(),HI(),fl(),vs(34,"button",15),Ag("click",function(){return n.apply()}),WC(35,"Apply"),fl()()(),eC(36,et,20,12),eC(37,tt,3,0,"div",16)(38,nt,5,1,"div",17)(39,ot,5,0,"div",16)(40,rt,30,2,"div",18),fl()),e&2&&(XE(16),Tg("ngModel",n.state.draftFilters().from),$I(),XE(),Tg("disabled",!n.state.draftFilters().from),XE(6),Tg("ngModel",n.state.draftFilters().to),$I(),XE(),Tg("disabled",!n.state.draftFilters().to),XE(5),Tg("ngModel",n.view()),$I(),XE(5),Tg("disabled",n.state.loading()),XE(2),tC(n.totalRow()?36:-1),XE(),tC(n.state.loading()?37:n.state.error()?38:n.isEmpty()?39:40));},dependencies:[ti,Qn,ei,Ye$1,At,Zn,cn,j,hr,Gn,yt,wt,K,Q],styles:[".page[_ngcontent-%COMP%]{padding:1.5rem;color:var(--color-text, #1d1d1f)}.page__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem;margin-bottom:1rem}.page__title-block[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem}.page__title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:650}.page__subtitle[_ngcontent-%COMP%]{margin:.25rem 0 0;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.95rem}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:flex-end;gap:.75rem}.filters__field[_ngcontent-%COMP%]{display:grid;gap:.25rem}.filters__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.filters__control[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.filters__input[_ngcontent-%COMP%], .filters__select[_ngcontent-%COMP%]{height:34px;padding:0 .5rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f)}.filters__apply[_ngcontent-%COMP%], .filters__clear[_ngcontent-%COMP%]{height:34px;padding:0 .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f);cursor:pointer}.kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin:.75rem 0 1rem}@media(max-width:900px){.kpis[_ngcontent-%COMP%]{grid-template-columns:1fr}}.kpi[_ngcontent-%COMP%]{border-radius:14px;padding:.75rem 1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.kpi__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.kpi__value[_ngcontent-%COMP%]{margin-top:.25rem;font-size:1.2rem;font-weight:650;font-variant-numeric:tabular-nums}.filters__apply[_ngcontent-%COMP%]{border-color:var(--color-primary, #007aff);background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff)}.filters__apply[_ngcontent-%COMP%]:disabled, .filters__clear[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1.5fr 1fr;gap:1rem;align-items:start}@media(max-width:1100px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.card[_ngcontent-%COMP%]{border-radius:14px;padding:1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.card--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.card__title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:.75rem}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.table[_ngcontent-%COMP%]{overflow-x:auto}.table__head[_ngcontent-%COMP%], .table__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 2fr 1fr 1fr 1fr .7fr 1fr;gap:.5rem;align-items:center}.table__head[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));padding:.25rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row[_ngcontent-%COMP%]{padding:.5rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row--total[_ngcontent-%COMP%]{font-weight:650;background:var(--color-bg-hover, rgba(0, 0, 0, .03));border-radius:10px;padding:.6rem .5rem;border-bottom:none;margin-top:.5rem}.table__cell[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.table__cell--num[_ngcontent-%COMP%]{text-align:right;font-variant-numeric:tabular-nums}.hint[_ngcontent-%COMP%]{margin:.25rem 0 1rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}"],changeDetection:1})};export{Oe as TokenUsageComponent};
|
|
1
|
+
import {g,bl as Sm,H as Hi,m as mT,cE as Fb,A as Aw,i as hr,j as Gn,v as vs,l as Ag,W as WC,k as fl,a3 as HI,n as eC,X as XE,r as Tg,a6 as $I,t as tC,w as we$1,z as z$1,a as P,Q as By,b as U,Y as x,b0 as An,be as aT,ac as mC,a8 as Zg,bh as lT,cF as dT,q as oC,cG as Xw,o as bg,x as iC,J as dy,cH as Nt,aw as pl,ax as hl,c8 as kf,b5 as Sg,cj as Ff,C as Cg,a5 as yl,a9 as dC,cI as Rg,aa as If,ab as wf,ad as Vg}from'./main-OWIJUFFO.js';import {t as ti,Q as Qn,e as ei,Y as Ye$1,A as At,Z as Zn,c as cn,y as yt,w as wt}from'./chunk-BOA9V0K7.js';var Ae=(o,t)=>t.date,He=(o,t)=>t.x,$e=(o,t)=>t.label;function Ve(o,t){o&1&&(pl(0,"div",0),WC(1,"No daily data points for this period."),hl());}function Le(o,t){if(o&1&&(kf(),Sg(0,"rect",18)),o&2){let e=mC().$implicit,n=mC(2);Cg("x",e.w+6)("y",n.yBase-e.tokensStubH)("width",e.w)("height",e.tokensStubH);}}function Ge(o,t){if(o&1&&(kf(),Sg(0,"rect",19)(1,"rect",20)),o&2){let e=mC().$implicit,n=mC(2);Cg("x",e.w+6)("y",n.yBase-(e.promptH??0))("width",e.w)("height",e.promptH??0),XE(),Cg("x",e.w+6)("y",n.yBase-((e.promptH??0)+(e.completionH??0)))("width",e.w)("height",e.completionH??0);}}function Ye(o,t){if(o&1){let e=dC();kf(),pl(0,"g",15),Rg("mouseenter",function(i){let d=If(e).$implicit,u=mC(2);return wf(u.showTooltip(i,d.point))})("mousemove",function(i){let d=If(e).$implicit,u=mC(2);return wf(u.showTooltip(i,d.point))})("mouseleave",function(){If(e);let i=mC(2);return wf(i.hideTooltip())}),Sg(1,"rect",16)(2,"rect",17),eC(3,Le,1,4,":svg:rect",18)(4,Ge,2,8),hl();}if(o&2){let e=t.$implicit,n=mC(2);Cg("transform","translate("+e.xGroup+",0)"),XE(),Cg("y",n.yTop)("width",e.groupW)("height",n.yBase-n.yTop),XE(),Cg("y",n.yBase-e.costH)("width",e.w)("height",e.costH),XE(),tC(e.tokensStubH!==null?3:4);}}function We(o,t){if(o&1&&(kf(),pl(0,"text",5),WC(1),hl()),o&2){let e=t.$implicit,n=mC(2);Cg("x",e.x)("y",n.yAxis),XE(),Zg(e.label);}}function je(o,t){if(o&1&&(pl(0,"div",24),WC(1),hl(),pl(2,"div",25),WC(3),hl()),o&2){let e=t.$implicit;XE(),Zg(e.label),XE(2),Zg(e.value);}}function ze(o,t){if(o&1&&(pl(0,"div",21)(1,"div",22),WC(2),hl(),pl(3,"div",23),oC(4,je,4,2,null,null,$e),hl()()),o&2){let e=mC(2);Vg("left",e.tooltip().x+12,"px")("top",e.tooltip().y+12,"px"),XE(2),Zg(e.tooltip().data.date),XE(2),iC(e.tooltipLines());}}function Xe(o,t){if(o&1&&(pl(0,"div",8)(1,"span",10),WC(2),hl()()),o&2){let e=mC(2);XE(2),Zg(e.tokenCoverageLabel());}}function Je(o,t){if(o&1&&(pl(0,"div",1),kf(),pl(1,"svg",2),Sg(2,"line",3)(3,"line",3),oC(4,Ye,5,8,":svg:g",4,Ae),oC(6,We,2,3,":svg:text",5,He),hl(),eC(8,ze,6,5,"div",6),Ff(),pl(9,"div",7)(10,"div",8),Sg(11,"span",9),pl(12,"span",10),WC(13,"Cost (per day)"),hl(),pl(14,"span",11),WC(15),hl()(),pl(16,"div",8),Sg(17,"span",12),pl(18,"span",10),WC(19,"Prompt tokens"),hl()(),pl(20,"div",8),Sg(21,"span",13),pl(22,"span",10),WC(23,"Completion tokens"),hl()(),pl(24,"div",8),Sg(25,"span",14),pl(26,"span",10),WC(27,"Tokens missing"),hl()(),pl(28,"div",8)(29,"span",10),WC(30,"Tokens scale"),hl(),pl(31,"span",11),WC(32),hl()(),eC(33,Xe,3,1,"div",8),hl()()),o&2){let e=mC();XE(),Cg("viewBox",e.viewBox),XE(),Cg("y1",e.yTop)("x2",720)("y2",e.yTop),XE(),Cg("y1",e.yBase)("x2",720)("y2",e.yBase),XE(),iC(e.bars()),XE(2),iC(e.axisLabels()),XE(2),tC(e.tooltip().visible&&e.tooltip().data?8:-1),XE(7),yl("max ",e.maxCostLabel()),XE(17),yl("max ",e.maxTokensLabel()),XE(),tC(e.tokenCoverageLabel()?33:-1);}}var j=class o{points=[];width=720;height=240;paddingX=12;paddingY=16;bottomAxisH=48;viewBox=`0 0 ${this.width} ${this.height}`;innerW=this.width-this.paddingX*2;innerH=this.height-this.paddingY*2-this.bottomAxisH;barGap=6;groupGap=14;safePoints=mT(()=>(this.points??[]).filter(t=>!!t.date));maxCost=mT(()=>Math.max(0,...this.safePoints().map(t=>t.cost??0)));maxTokens=mT(()=>{let t=this.safePoints().map(e=>{let n=e.promptTokens??null,i=e.completionTokens??null;return n===null&&i===null?null:(n??0)+(i??0)}).filter(e=>e!==null);return Math.max(0,...t)});tokenCoverageLabel=mT(()=>{let t=this.safePoints();return t.length===0?"":`Tokens available for ${t.filter(n=>n.promptTokens!==null||n.completionTokens!==null).length}/${t.length} days`});maxCostLabel=mT(()=>"$"+(new Fb("en-US").transform(this.maxCost(),"1.2-2")??"0.00"));maxTokensLabel=mT(()=>new Fb("en-US").transform(this.maxTokens(),"1.0-2")??"0");tooltip=Hi({visible:false,x:0,y:0,data:null});toTooltipData(t){let e=t.promptTokens,n=t.completionTokens,i=e===null&&n===null?null:(e??0)+(n??0);return {date:t.date,cost:t.cost??0,promptTokens:e,completionTokens:n,totalTokens:i,callCount:t.callCount??0}}showTooltip(t,e){let i=t.currentTarget?.closest(".chart")?.getBoundingClientRect(),d=i?t.clientX-i.left:t.clientX,u=i?t.clientY-i.top:t.clientY,f=320,k=170,U=12,C=i?Math.max(0,i.width-f-U):d,B=i?Math.max(0,i.height-k-U):u,F=i?Math.min(Math.max(0,d),C):d,ne=i?Math.min(Math.max(0,u),B):u;this.tooltip.set({visible:true,x:F,y:ne,data:this.toTooltipData(e)});}hideTooltip(){this.tooltip.update(t=>z$1(P({},t),{visible:false}));}formatTokens(t){return t===null?"\u2014":new Fb("en-US").transform(t,"1.0-2")??"0"}formatCost(t){return "$"+(new Fb("en-US").transform(t??0,"1.2-2")??"0.00")}tooltipLines=mT(()=>{let t=this.tooltip(),e=t.data;return !t.visible||!e?[]:[{label:"Cost",value:this.formatCost(e.cost)},{label:"Prompt tokens",value:this.formatTokens(e.promptTokens)},{label:"Completion tokens",value:this.formatTokens(e.completionTokens)},{label:"Total tokens",value:this.formatTokens(e.totalTokens)},{label:"Calls",value:`${e.callCount}`}]});bars=mT(()=>{let t=this.safePoints(),e=t.length;if(e===0)return [];let n=(this.innerW-(e-1)*this.groupGap)/e,i=Math.max(2,n),d=(i-this.barGap)/2,u=Math.max(1,d),f=this.maxCost()||1,k=this.maxTokens()||1,U=45;return t.map((C,B)=>{let F=this.paddingX+B*(i+this.groupGap),Ie=(C.cost??0)/f*this.innerH,oe=C.promptTokens,ae=C.completionTokens,Z=oe!==null||ae!==null,Ne=oe??0,Ue=ae??0,Be=Z?Ne/k*this.innerH:null,Fe=Z?Ue/k*this.innerH:null;return {date:C.date,point:C,xGroup:F,groupW:i,xCost:F,w:u,costH:Ie,xTokens:F+u+this.barGap,promptH:Be,completionH:Fe,tokensStubH:Z?null:U}})});axisLabels=mT(()=>{let t=this.safePoints(),e=t.length;if(e===0)return [];let i=Math.max(1,Math.ceil(e/8)),d=(this.innerW-(e-1)*this.groupGap)/e,u=Math.max(2,d);return t.map((f,k)=>({p:f,i:k})).filter(({i:f})=>f%i===0||f===e-1).map(({p:f,i:k})=>{let C=this.paddingX+k*(u+this.groupGap)+u/2,B=f.date.slice(5);return {x:C,label:B}})});yTop=this.paddingY;yBase=this.paddingY+this.innerH;yAxis=this.yBase+28;static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["app-daily-series-chart"]],inputs:{points:"points"},decls:2,vars:1,consts:[[1,"muted"],[1,"chart"],["preserveAspectRatio","none","role","img","aria-label","Daily token and cost usage",1,"chart__svg"],["x1","0",1,"chart__grid"],[1,"chart__day"],["text-anchor","middle",1,"chart__axis-label"],[1,"chart__tooltip",3,"left","top"],[1,"chart__legend"],[1,"chart__legend-item"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--cost"],[1,"chart__legend-label"],[1,"chart__legend-value"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--prompt"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--completion"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--tokens-missing"],[1,"chart__day",3,"mouseenter","mousemove","mouseleave"],["x","0",1,"chart__hover"],["x","0",1,"chart__bar","chart__bar--cost"],[1,"chart__bar","chart__bar--tokens-missing"],[1,"chart__bar","chart__bar--prompt"],[1,"chart__bar","chart__bar--completion"],[1,"chart__tooltip"],[1,"chart__tooltip-title"],[1,"chart__tooltip-grid"],[1,"chart__tooltip-label"],[1,"chart__tooltip-value"]],template:function(e,n){e&1&&eC(0,Ve,2,0,"div",0)(1,Je,34,11,"div",1),e&2&&tC(n.safePoints().length===0?0:1);},styles:[".chart[_ngcontent-%COMP%]{display:grid;gap:.5rem;position:relative}.chart__svg[_ngcontent-%COMP%]{width:100%;height:260px;display:block;border-radius:12px;background:var(--color-bg-secondary, rgba(255, 255, 255, .72));border:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.chart__grid[_ngcontent-%COMP%]{stroke:var(--color-border-light, rgba(0, 0, 0, .08));stroke-width:1}.chart__day[_ngcontent-%COMP%]{cursor:default}.chart__hover[_ngcontent-%COMP%]{fill:transparent}.chart__day[_ngcontent-%COMP%]:hover .chart__hover[_ngcontent-%COMP%]{fill:var(--color-bg-hover, rgba(0, 0, 0, .03))}.chart__tooltip[_ngcontent-%COMP%]{position:absolute;z-index:2;min-width:220px;max-width:320px;padding:10px 12px;border-radius:12px;background:rgb(var(--color-bg-secondary-rgb, 255 255 255)/1);border:1px solid var(--color-border-light, rgba(0, 0, 0, .08));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .12));pointer-events:none}.chart__tooltip-title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:6px}.chart__tooltip-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr auto;column-gap:10px;row-gap:4px}.chart__tooltip-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__tooltip-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums;text-align:right}.chart__bar[_ngcontent-%COMP%]{shape-rendering:geometricPrecision;rx:2;ry:2}.chart__bar--cost[_ngcontent-%COMP%]{fill:var(--color-primary, #007aff);opacity:.85}.chart__bar--prompt[_ngcontent-%COMP%]{fill:var(--color-success, #34c759);opacity:.85}.chart__bar--completion[_ngcontent-%COMP%]{fill:var(--color-warning, #ff9500);opacity:.85}.chart__bar--tokens-missing[_ngcontent-%COMP%]{fill:transparent;stroke:var(--color-text-secondary, rgba(29, 29, 31, .55));stroke-width:1.5;stroke-dasharray:4 3}.chart__axis-label[_ngcontent-%COMP%]{fill:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:12px;font-variant-numeric:tabular-nums}.chart__legend[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:.75rem;flex-wrap:wrap}.chart__legend-item[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:baseline}.chart__legend-swatch[_ngcontent-%COMP%]{width:10px;height:10px;border-radius:3px;align-self:center}.chart__legend-swatch--cost[_ngcontent-%COMP%]{background:var(--color-primary, #007aff)}.chart__legend-swatch--prompt[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.chart__legend-swatch--completion[_ngcontent-%COMP%]{background:var(--color-warning, #ff9500)}.chart__legend-swatch--tokens-missing[_ngcontent-%COMP%]{background:transparent;border:1px dashed var(--color-text-secondary, rgba(29, 29, 31, .55))}.chart__legend-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__legend-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}"]})};var X=class o{http=g(dy);getTokenUsage(t){let e=new Nt;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage",{params:e})}getTokenUsageSeries(t){let e=new Nt;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage/series",{params:e})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};function Pe(o){return `${o}`.padStart(2,"0")}function we(o){return `${o.getUTCFullYear()}-${Pe(o.getUTCMonth()+1)}-${Pe(o.getUTCDate())}`}function qe(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),1))}function Ke(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth()+1,1))}var J=class o{api=g(X);destroyRef=g(we$1);defaultFrom=we(qe());defaultTo=we(Ke());draftFilters=Hi({from:this.defaultFrom,to:this.defaultTo});appliedFilters=Hi({from:this.defaultFrom,to:this.defaultTo});loading=Hi(false);error=Hi(null);aggregation=Hi(null);seriesResponse=Hi(null);series=Hi(null);tokenDataPartial=Hi(false);aggregationByModelId=Hi(null);seriesByModelId=Hi(null);init(){this.reload();}setDraftFrom(t){this.draftFilters.update(e=>z$1(P({},e),{from:t}));}setDraftTo(t){this.draftFilters.update(e=>z$1(P({},e),{to:t}));}clearDraftFrom(){this.setDraftFrom(null);}clearDraftTo(){this.setDraftTo(null);}apply(){this.appliedFilters.set(this.draftFilters()),this.reload();}addNullableTokens(t,e){return t===null&&e===null?null:(t??0)+(e??0)}aggregateByModelId(t){let e=new Map;for(let n of t){let i=n.modelId,d=e.get(i);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(i,{agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0});}return [...e.values()].sort((n,i)=>(i.totalTokens??0)-(n.totalTokens??0))}aggregateSeriesByModelId(t){let e=new Map;for(let n of t){let i=`${n.date}|${n.modelId}`,d=e.get(i);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(i,{date:n.date,agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0});}return [...e.values()].sort((n,i)=>n.date<i.date?-1:1)}reload(){let{from:t,to:e}=this.appliedFilters();this.loading.set(true),this.error.set(null),By({aggregation:this.api.getTokenUsage({from:t,to:e}),series:this.api.getTokenUsageSeries({from:t,to:e})}).pipe(U(this.destroyRef)).subscribe({next:({aggregation:n,series:i})=>{this.aggregation.set(n),this.seriesResponse.set(i);let d=i.points??[];this.series.set(d),this.tokenDataPartial.set(n.tokenDataPartial||i.tokenDataPartial);let u=this.aggregateByModelId(n.models??[]);this.aggregationByModelId.set(u),this.seriesByModelId.set(this.aggregateSeriesByModelId(d)),this.loading.set(false);},error:n=>{this.loading.set(false),this.aggregation.set(null),this.seriesResponse.set(null),this.series.set(null),this.tokenDataPartial.set(false),this.aggregationByModelId.set(null),this.seriesByModelId.set(null),this.error.set(n instanceof Error?n.message:"Failed to load token usage");}});}static \u0275fac=function(e){return new(e||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var q=function(){throw new Error("DON'T USE this INSIDE A FUNCTION CALLED BY | call OR | apply IT MUST BE A PURE FUNCTION!")},De=typeof Proxy!="function"?Object.seal({}):new Proxy({},{get:q,set:q,deleteProperty:q,has:q}),K=class o{transform(t,e){if(typeof e!="function")throw new TypeError("You must pass a PURE function to | call");return e?.call(De,t)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=An({name:"call",type:o,pure:true})},Q=class o{transform(t,...e){if(typeof t!="function")throw new TypeError("You must use | apply on a PURE function");return t.apply(De,e)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=An({name:"apply",type:o,pure:true})};function Qe(o,t){o&1&&(vs(0,"div",23),WC(1," Partial data \u2014 token counts may not cover the full period "),fl());}function Ze(o,t){o&1&&(vs(0,"div",24),WC(1," No token data collected for this period "),fl());}function et(o,t){if(o&1&&(vs(0,"div",19)(1,"div",20)(2,"div",21),WC(3,"Total tokens"),fl(),vs(4,"div",22),WC(5),aT(6,"call"),fl()(),vs(7,"div",20)(8,"div",21),WC(9,"Total calls"),fl(),vs(10,"div",22),WC(11),fl()(),vs(12,"div",20)(13,"div",21),WC(14,"Total cost"),fl(),vs(15,"div",22),WC(16),aT(17,"apply"),fl()()(),eC(18,Qe,2,0,"div",23),eC(19,Ze,2,0,"div",24)),o&2){let e=mC();XE(5),Zg(lT(6,5,e.totalRow().totalTokens,e.formatTokenValue)),XE(6),Zg(e.totalRow().callCount),XE(5),Zg(dT(17,8,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)),XE(2),tC(e.isPartialPeriod()?18:-1),XE(),tC(e.isMissingPeriod()?19:-1);}}function tt(o,t){o&1&&(vs(0,"div",16)(1,"div",25),WC(2,"Loading token usage\u2026"),fl()());}function nt(o,t){if(o&1&&(vs(0,"div",17)(1,"div",26),WC(2,"Failed to load"),fl(),vs(3,"div",25),WC(4),fl()()),o&2){let e=mC();XE(4),Zg(e.state.error());}}function ot(o,t){o&1&&(vs(0,"div",16)(1,"div",26),WC(2,"No data"),fl(),vs(3,"div",25),WC(4,"No token usage recorded yet for this period."),fl()());}function at(o,t){if(o&1&&(vs(0,"div",32)(1,"div",29),WC(2),fl(),vs(3,"div",29),WC(4),fl(),vs(5,"div",29),WC(6),fl(),vs(7,"div",30),WC(8),aT(9,"call"),fl(),vs(10,"div",30),WC(11),aT(12,"call"),fl(),vs(13,"div",30),WC(14),aT(15,"call"),fl(),vs(16,"div",30),WC(17),fl(),vs(18,"div",30),WC(19),aT(20,"apply"),fl()()),o&2){let e=t.$implicit,n=mC(2);XE(2),Zg(e.agentName),XE(2),Zg(e.providerName),XE(2),Zg(e.modelId),XE(2),Zg(lT(9,8,e.promptTokens,n.formatTokenValue)),XE(3),Zg(lT(12,11,e.completionTokens,n.formatTokenValue)),XE(3),Zg(lT(15,14,e.totalTokens,n.formatTokenValue)),XE(3),Zg(e.callCount),XE(2),yl(" ",dT(20,17,n.formatCostValue,n.isMissingPeriod(),e.cost)," ");}}function it(o,t){if(o&1&&(vs(0,"div",33)(1,"div",29),WC(2),fl(),vs(3,"div",29),WC(4),fl(),vs(5,"div",29),WC(6),fl(),vs(7,"div",30),WC(8),aT(9,"call"),fl(),vs(10,"div",30),WC(11),aT(12,"call"),fl(),vs(13,"div",30),WC(14),aT(15,"call"),fl(),vs(16,"div",30),WC(17),fl(),vs(18,"div",30),WC(19),aT(20,"apply"),fl()()),o&2){let e=mC(2);XE(2),Zg(e.totalRow().agentName),XE(2),Zg(e.totalRow().providerName),XE(2),Zg(e.totalRow().modelId),XE(2),Zg(lT(9,8,e.totalRow().promptTokens,e.formatTokenValue)),XE(3),yl(" ",lT(12,11,e.totalRow().completionTokens,e.formatTokenValue)," "),XE(3),Zg(lT(15,14,e.totalRow().totalTokens,e.formatTokenValue)),XE(3),Zg(e.totalRow().callCount),XE(2),yl(" ",dT(20,17,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)," ");}}function rt(o,t){if(o&1&&(vs(0,"div",18)(1,"section",16)(2,"div",26),WC(3,"Summary"),fl(),vs(4,"div",27)(5,"div",28)(6,"div",29),WC(7,"agentName"),fl(),vs(8,"div",29),WC(9,"providerName"),fl(),vs(10,"div",29),WC(11,"modelId"),fl(),vs(12,"div",30),WC(13,"promptTokens"),fl(),vs(14,"div",30),WC(15,"completionTokens"),fl(),vs(16,"div",30),WC(17,"totalTokens"),fl(),vs(18,"div",30),WC(19,"callCount"),fl(),vs(20,"div",30),WC(21,"cost"),fl()(),vs(22,"div",31),oC(23,at,21,21,"div",32,Xw().trackRow,true),eC(25,it,21,21,"div",33),fl()()(),vs(26,"section",16)(27,"div",26),WC(28,"Daily series"),fl(),bg(29,"app-daily-series-chart",34),fl()()),o&2){let e=mC();XE(23),iC(e.rows()),XE(2),tC(e.totalRow()?25:-1),XE(4),Tg("points",e.chartPoints());}}var Ee="\u2014",Oe=class o{location=g(Sm);state=g(J);view=Hi("byModel");rowsByAgent=mT(()=>this.state.aggregation()?.models??[]);totalRow=mT(()=>this.state.aggregation()?.total??null);rowsByModel=mT(()=>this.state.aggregationByModelId()??[]);chartPointsByAgent=mT(()=>{let t=this.state.series()??[];return this.aggregateDailyPoints(t)});chartPointsByModel=mT(()=>{let t=this.state.seriesByModelId()??[];return this.aggregateDailyPoints(t)});chartPoints=mT(()=>this.view()==="byAgent"?this.chartPointsByAgent():this.chartPointsByModel());rows=mT(()=>this.view()==="byAgent"?this.rowsByAgent():this.rowsByModel());isEmpty=mT(()=>{let t=this.state.aggregation();return t?(t.models?.length??0)===0&&(t.total?.callCount??0)===0:false});ngOnInit(){this.state.init();}onFromChange(t){this.state.setDraftFrom(t||null);}onToChange(t){this.state.setDraftTo(t||null);}clearFrom(){this.state.clearDraftFrom();}clearTo(){this.state.clearDraftTo();}apply(){this.state.apply();}aggregateDailyPoints(t){let e=new Map;for(let n of t){let i=e.get(n.date);if(!i)e.set(n.date,{date:n.date,promptTokens:n.promptTokens,completionTokens:n.completionTokens,cost:n.cost??0,callCount:n.callCount??0});else {let d=(u,f)=>u===null&&f===null?null:(u??0)+(f??0);i.promptTokens=d(i.promptTokens,n.promptTokens),i.completionTokens=d(i.completionTokens,n.completionTokens),i.cost=(i.cost??0)+(n.cost??0),i.callCount=(i.callCount??0)+(n.callCount??0);}}return [...e.values()].sort((n,i)=>n.date<i.date?-1:1)}trackRow(t,e){return `${e.agentName}|${e.providerName}|${e.modelId}`}isMissingPeriod=mT(()=>{if(this.state.loading())return false;let t=this.state.aggregation()?.total;return t?t.totalTokens===null&&(t.cost===null||t.cost===void 0):false});isPartialPeriod=mT(()=>!this.isMissingPeriod()&&this.state.tokenDataPartial());navigateBack(){this.location.back();}formatTokenValue(t){return t===null?Ee:new Fb("en-US").transform(t,"1.0-2")??"0"}formatCostValue(t,e){return t?Ee:"$"+(new Fb("en-US").transform(e??0,"1.2-2")??"0.00")}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["app-token-usage"]],decls:41,vars:8,consts:[[1,"page"],[1,"page__header"],[1,"page__title-block"],["mat-icon-button","","title","Back",3,"click"],[1,"page__title"],[1,"page__subtitle"],[1,"filters"],[1,"filters__field"],[1,"filters__label"],[1,"filters__control"],["type","date",1,"filters__input",3,"ngModelChange","ngModel"],["type","button",1,"filters__clear",3,"click","disabled"],[1,"filters__select",3,"ngModelChange","ngModel"],["value","byModel"],["value","byAgent"],["type","button",1,"filters__apply",3,"click","disabled"],[1,"card"],[1,"card","card--error"],[1,"grid"],[1,"kpis"],[1,"kpi"],[1,"kpi__label"],[1,"kpi__value"],["title","Some calls in this period were recorded before token tracking was enabled. Token counts reflect only the portion where data was collected.",1,"hint"],["title","No token usage data was collected for this period.",1,"hint"],[1,"muted"],[1,"card__title"],[1,"table"],[1,"table__head"],[1,"table__cell"],[1,"table__cell","table__cell--num"],[1,"table__body"],[1,"table__row"],[1,"table__row","table__row--total"],[3,"points"]],template:function(e,n){e&1&&(vs(0,"section",0)(1,"header",1)(2,"div",2)(3,"button",3),Ag("click",function(){return n.navigateBack()}),vs(4,"mat-icon"),WC(5,"chevron_left"),fl()(),vs(6,"div")(7,"h1",4),WC(8,"Token Usage"),fl(),vs(9,"p",5),WC(10,"Track prompt and completion token usage by agent and model."),fl()()(),vs(11,"div",6)(12,"label",7)(13,"span",8),WC(14,"From"),fl(),vs(15,"div",9)(16,"input",10),Ag("ngModelChange",function(d){return n.onFromChange(d)}),fl(),HI(),vs(17,"button",11),Ag("click",function(){return n.clearFrom()}),WC(18," Clear "),fl()()(),vs(19,"label",7)(20,"span",8),WC(21,"To"),fl(),vs(22,"div",9)(23,"input",10),Ag("ngModelChange",function(d){return n.onToChange(d)}),fl(),HI(),vs(24,"button",11),Ag("click",function(){return n.clearTo()}),WC(25," Clear "),fl()()(),vs(26,"label",7)(27,"span",8),WC(28,"View"),fl(),vs(29,"select",12),Ag("ngModelChange",function(d){return n.view.set(d)}),vs(30,"option",13),WC(31,"By model"),fl(),vs(32,"option",14),WC(33,"By agent"),fl()(),HI(),fl(),vs(34,"button",15),Ag("click",function(){return n.apply()}),WC(35,"Apply"),fl()()(),eC(36,et,20,12),eC(37,tt,3,0,"div",16)(38,nt,5,1,"div",17)(39,ot,5,0,"div",16)(40,rt,30,2,"div",18),fl()),e&2&&(XE(16),Tg("ngModel",n.state.draftFilters().from),$I(),XE(),Tg("disabled",!n.state.draftFilters().from),XE(6),Tg("ngModel",n.state.draftFilters().to),$I(),XE(),Tg("disabled",!n.state.draftFilters().to),XE(5),Tg("ngModel",n.view()),$I(),XE(5),Tg("disabled",n.state.loading()),XE(2),tC(n.totalRow()?36:-1),XE(),tC(n.state.loading()?37:n.state.error()?38:n.isEmpty()?39:40));},dependencies:[ti,Qn,ei,Ye$1,At,Zn,cn,j,hr,Gn,yt,wt,K,Q],styles:[".page[_ngcontent-%COMP%]{padding:1.5rem;color:var(--color-text, #1d1d1f)}.page__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem;margin-bottom:1rem}.page__title-block[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem}.page__title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:650}.page__subtitle[_ngcontent-%COMP%]{margin:.25rem 0 0;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.95rem}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:flex-end;gap:.75rem}.filters__field[_ngcontent-%COMP%]{display:grid;gap:.25rem}.filters__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.filters__control[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.filters__input[_ngcontent-%COMP%], .filters__select[_ngcontent-%COMP%]{height:34px;padding:0 .5rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f)}.filters__apply[_ngcontent-%COMP%], .filters__clear[_ngcontent-%COMP%]{height:34px;padding:0 .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f);cursor:pointer}.kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin:.75rem 0 1rem}@media(max-width:900px){.kpis[_ngcontent-%COMP%]{grid-template-columns:1fr}}.kpi[_ngcontent-%COMP%]{border-radius:14px;padding:.75rem 1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.kpi__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.kpi__value[_ngcontent-%COMP%]{margin-top:.25rem;font-size:1.2rem;font-weight:650;font-variant-numeric:tabular-nums}.filters__apply[_ngcontent-%COMP%]{border-color:var(--color-primary, #007aff);background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff)}.filters__apply[_ngcontent-%COMP%]:disabled, .filters__clear[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1.5fr 1fr;gap:1rem;align-items:start}@media(max-width:1100px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.card[_ngcontent-%COMP%]{border-radius:14px;padding:1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.card--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.card__title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:.75rem}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.table[_ngcontent-%COMP%]{overflow-x:auto}.table__head[_ngcontent-%COMP%], .table__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 2fr 1fr 1fr 1fr .7fr 1fr;gap:.5rem;align-items:center}.table__head[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));padding:.25rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row[_ngcontent-%COMP%]{padding:.5rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row--total[_ngcontent-%COMP%]{font-weight:650;background:var(--color-bg-hover, rgba(0, 0, 0, .03));border-radius:10px;padding:.6rem .5rem;border-bottom:none;margin-top:.5rem}.table__cell[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.table__cell--num[_ngcontent-%COMP%]{text-align:right;font-variant-numeric:tabular-nums}.hint[_ngcontent-%COMP%]{margin:.25rem 0 1rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}"],changeDetection:1})};export{Oe as TokenUsageComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {bR as ma,a7 as ga,S as ha,cD as Rd}from'./main-OWIJUFFO.js';function i(t,o,p){return t.pipe(ma(()=>o().pipe(ga(()=>ha(p)))),Rd({bufferSize:1,refCount:true}))}export{i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-D7tJOrhH.js';import {m}from'./chunk-DDQLJIRS.js';import {g,ao as V$1,G as G$1,w as we,aI as Tr,bR as ma,Q as By,a7 as ga,S as ha,u as ue,b as U$1,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,W as WC,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-OWIJUFFO.js';import {W as Wn}from'./chunk-CHnP5DN-.js';import'./chunk-D1lFAnUU.js';import'./chunk-BOA9V0K7.js';import'./chunk-CzIfrMA5.js';var F=()=>[];function U(r,t){if(r&1){let o=dC();vs(0,"agentos-prompt-item",4),Ag("deleteRequested",function(n){If(o);let D=mC(2);return wf(D.deletePrompt(n))}),fl();}if(r&2){let o=mC().$implicit,e=mC();Tg("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function V(r,t){if(r&1&&eC(0,U,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=mC();tC((o=n.resolvePrompt(e.id))?0:-1,o);}}var j="platform",G="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);allPrompts$=this.refresh$.pipe(ma(()=>By({platform:this.promptState.listPlatform().pipe(ga(()=>ha([]))),namespace:this.promptState.listByNamespace(this.namespaceId)})));promptItems$=this.allPrompts$.pipe(ue(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:j,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe(({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:6,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return e.openCreateForm()}),vs(2,"button",2),Ag("click",function(){return e.goBack()}),WC(3,"\u2190 Namespaces"),fl()(),Dg(4,V,1,1,"ng-template",null,0,fT)),o&2){let n=TC(5);Tg("items",uT(1,3,e.promptItems$)??rT(5,F))("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Nb],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-wdkd9Gr0.js';import {v}from'./chunk-Bucs5HER.js';import {g,G,w as we,aI as Tr,bR as ma,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,W as WC,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-OWIJUFFO.js';import'./chunk-DDQLJIRS.js';import {W as Wn}from'./chunk-CHnP5DN-.js';import'./chunk-D1lFAnUU.js';import'./chunk-BOA9V0K7.js';import'./chunk-DbXjEO5o.js';import'./chunk-CzIfrMA5.js';var M=()=>[];function V(i,t){if(i&1){let e=dC();vs(0,"agentos-auth-setting-item",4),Ag("editRequested",function(n){If(e);let p=mC(2);return wf(p.onEdit(n))})("deleteRequested",function(n){If(e);let p=mC(2);return wf(p.onDelete(n))}),fl();}i&2&&Tg("config",t)("showBadge",false);}function F(i,t){if(i&1&&eC(0,V,1,2,"agentos-auth-setting-item",3),i&2){let e,o=t.$implicit,n=mC();tC((e=n.resolveSetting(o.id))?0:-1,e);}}var k=class i{router=g(G);destroyRef=g(we);state=g(v);refresh$=new Tr(void 0);settings$=this.refresh$.pipe(ma(()=>this.state.loadPlatformSettings()));settingItems$=this.settings$.pipe(ue(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe(t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.state.delete(t.id,"platform").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveSetting(t){return this.settingsById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:6,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"platform-auth-settings__back",3,"click"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,o){if(e&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return o.openCreateForm()}),vs(2,"button",2),Ag("click",function(){return o.goBack()}),WC(3,"\u2190 Admin"),fl()(),Dg(4,F,1,1,"ng-template",null,0,fT)),e&2){let n=TC(5);Tg("items",uT(1,3,o.settingItems$)??rT(5,M))("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,O,Nb],encapsulation:2})};export{k as PlatformAuthSettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bk as Mt,Y as x}from'./main-
|
|
1
|
+
import {g,bk as Mt,Y as x}from'./main-OWIJUFFO.js';var s=class n{snackBar=g(Mt);success(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]});}error(t,o=3e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]});}info(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]});}static \u0275fac=function(o){return new(o||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-DVdIFywU.js';import {g,G,w as we,d8 as M,aI as Tr,bR as ma,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-OWIJUFFO.js';import {W as Wn,S as Se}from'./chunk-CHnP5DN-.js';import'./chunk-D1lFAnUU.js';import'./chunk-BOA9V0K7.js';var S=()=>[];function F(n,t){if(n&1){let e=dC();vs(0,"agentos-agent-config-item",4),Ag("deleteRequested",function(o){If(e);let E=mC(2);return wf(E.deleteConfig(o))}),fl();}n&2&&Tg("config",t)("platformMode",true);}function L(n,t){if(n&1&&eC(0,F,1,2,"agentos-agent-config-item",3),n&2){let e,i=t.$implicit,o=mC();tC((e=o.resolveConfig(i.id))?0:-1,e);}}var D=class n{router=g(G);destroyRef=g(we);agentConfigController=g(M);refresh$=new Tr(void 0);configs$=this.refresh$.pipe(ma(()=>this.agentConfigController.listPlatformAgentsAgentConfig(true)));configItems$=this.configs$.pipe(ue(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.description}))));configsById=new Map;constructor(){this.configs$.pipe(U(this.destroyRef)).subscribe(t=>{this.configsById=new Map(t.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveConfig(t){return this.configsById.get(t)??null}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:5,vars:6,consts:[["agentConfigItemTpl",""],["title","Platform Agent Configs","emptyMessage","No platform agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"config","platformMode"],[3,"deleteRequested","config","platformMode"]],template:function(e,i){if(e&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return i.openCreateForm()}),vs(2,"ds-icon-button",2),Ag("action",function(){return i.goBack()}),fl()(),Dg(3,L,1,1,"ng-template",null,0,fT)),e&2){let o=TC(4);Tg("items",uT(1,3,i.configItems$)??rT(5,S))("showCreate",true)("itemTemplate",o);}},dependencies:[Wn,O,Se,Nb],styles:[".platform-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{D as PlatformAgentConfigsComponent};
|