@whoz-oss/coday-client 0.0.0-workstream-forge.299 → 0.0.0-workstream-forge.297

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.
Files changed (52) hide show
  1. package/browser/{chunk-CFmjVNMp.js → chunk-8XyNS78o.js} +1 -1
  2. package/browser/{chunk-DPfzD59Q.js → chunk-9l3CfInB.js} +1 -1
  3. package/browser/{chunk-Bu-j1i1F.js → chunk-9wvyLHuk.js} +1 -1
  4. package/browser/{chunk-Cv0bmOfa.js → chunk-B42ywiOW.js} +1 -1
  5. package/browser/{chunk-Btjxfsn3.js → chunk-B5JsB4XI.js} +1 -1
  6. package/browser/{chunk-DoX2Jqcx.js → chunk-BHTuNMop.js} +1 -1
  7. package/browser/{chunk-C6D03eC9.js → chunk-BIkPktdf.js} +1 -1
  8. package/browser/{chunk-DgKHoGIv.js → chunk-BJGcsBm7.js} +1 -1
  9. package/browser/{chunk-fHUER4U6.js → chunk-BM0VZISu.js} +1 -1
  10. package/browser/{chunk-CdkH2NKZ.js → chunk-BMhgEzMc.js} +1 -1
  11. package/browser/chunk-BNT94xkt.js +1 -0
  12. package/browser/{chunk-DdTCwg3n.js → chunk-BP7l1804.js} +1 -1
  13. package/browser/{chunk-C90nyg8k.js → chunk-BY4pYYCq.js} +3 -3
  14. package/browser/{chunk-C9QdIeaf.js → chunk-BZmi7l-J.js} +1 -1
  15. package/browser/{chunk-BAjpVi_E.js → chunk-BaXKtzjd.js} +1 -1
  16. package/browser/{chunk-B6gsrnkr.js → chunk-BibOnln8.js} +1 -1
  17. package/browser/{chunk-DCWDH_a0.js → chunk-BtTk4lBd.js} +1 -1
  18. package/browser/chunk-Bu0mFMKp.js +1 -0
  19. package/browser/{chunk-BEDwkVZi.js → chunk-Bvdz5sFR.js} +1 -1
  20. package/browser/{chunk-DDm3cabl.js → chunk-BweVOo8c.js} +1 -1
  21. package/browser/{chunk-Dhs29Flf.js → chunk-By5ToOHd.js} +1 -1
  22. package/browser/{chunk-DdMkHIw_.js → chunk-CBQlusyZ.js} +1 -1
  23. package/browser/{chunk-DrowH10V.js → chunk-CJ4vPhs4.js} +1 -1
  24. package/browser/{chunk-DOWY5FGX.js → chunk-CZLbKUEE.js} +1 -1
  25. package/browser/{chunk-C7KIJivU.js → chunk-CdBOn66B.js} +1 -1
  26. package/browser/{chunk-B8ShoQZU.js → chunk-ClvOUHzO.js} +1 -1
  27. package/browser/{chunk-DjLF6ZtY.js → chunk-Cqm5BJv_.js} +1 -1
  28. package/browser/chunk-DIe7xrW1.js +1 -0
  29. package/browser/{chunk-DxbOkoDc.js → chunk-DSwZ2lJp.js} +1 -1
  30. package/browser/{chunk-d4x3KbTe.js → chunk-DUQtHd5Q.js} +1 -1
  31. package/browser/{chunk-BjlPQNOw.js → chunk-DVwHMZjr.js} +1 -1
  32. package/browser/{chunk-kn6mevUy.js → chunk-DfkhqlKG.js} +1 -1
  33. package/browser/{chunk-BQZxl77C.js → chunk-Dh9AMc9f.js} +1 -1
  34. package/browser/{chunk-CiWU3c_P.js → chunk-DjrS7piD.js} +1 -1
  35. package/browser/{chunk-0xo7y4S1.js → chunk-Djrqlsja.js} +1 -1
  36. package/browser/{chunk-Nldlx5RO.js → chunk-DlUTCVia.js} +1 -1
  37. package/browser/{chunk-DD2v7fvf.js → chunk-Dp8Qtax9.js} +1 -1
  38. package/browser/{chunk-Dly3kfft.js → chunk-DvDLDjpo.js} +1 -1
  39. package/browser/{chunk-DKBlG8bB.js → chunk-Dwi6o0t0.js} +1 -1
  40. package/browser/{chunk-D6VG9tfL.js → chunk-EV6Gb91d.js} +1 -1
  41. package/browser/{chunk-BYBwATcv.js → chunk-GlRgl5dB.js} +1 -1
  42. package/browser/{chunk-BAPa85aK.js → chunk-QA5UvRgp.js} +1 -1
  43. package/browser/{chunk-CNsf98BP.js → chunk-h1DwHzOw.js} +1 -1
  44. package/browser/{chunk-BJt9W1KJ.js → chunk-hSQhyXAK.js} +1 -1
  45. package/browser/{chunk-CYuC3k-F.js → chunk-nfwj1uBg.js} +1 -1
  46. package/browser/{chunk-bT43nx1T.js → chunk-zOYWk0nL.js} +1 -1
  47. package/browser/index.html +2 -2
  48. package/browser/{main-EE6GZH3K.js → main-WIKPRSWZ.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-BlhyPwlI.js +0 -1
  51. package/browser/chunk-Cuut2fuQ.js +0 -1
  52. package/browser/chunk-DizwKPR4.js +0 -1
@@ -1 +1 @@
1
- import {S}from'./chunk-C90nyg8k.js';import {x as xw,Y as br,I as Is,U as UC,m as ml,a as hg,R as pg}from'./main-EE6GZH3K.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=xw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Is(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),UC(3,"Platform"),ml(),Is(4,"span",2),UC(5,"/"),ml(),Is(6,"span"),UC(7,"Administration"),ml()(),hg(8,"router-outlet"),ml()),e&2&&pg("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
1
+ import {S}from'./chunk-BY4pYYCq.js';import {x as xw,Y as br,I as Is,U as UC,m as ml,a as hg,R as pg}from'./main-WIKPRSWZ.js';var c=class a{groups=[{label:"Access",items:[{label:"Users & Groups",commands:["users"]},{label:"Auth settings",commands:["auth-settings"]}]},{label:"Connections",items:[{label:"Platform integrations",commands:["integration-configs"]}]},{label:"AI",items:[{label:"Platform agents",commands:["agent-configs"]},{label:"Platform AI providers",commands:["ai-providers"]},{label:"Platform AI models",commands:["ai-models"]},{label:"Platform skills",commands:["skills"]},{label:"Platform prompts",commands:["prompts"]}]},{label:"Automation",items:[{label:"Scheduled prompts",commands:["scheduled-prompts"]},{label:"Tool invoke",commands:["tool-invoke"]}]},{label:"System",items:[{label:"Configuration",commands:["configuration"]}]}];static \u0275fac=function(e){return new(e||a)};static \u0275cmp=xw({type:a,selectors:[["agentos-admin-settings-layout"]],decls:9,vars:1,consts:[["title","Admin \xB7 Configuration","mark","A","navigationLabel","Admin settings",3,"groups"],["settingsBreadcrumb","","aria-label","Breadcrumb"],["aria-hidden","true"]],template:function(e,g){e&1&&(Is(0,"agentos-settings-layout",0)(1,"nav",1)(2,"span"),UC(3,"Platform"),ml(),Is(4,"span",2),UC(5,"/"),ml(),Is(6,"span"),UC(7,"Administration"),ml()(),hg(8,"router-outlet"),ml()),e&2&&pg("groups",g.groups);},dependencies:[br,S],styles:["nav[settingsBreadcrumb][_ngcontent-%COMP%]{display:flex;gap:8px;align-items:center}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-accent-700);text-decoration:none}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover{text-decoration:underline}nav[settingsBreadcrumb][_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px}"]})};export{c as AdminSettingsLayoutComponent};
@@ -1,2 +1,2 @@
1
- import {I}from'./chunk-DPfzD59Q.js';import {g,W,a_ as L,H as we,z as zi,k as yT,a$ as Ne,ac as Ny,M as U,a2 as ga,aa as _r,x as xw,I as Is,a as hg,Q as Qw,m as ml,S as Eg,K as KE,b as Kw,R as pg,U as UC,s as aC,T as VI,l as eC,r as fC,X as UI,t as tC,q as Il,as as jg,u as mf,w as yf,L as Lg}from'./main-EE6GZH3K.js';import {a6 as gd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,c as fo,a8 as _a,ac as Bi,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-C90nyg8k.js';import'./chunk-Cuut2fuQ.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Is(0,"p",1),UC(1,"Loading\u2026"),ml());}function se(i,t){if(i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function re(i,t){if(i&1){let e=aC();Is(0,"div")(1,"button",23),Eg("click",function(){mf(e);let s=fC(2);return yf(s.retryLoad())}),UC(2,"Retry loading"),ml()();}}function ce(i,t){if(i&1&&(hg(0,"br"),UC(1)),i&2){let e=fC(3);KE(),Il("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Is(0,"ds-notice",3),UC(1),Qw(2,ce,2,1),ml()),i&2){let e=fC(2);pg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),KE(),Il(" Repository: ",e.checkoutStatus()," "),KE(),Kw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Is(0,"option",12),UC(1),ml()),i&2){let e=t.$implicit,c=fC(2);pg("value",e.id),KE(),jg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Is(0,"p",13),UC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),ml());}function pe(i,t){if(i&1){let e=aC();Is(0,"button",24),Eg("click",function(){mf(e);let s=fC(2);return yf(s.remove())}),UC(1," Remove association "),ml();}if(i&2){let e=fC(2);pg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=aC();Qw(0,se,2,1,"ds-notice"),Qw(1,re,3,0,"div"),Qw(2,de,3,3,"ds-notice",3),Is(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.repositoryUrl.set(s))}),ml(),VI(),ml(),Is(6,"ds-form-field",7)(7,"input",8),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.mainBranch.set(s))}),ml(),VI(),ml(),Is(8,"ds-form-field",9)(9,"select",10),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.serviceAuthSettingId.set(s))}),Is(10,"option",11),UC(11,"Select an auth setting\u2026"),ml(),eC(12,le,2,3,"option",12,oe),ml(),VI(),Qw(14,me,2,0,"p",13),ml()(),Is(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.autoWorktree.set(s))}),ml(),VI(),UC(19," Offer a worktree to every new top-level case "),ml(),Is(20,"p",18),UC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),ml()(),Is(22,"ds-form-field",19)(23,"input",20),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.setupCommand.set(s))}),ml(),VI(),Is(24,"p",13),UC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),ml()()(),Is(26,"ds-form-actions")(27,"button",21),Eg("click",function(){mf(e);let s=fC();return yf(s.save())}),UC(28),ml(),Qw(29,pe,2,1,"button",22),ml();}if(i&2){let e=fC();Kw(e.errorMessage()?0:-1),KE(),Kw(e.associationLoaded()?-1:1),KE(),Kw(e.isAssociated()&&e.checkoutStatus()?2:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(2),pg("ngModel",e.repositoryUrl()),UI(),KE(2),pg("ngModel",e.mainBranch()),UI(),KE(2),pg("ngModel",e.serviceAuthSettingId()),UI(),KE(3),tC(e.eligibleAuthSettings()),KE(2),Kw(e.eligibleAuthSettings().length===0?14:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(3),pg("ngModel",e.autoWorktree()),UI(),KE(5),pg("ngModel",e.setupCommand()),UI(),KE(4),pg("disabled",!e.canSave()),KE(),Il(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),KE(),Kw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(we);isLoading=zi(true);isSaving=zi(false);confirmingRemove=zi(false);associationLoaded=zi(false);errorMessage=zi(null);association=zi(null);authSettings=zi([]);repositoryUrl=zi("");mainBranch=zi("main");serviceAuthSettingId=zi("");autoWorktree=zi(false);setupCommand=zi("");namespaceId="";isAssociated=yT(()=>this.association()?.associated===true);eligibleAuthSettings=yT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=yT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=yT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Ne;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ny({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Qw(2,ae,2,0,"p",1)(3,ue,30,14),ml(),Is(4,"ds-confirm-dialog",2),Eg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),ml()),e&2&&(KE(2),Kw(c.isLoading()?2:3),KE(2),pg("open",c.confirmingRemove()));},dependencies:[gd,Mo,Do,Ut,Mn,Qt,fo,_a,Bi,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};
1
+ import {I}from'./chunk-9l3CfInB.js';import {g,W,aX as L,H as we,z as zi,k as yT,aY as Ne,ac as Ny,M as U,a2 as ga,aa as _r,x as xw,I as Is,a as hg,Q as Qw,m as ml,S as Eg,K as KE,b as Kw,R as pg,U as UC,s as aC,T as VI,l as eC,r as fC,X as UI,t as tC,q as Il,as as jg,u as mf,w as yf,L as Lg}from'./main-WIKPRSWZ.js';import {a6 as gd,M as Mo,D as Do,U as Ut,o as Mn,Q as Qt,c as fo,a8 as _a,ac as Bi,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-BY4pYYCq.js';import'./chunk-BNT94xkt.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Is(0,"p",1),UC(1,"Loading\u2026"),ml());}function se(i,t){if(i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function re(i,t){if(i&1){let e=aC();Is(0,"div")(1,"button",23),Eg("click",function(){mf(e);let s=fC(2);return yf(s.retryLoad())}),UC(2,"Retry loading"),ml()();}}function ce(i,t){if(i&1&&(hg(0,"br"),UC(1)),i&2){let e=fC(3);KE(),Il("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Is(0,"ds-notice",3),UC(1),Qw(2,ce,2,1),ml()),i&2){let e=fC(2);pg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),KE(),Il(" Repository: ",e.checkoutStatus()," "),KE(),Kw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Is(0,"option",12),UC(1),ml()),i&2){let e=t.$implicit,c=fC(2);pg("value",e.id),KE(),jg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Is(0,"p",13),UC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),ml());}function pe(i,t){if(i&1){let e=aC();Is(0,"button",24),Eg("click",function(){mf(e);let s=fC(2);return yf(s.remove())}),UC(1," Remove association "),ml();}if(i&2){let e=fC(2);pg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=aC();Qw(0,se,2,1,"ds-notice"),Qw(1,re,3,0,"div"),Qw(2,de,3,3,"ds-notice",3),Is(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.repositoryUrl.set(s))}),ml(),VI(),ml(),Is(6,"ds-form-field",7)(7,"input",8),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.mainBranch.set(s))}),ml(),VI(),ml(),Is(8,"ds-form-field",9)(9,"select",10),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.serviceAuthSettingId.set(s))}),Is(10,"option",11),UC(11,"Select an auth setting\u2026"),ml(),eC(12,le,2,3,"option",12,oe),ml(),VI(),Qw(14,me,2,0,"p",13),ml()(),Is(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.autoWorktree.set(s))}),ml(),VI(),UC(19," Offer a worktree to every new top-level case "),ml(),Is(20,"p",18),UC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),ml()(),Is(22,"ds-form-field",19)(23,"input",20),Eg("ngModelChange",function(s){mf(e);let u=fC();return yf(u.setupCommand.set(s))}),ml(),VI(),Is(24,"p",13),UC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),ml()()(),Is(26,"ds-form-actions")(27,"button",21),Eg("click",function(){mf(e);let s=fC();return yf(s.save())}),UC(28),ml(),Qw(29,pe,2,1,"button",22),ml();}if(i&2){let e=fC();Kw(e.errorMessage()?0:-1),KE(),Kw(e.associationLoaded()?-1:1),KE(),Kw(e.isAssociated()&&e.checkoutStatus()?2:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(2),pg("ngModel",e.repositoryUrl()),UI(),KE(2),pg("ngModel",e.mainBranch()),UI(),KE(2),pg("ngModel",e.serviceAuthSettingId()),UI(),KE(3),tC(e.eligibleAuthSettings()),KE(2),Kw(e.eligibleAuthSettings().length===0?14:-1),KE(),pg("disabled",!e.associationLoaded()||e.isSaving()),KE(3),pg("ngModel",e.autoWorktree()),UI(),KE(5),pg("ngModel",e.setupCommand()),UI(),KE(4),pg("disabled",!e.canSave()),KE(),Il(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),KE(),Kw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(I);destroyRef=g(we);isLoading=zi(true);isSaving=zi(false);confirmingRemove=zi(false);associationLoaded=zi(false);errorMessage=zi(null);association=zi(null);authSettings=zi([]);repositoryUrl=zi("");mainBranch=zi("main");serviceAuthSettingId=zi("");autoWorktree=zi(false);setupCommand=zi("");namespaceId="";isAssociated=yT(()=>this.association()?.associated===true);eligibleAuthSettings=yT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=yT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=yT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Ne;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ny({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ga(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),_r(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Qw(2,ae,2,0,"p",1)(3,ue,30,14),ml(),Is(4,"ds-confirm-dialog",2),Eg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),ml()),e&2&&(KE(2),Kw(c.isLoading()?2:3),KE(2),pg("open",c.confirmingRemove()));},dependencies:[gd,Mo,Do,Ut,Mn,Qt,fo,_a,Bi,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};
2
2
  export{ne as NamespaceGitComponent};
@@ -1 +1 @@
1
- import {g,aN as ue,a6 as A}from'./main-EE6GZH3K.js';var o=class r{skillController=g(ue);getById(l){return this.skillController.getByIdSkill(l)}listPlatform(){return this.skillController.listPlatformSkill()}listByNamespace(l){return this.skillController.listByParentSkill(l)}listEffective(l){return this.skillController.listEffectiveSkill(l)}create(l){return this.skillController.createSkill(l)}update(l,e){return this.skillController.updateSkill(l,e)}delete(l){return this.skillController.deleteSkill(l)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
1
+ import {g,aK as ue,a6 as A}from'./main-WIKPRSWZ.js';var o=class r{skillController=g(ue);getById(l){return this.skillController.getByIdSkill(l)}listPlatform(){return this.skillController.listPlatformSkill()}listByNamespace(l){return this.skillController.listByParentSkill(l)}listEffective(l){return this.skillController.listEffectiveSkill(l)}create(l){return this.skillController.createSkill(l)}update(l,e){return this.skillController.updateSkill(l,e)}delete(l){return this.skillController.deleteSkill(l)}static \u0275fac=function(e){return new(e||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{o};
@@ -1,2 +1,2 @@
1
- import {I,n as nt,i as it}from'./chunk-DPfzD59Q.js';import {v}from'./chunk-BYBwATcv.js';import {g,W,F,H as we,z as zi,a9 as F$1,k as yT,p as Ff,M as U,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,s as aC,l as eC,ao as Jw,T as VI,a as hg,r as fC,X as UI,t as tC,q as Il,ae as Zw,L as Lg,j as fg,u as mf,w as yf}from'./main-EE6GZH3K.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-C90nyg8k.js';import'./chunk-Cuut2fuQ.js';function Ce(i,t){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ye(i,t){if(i&1&&(Is(0,"label",16),hg(1,"input",17),VI(),UC(2),ml()),i&2){let e=t.$implicit,n=fC(3);KE(),pg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),KE(),Il(" ",e.label," ");}}function ge(i,t){if(i&1&&(Is(0,"ds-fieldset",5),eC(1,ye,3,4,"label",16,Zw().trackByScope,true),ml()),i&2){let e=fC(2);pg("disabled",e.isEditMode()),KE(),tC(e.scopeOptions);}}function fe(i,t){if(i&1&&(Is(0,"option",8),UC(1),ml()),i&2){let e=t.$implicit,n=fC(2);pg("value",e),KE(),Lg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Is(0,"ds-form-field",18),hg(1,"input",19),VI(),ml()),i&2){let e=fC().$implicit;pg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),KE(),pg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),fg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI();}}function Ae(i,t){if(i&1&&Qw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=fC(3);Kw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Is(0,"ds-fieldset",13),eC(1,Ae,1,1,null,null,Zw().trackByField,true),ml()),i&2){let e=fC(2);pg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),KE(),tC(e.credentialFields());}}function be(i,t){if(i&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let o=fC();return yf(o.submit())}),Qw(1,ge,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),eC(4,fe,2,2,"option",8,Jw),ml(),VI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),VI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),VI(),ml(),Qw(10,ve,3,1,"ds-fieldset",13),Is(11,"ds-form-actions")(12,"button",14),UC(13),ml(),Is(14,"button",15),Eg("click",function(){mf(e);let o=fC();return yf(o.cancel())}),UC(15,"Cancel"),ml()()();}if(i&2){let e=fC();pg("formGroup",e.form),KE(),Kw(e.isPlatformMode?-1:1),KE(2),pg("formControl",e.authTypeControl),UI(),KE(),tC(e.authTypeOptions),KE(3),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.credentialFields().length>0?10:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={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}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=yT(()=>_e[this.selectedAuthType()]);isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Ff(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.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,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;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,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{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=xw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Auth settings "),ml()(),Qw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),ml()),e&2&&(KE(),pg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),KE(3),Kw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
1
+ import {I,n as nt,i as it}from'./chunk-9l3CfInB.js';import {v}from'./chunk-GlRgl5dB.js';import {g,W,F,H as we,z as zi,a9 as F$1,k as yT,p as Ff,M as U,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,s as aC,l as eC,ao as Jw,T as VI,a as hg,r as fC,X as UI,t as tC,q as Il,ae as Zw,L as Lg,j as fg,u as mf,w as yf}from'./main-WIKPRSWZ.js';import {T as Te,b as bn,p as pt,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,n as cn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,C as Ca,c as fo,g as go,N as Nn,R as Rn}from'./chunk-BY4pYYCq.js';import'./chunk-BNT94xkt.js';function Ce(i,t){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ye(i,t){if(i&1&&(Is(0,"label",16),hg(1,"input",17),VI(),UC(2),ml()),i&2){let e=t.$implicit,n=fC(3);KE(),pg("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),UI(),KE(),Il(" ",e.label," ");}}function ge(i,t){if(i&1&&(Is(0,"ds-fieldset",5),eC(1,ye,3,4,"label",16,Zw().trackByScope,true),ml()),i&2){let e=fC(2);pg("disabled",e.isEditMode()),KE(),tC(e.scopeOptions);}}function fe(i,t){if(i&1&&(Is(0,"option",8),UC(1),ml()),i&2){let e=t.$implicit,n=fC(2);pg("value",e),KE(),Lg(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Is(0,"ds-form-field",18),hg(1,"input",19),VI(),ml()),i&2){let e=fC().$implicit;pg("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),KE(),pg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),fg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI();}}function Ae(i,t){if(i&1&&Qw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=fC(3);Kw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Is(0,"ds-fieldset",13),eC(1,Ae,1,1,null,null,Zw().trackByField,true),ml()),i&2){let e=fC(2);pg("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),KE(),tC(e.credentialFields());}}function be(i,t){if(i&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let o=fC();return yf(o.submit())}),Qw(1,ge,3,1,"ds-fieldset",5),Is(2,"ds-form-field",6)(3,"select",7),eC(4,fe,2,2,"option",8,Jw),ml(),VI(),ml(),Is(6,"ds-form-field",9),hg(7,"input",10),VI(),ml(),Is(8,"ds-form-field",11),hg(9,"input",12),VI(),ml(),Qw(10,ve,3,1,"ds-fieldset",13),Is(11,"ds-form-actions")(12,"button",14),UC(13),ml(),Is(14,"button",15),Eg("click",function(){mf(e);let o=fC();return yf(o.cancel())}),UC(15,"Cancel"),ml()()();}if(i&2){let e=fC();pg("formGroup",e.form),KE(),Kw(e.isPlatformMode?-1:1),KE(2),pg("formControl",e.authTypeControl),UI(),KE(),tC(e.authTypeOptions),KE(3),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.credentialFields().length>0?10:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={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}]},me=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?zi(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[bn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=yT(()=>_e[this.selectedAuthType()]);isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Ff(()=>{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,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.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,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;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,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{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=xw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Auth settings "),ml()(),Qw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),ml()),e&2&&(KE(),pg("title",n.isEditMode()?"Edit auth setting":"New auth setting"),KE(3),Kw(n.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,cn,Kt,fd,Mo,Do,Ut,Qt,Ca,fo,go,Nn,Rn],encapsulation:2})};
2
2
  export{me as AuthSettingFormComponent};
@@ -0,0 +1 @@
1
+ import {w as m,p as pt,W as Wt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,Q as Qt,c as fo,g as go,N as Nn,R as Rn,E as Ea,x as yo,z as bo,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un}from'./chunk-BY4pYYCq.js';import {g,W,F,H as we,ag as U,z as zi,M as U$1,a2 as ga,aa as _r,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,q as Il,b as Kw,s as aC,a as hg,T as VI,l as eC,am as Xw,r as fC,X as UI,L as Lg,t as tC,j as fg,u as mf,w as yf}from'./main-WIKPRSWZ.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function fe(o,t){if(o&1&&(Is(0,"ds-form-field",20),hg(1,"input",22),ml()),o&2){let e=fC(3);KE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Is(0,"option",24),UC(1),ml()),o&2){let e=t.$implicit;pg("ngValue",e.id),KE(),Lg(e.name);}}function Ce(o,t){if(o&1&&(Is(0,"ds-form-field",21)(1,"select",23)(2,"option",24),UC(3,"\u2014 None \u2014"),ml(),eC(4,ge,2,2,"option",24,ce),ml(),VI(),ml()),o&2){let e=fC(3);KE(),pg("formControl",e.agentConfigIdControl),UI(),KE(),pg("ngValue",null),KE(2),tC(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Qw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=fC(2);Kw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Is(0,"p",2),UC(1,"No parameters defined."),ml());}function he(o,t){if(o&1){let e=aC();Is(0,"div",11)(1,"div",25)(2,"ds-form-field",26),hg(3,"input",27),VI(),ml(),Is(4,"ds-form-field",28),hg(5,"input",29),VI(),ml(),Is(6,"ds-form-field",30),hg(7,"input",31),VI(),ml()(),Is(8,"button",32),Eg("click",function(){let d=mf(e).$index,m=fC(2);return yf(m.removeParameter(d))}),UC(9," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index;pg("formGroupName",r),KE(2),pg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),KE(),pg("id","param-name-"+r),UI(),KE(),pg("controlId","param-desc-"+r),KE(),pg("id","param-desc-"+r),UI(),KE(),pg("controlId","param-default-"+r),KE(),pg("id","param-default-"+r),UI();}}function _e(o,t){if(o&1){let e=aC();Is(0,"div",14)(1,"span",33),UC(2),ml(),Is(3,"ds-form-field",34),hg(4,"textarea",35),VI(),ml(),Is(5,"button",36),Eg("click",function(){let d=mf(e).$index,m=fC(2);return yf(m.removeContentEntry(d))}),UC(6," \xD7 "),ml()();}if(o&2){let e=t.$implicit,r=t.$index,d=fC(2);KE(2),Lg(r+1),KE(),pg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),KE(),pg("formControlName",r),fg("aria-label","Content entry "+(r+1)),UI(),KE(),pg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Is(0,"ds-notice"),UC(1),ml()),o&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function be(o,t){if(o&1){let e=aC();Is(0,"button",37),Eg("click",function(){mf(e);let d=fC(2);return yf(d.exportYaml())}),UC(1),ml();}if(o&2){let e=fC(2);pg("disabled",e.isExporting()),KE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let d=fC();return yf(d.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),VI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),VI(),ml(),Qw(5,ye,2,1),Is(6,"ds-fieldset",9)(7,"p",2),UC(8," Each parameter must have a name and a default value. Use "),Is(9,"code"),UC(10),ml(),UC(11," in content entries to reference them. "),ml(),Is(12,"div",10),Qw(13,ve,2,0,"p",2),eC(14,he,10,8,"div",11,Xw),Is(16,"div")(17,"button",12),Eg("click",function(){mf(e);let d=fC();return yf(d.addParameter())}),UC(18,"+ Add parameter"),ml()()()(),Is(19,"ds-fieldset",13)(20,"p",2),UC(21," Each content entry is a command. Use "),Is(22,"code"),UC(23,"@AgentName"),ml(),UC(24," to target an agent, "),Is(25,"code"),UC(26,"/promptName param1 param2"),ml(),UC(27," to call another prompt, and "),Is(28,"code"),UC(29),ml(),UC(30," for parameter placeholders. "),ml(),Is(31,"div",10),eC(32,_e,7,5,"div",14,Xw),Is(34,"div")(35,"button",12),Eg("click",function(){mf(e);let d=fC();return yf(d.addContentEntry())}),UC(36,"+ Add content entry"),ml()()()(),Qw(37,xe,2,1,"ds-notice"),Is(38,"ds-form-field",15),hg(39,"textarea",16),VI(),ml(),Is(40,"ds-form-actions")(41,"button",17),UC(42),ml(),Qw(43,be,2,2,"button",18),Is(44,"button",19),Eg("click",function(){mf(e);let d=fC();return yf(d.cancel())}),UC(45,"Cancel"),ml()()();}if(o&2){let e=fC();pg("formGroup",e.form),KE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),KE(),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.availableAgentConfigs().length>0?5:-1),KE(5),Lg(e.paramPlaceholderSyntax),KE(2),pg("formArrayName","parameters"),KE(),Kw(e.parametersArray.length===0?13:-1),KE(),tC(e.parametersArray.controls),KE(15),Lg(e.paramPlaceholderSyntax),KE(2),pg("formArrayName","content"),KE(),tC(e.contentArray.controls),KE(5),Kw(e.errorMessage()?37:-1),KE(),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),KE(),pg("formControl",e.externalMetadataJsonControl),UI(),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," "),KE(),Kw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Wt([this.createContentControl()],{validators:[bn.required]}),parameters:new Wt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);errorMessage=zi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=zi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ga(()=>_r([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ga(()=>_r([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[bn.required,bn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[bn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.cancel()}),UC(3),ml()(),Qw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),ml()),e&2&&(KE(),pg("title",r.isEditMode()?"Edit prompt":"New prompt"),KE(2),Il(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),KE(),Kw(r.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Nn,Rn,Ea,yo,bo,vn,yn,fn,pn,hn,_n,at,un],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1 +1 @@
1
- import {q as k$2,O,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-C90nyg8k.js';import {g,F,H as we,ap as k$1,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,s as aC,j as fg,u as mf,w as yf}from'./main-EE6GZH3K.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Is(0,"p",3),UC(1),ml()),i&2){let t=fC();KE(),Lg(t.deletion.error());}}function U(i,e){i&1&&(Is(0,"p",4),UC(1,"Loading AI providers\u2026"),ml());}function j(i,e){i&1&&(Is(0,"p",5),UC(1,"No platform AI providers defined yet."),ml());}function K(i,e){i&1&&(Is(0,"p",4),UC(1,"No AI providers match the current filter."),ml());}function H(i,e){if(i&1){let t=aC();Is(0,"button",19),Eg("click",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.edit(s))}),UC(1," Edit "),ml();}if(i&2){let t=fC().$implicit;fg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=aC();Is(0,"agentos-row-delete-action",20),Eg("deleteRequested",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.deletion.request(s.id))})("deleteConfirmed",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=fC(3);return yf(s.deletion.cancel())}),ml();}if(i&2){let t=fC().$implicit,r=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14),UC(6),ml(),Is(7,"td",15)(8,"div",16),Qw(9,H,2,1,"button",17),Qw(10,z,1,3,"agentos-row-delete-action",18),ml()()()),i&2){let t=e.$implicit,r=fC(2);KE(2),Lg(t.name),KE(2),Lg(t.apiType),KE(2),Lg(t.baseUrl||"\u2014"),KE(3),Kw(r.deletion.confirmingId()!==t.id?9:-1),KE(),Kw(t.id?10:-1);}}function J(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"API type"),ml(),Is(8,"th",10),UC(9,"Base URL"),ml(),Is(10,"th",10)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,G,11,5,"tr",9,B),ml()()()),i&2){let t=fC();KE(14),tC(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(we);aiProviderController=g(k$1);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$2();providers=zi([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return r.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),UC(3,"New AI provider"),ml()(),Qw(4,M,2,1,"p",3),Qw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(KE(),pg("query",r.rowFilter.query()),KE(3),Kw(r.deletion.error()?4:-1),KE(),Kw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};
1
+ import {q as k$2,O,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-BY4pYYCq.js';import {g,F,H as we,ap as k$1,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,s as aC,j as fg,u as mf,w as yf}from'./main-WIKPRSWZ.js';var B=(i,e)=>e.id??e.name;function M(i,e){if(i&1&&(Is(0,"p",3),UC(1),ml()),i&2){let t=fC();KE(),Lg(t.deletion.error());}}function U(i,e){i&1&&(Is(0,"p",4),UC(1,"Loading AI providers\u2026"),ml());}function j(i,e){i&1&&(Is(0,"p",5),UC(1,"No platform AI providers defined yet."),ml());}function K(i,e){i&1&&(Is(0,"p",4),UC(1,"No AI providers match the current filter."),ml());}function H(i,e){if(i&1){let t=aC();Is(0,"button",19),Eg("click",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.edit(s))}),UC(1," Edit "),ml();}if(i&2){let t=fC().$implicit;fg("aria-label","Edit "+t.name);}}function z(i,e){if(i&1){let t=aC();Is(0,"agentos-row-delete-action",20),Eg("deleteRequested",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.deletion.request(s.id))})("deleteConfirmed",function(){mf(t);let s=fC().$implicit,m=fC(2);return yf(m.confirmDelete(s))})("deleteCancelled",function(){mf(t);let s=fC(3);return yf(s.deletion.cancel())}),ml();}if(i&2){let t=fC().$implicit,r=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",r.deletion);}}function G(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14),UC(6),ml(),Is(7,"td",15)(8,"div",16),Qw(9,H,2,1,"button",17),Qw(10,z,1,3,"agentos-row-delete-action",18),ml()()()),i&2){let t=e.$implicit,r=fC(2);KE(2),Lg(t.name),KE(2),Lg(t.apiType),KE(2),Lg(t.baseUrl||"\u2014"),KE(3),Kw(r.deletion.confirmingId()!==t.id?9:-1),KE(),Kw(t.id?10:-1);}}function J(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"API type"),ml(),Is(8,"th",10),UC(9,"Base URL"),ml(),Is(10,"th",10)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,G,11,5,"tr",9,B),ml()()()),i&2){let t=fC();KE(14),tC(t.rowFilter.filteredRows());}}var k=class i{router=g(F);destroyRef=g(we);aiProviderController=g(k$1);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k$2();providers=zi([]);rowFilter=O(this.providers,e=>[e.name,e.apiType,e.baseUrl].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.aiProviderController.listAiProvider("none"))),U$1(this.destroyRef)).subscribe({next:e=>{this.providers.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.aiProviderController.deleteAiProvider(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-platform-ai-providers"]],decls:9,vars:3,consts:[["title","Platform AI providers","description","AI providers shared across every namespace."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type"],["role","cell","data-label","Base URL",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return r.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),UC(3,"New AI provider"),ml()(),Qw(4,M,2,1,"p",3),Qw(5,U,2,0,"p",4)(6,j,2,0,"p",5)(7,K,2,0,"p",4)(8,J,16,0,"div",6)),t&2&&(KE(),pg("query",r.rowFilter.query()),KE(3),Kw(r.deletion.error()?4:-1),KE(),Kw(r.isLoading()?5:r.providers().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{k as PlatformAiProvidersComponent};
@@ -1 +1 @@
1
- import {i}from'./chunk-Cuut2fuQ.js';import {y}from'./chunk-C90nyg8k.js';import {g as g$1,ap as k,$ as Sr,at as _y,a1 as ma,a2 as ga,aa as _r,ad as ne,aF as Jy,a5 as Ed,O as w,a6 as A}from'./main-EE6GZH3K.js';var g="none",N="me",O=class p{nsController=g$1(k);userState=g$1(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([e])=>{let r=this.loadPlatformProviders().pipe(ga(()=>_r([])));return e?_y([r,this.loadNamespaceProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):_y([r,this.loadNamespaceProviders("").pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Jy({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):_r([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Ed(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Ed(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Ed(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Ed(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=A({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
1
+ import {i}from'./chunk-BNT94xkt.js';import {y}from'./chunk-BY4pYYCq.js';import {g as g$1,ap as k,$ as Sr,at as _y,a1 as ma,a2 as ga,aa as _r,ad as ne,aC as Jy,a5 as Ed,O as w,a6 as A}from'./main-WIKPRSWZ.js';var g="none",N="me",O=class p{nsController=g$1(k);userState=g$1(y);refresh$=new Sr(void 0);namespaceId$=new Sr(null);vm$=_y([this.namespaceId$,this.refresh$]).pipe(ma(([e])=>{let r=this.loadPlatformProviders().pipe(ga(()=>_r([])));return e?_y([r,this.loadNamespaceProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders(e).pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):_y([r,this.loadNamespaceProviders("").pipe(ga(()=>_r([]))),this.loadUserProviders("global").pipe(ga(()=>_r([])))]).pipe(ne(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),Jy({bufferSize:1,refCount:true}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e);}refresh(){this.refresh$.next();}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=i(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):_r([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(Ed(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(Ed(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=w({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(Ed(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(Ed(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=A({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O};
@@ -1 +1 @@
1
- import {c}from'./chunk-DrowH10V.js';import {p as pt,T as Te$1,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-C90nyg8k.js';import {g,W,F,H as we$1,ag as U,ah as De$1,ai as ke$1,z as zi,aj as We,a9 as F$1,ak as Dd,k as yT,ac as Ny,M as U$1,a2 as ga,aa as _r,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,q as Il,b as Kw,s as aC,a as hg,T as VI,l as eC,r as fC,X as UI,t as tC,L as Lg,u as mf,w as yf,C as ch}from'./main-EE6GZH3K.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function _e(n,t){if(n&1&&(Is(0,"ds-form-field",9),hg(1,"input",38),ml()),n&2){let e=fC(2);KE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Is(0,"a",39),UC(1,"Add an agent config"),ml(),UC(2," first. ")),n&2){let e=fC(3);pg("href","/agentos/"+e.namespaceId+"/agent-configs/new",ch);}}function xe(n,t){if(n&1&&(Is(0,"ds-form-field",10)(1,"p",2),UC(2," No agent configs available in this scope yet. "),Qw(3,Se,3,1),ml()()),n&2){let e=fC(2);KE(3),Kw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Is(0,"option",17),UC(1),ml()),n&2){let e=t.$implicit;pg("value",e.id),KE(),Lg(e.name);}}function De(n,t){if(n&1&&(Is(0,"ds-form-field",11)(1,"select",40)(2,"option",41),UC(3,"Select an agent config\u2026"),ml(),eC(4,Ee,2,2,"option",17,ve),ml(),VI(),ml()),n&2){let e=fC(2);pg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),KE(),pg("formControl",e.agentConfigIdControl),UI(),KE(3),tC(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Is(0,"option",17),UC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),KE(),Lg(e.label);}}function Ne(n,t){if(n&1){let e=aC();Is(0,"label",31)(1,"input",43),Eg("change",function(){let f=mf(e).$implicit,h=fC(3);return yf(h.toggleDay(f.value))}),ml(),UC(2),ml();}if(n&2){let e=t.$implicit,l=fC(3);KE(),pg("checked",l.isDaySelected(e.value)),KE(),Il(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Is(0,"ds-form-field",18)(1,"div",42),eC(2,Ne,3,2,"label",31,V),ml()()),n&2){let e=fC(2);KE(2),tC(e.dayOptions);}}function Me(n,t){if(n&1&&(Is(0,"option",17),UC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),KE(),Lg(e.label);}}function Pe(n,t){if(n&1&&(Is(0,"ds-form-field",28),hg(1,"input",44),VI(),ml()),n&2){let e=fC(2);pg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),KE(),pg("formControl",e.endDateControl),UI();}}function we(n,t){if(n&1&&(Is(0,"ds-form-field",29),hg(1,"input",45),VI(),ml()),n&2){let e=fC(2);pg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),KE(),pg("formControl",e.occurrenceCountControl),UI();}}function Fe(n,t){if(n&1&&(Is(0,"ds-notice"),UC(1),ml()),n&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let f=fC();return yf(f.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),VI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),VI(),ml(),Qw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Is(8,"ds-form-field",12),hg(9,"textarea",13),VI(),ml(),Is(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),eC(13,Te,2,2,"option",17,V),ml(),VI(),ml(),Qw(15,Ie,4,0,"ds-form-field",18),Is(16,"ds-form-field",19)(17,"div",20),hg(18,"input",21),VI(),Is(19,"span",22),UC(20,"UTC"),ml()()()(),Is(21,"ds-fieldset",23)(22,"ds-form-field",24),hg(23,"input",25),VI(),ml(),Is(24,"ds-form-field",26)(25,"select",27),eC(26,Me,2,2,"option",17,V),ml(),VI(),ml(),Qw(28,Pe,2,2,"ds-form-field",28),Qw(29,we,2,2,"ds-form-field",29),ml(),Is(30,"div",30)(31,"label",31),hg(32,"input",32),VI(),UC(33," Enabled "),ml(),Is(34,"p",33),UC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),ml()(),Is(36,"ds-form-field",34),hg(37,"textarea",35),VI(),ml(),Qw(38,Fe,2,1,"ds-notice"),Is(39,"ds-form-actions")(40,"button",36),UC(41),ml(),Is(42,"button",37),Eg("click",function(){mf(e);let f=fC();return yf(f.cancel())}),UC(43,"Cancel"),ml()()();}if(n&2){let e=fC();pg("formGroup",e.form),KE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),KE(),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),KE(3),pg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),KE(),pg("formControl",e.promptContentControl),UI(),KE(3),pg("formControl",e.unitControl),UI(),KE(),tC(e.schedulerUnits),KE(2),Kw(e.showDayFilter()?15:-1),KE(),pg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),KE(2),pg("formControl",e.timeUtcControl),UI(),KE(4),pg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),KE(),pg("formControl",e.startDateControl),UI(),KE(2),pg("formControl",e.endTypeControl),UI(),KE(),tC(e.endTypes),KE(2),Kw(e.showEndDate()?28:-1),KE(),Kw(e.showOccurrenceCount()?29:-1),KE(3),pg("formControl",e.enabledControl),UI(),KE(4),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),KE(),pg("formControl",e.externalMetadataJsonControl),UI(),KE(),Kw(e.errorMessage()?38:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(De$1.NEVER,{nonNullable:true,validators:[bn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);errorMessage=zi(null);SchedulerUnit=ke$1;SchedulerEndType=De$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:De$1.NEVER,label:"Never"},{value:De$1.ON_DATE,label:"On date"},{value:De$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(We).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(Dd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(Dd(this.endTypeControl.value)));showDayFilter=yT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=yT(()=>this.endTypeSignal()===De$1.ON_DATE);showOccurrenceCount=yT(()=>this.endTypeSignal()===De$1.OCCURRENCES);agentConfigs=zi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ny({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>_r([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===De$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===De$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return l.cancel()}),UC(3),ml()(),Qw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),ml()),e&2&&(KE(),pg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),KE(2),Il(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),KE(),Kw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===De$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===De$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-CJ4vPhs4.js';import {p as pt,T as Te$1,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-BY4pYYCq.js';import {g,W,F,H as we$1,ag as U,ah as De$1,ai as ke$1,z as zi,aj as We,a9 as F$1,ak as Dd,k as yT,ac as Ny,M as U$1,a2 as ga,aa as _r,P as x,O as w,x as xw,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,q as Il,b as Kw,s as aC,a as hg,T as VI,l as eC,r as fC,X as UI,t as tC,L as Lg,u as mf,w as yf,C as ch}from'./main-WIKPRSWZ.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function _e(n,t){if(n&1&&(Is(0,"ds-form-field",9),hg(1,"input",38),ml()),n&2){let e=fC(2);KE(),pg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Is(0,"a",39),UC(1,"Add an agent config"),ml(),UC(2," first. ")),n&2){let e=fC(3);pg("href","/agentos/"+e.namespaceId+"/agent-configs/new",ch);}}function xe(n,t){if(n&1&&(Is(0,"ds-form-field",10)(1,"p",2),UC(2," No agent configs available in this scope yet. "),Qw(3,Se,3,1),ml()()),n&2){let e=fC(2);KE(3),Kw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Is(0,"option",17),UC(1),ml()),n&2){let e=t.$implicit;pg("value",e.id),KE(),Lg(e.name);}}function De(n,t){if(n&1&&(Is(0,"ds-form-field",11)(1,"select",40)(2,"option",41),UC(3,"Select an agent config\u2026"),ml(),eC(4,Ee,2,2,"option",17,ve),ml(),VI(),ml()),n&2){let e=fC(2);pg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),KE(),pg("formControl",e.agentConfigIdControl),UI(),KE(3),tC(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Is(0,"option",17),UC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),KE(),Lg(e.label);}}function Ne(n,t){if(n&1){let e=aC();Is(0,"label",31)(1,"input",43),Eg("change",function(){let f=mf(e).$implicit,h=fC(3);return yf(h.toggleDay(f.value))}),ml(),UC(2),ml();}if(n&2){let e=t.$implicit,l=fC(3);KE(),pg("checked",l.isDaySelected(e.value)),KE(),Il(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Is(0,"ds-form-field",18)(1,"div",42),eC(2,Ne,3,2,"label",31,V),ml()()),n&2){let e=fC(2);KE(2),tC(e.dayOptions);}}function Me(n,t){if(n&1&&(Is(0,"option",17),UC(1),ml()),n&2){let e=t.$implicit;pg("value",e.value),KE(),Lg(e.label);}}function Pe(n,t){if(n&1&&(Is(0,"ds-form-field",28),hg(1,"input",44),VI(),ml()),n&2){let e=fC(2);pg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),KE(),pg("formControl",e.endDateControl),UI();}}function we(n,t){if(n&1&&(Is(0,"ds-form-field",29),hg(1,"input",45),VI(),ml()),n&2){let e=fC(2);pg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),KE(),pg("formControl",e.occurrenceCountControl),UI();}}function Fe(n,t){if(n&1&&(Is(0,"ds-notice"),UC(1),ml()),n&2){let e=fC(2);KE(),Lg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let f=fC();return yf(f.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),VI(),ml(),Is(3,"ds-form-field",7),hg(4,"input",8),VI(),ml(),Qw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Is(8,"ds-form-field",12),hg(9,"textarea",13),VI(),ml(),Is(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),eC(13,Te,2,2,"option",17,V),ml(),VI(),ml(),Qw(15,Ie,4,0,"ds-form-field",18),Is(16,"ds-form-field",19)(17,"div",20),hg(18,"input",21),VI(),Is(19,"span",22),UC(20,"UTC"),ml()()()(),Is(21,"ds-fieldset",23)(22,"ds-form-field",24),hg(23,"input",25),VI(),ml(),Is(24,"ds-form-field",26)(25,"select",27),eC(26,Me,2,2,"option",17,V),ml(),VI(),ml(),Qw(28,Pe,2,2,"ds-form-field",28),Qw(29,we,2,2,"ds-form-field",29),ml(),Is(30,"div",30)(31,"label",31),hg(32,"input",32),VI(),UC(33," Enabled "),ml(),Is(34,"p",33),UC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),ml()(),Is(36,"ds-form-field",34),hg(37,"textarea",35),VI(),ml(),Qw(38,Fe,2,1,"ds-notice"),Is(39,"ds-form-actions")(40,"button",36),UC(41),ml(),Is(42,"button",37),Eg("click",function(){mf(e);let f=fC();return yf(f.cancel())}),UC(43,"Cancel"),ml()()();}if(n&2){let e=fC();pg("formGroup",e.form),KE(),pg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),KE(),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(),Kw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),KE(3),pg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),KE(),pg("formControl",e.promptContentControl),UI(),KE(3),pg("formControl",e.unitControl),UI(),KE(),tC(e.schedulerUnits),KE(2),Kw(e.showDayFilter()?15:-1),KE(),pg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),KE(2),pg("formControl",e.timeUtcControl),UI(),KE(4),pg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),KE(),pg("formControl",e.startDateControl),UI(),KE(2),pg("formControl",e.endTypeControl),UI(),KE(),tC(e.endTypes),KE(2),Kw(e.showEndDate()?28:-1),KE(),Kw(e.showOccurrenceCount()?29:-1),KE(3),pg("formControl",e.enabledControl),UI(),KE(4),pg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),KE(),pg("formControl",e.externalMetadataJsonControl),UI(),KE(),Kw(e.errorMessage()?38:-1),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(De$1.NEVER,{nonNullable:true,validators:[bn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);errorMessage=zi(null);SchedulerUnit=ke$1;SchedulerEndType=De$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:De$1.NEVER,label:"Never"},{value:De$1.ON_DATE,label:"On date"},{value:De$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(We).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(Dd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(Dd(this.endTypeControl.value)));showDayFilter=yT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=yT(()=>this.endTypeSignal()===De$1.ON_DATE);showOccurrenceCount=yT(()=>this.endTypeSignal()===De$1.OCCURRENCES);agentConfigs=zi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ny({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ga(()=>_r([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===De$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===De$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return l.cancel()}),UC(3),ml()(),Qw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),ml()),e&2&&(KE(),pg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),KE(2),Il(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),KE(),Kw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===De$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===De$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
@@ -1 +1 @@
1
- import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-C90nyg8k.js';import {g,F,H as we,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,j as fg,u as mf,w as yf}from'./main-EE6GZH3K.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Is(0,"p",3),UC(1),ml()),t&2){let n=fC();KE(),Lg(n.deletion.error());}}function K(t,e){t&1&&(Is(0,"p",4),UC(1,"Loading prompts\u2026"),ml());}function H(t,e){t&1&&(Is(0,"p",5),UC(1,"No platform prompts defined yet."),ml());}function U(t,e){t&1&&(Is(0,"p",4),UC(1,"No prompts match the current filter."),ml());}function z(t,e){if(t&1){let n=aC();Is(0,"button",18),Eg("click",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.edit(m))}),UC(1,"Edit"),ml();}if(t&2){let n=fC().$implicit;fg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=aC();Is(0,"agentos-row-delete-action",19),Eg("deleteRequested",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.deletion.request(m.id))})("deleteConfirmed",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.confirmDelete(m))})("deleteCancelled",function(){mf(n);let m=fC(3);return yf(m.deletion.cancel())}),ml();}if(t&2){let n=fC().$implicit,r=fC(2);pg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14)(6,"div",15),Qw(7,z,2,1,"button",16),Qw(8,G,1,3,"agentos-row-delete-action",17),ml()()()),t&2){let n=e.$implicit,r=fC(2);KE(2),Lg(n.name),KE(2),Il(" ",n.description||"\u2014"," "),KE(3),Kw(r.deletion.confirmingId()!==n.id?7:-1),KE(),Kw(n.id?8:-1);}}function O(t,e){if(t&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10)(9,"span",11),UC(10,"Actions"),ml()()()(),Is(11,"tbody",8),eC(12,J,9,4,"tr",9,j),ml()()()),t&2){let n=fC();KE(12),tC(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();prompts=zi([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=xw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return r.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),UC(3,"New prompt"),ml()(),Qw(4,A,2,1,"p",3),Qw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(KE(),pg("query",r.rowFilter.query()),KE(3),Kw(r.deletion.error()?4:-1),KE(),Kw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
1
+ import {w as m,q as k,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-BY4pYYCq.js';import {g,F,H as we,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,j as fg,u as mf,w as yf}from'./main-WIKPRSWZ.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Is(0,"p",3),UC(1),ml()),t&2){let n=fC();KE(),Lg(n.deletion.error());}}function K(t,e){t&1&&(Is(0,"p",4),UC(1,"Loading prompts\u2026"),ml());}function H(t,e){t&1&&(Is(0,"p",5),UC(1,"No platform prompts defined yet."),ml());}function U(t,e){t&1&&(Is(0,"p",4),UC(1,"No prompts match the current filter."),ml());}function z(t,e){if(t&1){let n=aC();Is(0,"button",18),Eg("click",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.edit(m))}),UC(1,"Edit"),ml();}if(t&2){let n=fC().$implicit;fg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=aC();Is(0,"agentos-row-delete-action",19),Eg("deleteRequested",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.deletion.request(m.id))})("deleteConfirmed",function(){mf(n);let m=fC().$implicit,p=fC(2);return yf(p.confirmDelete(m))})("deleteCancelled",function(){mf(n);let m=fC(3);return yf(m.deletion.cancel())}),ml();}if(t&2){let n=fC().$implicit,r=fC(2);pg("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Is(0,"tr",9)(1,"td",12),UC(2),ml(),Is(3,"td",13),UC(4),ml(),Is(5,"td",14)(6,"div",15),Qw(7,z,2,1,"button",16),Qw(8,G,1,3,"agentos-row-delete-action",17),ml()()()),t&2){let n=e.$implicit,r=fC(2);KE(2),Lg(n.name),KE(2),Il(" ",n.description||"\u2014"," "),KE(3),Kw(r.deletion.confirmingId()!==n.id?7:-1),KE(),Kw(n.id?8:-1);}}function O(t,e){if(t&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10)(9,"span",11),UC(10,"Actions"),ml()()()(),Is(11,"tbody",8),eC(12,J,9,4,"tr",9,j),ml()()()),t&2){let n=fC();KE(12),tC(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();prompts=zi([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=xw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return r.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return r.openCreateForm()}),UC(3,"New prompt"),ml()(),Qw(4,A,2,1,"p",3),Qw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(KE(),pg("query",r.rowFilter.query()),KE(3),Kw(r.deletion.error()?4:-1),KE(),Kw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
@@ -1 +1 @@
1
- import {g,aM as fe,a6 as A}from'./main-EE6GZH3K.js';var c=class r{api=g(fe);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
1
+ import {g,aJ as fe,a6 as A}from'./main-WIKPRSWZ.js';var c=class r{api=g(fe);getById(e){return this.api.getByIdScheduledPrompt(e)}listPlatform(){return this.api.searchScheduledPrompt({namespaceId:null,userId:null})}listByNamespace(e){return this.api.searchScheduledPrompt({namespaceId:e,userId:null})}search(e){return this.api.searchScheduledPrompt(e)}listEffective(e){return this.api.resolveEffectiveScheduledPrompt(e)}create(e){return this.api.createScheduledPrompt(e)}update(e,t){return this.api.updateScheduledPrompt(e,t)}enable(e){return this.api.enableScheduledPrompt(e)}disable(e){return this.api.disableScheduledPrompt(e)}delete(e){return this.api.deleteScheduledPrompt(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=A({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c};
@@ -1 +1 @@
1
- import {o}from'./chunk-B6gsrnkr.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-C90nyg8k.js';import {g,F,H as we,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,u as mf,w as yf,j as fg}from'./main-EE6GZH3K.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Is(0,"p",3),UC(1),ml()),i&2){let t=fC();KE(),Lg(t.deletion.error());}}function A(i,e){i&1&&(Is(0,"p",4),UC(1,"Loading skills\u2026"),ml());}function H(i,e){i&1&&(Is(0,"p",5),UC(1,"No platform skills defined yet."),ml());}function U(i,e){i&1&&(Is(0,"p",4),UC(1,"No skills match the current filter."),ml());}function z(i,e){i&1&&(Is(0,"ds-tag",15),UC(1,"SKILL.md"),ml());}function G(i,e){if(i&1){let t=aC();Is(0,"button",21),Eg("click",function(){mf(t);let d=fC(2).$implicit,m=fC(2);return yf(m.edit(d))}),UC(1,"Edit"),ml();}if(i&2){let t=fC(2).$implicit;fg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=aC();Is(0,"button",21),Eg("click",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.inspect(d))}),UC(1,"View"),ml(),Qw(2,G,2,1,"button",22);}if(i&2){let t=fC().$implicit;fg("aria-label","View "+t.name),KE(2),Kw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=aC();Is(0,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.deletion.request(d.id))})("deleteConfirmed",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=fC(3);return yf(d.deletion.cancel())}),ml();}if(i&2){let t=fC().$implicit,l=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),UC(4),ml(),Qw(5,z,2,0,"ds-tag",15),ml()(),Is(6,"td",16),UC(7),ml(),Is(8,"td",17),UC(9),ml(),Is(10,"td",18)(11,"div",19),Qw(12,J,3,2),Qw(13,Q,1,3,"agentos-row-delete-action",20),ml()()()),i&2){let t=e.$implicit,l=fC(2);KE(4),Lg(t.name),KE(),Kw(t.readOnly?5:-1),KE(2),Il(" ",t.description||"\u2014"," "),KE(2),Lg(l.resourceCount(t)),KE(3),Kw(l.deletion.confirmingId()!==t.id?12:-1),KE(),Kw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10),UC(9,"Resources"),ml(),Is(10,"th",10)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,W,14,6,"tr",9,K),ml()()()),i&2){let t=fC();KE(14),tC(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(we);skillState=g(o);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();skills=zi([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return l.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return l.openCreateForm()}),UC(3,"New skill"),ml()(),Qw(4,O,2,1,"p",3),Qw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(KE(),pg("query",l.rowFilter.query()),KE(3),Kw(l.deletion.error()?4:-1),KE(),Kw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
1
+ import {o}from'./chunk-BibOnln8.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-BY4pYYCq.js';import {g,F,H as we,$ as Sr,z as zi,a1 as ma,M as U$1,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,q as Il,s as aC,u as mf,w as yf,j as fg}from'./main-WIKPRSWZ.js';var K=(i,e)=>e.id??e.name;function O(i,e){if(i&1&&(Is(0,"p",3),UC(1),ml()),i&2){let t=fC();KE(),Lg(t.deletion.error());}}function A(i,e){i&1&&(Is(0,"p",4),UC(1,"Loading skills\u2026"),ml());}function H(i,e){i&1&&(Is(0,"p",5),UC(1,"No platform skills defined yet."),ml());}function U(i,e){i&1&&(Is(0,"p",4),UC(1,"No skills match the current filter."),ml());}function z(i,e){i&1&&(Is(0,"ds-tag",15),UC(1,"SKILL.md"),ml());}function G(i,e){if(i&1){let t=aC();Is(0,"button",21),Eg("click",function(){mf(t);let d=fC(2).$implicit,m=fC(2);return yf(m.edit(d))}),UC(1,"Edit"),ml();}if(i&2){let t=fC(2).$implicit;fg("aria-label","Edit "+t.name);}}function J(i,e){if(i&1){let t=aC();Is(0,"button",21),Eg("click",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.inspect(d))}),UC(1,"View"),ml(),Qw(2,G,2,1,"button",22);}if(i&2){let t=fC().$implicit;fg("aria-label","View "+t.name),KE(2),Kw(t.readOnly?-1:2);}}function Q(i,e){if(i&1){let t=aC();Is(0,"agentos-row-delete-action",23),Eg("deleteRequested",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.deletion.request(d.id))})("deleteConfirmed",function(){mf(t);let d=fC().$implicit,m=fC(2);return yf(m.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=fC(3);return yf(d.deletion.cancel())}),ml();}if(i&2){let t=fC().$implicit,l=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",l.deletion);}}function W(i,e){if(i&1&&(Is(0,"tr",9)(1,"td",12)(2,"div",13)(3,"span",14),UC(4),ml(),Qw(5,z,2,0,"ds-tag",15),ml()(),Is(6,"td",16),UC(7),ml(),Is(8,"td",17),UC(9),ml(),Is(10,"td",18)(11,"div",19),Qw(12,J,3,2),Qw(13,Q,1,3,"agentos-row-delete-action",20),ml()()()),i&2){let t=e.$implicit,l=fC(2);KE(4),Lg(t.name),KE(),Kw(t.readOnly?5:-1),KE(2),Il(" ",t.description||"\u2014"," "),KE(2),Lg(l.resourceCount(t)),KE(3),Kw(l.deletion.confirmingId()!==t.id?12:-1),KE(),Kw(!t.readOnly&&t.id?13:-1);}}function X(i,e){if(i&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Description"),ml(),Is(8,"th",10),UC(9,"Resources"),ml(),Is(10,"th",10)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,W,14,6,"tr",9,K),ml()()()),i&2){let t=fC();KE(14),tC(t.rowFilter.filteredRows());}}var B=class i{router=g(F);destroyRef=g(we);skillState=g(o);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();skills=zi([]);rowFilter=O$1(this.skills,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.skillState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.skills.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}openCreateForm(){this.router.navigate(["/agentos","admin","skills","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","skills",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.skillState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:t=>t.status===403?`Deleting "${e.name}" requires platform administrator rights.`:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-platform-skills"]],decls:9,vars:3,consts:[["title","Platform skills","description","Skills shared across every namespace."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform skills"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__tags"],[1,"settings-table__name"],["variant","neutral"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,l){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(m){return l.rowFilter.query.set(m)}),ml(),Is(2,"button",2),Eg("click",function(){return l.openCreateForm()}),UC(3,"New skill"),ml()(),Qw(4,O,2,1,"p",3),Qw(5,A,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,X,16,0,"div",6)),t&2&&(KE(),pg("query",l.rowFilter.query()),KE(3),Kw(l.deletion.error()?4:-1),KE(),Kw(l.isLoading()?5:l.skills().length===0?6:l.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{B as PlatformSkillsComponent};
@@ -1 +1 @@
1
- import {v as vn,d as yn,k as dn,_ as _n,i as at,m as mn,F as Ni,G as c}from'./chunk-C90nyg8k.js';import {g,W as W$1,F,H as we,ag as U,z as zi,k as yT,M as U$1,x as xw,au as $t,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,c as xg,q as Il,l as eC,t as tC,s as aC,a as hg,av as uT,aw as dT,u as mf,w as yf,ax as iE}from'./main-EE6GZH3K.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Is(0,"p",3),UC(1,"Loading\u2026"),ml());}function Q(t,n){t&1&&(Is(0,"ds-notice"),UC(1,"Failed to load agent definition."),ml());}function W(t,n){if(t&1&&(Is(0,"dt"),UC(1,"User context"),ml(),Is(2,"dd",6),UC(3),ml()),t&2){let e=fC();KE(3),Lg(e.userId);}}function X(t,n){if(t&1){let e=aC();Is(0,"ds-card")(1,"ds-disclosure",12),Eg("toggled",function(){mf(e);let m=fC(2);return yf(m.toggleSystemPrompt())}),Is(2,"pre",13),UC(3),ml()()();}if(t&2){let e=fC(),r=fC();KE(),pg("open",!r.systemPromptCollapsed()),KE(2),Lg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=aC();Is(0,"ds-card")(1,"ds-disclosure",14),Eg("toggled",function(){mf(e);let m=fC(2);return yf(m.toggleInstructions())}),Is(2,"pre",13),UC(3),ml()()();}if(t&2){let e=fC(),r=fC();KE(),pg("open",!r.instructionsCollapsed()),KE(2),Lg(e.instructions);}}function Z(t,n){t&1&&(Is(0,"p",3),UC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),ml());}function ee(t,n){t&1&&(Is(0,"span",17),UC(1,"platform"),ml());}function te(t,n){t&1&&(Is(0,"span",17),UC(1,"SKILL.md"),ml());}function ne(t,n){if(t&1&&(Is(0,"li",15)(1,"span")(2,"span",16),UC(3),ml(),Qw(4,ee,2,0,"span",17),Qw(5,te,2,0,"span",17),ml(),Is(6,"p",3),UC(7),ml()()),t&2){let e=n.$implicit;KE(3),Lg(e.name),KE(),Kw(e.namespaceId?-1:4),KE(),Kw(e.readOnly?5:-1),KE(2),Lg(e.description);}}function ie(t,n){if(t&1&&(Is(0,"ul",11),eC(1,ne,8,4,"li",15,j),ml()),t&2){let e=fC(2);KE(),tC(e.resolvedSkills());}}function oe(t,n){t&1&&(Is(0,"p",3),UC(1,"No tools available for this agent."),ml());}function ae(t,n){if(t&1&&(hg(0,"div",19),uT(1,"agentosMarkdown")),t&2){let e=fC().$implicit;pg("innerHTML",dT(1,1,e.description),iE);}}function de(t,n){if(t&1){let e=aC();Is(0,"li")(1,"ds-disclosure",18),Eg("toggled",function(){let m=mf(e).$implicit,U=fC(3);return yf(U.toggleTool(m))}),Qw(2,ae,2,3,"div",19),Is(3,"pre",20),UC(4),ml()()();}if(t&2){let e=n.$implicit,r=fC(3);KE(),pg("heading",e.name)("open",r.isToolExpanded(e)),KE(),Kw(e.description?2:-1),KE(2),Lg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Is(0,"ul",11),eC(1,de,5,4,"li",null,z),ml()),t&2){let e=fC();KE(),tC(e.tools);}}function se(t,n){if(t&1&&(Is(0,"ds-card",4)(1,"dl",5)(2,"dt"),UC(3,"Name"),ml(),Is(4,"dd"),UC(5),ml(),Is(6,"dt"),UC(7,"Resolved model"),ml(),Is(8,"dd",6),UC(9),ml(),Is(10,"dt"),UC(11,"Provider"),ml(),Is(12,"dd"),UC(13),ml(),Is(14,"dt",7),UC(15,"Execution mode"),ml(),Is(16,"dd",8)(17,"span",9),UC(18),ml()(),Qw(19,W,4,1),ml()(),Qw(20,X,4,2,"ds-card"),Qw(21,Y,4,2,"ds-card"),Is(22,"ds-card",10),Qw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),ml(),Is(25,"ds-card",10),Qw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),ml()),t&2){let e=n,r=fC();KE(5),Lg(e.name),KE(4),Lg(e.resolvedModelApiName),KE(4),Lg(e.resolvedProviderName),KE(4),xg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),KE(),Il(" ",e.executionMode," "),KE(),Kw(e.userId?19:-1),KE(),Kw(e.systemPrompt?20:-1),KE(),Kw(e.instructions?21:-1),KE(),pg("heading","Skills ("+r.resolvedSkills().length+")"),KE(),Kw(r.resolvedSkills().length===0?23:24),KE(2),pg("heading","Tools ("+e.tools.length+")"),KE(),Kw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=zi(true);hasError=zi(false);definition=zi(null);expandedTools=zi(new Set);resolvedSkills=yT(()=>this.definition()?.skills??[]);systemPromptCollapsed=zi(true);instructionsCollapsed=zi(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=xw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.back()}),UC(3," \u2190 Agent configs "),ml(),Is(4,"a",2),UC(5,"Edit config \u2192"),ml()(),Qw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),ml()),e&2){let m;KE(4),pg("routerLink",r.editRoute()),KE(2),Kw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,vn,yn,dn,_n,at,mn,Ni,c],encapsulation:2})};export{K as AgentConfigInspectComponent};
1
+ import {v as vn,d as yn,k as dn,_ as _n,i as at,m as mn,F as Ni,G as c}from'./chunk-BY4pYYCq.js';import {g,W as W$1,F,H as we,ag as U,z as zi,k as yT,M as U$1,x as xw,au as $t,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,c as xg,q as Il,l as eC,t as tC,s as aC,a as hg,av as uT,aw as dT,u as mf,w as yf,ax as iE}from'./main-WIKPRSWZ.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Is(0,"p",3),UC(1,"Loading\u2026"),ml());}function Q(t,n){t&1&&(Is(0,"ds-notice"),UC(1,"Failed to load agent definition."),ml());}function W(t,n){if(t&1&&(Is(0,"dt"),UC(1,"User context"),ml(),Is(2,"dd",6),UC(3),ml()),t&2){let e=fC();KE(3),Lg(e.userId);}}function X(t,n){if(t&1){let e=aC();Is(0,"ds-card")(1,"ds-disclosure",12),Eg("toggled",function(){mf(e);let m=fC(2);return yf(m.toggleSystemPrompt())}),Is(2,"pre",13),UC(3),ml()()();}if(t&2){let e=fC(),r=fC();KE(),pg("open",!r.systemPromptCollapsed()),KE(2),Lg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=aC();Is(0,"ds-card")(1,"ds-disclosure",14),Eg("toggled",function(){mf(e);let m=fC(2);return yf(m.toggleInstructions())}),Is(2,"pre",13),UC(3),ml()()();}if(t&2){let e=fC(),r=fC();KE(),pg("open",!r.instructionsCollapsed()),KE(2),Lg(e.instructions);}}function Z(t,n){t&1&&(Is(0,"p",3),UC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),ml());}function ee(t,n){t&1&&(Is(0,"span",17),UC(1,"platform"),ml());}function te(t,n){t&1&&(Is(0,"span",17),UC(1,"SKILL.md"),ml());}function ne(t,n){if(t&1&&(Is(0,"li",15)(1,"span")(2,"span",16),UC(3),ml(),Qw(4,ee,2,0,"span",17),Qw(5,te,2,0,"span",17),ml(),Is(6,"p",3),UC(7),ml()()),t&2){let e=n.$implicit;KE(3),Lg(e.name),KE(),Kw(e.namespaceId?-1:4),KE(),Kw(e.readOnly?5:-1),KE(2),Lg(e.description);}}function ie(t,n){if(t&1&&(Is(0,"ul",11),eC(1,ne,8,4,"li",15,j),ml()),t&2){let e=fC(2);KE(),tC(e.resolvedSkills());}}function oe(t,n){t&1&&(Is(0,"p",3),UC(1,"No tools available for this agent."),ml());}function ae(t,n){if(t&1&&(hg(0,"div",19),uT(1,"agentosMarkdown")),t&2){let e=fC().$implicit;pg("innerHTML",dT(1,1,e.description),iE);}}function de(t,n){if(t&1){let e=aC();Is(0,"li")(1,"ds-disclosure",18),Eg("toggled",function(){let m=mf(e).$implicit,U=fC(3);return yf(U.toggleTool(m))}),Qw(2,ae,2,3,"div",19),Is(3,"pre",20),UC(4),ml()()();}if(t&2){let e=n.$implicit,r=fC(3);KE(),pg("heading",e.name)("open",r.isToolExpanded(e)),KE(),Kw(e.description?2:-1),KE(2),Lg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Is(0,"ul",11),eC(1,de,5,4,"li",null,z),ml()),t&2){let e=fC();KE(),tC(e.tools);}}function se(t,n){if(t&1&&(Is(0,"ds-card",4)(1,"dl",5)(2,"dt"),UC(3,"Name"),ml(),Is(4,"dd"),UC(5),ml(),Is(6,"dt"),UC(7,"Resolved model"),ml(),Is(8,"dd",6),UC(9),ml(),Is(10,"dt"),UC(11,"Provider"),ml(),Is(12,"dd"),UC(13),ml(),Is(14,"dt",7),UC(15,"Execution mode"),ml(),Is(16,"dd",8)(17,"span",9),UC(18),ml()(),Qw(19,W,4,1),ml()(),Qw(20,X,4,2,"ds-card"),Qw(21,Y,4,2,"ds-card"),Is(22,"ds-card",10),Qw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),ml(),Is(25,"ds-card",10),Qw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),ml()),t&2){let e=n,r=fC();KE(5),Lg(e.name),KE(4),Lg(e.resolvedModelApiName),KE(4),Lg(e.resolvedProviderName),KE(4),xg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),KE(),Il(" ",e.executionMode," "),KE(),Kw(e.userId?19:-1),KE(),Kw(e.systemPrompt?20:-1),KE(),Kw(e.instructions?21:-1),KE(),pg("heading","Skills ("+r.resolvedSkills().length+")"),KE(),Kw(r.resolvedSkills().length===0?23:24),KE(2),pg("heading","Tools ("+e.tools.length+")"),KE(),Kw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=zi(true);hasError=zi(false);definition=zi(null);expandedTools=zi(new Set);resolvedSkills=yT(()=>this.definition()?.skills??[]);systemPromptCollapsed=zi(true);instructionsCollapsed=zi(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=xw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return r.back()}),UC(3," \u2190 Agent configs "),ml(),Is(4,"a",2),UC(5,"Edit config \u2192"),ml()(),Qw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),ml()),e&2){let m;KE(4),pg("routerLink",r.editRoute()),KE(2),Kw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,vn,yn,dn,_n,at,mn,Ni,c],encapsulation:2})};export{K as AgentConfigInspectComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-DrowH10V.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-C90nyg8k.js';import {g,W,F,H as we,z as zi,ac as Ny,a2 as ga,aa as _r,M as U,P as x,O as w,ai as ke,al as Ge,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,s as aC,u as mf,w as yf,j as fg}from'./main-EE6GZH3K.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let e=fC();KE(),Lg(e.deletion.error());}}function Y(n,t){n&1&&(Is(0,"p",4),UC(1,"Loading scheduled prompts\u2026"),ml());}function z(n,t){n&1&&(Is(0,"p",5),UC(1,"No scheduled prompts available."),ml());}function G(n,t){n&1&&(Is(0,"p",4),UC(1,"No scheduled prompts match the current filter."),ml());}function Q(n,t){if(n&1&&(Is(0,"span",14),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Lg(e.prompt.description);}}function X(n,t){n&1&&(Is(0,"ds-tag",20),UC(1,"Read-only"),ml());}function Z(n,t){if(n&1){let e=aC();Is(0,"button",25),Eg("click",function(){mf(e);let l=fC(2).$implicit,p=fC(2);return yf(p.toggle(l))}),UC(1),ml(),Is(2,"button",25),Eg("click",function(){mf(e);let l=fC(2).$implicit,p=fC(2);return yf(p.edit(l))}),UC(3," Edit "),ml();}if(n&2){let e=fC(2).$implicit;KE(),Lg(e.prompt.enabled?"Disable":"Enable"),KE(),fg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=aC();Qw(0,Z,4,2),Is(1,"agentos-row-delete-action",24),Eg("deleteRequested",function(){mf(e);let l=fC().$implicit,p=fC(2);return yf(p.deletion.request(l.key))})("deleteConfirmed",function(){mf(e);let l=fC().$implicit,p=fC(2);return yf(p.confirmDelete(l))})("deleteCancelled",function(){mf(e);let l=fC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let e=fC().$implicit,i=fC(2);Kw(i.deletion.confirmingId()!==e.key?0:-1),KE(),pg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Is(0,"button",23),UC(1,"Inherited"),ml());}function ne(n,t){if(n&1&&(Is(0,"tr",9)(1,"td",12)(2,"span",13),UC(3),ml(),Qw(4,Q,2,1,"span",14),ml(),Is(5,"td",15),UC(6),ml(),Is(7,"td",16)(8,"ds-tag",17),UC(9),ml()(),Is(10,"td",18)(11,"div",19)(12,"ds-tag",17),UC(13),ml(),Qw(14,X,2,0,"ds-tag",20),ml()(),Is(15,"td",21)(16,"div",22),Qw(17,ee,2,4)(18,te,2,0,"button",23),ml()()()),n&2){let e=t.$implicit,i=fC(2);KE(3),Lg(e.prompt.name),KE(),Kw(e.prompt.description?4:-1),KE(2),Lg(i.scheduleLabel(e.prompt)),KE(2),pg("variant",e.prompt.enabled?"accent":"outline"),KE(),Lg(e.prompt.enabled?"Enabled":"Disabled"),KE(3),pg("variant",e.scope==="platform"?"neutral":"accent"),KE(),Lg(e.scope==="platform"?"Platform":"Namespace"),KE(),Kw(e.scope==="platform"?14:-1),KE(3),Kw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Schedule"),ml(),Is(8,"th",10),UC(9,"Status"),ml(),Is(10,"th",10),UC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),UC(14,"Actions"),ml()()()(),Is(15,"tbody",8),eC(16,ne,19,9,"tr",9,J),ml()()()),n&2){let e=fC();KE(16),tC(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=zi([]);isLoading=zi(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Ny({platform:this.state.listPlatform().pipe(ga(()=>_r([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===ke.WEEK?"week":"month",l=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(p=>Ge[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return i.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),UC(3,"New scheduled prompt"),ml()(),Qw(4,O,2,1,"p",3),Qw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(KE(),pg("query",i.rowFilter.query()),KE(3),Kw(i.deletion.error()?4:-1),KE(),Kw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-CJ4vPhs4.js';import {q as k,O as O$1,i as at,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-BY4pYYCq.js';import {g,W,F,H as we,z as zi,ac as Ny,a2 as ga,aa as _r,M as U,P as x,O as w,ai as ke,al as Ge,x as xw,I as Is,S as Eg,m as ml,U as UC,Q as Qw,K as KE,R as pg,b as Kw,r as fC,L as Lg,l as eC,t as tC,s as aC,u as mf,w as yf,j as fg}from'./main-WIKPRSWZ.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let e=fC();KE(),Lg(e.deletion.error());}}function Y(n,t){n&1&&(Is(0,"p",4),UC(1,"Loading scheduled prompts\u2026"),ml());}function z(n,t){n&1&&(Is(0,"p",5),UC(1,"No scheduled prompts available."),ml());}function G(n,t){n&1&&(Is(0,"p",4),UC(1,"No scheduled prompts match the current filter."),ml());}function Q(n,t){if(n&1&&(Is(0,"span",14),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Lg(e.prompt.description);}}function X(n,t){n&1&&(Is(0,"ds-tag",20),UC(1,"Read-only"),ml());}function Z(n,t){if(n&1){let e=aC();Is(0,"button",25),Eg("click",function(){mf(e);let l=fC(2).$implicit,p=fC(2);return yf(p.toggle(l))}),UC(1),ml(),Is(2,"button",25),Eg("click",function(){mf(e);let l=fC(2).$implicit,p=fC(2);return yf(p.edit(l))}),UC(3," Edit "),ml();}if(n&2){let e=fC(2).$implicit;KE(),Lg(e.prompt.enabled?"Disable":"Enable"),KE(),fg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=aC();Qw(0,Z,4,2),Is(1,"agentos-row-delete-action",24),Eg("deleteRequested",function(){mf(e);let l=fC().$implicit,p=fC(2);return yf(p.deletion.request(l.key))})("deleteConfirmed",function(){mf(e);let l=fC().$implicit,p=fC(2);return yf(p.confirmDelete(l))})("deleteCancelled",function(){mf(e);let l=fC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let e=fC().$implicit,i=fC(2);Kw(i.deletion.confirmingId()!==e.key?0:-1),KE(),pg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Is(0,"button",23),UC(1,"Inherited"),ml());}function ne(n,t){if(n&1&&(Is(0,"tr",9)(1,"td",12)(2,"span",13),UC(3),ml(),Qw(4,Q,2,1,"span",14),ml(),Is(5,"td",15),UC(6),ml(),Is(7,"td",16)(8,"ds-tag",17),UC(9),ml()(),Is(10,"td",18)(11,"div",19)(12,"ds-tag",17),UC(13),ml(),Qw(14,X,2,0,"ds-tag",20),ml()(),Is(15,"td",21)(16,"div",22),Qw(17,ee,2,4)(18,te,2,0,"button",23),ml()()()),n&2){let e=t.$implicit,i=fC(2);KE(3),Lg(e.prompt.name),KE(),Kw(e.prompt.description?4:-1),KE(2),Lg(i.scheduleLabel(e.prompt)),KE(2),pg("variant",e.prompt.enabled?"accent":"outline"),KE(),Lg(e.prompt.enabled?"Enabled":"Disabled"),KE(3),pg("variant",e.scope==="platform"?"neutral":"accent"),KE(),Lg(e.scope==="platform"?"Platform":"Namespace"),KE(),Kw(e.scope==="platform"?14:-1),KE(3),Kw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Is(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),UC(5,"Name"),ml(),Is(6,"th",10),UC(7,"Schedule"),ml(),Is(8,"th",10),UC(9,"Status"),ml(),Is(10,"th",10),UC(11,"Scope"),ml(),Is(12,"th",10)(13,"span",11),UC(14,"Actions"),ml()()()(),Is(15,"tbody",8),eC(16,ne,19,9,"tr",9,J),ml()()()),n&2){let e=fC();KE(16),tC(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=zi([]);isLoading=zi(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){Ny({platform:this.state.listPlatform().pipe(ga(()=>_r([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===ke.WEEK?"week":"month",l=e.unit===ke.WEEK&&e.days?.length?` (${e.days.map(p=>Ge[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(p){return i.rowFilter.query.set(p)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),UC(3,"New scheduled prompt"),ml()(),Qw(4,O,2,1,"p",3),Qw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(KE(),pg("query",i.rowFilter.query()),KE(3),Kw(i.deletion.error()?4:-1),KE(),Kw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -1,4 +1,4 @@
1
- import {b0 as A,b1 as z$1}from'./main-EE6GZH3K.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
1
+ import {aZ as A,a_ as z$1}from'./main-WIKPRSWZ.js';var ut=z$1(Xe=>{"use strict";(function(i){var n=/\S/,t=/\"/g,e=/\n/g,r=/\r/g,a=/\\/g,s=/\u2028/,u=/\u2029/;i.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},i.scan=function(h,g){var S=h.length,U=0,R=1,q=2,E=U,$=null,ee=null,B="",I=[],J=!1,O=0,C=0,L="{{",b="}}";function te(){B.length>0&&(I.push({tag:"_t",text:new String(B)}),B="");}function ge(){for(var A=!0,k=C;k<I.length;k++)if(A=i.tags[I[k].tag]<i.tags._v||I[k].tag=="_t"&&I[k].text.match(n)===null,!A)return !1;return A}function be(A,k){if(te(),A&&ge())for(var _=C,ie;_<I.length;_++)I[_].text&&((ie=I[_+1])&&ie.tag==">"&&(ie.indent=I[_].text.toString()),I.splice(_,1));else k||I.push({tag:`
2
2
  `});J=!1,C=I.length;}function ne(A,k){var _="="+b,ie=A.indexOf(_,k),De=f(A.substring(A.indexOf("=",k)+1,ie)).split(" ");return L=De[0],b=De[De.length-1],ie+_.length-1}for(g&&(g=g.split(" "),L=g[0],b=g[1]),O=0;O<S;O++)E==U?v(L,h,O)?(--O,te(),E=R):h.charAt(O)==`
3
3
  `?be(J):B+=h.charAt(O):E==R?(O+=L.length-1,ee=i.tags[h.charAt(O+1)],$=ee?h.charAt(O+1):"_v",$=="="?(O=ne(h,O),E=U):(ee&&O++,E=q),J=O):v(b,h,O)?(I.push({tag:$,n:f(B),otag:L,ctag:b,i:$=="/"?J-L.length:O+b.length}),B="",O+=b.length-1,E=U,$=="{"&&(b=="}}"?O++:d(I[I.length-1]))):B+=h.charAt(O);return be(J,!0),I};function d(l){l.n.substr(l.n.length-1)==="}"&&(l.n=l.n.substring(0,l.n.length-1));}function f(l){return l.trim?l.trim():l.replace(/^\s*|\s*$/g,"")}function v(l,h,g){if(h.charAt(g)!=l.charAt(0))return !1;for(var S=1,U=l.length;S<U;S++)if(h.charAt(g+S)!=l.charAt(S))return !1;return !0}var y={_t:!0,"\n":!0,$:!0,"/":!0};function o(l,h,g,S){var U=[],R=null,q=null,E=null;for(q=g[g.length-1];l.length>0;){if(E=l.shift(),q&&q.tag=="<"&&!(E.tag in y))throw new Error("Illegal content in < super tag.");if(i.tags[E.tag]<=i.tags.$||c(E,S))g.push(E),E.nodes=o(l,E.tag,g,S);else if(E.tag=="/"){if(g.length===0)throw new Error("Closing tag without opener: /"+E.n);if(R=g.pop(),E.n!=R.n&&!m(E.n,R.n,S))throw new Error("Nesting error: "+R.n+" vs. "+E.n);return R.end=E.i,U}else E.tag==`
4
4
  `&&(E.last=l.length==0||l[0].tag==`