@whoz-oss/coday-client 0.0.0-workstream-forge.325 → 0.0.0-workstream-forge.326

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 (58) hide show
  1. package/browser/{chunk-BnR0LAO8.js → chunk-B4QJcXnP.js} +1 -1
  2. package/browser/{chunk-BT5XTRqh.js → chunk-B6QDDnOW.js} +1 -1
  3. package/browser/{chunk-BGV30iCr.js → chunk-B6sYf1j_.js} +1 -1
  4. package/browser/{chunk-8I9n3lLn.js → chunk-BJB2wYDC.js} +1 -1
  5. package/browser/{chunk-BEFOXFc7.js → chunk-BKQaiiDm.js} +1 -1
  6. package/browser/chunk-BNW_UB32.js +1 -0
  7. package/browser/{chunk-BJWbTVL_.js → chunk-BNwyfYSr.js} +1 -1
  8. package/browser/chunk-BQgwuEVI.js +1 -0
  9. package/browser/{chunk-D-Fh__Rr.js → chunk-BX0TCJGF.js} +1 -1
  10. package/browser/chunk-B_HwXrtQ.js +1 -0
  11. package/browser/{chunk-B0CbpOrN.js → chunk-BiC6IJLJ.js} +1 -1
  12. package/browser/{chunk-PUAz3rec.js → chunk-Bmt85b9e.js} +1 -1
  13. package/browser/{chunk-BzmbXSRo.js → chunk-BtllBdOZ.js} +1 -1
  14. package/browser/{chunk-e4zJYzoL.js → chunk-BzCl7uMh.js} +1 -1
  15. package/browser/{chunk-BrfcY3tC.js → chunk-C0Lw7VMt.js} +1 -1
  16. package/browser/{chunk-D_CCZjeF.js → chunk-CDqiY5Rf.js} +1 -1
  17. package/browser/chunk-CG27SgJm.js +1 -0
  18. package/browser/{chunk-BrmadML0.js → chunk-CZPehjGB.js} +1 -1
  19. package/browser/chunk-C_tG-O6X.js +1 -0
  20. package/browser/chunk-Cdygrlhj.js +1 -0
  21. package/browser/{chunk-Bx9BfTbQ.js → chunk-ChwyhN7l.js} +1 -1
  22. package/browser/chunk-CjbU1hmS.js +1 -0
  23. package/browser/{chunk-CEwLL0y6.js → chunk-CoPRV7_K.js} +1 -1
  24. package/browser/chunk-Cp6XPrd_.js +1 -0
  25. package/browser/{chunk-3MZx6Kaj.js → chunk-CpC2V56W.js} +1 -1
  26. package/browser/{chunk-CWUT8BmF.js → chunk-CzNxwmwF.js} +1 -1
  27. package/browser/{chunk-v5ROMoP7.js → chunk-D0BRxefp.js} +1 -1
  28. package/browser/{chunk-C2vvMqUu.js → chunk-D0iMXAi6.js} +1 -1
  29. package/browser/{chunk-BLLdCsEy.js → chunk-D6j56Kh6.js} +1 -1
  30. package/browser/{chunk-Bucs_YQV.js → chunk-DGvA9EMF.js} +1 -1
  31. package/browser/{chunk-z_6fP4xn.js → chunk-DHPXIsXJ.js} +1 -1
  32. package/browser/{chunk-BIqKO9_X.js → chunk-DQ809zoB.js} +1 -1
  33. package/browser/{chunk-CxM3QN6m.js → chunk-DZp724cW.js} +1 -1
  34. package/browser/{chunk-j7CwKDfo.js → chunk-DiQNvMeR.js} +1 -1
  35. package/browser/{chunk-7TqeWvXK.js → chunk-Dt0eIaud.js} +1 -1
  36. package/browser/{chunk-B2dLmELH.js → chunk-EZsHLrVl.js} +1 -1
  37. package/browser/{chunk-BsmAqurT.js → chunk-GWxavAtB.js} +1 -1
  38. package/browser/{chunk-C9Lvnk2W.js → chunk-JrGCfHkP.js} +1 -1
  39. package/browser/chunk-NNFw4bVT.js +1 -0
  40. package/browser/{chunk-CIGX4h3f.js → chunk-NSyXB8Tu.js} +1 -1
  41. package/browser/{chunk-2vMDhSwg.js → chunk-V5vAYMRr.js} +1 -1
  42. package/browser/{chunk-Y0RP9yux.js → chunk-VbI0SYDI.js} +20 -20
  43. package/browser/{chunk-BXIfWVJs.js → chunk-YwnuVV6j.js} +1 -1
  44. package/browser/{chunk-kWYdxdb6.js → chunk-d7qpGlVe.js} +1 -1
  45. package/browser/{chunk-BeFguURn.js → chunk-e5qg27G2.js} +1 -1
  46. package/browser/{chunk-BiOlkBEs.js → chunk-mVP550cv.js} +1 -1
  47. package/browser/{chunk-Vsk0JW3A.js → chunk-rvd0XXmM.js} +1 -1
  48. package/browser/index.html +2 -2
  49. package/browser/{main-NUYYC27E.js → main-6TWWBEJW.js} +8 -8
  50. package/package.json +1 -1
  51. package/browser/chunk-BibZXPj5.js +0 -1
  52. package/browser/chunk-BufqW_U3.js +0 -1
  53. package/browser/chunk-CC8u54WZ.js +0 -1
  54. package/browser/chunk-CRV6iGhg.js +0 -1
  55. package/browser/chunk-D-pY3GeH.js +0 -1
  56. package/browser/chunk-DKYHSdHT.js +0 -1
  57. package/browser/chunk-NRJ3xkL0.js +0 -1
  58. package/browser/chunk-WDlf94_k.js +0 -1
@@ -1 +1 @@
1
- import {f,a6 as gd,a as fd,U as Ut,c as fo,g as go,a7 as uo,a8 as _a,a9 as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,aa as f$1}from'./chunk-Y0RP9yux.js';import {g,W,aP as Y,z as zi,ab as le,p as Ff,x as xw,aQ as Ob,I as Is,a as hg,Q as Qw,m as ml,K as KE,b as Kw,ak as Dd,a1 as ma,a3 as rn,ac as Ny,a2 as ga,U as UC,s as aC,S as Eg,aR as $g,T as VI,r as fC,aS as Ug,X as UI,l as eC,t as tC,aT as oT,aU as rT,L as Lg,j as fg,av as uT,aw as dT,as as jg,q as Il,aV as fT,u as mf,w as yf,aW as ZC}from'./main-NUYYC27E.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Is(0,"p",2),UC(1,"Loading usage settings\u2026"),ml());}function fe(e,a){if(e&1){let t=aC();Is(0,"ds-notice"),UC(1,"Could not load usage settings. Please try again."),ml(),Is(2,"div")(3,"button",3),Eg("click",function(){mf(t);let s=fC();return yf(s.configuration.retry())}),UC(4,"Retry usage settings"),ml()();}}function ye(e,a){e&1&&(Is(0,"p",2),UC(1,"Usage tracking is disabled."),ml());}function be(e,a){e&1&&(Is(0,"ds-notice"),UC(1),ml()),e&2&&(KE(),Lg(a));}function xe(e,a){e&1&&(Is(0,"p",2),UC(1,"Loading usage\u2026"),ml());}function he(e,a){e&1&&(Is(0,"p",12),UC(1,"No recorded usage for this period."),ml());}function Se(e,a){if(e&1&&(Is(0,"p",10),UC(1),ml()),e&2){let t=fC().$implicit;KE(),Il("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Is(0,"tr",16)(1,"td",18),UC(2),ml(),Is(3,"td",19),UC(4),uT(5,"number"),ml(),Is(6,"td",20),UC(7),uT(8,"number"),uT(9,"number"),ml(),Is(10,"td",21),UC(11),uT(12,"number"),uT(13,"number"),ml(),Is(14,"td",22),UC(15),uT(16,"agentosCost"),Qw(17,Se,2,1,"p",10),ml()()),e&2){let t=a.$implicit;KE(2),Lg(t.key),KE(2),Lg(dT(5,8,t.aggregate.totalTokens)),KE(3),jg(" ",dT(8,10,t.aggregate.inputTokens)," / ",dT(9,12,t.aggregate.outputTokens)," "),KE(4),jg(" ",dT(12,14,t.aggregate.cacheReadTokens)," / ",dT(13,16,t.aggregate.cacheWriteTokens)," "),KE(4),Il(" ",fT(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),KE(2),Kw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Is(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),UC(5,"Name"),ml(),Is(6,"th",17),UC(7,"Tokens"),ml(),Is(8,"th",17),UC(9,"Input / output"),ml(),Is(10,"th",17),UC(11,"Cache read / write"),ml(),Is(12,"th",17),UC(13,"Estimated cost"),ml()()(),Is(14,"tbody",15),eC(15,we,18,21,"tr",16,_e),ml()()()),e&2){let t=fC().$implicit;KE(),fg("aria-label","Usage "+t.title.toLowerCase()),KE(14),tC(t.rows);}}function Ne(e,a){if(e&1&&(Is(0,"h3",11),UC(1),ml(),Qw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;KE(),Lg(t.title),KE(),Kw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(eC(0,Ne,4,2,null,null,ue),Is(2,"p",10),UC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),ml()),e&2){let t=fC(2);tC(oT(4,ge,rT(0,ce,t.agents()),rT(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(t);let s=fC();return yf(s.load())}),Is(1,"ds-form-field",5)(2,"input",6),$g("ngModelChange",function(s){mf(t);let m=fC();return ZC(m.from,s)||(m.from=s),yf(s)}),ml(),VI(),ml(),Is(3,"ds-form-field",7)(4,"input",8),$g("ngModelChange",function(s){mf(t);let m=fC();return ZC(m.to,s)||(m.to=s),yf(s)}),ml(),VI(),ml(),Is(5,"button",9),UC(6,"Refresh"),ml()(),Qw(7,be,2,1,"ds-notice"),Qw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=fC();KE(2),Ug("ngModel",r.from),UI(),KE(2),Ug("ngModel",r.to),UI(),KE(3),Kw((t=r.error())?7:-1,t),KE(),Kw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Y);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=zi([]);models=zi([]);error=zi(null);loading=zi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Ff(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Dd(void 0),ma(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),Ny({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ga(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Is(0,"ds-page",0),hg(1,"ds-section-header",1),Qw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),ml()),t&2&&(KE(2),Kw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[gd,fd,Ut,fo,go,uo,_a,pa,vn,yn,fn,_n,at,un,Vo,Ob,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
1
+ import {f,a6 as gd,a as fd,U as Ut,c as fo,g as go,a7 as uo,a8 as _a,a9 as pa,v as vn,d as yn,e as fn,_ as _n,i as at,u as un,V as Vo,aa as f$1}from'./chunk-VbI0SYDI.js';import {g,W,aQ as Q,z as zi,ad as le,p as Ff,x as xw,aR as Ob,I as Is,a as hg,Q as Qw,m as ml,K as KE,b as Kw,am as Dd,a1 as ma,a3 as rn,ae as Ny,a2 as ga,U as UC,s as aC,S as Eg,aS as $g,T as VI,r as fC,aT as Ug,X as UI,l as eC,t as tC,aU as oT,aV as rT,L as Lg,j as fg,aw as uT,ax as dT,a5 as jg,q as Il,aW as fT,u as mf,w as yf,aX as ZC}from'./main-6TWWBEJW.js';var ce=e=>({title:"By agent",rows:e}),pe=e=>({title:"By model",rows:e}),ge=(e,a)=>[e,a],ue=(e,a)=>a.title,_e=(e,a)=>a.key;function Ce(e,a){e&1&&(Is(0,"p",2),UC(1,"Loading usage settings\u2026"),ml());}function fe(e,a){if(e&1){let t=aC();Is(0,"ds-notice"),UC(1,"Could not load usage settings. Please try again."),ml(),Is(2,"div")(3,"button",3),Eg("click",function(){mf(t);let s=fC();return yf(s.configuration.retry())}),UC(4,"Retry usage settings"),ml()();}}function ye(e,a){e&1&&(Is(0,"p",2),UC(1,"Usage tracking is disabled."),ml());}function be(e,a){e&1&&(Is(0,"ds-notice"),UC(1),ml()),e&2&&(KE(),Lg(a));}function xe(e,a){e&1&&(Is(0,"p",2),UC(1,"Loading usage\u2026"),ml());}function he(e,a){e&1&&(Is(0,"p",12),UC(1,"No recorded usage for this period."),ml());}function Se(e,a){if(e&1&&(Is(0,"p",10),UC(1),ml()),e&2){let t=fC().$implicit;KE(),Il("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function we(e,a){if(e&1&&(Is(0,"tr",16)(1,"td",18),UC(2),ml(),Is(3,"td",19),UC(4),uT(5,"number"),ml(),Is(6,"td",20),UC(7),uT(8,"number"),uT(9,"number"),ml(),Is(10,"td",21),UC(11),uT(12,"number"),uT(13,"number"),ml(),Is(14,"td",22),UC(15),uT(16,"agentosCost"),Qw(17,Se,2,1,"p",10),ml()()),e&2){let t=a.$implicit;KE(2),Lg(t.key),KE(2),Lg(dT(5,8,t.aggregate.totalTokens)),KE(3),jg(" ",dT(8,10,t.aggregate.inputTokens)," / ",dT(9,12,t.aggregate.outputTokens)," "),KE(4),jg(" ",dT(12,14,t.aggregate.cacheReadTokens)," / ",dT(13,16,t.aggregate.cacheWriteTokens)," "),KE(4),Il(" ",fT(16,18,t.aggregate.cost,t.aggregate.unknownCostCount)," "),KE(2),Kw(t.aggregate.unknownCostCount>0?17:-1);}}function ve(e,a){if(e&1&&(Is(0,"div",13)(1,"table",14)(2,"thead",15)(3,"tr",16)(4,"th",17),UC(5,"Name"),ml(),Is(6,"th",17),UC(7,"Tokens"),ml(),Is(8,"th",17),UC(9,"Input / output"),ml(),Is(10,"th",17),UC(11,"Cache read / write"),ml(),Is(12,"th",17),UC(13,"Estimated cost"),ml()()(),Is(14,"tbody",15),eC(15,we,18,21,"tr",16,_e),ml()()()),e&2){let t=fC().$implicit;KE(),fg("aria-label","Usage "+t.title.toLowerCase()),KE(14),tC(t.rows);}}function Ne(e,a){if(e&1&&(Is(0,"h3",11),UC(1),ml(),Qw(2,he,2,0,"p",12)(3,ve,17,1,"div",13)),e&2){let t=a.$implicit;KE(),Lg(t.title),KE(),Kw(t.rows.length===0?2:3);}}function Te(e,a){if(e&1&&(eC(0,Ne,4,2,null,null,ue),Is(2,"p",10),UC(3," Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish. "),ml()),e&2){let t=fC(2);tC(oT(4,ge,rT(0,ce,t.agents()),rT(2,pe,t.models())));}}function Ee(e,a){if(e&1){let t=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(t);let s=fC();return yf(s.load())}),Is(1,"ds-form-field",5)(2,"input",6),$g("ngModelChange",function(s){mf(t);let m=fC();return ZC(m.from,s)||(m.from=s),yf(s)}),ml(),VI(),ml(),Is(3,"ds-form-field",7)(4,"input",8),$g("ngModelChange",function(s){mf(t);let m=fC();return ZC(m.to,s)||(m.to=s),yf(s)}),ml(),VI(),ml(),Is(5,"button",9),UC(6,"Refresh"),ml()(),Qw(7,be,2,1,"ds-notice"),Qw(8,xe,2,0,"p",2)(9,Te,4,7);}if(e&2){let t,r=fC();KE(2),Ug("ngModel",r.from),UI(),KE(2),Ug("ngModel",r.to),UI(),KE(3),Kw((t=r.error())?7:-1,t),KE(),Kw(r.loading()?8:r.error()?-1:9);}}var me=class e{route=g(W);api=g(Q);configuration=g(f);namespaceId=this.route.snapshot.params.namespaceId;agents=zi([]);models=zi([]);error=zi(null);loading=zi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new le;constructor(){Ff(a=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Dd(void 0),ma(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),rn):(this.loading.set(true),Ny({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ga(m=>(this.loading.set(false),this.error.set(m.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),rn))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});a(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-namespace-usage"]],decls:6,vars:1,consts:[["full",""],["title","Usage and costs","description","Recorded LLM usage across this namespace. Costs are estimates in the platform currency."],["role","status",1,"settings-table__status"],["dsButton","","type","button",3,"click"],[1,"ds-inline","ds-inline--wrap","ds-inline--end",3,"ngSubmit"],["label","From (UTC)","controlId","usage-from"],["dsControl","","id","usage-from","type","date","name","from","required","",3,"ngModelChange","ngModel"],["label","To (UTC)","controlId","usage-to"],["dsControl","","id","usage-to","type","date","name","to","required","",3,"ngModelChange","ngModel"],["dsButton","","variant","primary","type","submit"],[1,"ds-hint"],[1,"ds-micro"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table"],["role","rowgroup"],["role","row"],["role","columnheader"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Tokens"],["role","cell","data-label","Input / output"],["role","cell","data-label","Cache read / write"],["role","cell","data-label","Estimated cost"]],template:function(t,r){t&1&&(Is(0,"ds-page",0),hg(1,"ds-section-header",1),Qw(2,Ce,2,0,"p",2)(3,fe,5,0)(4,ye,2,0,"p",2)(5,Ee,10,4),ml()),t&2&&(KE(2),Kw(r.configuration.state()==="loading"?2:r.configuration.state()==="error"?3:r.configuration.state()==="disabled"?4:5));},dependencies:[gd,fd,Ut,fo,go,uo,_a,pa,vn,yn,fn,_n,at,un,Vo,Ob,f$1],encapsulation:2})};export{me as NamespaceUsageComponent};
@@ -0,0 +1 @@
1
+ import {f,y,p as pt,T as Te,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,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,h as hn,i as at,u as un}from'./chunk-VbI0SYDI.js';import {g,W,F,H as L,J as we,k as yT,z as zi,p as Ff,M as U,O as w,P as x,x as xw,I as Is,a as hg,Q as Qw,m as ml,R as pg,K as KE,b as Kw,U as UC,s as aC,S as Eg,T as VI,l as eC,r as fC,X as UI,j as fg,t as tC,q as Il,L as Lg,u as mf,w as yf}from'./main-6TWWBEJW.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function he(i,t){if(i&1&&(Is(0,"option",23),UC(1),ml()),i&2){let e=t.$implicit;pg("value",e.value),KE(),Lg(e.label);}}function pe(i,t){if(i&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let p=fC();return yf(p.submit())}),Is(1,"ds-form-field",5),hg(2,"input",6),VI(),ml(),Is(3,"ds-form-field",7),hg(4,"textarea",8),VI(),ml(),Is(5,"ds-form-field",9),hg(6,"input",10),VI(),ml(),Is(7,"ds-form-field",11),hg(8,"input",12),VI(),ml(),Is(9,"ds-form-field",13),hg(10,"input",14),VI(),ml(),Is(11,"ds-form-field",15),hg(12,"input",16),VI(),ml(),Is(13,"ds-form-field",17),hg(14,"input",18),VI(),ml(),Is(15,"ds-form-field",19)(16,"input",20),Eg("input",function(p){mf(e);let se=fC();return yf(se.onMaxToolRoundsInput(p))}),ml(),VI(),ml(),Is(17,"ds-form-field",21)(18,"select",22),eC(19,he,2,2,"option",23,ce),ml(),VI(),ml(),Is(21,"ds-form-actions")(22,"button",24),UC(23),ml(),Is(24,"button",25),Eg("click",function(){mf(e);let p=fC();return yf(p.cancel())}),UC(25,"Cancel"),ml()()();}if(i&2){let e=fC();pg("formGroup",e.form),KE(2),pg("formControl",e.nameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.externalIdControl),UI(),KE(2),pg("formControl",e.defaultAgentNameControl),UI(),KE(2),pg("formControl",e.configPathControl),UI(),KE(),pg("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),KE(),pg("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),fg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),UI(),KE(),pg("hint",e.runCostThresholdHint()),KE(),pg("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),UI(),KE(),pg("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),KE(),pg("formControl",e.maxToolRoundsControl),fg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),UI(),KE(2),pg("formControl",e.adminCaseListingControl),UI(),KE(),tC(e.adminCaseListingOptions),KE(3),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(L);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=yT(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=yT(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=yT(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=yT(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[bn.min(fe),bn.max(ge),bn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=zi(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);existingNamespace=null;constructor(){Ff(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Is(0,"ds-page",0),hg(1,"ds-section-header",1),Qw(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),ml()),e&2&&(pg("framed",!u.isEditMode()),KE(),pg("title",u.isEditMode()?"Edit namespace":"New namespace"),KE(),Kw(u.isLoading()?2:3));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,hn,at,un],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
@@ -0,0 +1 @@
1
+ import {S}from'./chunk-VbI0SYDI.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-6TWWBEJW.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"]},{label:"Caches",commands:["caches"]}]}];static \u0275fac=function(t){return new(t||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(t,g){t&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()),t&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 +1 @@
1
- import {c}from'./chunk-BiOlkBEs.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-Y0RP9yux.js';import {g,F,H as we,z as zi,M as U$1,ai as De,al as _e,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-NUYYC27E.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let e=fC();KE(),Lg(e.deletion.error());}}function B(n,t){n&1&&(Is(0,"p",4),UC(1,"Loading scheduled prompts\u2026"),ml());}function j(n,t){n&1&&(Is(0,"p",5),UC(1,"No platform scheduled prompts defined yet."),ml());}function W(n,t){n&1&&(Is(0,"p",4),UC(1,"No scheduled prompts match the current filter."),ml());}function H(n,t){if(n&1&&(Is(0,"span",14),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Lg(e.description);}}function O(n,t){if(n&1){let e=aC();Is(0,"button",21),Eg("click",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.toggle(s))}),UC(1),ml(),Is(2,"button",21),Eg("click",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.edit(s))}),UC(3,"Edit"),ml();}if(n&2){let e=fC().$implicit;KE(),Lg(e.enabled?"Disable":"Enable"),KE(),fg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=aC();Is(0,"agentos-row-delete-action",22),Eg("deleteRequested",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.deletion.request(s.id))})("deleteConfirmed",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.confirmDelete(s))})("deleteCancelled",function(){mf(e);let s=fC(3);return yf(s.deletion.cancel())}),ml();}if(n&2){let e=fC().$implicit,i=fC(2);pg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Is(0,"tr",9)(1,"td",12)(2,"span",13),UC(3),ml(),Qw(4,H,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),Qw(12,O,4,2),Qw(13,Y,1,3,"agentos-row-delete-action",20),ml()()()),n&2){let e=t.$implicit,i=fC(2);KE(3),Lg(e.name),KE(),Kw(e.description?4:-1),KE(2),Lg(i.scheduleLabel(e)),KE(2),pg("variant",e.enabled?"accent":"outline"),KE(),Lg(e.enabled?"Enabled":"Disabled"),KE(3),Kw(i.deletion.confirmingId()!==e.id?12:-1),KE(),Kw(e.id?13:-1);}}function G(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)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,z,14,7,"tr",9,M),ml()()()),n&2){let e=fC();KE(14),tC(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=zi([]);isLoading=zi(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===De.WEEK?"week":"month",s=e.unit===De.WEEK&&e.days?.length?` (${e.days.map(c=>_e[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["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","Platform 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","Actions","data-actions",""],[1,"settings-table__actions"],["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(e,i){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return i.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),UC(3,"New scheduled prompt"),ml()(),Qw(4,U,2,1,"p",3),Qw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,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.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
1
+ import {c}from'./chunk-mVP550cv.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-VbI0SYDI.js';import {g,F,J as we,z as zi,M as U$1,ak as We,an as Je,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-6TWWBEJW.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let e=fC();KE(),Lg(e.deletion.error());}}function B(n,t){n&1&&(Is(0,"p",4),UC(1,"Loading scheduled prompts\u2026"),ml());}function j(n,t){n&1&&(Is(0,"p",5),UC(1,"No platform scheduled prompts defined yet."),ml());}function W(n,t){n&1&&(Is(0,"p",4),UC(1,"No scheduled prompts match the current filter."),ml());}function H(n,t){if(n&1&&(Is(0,"span",14),UC(1),ml()),n&2){let e=fC().$implicit;KE(),Lg(e.description);}}function O(n,t){if(n&1){let e=aC();Is(0,"button",21),Eg("click",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.toggle(s))}),UC(1),ml(),Is(2,"button",21),Eg("click",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.edit(s))}),UC(3,"Edit"),ml();}if(n&2){let e=fC().$implicit;KE(),Lg(e.enabled?"Disable":"Enable"),KE(),fg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=aC();Is(0,"agentos-row-delete-action",22),Eg("deleteRequested",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.deletion.request(s.id))})("deleteConfirmed",function(){mf(e);let s=fC().$implicit,c=fC(2);return yf(c.confirmDelete(s))})("deleteCancelled",function(){mf(e);let s=fC(3);return yf(s.deletion.cancel())}),ml();}if(n&2){let e=fC().$implicit,i=fC(2);pg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Is(0,"tr",9)(1,"td",12)(2,"span",13),UC(3),ml(),Qw(4,H,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),Qw(12,O,4,2),Qw(13,Y,1,3,"agentos-row-delete-action",20),ml()()()),n&2){let e=t.$implicit,i=fC(2);KE(3),Lg(e.name),KE(),Kw(e.description?4:-1),KE(2),Lg(i.scheduleLabel(e)),KE(2),pg("variant",e.enabled?"accent":"outline"),KE(),Lg(e.enabled?"Enabled":"Disabled"),KE(3),Kw(i.deletion.confirmingId()!==e.id?12:-1),KE(),Kw(e.id?13:-1);}}function G(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)(11,"span",11),UC(12,"Actions"),ml()()()(),Is(13,"tbody",8),eC(14,z,14,7,"tr",9,M),ml()()()),n&2){let e=fC();KE(14),tC(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=zi([]);isLoading=zi(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===We.WEEK?"week":"month",s=e.unit===We.WEEK&&e.days?.length?` (${e.days.map(c=>Je[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["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","Platform 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","Actions","data-actions",""],[1,"settings-table__actions"],["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(e,i){e&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return i.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return i.openCreateForm()}),UC(3,"New scheduled prompt"),ml()(),Qw(4,U,2,1,"p",3),Qw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,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.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,Ao,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
@@ -0,0 +1 @@
1
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-B4QJcXnP.js';import {O}from'./chunk-YwnuVV6j.js';import {g,W,F,J as we,ai as U,az as N,z as zi,aA as K$1,aa as J,k as yT,ab as F$1,aB as QB,aC as Ue,M as U$1,a2 as ga,ac as _r,ae as Ny,af as ne,P as x,O as w,x as xw,av as $t$1,I as Is,S as Eg,U as UC,m as ml,Q as Qw,K as KE,R as pg,b as Kw,aD as Sg,aE as DC,r as fC,s as aC,a as hg,T as VI,u as mf,w as yf,X as UI,c as xg,j as fg,q as Il,l as eC,t as tC,L as Lg,a5 as jg}from'./main-6TWWBEJW.js';import {H as A,p as pt$1,T as Te,b as bn,I as E,K as Kt$1,a as fd,M as Mo,D as Do,U as Ut$1,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,Z as Zr,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$1,u as un,n as cn,A as Ao}from'./chunk-VbI0SYDI.js';import'./chunk-CG27SgJm.js';var D="*";function Ke(i){return (i??[]).some(t=>t.trim()===D)}function He(i){let t=(i??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D).map(e=>e.toLowerCase());return new Set(t)}function K(i){return i.includes(D)}function Qe(i){let t=i.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function Y(i,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D&&K(e)).some(e=>Qe(e)?.test(i)??false)}var We="AGENTOS_CONFIG",Xe=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Je(i){return i.configEnabled&&(i.hasSubAgents||i.integrationTypes.some(t=>Xe.has(t)))}var Ze=["instructionsTextarea"],Ye=(i,t)=>t.value,et=(i,t)=>t.config.id,tt=(i,t)=>t.type,ze=(i,t)=>t.selector;function nt(i,t){if(i&1&&(Is(0,"a",3),UC(1,"View resolved definition \u2192"),ml()),i&2){let e=fC();pg("routerLink",e.inspectRoute());}}function it(i,t){i&1&&(Is(0,"ds-tag",4),UC(1,"Platform level"),ml());}function ot(i,t){i&1&&(Is(0,"p",5),UC(1,"Loading\u2026"),ml());}function at(i,t){if(i&1&&(hg(0,"input",18),VI()),i&2){let e=fC(2);pg("formControl",e.modelNameControl),UI();}}function lt(i,t){if(i&1&&(Is(0,"option",45),UC(1),ml()),i&2){let e=t;pg("ngValue",e.value),KE(),Lg(e.label);}}function rt(i,t){if(i&1&&(Is(0,"option",45),UC(1),ml()),i&2){let e=t.$implicit;pg("ngValue",e.value),KE(),Lg(e.label);}}function st(i,t){if(i&1&&(Is(0,"optgroup",46),eC(1,rt,2,2,"option",45,Ye),ml()),i&2){let e=fC(3);KE(),tC(e.modelOptions().aliases);}}function dt(i,t){if(i&1&&(Is(0,"option",45),UC(1),ml()),i&2){let e=t.$implicit;pg("ngValue",e.value),KE(),Lg(e.label);}}function ct(i,t){if(i&1&&(Is(0,"optgroup",47),eC(1,dt,2,2,"option",45,Ye),ml()),i&2){let e=fC(3);KE(),tC(e.modelOptions().apiNames);}}function ut(i,t){if(i&1&&(Is(0,"select",19)(1,"option",44),UC(2,"Select a model"),ml(),Qw(3,lt,2,2,"option",45),Qw(4,st,3,0,"optgroup",46),Qw(5,ct,3,0,"optgroup",47),ml(),VI()),i&2){let e,n=fC(2);pg("formControl",n.modelNameControl),UI(),KE(),pg("ngValue",null),KE(2),Kw((e=n.modelOptions().current)?3:-1,e),KE(),Kw(n.modelOptions().aliases.length>0?4:-1),KE(),Kw(n.modelOptions().apiNames.length>0?5:-1);}}function gt(i,t){if(i&1&&(Is(0,"span",48),UC(1),ml()),i&2){let e=fC().$implicit;KE(),Lg(e.config.integrationType);}}function mt(i,t){if(i&1&&(hg(0,"input",49),VI()),i&2){let e=fC().$implicit;pg("formControl",e.toolsControl),fg("aria-label","Tools of "+e.config.name),UI();}}function pt(i,t){if(i&1){let e=aC();Is(0,"div",11)(1,"label",12)(2,"input",27),Eg("change",function(){let s=mf(e).$implicit,u=fC(3);return yf(u.toggleIntegration(s))}),ml(),Is(3,"span",28),UC(4),ml(),Qw(5,gt,2,1,"span",48),ml(),Qw(6,mt,1,2,"input",49),ml();}if(i&2){let e=t.$implicit;KE(2),pg("checked",e.enabled()),KE(2),Lg(e.config.name),KE(),Kw(e.config.integrationType?5:-1),KE(),Kw(e.enabled()?6:-1);}}function ft(i,t){if(i&1&&(Is(0,"p",14),UC(1),ml()),i&2){let e=fC().$implicit;KE(),Il(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(i,t){if(i&1){let e=aC();Is(0,"div",11)(1,"label",28),UC(2),Is(3,"span",48),UC(4,"built-in"),ml()(),Is(5,"select",51),Eg("change",function(s){let u=mf(e).$implicit,C=fC(4);return yf(C.setBuiltInState(u,s.target.value))}),Is(6,"option",52),UC(7),ml(),Is(8,"option",53),UC(9,"Enabled"),ml(),Is(10,"option",54),UC(11,"Disabled"),ml()(),Qw(12,ft,2,1,"p",14),Is(13,"p",14),UC(14),ml()();}if(i&2){let e=t.$implicit,n=fC(4);KE(),fg("for","built-in-"+e.type),KE(),Il(" ",e.displayName," "),KE(3),pg("id","built-in-"+e.type)("value",e.state()),KE(2),Lg(n.builtInDefaultLabel(e)),KE(5),Kw(e.state()==="on"&&e.restrictedTools?12:-1),KE(2),Lg(e.description);}}function _t(i,t){if(i&1&&(Is(0,"span",50),UC(1,"Built-in integrations"),ml(),eC(2,Ct,15,7,"div",11,tt)),i&2){let e=fC(3);KE(2),tC(e.builtInRows());}}function bt(i,t){i&1&&(Is(0,"ds-notice",30),UC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),ml());}function ht(i,t){if(i&1&&(Is(0,"ds-fieldset",25),eC(1,pt,7,4,"div",11,et),Qw(3,_t,4,0),Qw(4,bt,2,0,"ds-notice",30),ml()),i&2){let e=fC(2);KE(),tC(e.integrationRows()),KE(2),Kw(e.builtInRows().length>0?3:-1),KE(),Kw(e.configAgentExposureWarning()?4:-1);}}function yt(i,t){i&1&&UC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function xt(i,t){i&1&&(Is(0,"ds-notice",30),UC(1," Saving with this on replaces the selection below with "),Is(2,"code",29),UC(3,"*"),ml(),UC(4,". "),ml());}function vt(i,t){i&1&&(Is(0,"ds-notice"),UC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function St(i,t){i&1&&(Is(0,"p",5),UC(1,"No skill available in this scope yet."),ml());}function At(i,t){i&1&&(Is(0,"span",48),UC(1,"platform"),ml());}function wt(i,t){if(i&1&&(Is(0,"span",48),UC(1),ml()),i&2){let e=fC(4);KE(),Il(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(i,t){if(i&1&&(Is(0,"p",14),UC(1),ml()),i&2){let e=fC().$implicit;KE(),Lg(e.description);}}function Tt(i,t){if(i&1){let e=aC();Is(0,"div",11)(1,"label",12)(2,"input",55),Eg("change",function(){let s=mf(e).$implicit,u=fC(3);return yf(u.toggleSkill(s))}),ml(),Is(3,"span",28),UC(4),ml(),Qw(5,At,2,0,"span",48),Qw(6,wt,2,1,"span",48),ml(),Qw(7,Et,2,1,"p",14),ml();}if(i&2){let e=t.$implicit,n=fC(3);KE(2),pg("checked",e.selected())("disabled",n.allSkillsSelected()),KE(2),Lg(e.name),KE(),Kw(e.platform?5:-1),KE(),Kw(e.unresolved?6:-1),KE(),Kw(e.description?7:-1);}}function kt(i,t){if(i&1&&eC(0,Tt,8,6,"div",11,ze),i&2){let e=fC(2);tC(e.skillRows());}}function It(i,t){if(i&1&&(Is(0,"ds-form-field",34),hg(1,"textarea",56),VI(),Is(2,"p",5),UC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Is(4,"code"),UC(5,"AgentLoopPayload"),ml(),UC(6,". Leave empty if you always provide the payload at launch. "),ml()()),i&2){let e=fC(2);pg("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),KE(),pg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),UI();}}function Mt(i,t){i&1&&UC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function Ft(i,t){if(i&1&&UC(0),i&2){let e=fC(3);jg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Rt(i,t){if(i&1&&(Is(0,"ds-notice",30),UC(1," Saving with this on replaces the selection below with "),Is(2,"code",29),UC(3,"*"),ml(),UC(4,". "),Qw(5,Ft,1,2),ml()),i&2){let e=fC(2);KE(5),Kw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(i,t){i&1&&(Is(0,"ds-notice"),UC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),ml());}function Dt(i,t){i&1&&(Is(0,"p",5),UC(1,"No other agent is available in this scope yet."),ml());}function Lt(i,t){i&1&&(Is(0,"span",48),UC(1,"pattern"),ml());}function Vt(i,t){i&1&&(Is(0,"span",48),UC(1,"via pattern"),ml());}function Pt(i,t){if(i&1&&(Is(0,"span",48),UC(1),ml()),i&2){let e=fC(4);KE(),Il(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Ot(i,t){if(i&1){let e=aC();Is(0,"button",59),Eg("click",function(){mf(e);let s=fC().$implicit,u=fC(3);return yf(u.removeSubAgent(s))}),UC(1," \xD7 "),ml();}if(i&2){let e=fC().$implicit;fg("aria-label","Remove "+e.selector);}}function Bt(i,t){if(i&1){let e=aC();Is(0,"div",36)(1,"label",57)(2,"input",55),Eg("change",function(){let s=mf(e).$implicit,u=fC(3);return yf(u.toggleSubAgent(s))}),ml(),Is(3,"span",28),UC(4),ml(),Qw(5,Lt,2,0,"span",48)(6,Vt,2,0,"span",48)(7,Pt,2,1,"span",48),ml(),Qw(8,Ot,2,1,"button",58),ml();}if(i&2){let e=t.$implicit,n=fC(3);KE(2),pg("checked",e.selected())("disabled",n.allSubAgentsSelected()),KE(2),Lg(e.name),KE(),Kw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),KE(3),Kw(e.unresolved?8:-1);}}function $t(i,t){if(i&1&&eC(0,Bt,9,5,"div",36,ze),i&2){let e=fC(2);tC(e.subAgentRows());}}function Ut(i,t){if(i&1){let e=aC();Is(0,"div")(1,"button",60),Eg("click",function(){mf(e);let s=fC(2);return yf(s.useDefaultDelegationTimeout())}),UC(2," Use server default "),ml()();}}function Gt(i,t){i&1&&(Is(0,"ds-notice"),UC(1),ml()),i&2&&(KE(),Lg(t));}function jt(i,t){if(i&1){let e=aC();Is(0,"button",61),Eg("click",function(){mf(e);let s=fC(2);return yf(s.exportYaml())}),UC(1),ml();}if(i&2){let e=fC(2);pg("disabled",e.isExporting()),KE(),Il(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(i,t){if(i&1){let e=aC();Is(0,"form",7),Eg("ngSubmit",function(){mf(e);let s=fC();return yf(s.submit())}),Is(1,"ds-fieldset",8)(2,"ds-form-field",9),hg(3,"input",10),VI(),ml(),Is(4,"div",11)(5,"label",12),hg(6,"input",13),VI(),UC(7," Enabled "),ml(),Is(8,"p",14),UC(9,"Disabled agents are excluded from namespace resolution."),ml()(),Is(10,"ds-form-field",15),hg(11,"input",16),VI(),ml(),Is(12,"ds-form-field",17),Qw(13,at,1,1,"input",18)(14,ut,6,5,"select",19),ml(),Is(15,"div",20)(16,"div",21)(17,"button",22),Eg("click",function(){mf(e);let s=fC();return yf(s.toggleInstructionsFullscreen())})("keydown.escape",function(){mf(e);let s=fC();return yf(s.closeInstructionsFullscreen())}),UC(18),ml()(),Is(19,"ds-form-field",23)(20,"textarea",24,0),Eg("keydown.escape",function(){mf(e);let s=fC();return yf(s.closeInstructionsFullscreen())}),ml(),VI(),ml()()(),Qw(22,ht,5,2,"ds-fieldset",25),Is(23,"ds-fieldset",26)(24,"p",5),UC(25," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Is(26,"code"),UC(27,"readSkill"),ml(),UC(28," and "),Is(29,"code"),UC(30,"readSkillResource"),ml(),UC(31," tools; selecting none grants neither. "),Qw(32,yt,1,0),ml(),Is(33,"label",12)(34,"input",27),Eg("change",function(){mf(e);let s=fC();return yf(s.toggleAllSkills())}),ml(),Is(35,"span",28),UC(36,"Every skill in the catalogue ("),Is(37,"code",29),UC(38,"*"),ml(),UC(39,")"),ml()(),Is(40,"p",14),UC(41," Resolved at run time, so skills added later are granted too, without editing this agent. "),ml(),Qw(42,xt,5,0,"ds-notice",30),Qw(43,vt,2,0,"ds-notice"),Qw(44,St,2,0,"p",5)(45,kt,2,0),ml(),Is(46,"ds-form-field",31)(47,"select",32)(48,"option",33),UC(49,"SIMPLE \u2014 Standard agent (single LLM call)"),ml(),Is(50,"option",33),UC(51,"ADVANCED \u2014 Multi-step reasoning loop"),ml(),Is(52,"option",33),UC(53,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),ml()(),VI(),ml(),Qw(54,It,7,3,"ds-form-field",34),Is(55,"ds-fieldset",35)(56,"p",5),UC(57," The agents this one may delegate to. Selecting at least one grants it the "),Is(58,"code"),UC(59,"DELEGATE__delegate"),ml(),UC(60," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Qw(61,Mt,1,0),ml(),Is(62,"label",12)(63,"input",27),Eg("change",function(){mf(e);let s=fC();return yf(s.toggleAllSubAgents())}),ml(),Is(64,"span",28),UC(65,"Every agent it can reach ("),Is(66,"code",29),UC(67,"*"),ml(),UC(68,")"),ml()(),Is(69,"p",14),UC(70," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),ml(),Qw(71,Rt,6,1,"ds-notice",30),Qw(72,Nt,2,0,"ds-notice"),Qw(73,Dt,2,0,"p",5)(74,$t,2,0),Is(75,"p",5),UC(76," Advanced \u2014 add a glob instead of picking a name, for example "),Is(77,"code"),UC(78,"*Fixer"),ml(),UC(79," to cover BugFixer and StoryFixer. "),ml(),Is(80,"div",36)(81,"input",37),Eg("keydown.enter",function(){mf(e);let s=fC();return yf(s.addSubAgent())}),ml(),VI(),Is(82,"button",38),Eg("click",function(){mf(e);let s=fC();return yf(s.addSubAgent())}),UC(83," + "),ml()(),Is(84,"ds-form-field",39),hg(85,"input",40),VI(),Qw(86,Ut,3,0,"div"),ml()(),Qw(87,Gt,2,1,"ds-notice"),Is(88,"ds-form-actions")(89,"button",41),UC(90),ml(),Qw(91,jt,2,2,"button",42),Is(92,"button",43),Eg("click",function(){mf(e);let s=fC();return yf(s.cancel())}),UC(93,"Cancel"),ml()()();}if(i&2){let e,n=fC();pg("formGroup",n.form),KE(3),pg("formControl",n.nameControl),UI(),KE(3),pg("formControl",n.enabledControl),UI(),KE(5),pg("formControl",n.descriptionControl),UI(),KE(2),Kw(n.modelAsFreeText()?13:14),KE(2),xg("agent-config-instructions--fullscreen",n.instructionsFullscreen()),KE(2),fg("aria-pressed",n.instructionsFullscreen()),KE(),Il(" ",n.instructionsFullscreen()?"Exit full screen":"Full screen"," "),KE(),pg("hint",n.instructionsCounter())("error",n.instructionsError()),KE(),pg("formControl",n.instructionsControl),fg("aria-invalid",n.instructionsControl.invalid),UI(),KE(2),Kw(n.integrationRows().length>0||n.builtInRows().length>0?22:-1),KE(10),Kw(n.isPlatformMode?32:-1),KE(2),pg("checked",n.allSkillsSelected()),KE(8),Kw(n.namedSkillSelectionDropped()?42:-1),KE(),Kw(n.skillCatalogueUnavailable()?43:-1),KE(),Kw(n.skillRows().length===0?44:45),KE(3),pg("formControl",n.executionModeControl),UI(),KE(),pg("value",n.ExecutionMode.SIMPLE),KE(2),pg("value",n.ExecutionMode.ADVANCED),KE(2),pg("value",n.ExecutionMode.LOOP),KE(2),Kw(n.isLoopMode()?54:-1),KE(7),Kw(n.isPlatformMode?61:-1),KE(2),pg("checked",n.allSubAgentsSelected()),KE(8),Kw(n.namedSubAgentSelectionDropped()?71:-1),KE(),Kw(n.subAgentCandidatesUnavailable()?72:-1),KE(),Kw(n.subAgentRows().length===0?73:74),KE(8),pg("formControl",n.newSubAgentControl),UI(),KE(),pg("disabled",!n.newSubAgentControl.value.trim()),KE(2),pg("hint",n.delegationTimeoutHint())("error",n.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),KE(),pg("formControl",n.delegationTimeoutControl),fg("aria-invalid",n.delegationTimeoutControl.invalid),UI(),KE(),Kw(n.delegationTimeoutControl.value!==null?86:-1),KE(),Kw((e=n.submitError())?87:-1,e),KE(2),pg("disabled",n.form.invalid||n.isSubmitting()),KE(),Il(" ",n.isEditMode()?"Save changes":"Create"," "),KE(),Kw(n.isEditMode()?91:-1);}}var z=2e4,qe=class i$1{route=g(W);router=g(F);destroyRef=g(we);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=zi(null);exportService=g(K$1);integrationConfigState=g(O);integrationTypeController=g(J);skillState=g(o);aiModelState=g(A);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[bn.required,i$1.notBlankValidator]}),instructions:new Te(null,{validators:[bn.maxLength(z)]}),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[bn.min(1),bn.max(2147483647),bn.pattern(/^\d+$/)]}),enabled:new Te(true,{nonNullable:true}),loopConfig:new Te(null,{validators:[i$1.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(n){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=yT(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=yT(()=>this.executionModeValue()==="LOOP");static maxInstructionsLabel=z.toLocaleString("en-US");instructionsValue=F$1(this.form.controls.instructions.valueChanges,{initialValue:this.form.controls.instructions.value});instructionsLength=yT(()=>(this.instructionsValue()??"").length);instructionsCounter=yT(()=>`${this.instructionsLength().toLocaleString("en-US")} / ${i$1.maxInstructionsLabel} characters`);instructionsError=yT(()=>{let t=this.instructionsLength();return t<=z?null:`Instructions must not exceed ${i$1.maxInstructionsLabel} characters (currently ${t.toLocaleString("en-US")}).`});instructionsFullscreen=zi(false);instructionsTextarea=QB("instructionsTextarea");toggleInstructionsFullscreen(){this.instructionsFullscreen.update(t=>!t),this.instructionsTextarea()?.nativeElement.focus();}closeInstructionsFullscreen(){this.instructionsFullscreen()&&(this.instructionsFullscreen.set(false),this.instructionsTextarea()?.nativeElement.focus());}subAgentRows=zi([]);allSubAgentsSelected=zi(false);subAgentCandidatesUnavailable=zi(false);namedSubAgentSelectionDropped=yT(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=yT(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=yT(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);isExporting=zi(false);submitError=zi(null);ExecutionMode=Ue;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=zi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=yT(()=>Je({configEnabled:this.builtInRows().some(t=>t.type===We&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=zi({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=zi(false);modelAsFreeText=yT(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(E(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=zi([]);skillRows=zi([]);allSkillsSelected=zi(false);skillCatalogueUnavailable=zi(false);namedSkillSelectionDropped=yT(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),ga(()=>_r(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ny({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:n,platformIntegrations:s,builtInTypes:u,skillCatalogue:C,delegationCandidates:T,models:k})=>{this.existingConfig=e,this.applyModelCatalogue(k,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let f=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(f),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let L=[...s,...n];this.integrationRows.set(this.buildIntegrationRows(L,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(u,e.integrations??void 0)),this.allSubAgentsSelected.set(Ke(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(T,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(C,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ny({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):_r([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:n,builtInTypes:s,skillCatalogue:u,delegationCandidates:C,models:T})=>{this.applyModelCatalogue(T,null);let k=[...n,...e];this.integrationRows.set(this.buildIntegrationRows(k,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(s,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(C,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(u,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(n=>({id:n.id??"",name:n.name,description:n.description,namespaceId:n.namespaceId??null,readOnly:n.readOnly===true}))))).pipe(ga(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),_r([]))))}buildSkillRows(t,e){let s=(e??[]).map(f=>f.trim()).filter(f=>f.length>0).filter(f=>f!==r),u=i(s),C=new Set(t.map(f=>f.name.toLowerCase())),T=t.map(f=>({selector:f.name,name:f.name,description:f.description,platform:f.namespaceId==null,unresolved:false,selected:zi(u.has(f.name.toLowerCase()))})),k=new Set;for(let f of s){let L=l(f).toLowerCase();C.has(L)||k.has(L)||(k.add(L),T.push({selector:f,name:f,description:"",platform:false,unresolved:true,selected:zi(true)}));}return T}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):_r([]);return Ny({platform:t,namespace:e}).pipe(ne(({platform:n,namespace:s})=>[...n,...s]),ne(n=>n.map(s=>s.name).filter(s=>s.length>0)),ne(n=>i$1.dedupeByKey(n)))}orNoCandidates(){return ga(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),_r([])))}static dedupeByKey(t){let e=new Set;return t.filter(n=>{let s=n.toLowerCase();return e.has(s)?false:(e.add(s),true)})}buildSubAgentRows(t,e,n){let s=He(e),u=n?.toLowerCase()??null,C=t.filter(_=>{let B=_.toLowerCase();return B!==u||s.has(B)}),T=new Set(C.map(_=>_.toLowerCase())),k=C.map(_=>({selector:_,name:_,unresolved:false,pattern:false,grantedByPattern:Y(_,e),selected:zi(s.has(_.toLowerCase()))})),f=new Set,L=(e??[]).map(_=>_.trim()).filter(_=>_.length>0&&_!==D);for(let _ of L){let B=_.toLowerCase();T.has(B)||f.has(B)||(f.add(B),k.push({selector:_,name:_,unresolved:true,pattern:K(_),grantedByPattern:false,selected:zi(true)}));}return k}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),ga(t=>(console.error("[agent-config-form] failed to load integration types",t),_r([]))))}buildIntegrationRows(t,e){return t.map(n=>{let s=n.name??"",u=e?.[s],C=e!=null&&s in e,T=Array.isArray(u)?u.join(", "):"";return {config:n,enabled:zi(C),toolsControl:new Te(T,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(n=>{let s=e!=null&&n.type in e,u=e?.[n.type],C=s?Array.isArray(u)&&u.length===0?"off":"on":"default";return {type:n.type,displayName:n.displayName,description:n.description,enabledByDefault:n.enabledByDefault===true,state:zi(C),restrictedTools:Array.isArray(u)&&u.length>0?u:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(n=>n.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===D?this.allSubAgentsSelected.set(true):this.subAgentRows.update(n=>this.withPatternGrants([...n,{selector:t,name:t,unresolved:true,pattern:K(t),grantedByPattern:false,selected:zi(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(n=>this.withPatternGrants(n.filter(s=>s.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(n=>n.selected()).map(n=>n.selector);return t.map(n=>n.unresolved?n:x(w({},n),{grantedByPattern:Y(n.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [D];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let n of this.integrationRows().filter(s=>s.enabled())){let s=n.config.name??"",u=n.toolsControl.value.trim();t[s]=u===""?null:u.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let n of this.builtInRows()){let s=n.state();s==="on"?t[n.type]=n.restrictedTools??null:s==="off"&&(t[n.type]=[]);}let e=new Set([...this.integrationRows().map(n=>n.config.name??""),...this.builtInRows().map(n=>n.type)]);for(let[n,s]of Object.entries(this.existingConfig?.integrations??{}))e.has(n)||(t[n]=s);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:n=>{this.isSubmitting.set(false),this.submitError.set(i$1.serverMessage(n));}});}static serverMessage(t){let n=t?.error?.message;if(typeof n=="string"&&n.trim().length>0)return n;let s=t?.status;return s===0?"The server could not be reached. The agent was not saved.":typeof s=="number"&&s>=500?`The server failed to save the agent (HTTP ${s}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let n=new Blob([e],{type:"application/yaml"}),s=URL.createObjectURL(n),u=document.createElement("a");u.href=s,u.download=`${this.existingConfig?.name??"agent"}.yaml`,u.click(),URL.revokeObjectURL(s),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||i$1)};static \u0275cmp=xw({type:i$1,selectors:[["agentos-agent-config-form"]],viewQuery:function(e,n){e&1&&Sg(n.instructionsTextarea,Ze,5),e&2&&DC();},decls:8,vars:4,consts:[["instructionsTextarea",""],[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],[1,"agent-config-instructions"],[1,"agent-config-instructions__toolbar"],["dsButton","","variant","ghost","type","button",3,"click","keydown.escape"],["label","Instructions","controlId","agent-config-instructions","hintId","agent-config-instructions-hint","errorId","agent-config-instructions-error",3,"hint","error"],["dsControl","","id","agent-config-instructions","rows","20","placeholder","Optional \u2014 system instructions for this agent","aria-describedby","agent-config-instructions-hint agent-config-instructions-error",3,"keydown.escape","formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,n){e&1&&(Is(0,"ds-page")(1,"ds-section-header",1)(2,"button",2),Eg("click",function(){return n.cancel()}),UC(3," \u2190 Agent configs "),ml(),Qw(4,nt,2,1,"a",3),Qw(5,it,2,0,"ds-tag",4),ml(),Qw(6,ot,2,0,"p",5)(7,Kt,94,40,"form",6),ml()),e&2&&(KE(),pg("title",n.isEditMode()?"Edit agent config":"New agent config"),KE(3),Kw(n.isEditMode()?4:-1),KE(),Kw(n.isPlatformMode?5:-1),KE(),Kw(n.isLoading()?6:7));},dependencies:[Kt$1,fd,Mo,Do,Ut$1,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,$t$1,vn,yn,fn,pn,hn,_n,at$1,un,cn,Ao],styles:[".agent-config-instructions[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;min-width:0}.agent-config-instructions[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{min-height:24rem}.agent-config-instructions__toolbar[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.agent-config-instructions--fullscreen[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:1000;box-sizing:border-box;padding:1.5rem;background:var(--color-bg, #fff)}.agent-config-instructions--fullscreen[_ngcontent-%COMP%] ds-form-field[_ngcontent-%COMP%]{flex:1;min-height:0}.agent-config-instructions--fullscreen[_ngcontent-%COMP%] textarea[_ngcontent-%COMP%]{flex:1;min-height:0;resize:none}@media(max-width:760px){.agent-config-instructions--fullscreen[_ngcontent-%COMP%]{padding:.75rem}}"]})};export{qe as AgentConfigFormComponent,z as MAX_INSTRUCTIONS_LENGTH};
@@ -1 +1 @@
1
- import {p as pt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,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,Z as Zr,N as Nn,R as Rn,E as Ea}from'./chunk-Y0RP9yux.js';import {g,W,F,H as we,aq as F$1,ap as k,a9 as F$2,a2 as ga,aa as _r,ar as ke,k as yT,z as zi,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,a as hg,T as VI,l as eC,ao as Jw,r as fC,X as UI,t as tC,q as Il,ae as Zw,L as Lg,as as jg,u as mf,w as yf}from'./main-NUYYC27E.js';function he(r,t){r&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ve(r,t){if(r&1&&hg(0,"input",6),r&2){let e=fC(2);pg("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Is(0,"option",44),UC(1),ml()),r&2){let e=t.$implicit;pg("value",e.id),KE(),jg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Is(0,"select",7)(1,"option",43),UC(2,"Select provider"),ml(),eC(3,ye,2,3,"option",44,Zw().trackByProvider,true),ml(),VI()),r&2){let e=fC(2);pg("formControl",e.aiProviderIdControl),UI(),KE(3),tC(e.providers());}}function xe(r,t){if(r&1&&(Is(0,"option",25),UC(1),ml()),r&2){let e=t.$implicit;pg("ngValue",e),KE(),Lg(e.toLowerCase());}}function _e(r,t){r&1&&(Is(0,"p",2),UC(1,"Not supported yet for Anthropic and Gemini providers."),ml());}function Me(r,t){r&1&&(Is(0,"p",2),UC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),ml());}function Ee(r,t){r&1&&(Is(0,"p",26),UC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),ml());}function Ae(r,t){if(r&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let u=fC();return yf(u.submit())}),Is(1,"ds-form-field",5),Qw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),ml(),Is(4,"ds-form-field",8),hg(5,"input",9),VI(),ml(),Is(6,"ds-form-field",10),hg(7,"input",11),VI(),ml(),Is(8,"ds-form-field",12),hg(9,"input",13),VI(),ml(),Is(10,"ds-form-field",14),hg(11,"input",15),VI(),ml(),Is(12,"div",16)(13,"ds-form-field",17),hg(14,"input",18),VI(),ml(),Is(15,"ds-form-field",19),hg(16,"input",20),VI(),ml()(),Is(17,"ds-form-field",21),hg(18,"input",22),VI(),ml(),Is(19,"ds-form-field",23)(20,"select",24)(21,"option",25),UC(22,"Provider default"),ml(),eC(23,xe,2,2,"option",25,Jw),ml(),VI(),Qw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Qw(27,Ee,2,0,"p",26),ml(),Is(28,"div",27)(29,"label",28),hg(30,"input",29),VI(),Is(31,"span",30),UC(32,"Supports advanced execution"),ml()(),Is(33,"p",31),UC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),ml()(),Is(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),hg(38,"input",34),VI(),ml(),Is(39,"ds-form-field",35),hg(40,"input",36),VI(),ml()(),Is(41,"div",16)(42,"ds-form-field",37),hg(43,"input",38),VI(),ml(),Is(44,"ds-form-field",39),hg(45,"input",40),VI(),ml()()(),Is(46,"ds-form-actions")(47,"button",41),UC(48),ml(),Is(49,"button",42),Eg("click",function(){mf(e);let u=fC();return yf(u.cancel())}),UC(50,"Cancel"),ml()()();}if(r&2){let e=fC();pg("formGroup",e.form),KE(2),Kw(e.isEditMode()?2:3),KE(3),pg("formControl",e.apiModelNameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.aliasControl),UI(),KE(2),pg("formControl",e.priorityControl),UI(),KE(3),pg("formControl",e.temperatureControl),UI(),KE(2),pg("formControl",e.contextWindowControl),UI(),KE(2),pg("formControl",e.maxCompletionTokensControl),UI(),KE(2),pg("formControl",e.reasoningEffortControl),UI(),KE(),pg("ngValue",null),KE(2),tC(e.reasoningEffortOptions),KE(2),Kw(e.reasoningEffortUnsupported()?25:26),KE(2),Kw(e.temperatureMayConflictWithEffort()?27:-1),KE(3),pg("formControl",e.supportsAdvancedExecutionControl),UI(),KE(5),pg("formGroup",e.pricingGroup),KE(3),UI(),KE(2),UI(),KE(3),UI(),KE(2),UI(),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ga(()=>_r([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[bn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(ke);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=yT(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=yT(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);selectedProviderLabel=yT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Ff(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return c.cancel()}),UC(3," \u2190 AI models "),ml()(),Qw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),ml()),e&2&&(KE(),pg("title",c.isEditMode()?"Edit AI model":"New AI model"),KE(3),Kw(c.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,Ea],encapsulation:2})};export{ge as AiModelFormComponent};
1
+ import {p as pt,T as Te,b as bn,v as vn,d as yn,e as fn,l as pn,h as hn,i as at,u as un,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,Z as Zr,N as Nn,R as Rn,E as Ea}from'./chunk-VbI0SYDI.js';import {g,W,F,J as we,as as F$1,ar as k,ab as F$2,a2 as ga,ac as _r,at as De,k as yT,z as zi,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,a as hg,T as VI,l as eC,aq as Jw,r as fC,X as UI,t as tC,q as Il,ag as Zw,L as Lg,a5 as jg,u as mf,w as yf}from'./main-6TWWBEJW.js';function he(r,t){r&1&&(Is(0,"p",2),UC(1,"Loading\u2026"),ml());}function ve(r,t){if(r&1&&hg(0,"input",6),r&2){let e=fC(2);pg("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Is(0,"option",44),UC(1),ml()),r&2){let e=t.$implicit;pg("value",e.id),KE(),jg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Is(0,"select",7)(1,"option",43),UC(2,"Select provider"),ml(),eC(3,ye,2,3,"option",44,Zw().trackByProvider,true),ml(),VI()),r&2){let e=fC(2);pg("formControl",e.aiProviderIdControl),UI(),KE(3),tC(e.providers());}}function xe(r,t){if(r&1&&(Is(0,"option",25),UC(1),ml()),r&2){let e=t.$implicit;pg("ngValue",e),KE(),Lg(e.toLowerCase());}}function _e(r,t){r&1&&(Is(0,"p",2),UC(1,"Not supported yet for Anthropic and Gemini providers."),ml());}function Me(r,t){r&1&&(Is(0,"p",2),UC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),ml());}function Ee(r,t){r&1&&(Is(0,"p",26),UC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),ml());}function Ae(r,t){if(r&1){let e=aC();Is(0,"form",4),Eg("ngSubmit",function(){mf(e);let u=fC();return yf(u.submit())}),Is(1,"ds-form-field",5),Qw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),ml(),Is(4,"ds-form-field",8),hg(5,"input",9),VI(),ml(),Is(6,"ds-form-field",10),hg(7,"input",11),VI(),ml(),Is(8,"ds-form-field",12),hg(9,"input",13),VI(),ml(),Is(10,"ds-form-field",14),hg(11,"input",15),VI(),ml(),Is(12,"div",16)(13,"ds-form-field",17),hg(14,"input",18),VI(),ml(),Is(15,"ds-form-field",19),hg(16,"input",20),VI(),ml()(),Is(17,"ds-form-field",21),hg(18,"input",22),VI(),ml(),Is(19,"ds-form-field",23)(20,"select",24)(21,"option",25),UC(22,"Provider default"),ml(),eC(23,xe,2,2,"option",25,Jw),ml(),VI(),Qw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Qw(27,Ee,2,0,"p",26),ml(),Is(28,"div",27)(29,"label",28),hg(30,"input",29),VI(),Is(31,"span",30),UC(32,"Supports advanced execution"),ml()(),Is(33,"p",31),UC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),ml()(),Is(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),hg(38,"input",34),VI(),ml(),Is(39,"ds-form-field",35),hg(40,"input",36),VI(),ml()(),Is(41,"div",16)(42,"ds-form-field",37),hg(43,"input",38),VI(),ml(),Is(44,"ds-form-field",39),hg(45,"input",40),VI(),ml()()(),Is(46,"ds-form-actions")(47,"button",41),UC(48),ml(),Is(49,"button",42),Eg("click",function(){mf(e);let u=fC();return yf(u.cancel())}),UC(50,"Cancel"),ml()()();}if(r&2){let e=fC();pg("formGroup",e.form),KE(2),Kw(e.isEditMode()?2:3),KE(3),pg("formControl",e.apiModelNameControl),UI(),KE(2),pg("formControl",e.descriptionControl),UI(),KE(2),pg("formControl",e.aliasControl),UI(),KE(2),pg("formControl",e.priorityControl),UI(),KE(3),pg("formControl",e.temperatureControl),UI(),KE(2),pg("formControl",e.contextWindowControl),UI(),KE(2),pg("formControl",e.maxCompletionTokensControl),UI(),KE(2),pg("formControl",e.reasoningEffortControl),UI(),KE(),pg("ngValue",null),KE(2),tC(e.reasoningEffortOptions),KE(2),Kw(e.reasoningEffortUnsupported()?25:26),KE(2),Kw(e.temperatureMayConflictWithEffort()?27:-1),KE(3),pg("formControl",e.supportsAdvancedExecutionControl),UI(),KE(5),pg("formGroup",e.pricingGroup),KE(3),UI(),KE(2),UI(),KE(3),UI(),KE(2),UI(),KE(2),pg("disabled",e.form.invalid||e.isSubmitting()),KE(),Il(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(F$1);aiProviderController=g(k);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(ga(()=>_r([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[bn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[bn.required,bn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(De);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=yT(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=yT(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=zi(false);isSubmitting=zi(false);isLoading=zi(false);selectedProviderLabel=yT(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Ff(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Is(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),Eg("click",function(){return c.cancel()}),UC(3," \u2190 AI models "),ml()(),Qw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),ml()),e&2&&(KE(),pg("title",c.isEditMode()?"Edit AI model":"New AI model"),KE(3),Kw(c.isLoading()?4:5));},dependencies:[vn,yn,fn,pn,hn,at,un,Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Zr,Nn,Rn,Ea],encapsulation:2})};export{ge as AiModelFormComponent};
@@ -0,0 +1 @@
1
+ import {y,p as pt,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,R as Rn,E as Ea,v as vn,d as yn,e as fn,h as hn,k as dn,i as at,u as un,m as mn,A as Ao}from'./chunk-VbI0SYDI.js';import {g,J as we,W,H as L,z as zi,M as U,x as xw,I as Is,a as hg,S as Eg,Q as Qw,m as ml,T as VI,U as UC,K as KE,R as pg,b as Kw,X as UI,q as Il,a6 as Ie,a7 as Ed,a8 as A,r as fC,s as aC,L as Lg,a9 as Ln,u as mf,w as yf,l as eC,t as tC}from'./main-6TWWBEJW.js';var I=class e{api=g(Ie);isLoading=zi(false);result=zi(null);errorMessage=zi(null);invoke(t,n,o,l){return this.isLoading.set(true),this.result.set(null),this.errorMessage.set(null),this.api.invoke({namespaceId:t,userId:n||void 0,toolName:o,payload:l||void 0}).pipe(Ed({next:v=>{this.result.set(v),this.isLoading.set(false);},error:v=>{this.errorMessage.set(le(v)),this.isLoading.set(false);}}))}reset(){this.result.set(null),this.errorMessage.set(null);}static \u0275fac=function(n){return new(n||e)};static \u0275prov=A({token:e,factory:e.\u0275fac,providedIn:"root"})};function le(e){if(e instanceof Ln){let t=e.error;return t&&typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:typeof t=="string"&&t.trim().length>0?t:e.statusText||`HTTP ${e.status}`}return e instanceof Error?e.message:"Unknown error"}var de=(e,t)=>t.id;function me(e,t){e&1&&(Is(0,"p",14),UC(1,"Loading namespaces\u2026"),ml());}function pe(e,t){if(e&1&&(Is(0,"option",17),UC(1),ml()),e&2){let n=t.$implicit;pg("value",n.id),KE(),Lg(n.name);}}function ce(e,t){if(e&1&&(Is(0,"select",15)(1,"option",16),UC(2,"Select a namespace"),ml(),eC(3,pe,2,2,"option",17,de),ml(),VI()),e&2){let n=fC(2);UI(),KE(3),tC(n.namespaces());}}function ue(e,t){if(e&1&&Qw(0,me,2,0,"p",14)(1,ce,5,0,"select",15),e&2){let n=fC();Kw(n.namespacesLoading()?0:1);}}function fe(e,t){if(e&1&&hg(0,"input",3),e&2){let n=fC();pg("value",n.namespaceName()??n.namespaceId);}}function ge(e,t){if(e&1){let n=aC();Is(0,"button",18),Eg("click",function(){mf(n);let l=fC();return yf(l.reset())}),UC(1,"Clear result"),ml();}}function ve(e,t){e&1&&(Is(0,"ds-card",12)(1,"pre",19),UC(2),ml()()),e&2&&(KE(2),Lg(t));}function ye(e,t){e&1&&(Is(0,"span",21),UC(1,"Metadata"),ml(),Is(2,"pre",19),UC(3),ml()),e&2&&(KE(3),Lg(t));}function Ce(e,t){if(e&1&&(Is(0,"dt"),UC(1,"Type"),ml(),Is(2,"dd",23),UC(3),ml()),e&2){let n=fC(2);KE(3),Lg(n.errorType);}}function _e(e,t){if(e&1&&(Is(0,"dt"),UC(1,"Message"),ml(),Is(2,"dd"),UC(3),ml()),e&2){let n=fC(2);KE(3),Lg(n.errorMessage);}}function be(e,t){if(e&1&&(Is(0,"span",21),UC(1,"Tool error details"),ml(),Is(2,"dl",22),Qw(3,Ce,4,1),Qw(4,_e,4,1),ml()),e&2){let n=fC();KE(3),Kw(n.errorType?3:-1),KE(),Kw(n.errorMessage?4:-1);}}function he(e,t){if(e&1&&(Is(0,"ds-card",13)(1,"div")(2,"ds-tag",20),UC(3),ml()(),Is(4,"span",21),UC(5,"Output"),ml(),Is(6,"pre",19),UC(7),ml(),Qw(8,ye,4,1),Is(9,"span",21),UC(10,"Structured output"),ml(),Is(11,"pre",19),UC(12),ml(),Qw(13,be,5,2),ml()),e&2){let n,o=t,l=fC();pg("heading","Result \u2014 "+o.toolName),KE(2),pg("variant",o.success?"accent":"outline"),KE(),Lg(o.success?"Success":"Tool error"),KE(4),Lg(o.output),KE(),Kw((n=l.formatMetadata(o.metadata))?8:-1,n),KE(4),Lg(l.formatStructuredOutput(o.structuredOutput)??"null"),KE(),Kw(o.errorType||o.errorMessage?13:-1);}}var re=class e{destroyRef=g(we);route=g(W);namespaceController=g(L);userState=g(y);state=g(I);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;namespaces=zi([]);namespacesLoading=zi(true);namespaceName=zi(null);form=new pt({namespaceId:new Te("",{nonNullable:true,validators:[bn.required]}),userId:new Te("",{nonNullable:true}),toolName:new Te("",{nonNullable:true,validators:[bn.required]}),payload:new Te("",{nonNullable:true})});ngOnInit(){let t=this.userState.currentUser()?.id;t?this.form.controls.userId.patchValue(t):this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:n=>{n.id&&this.form.controls.userId.patchValue(n.id);}}),this.isPlatformMode?this.namespaceController.listAllNamespace().pipe(U(this.destroyRef)).subscribe({next:n=>{this.namespaces.set(n.map(o=>({id:o.id,name:o.name}))),this.namespacesLoading.set(false);},error:()=>this.namespacesLoading.set(false)}):(this.form.controls.namespaceId.patchValue(this.namespaceId),this.namespacesLoading.set(false),this.namespaceController.getByIdNamespace(this.namespaceId).pipe(U(this.destroyRef)).subscribe({next:n=>this.namespaceName.set(n.name),error:()=>this.namespaceName.set(this.namespaceId)}));}submit(){if(this.form.invalid||this.state.isLoading())return;let{namespaceId:t,userId:n,toolName:o,payload:l}=this.form.getRawValue();this.state.invoke(t,n.trim()||void 0,o.trim(),l.trim()||void 0).pipe(U(this.destroyRef)).subscribe();}reset(){this.state.reset();}formatMetadata(t){return !t||Object.keys(t).length===0?null:JSON.stringify(t,null,2)}formatStructuredOutput(t){return t===void 0?null:JSON.stringify(t,null,2)}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-tool-invoke"]],decls:18,vars:8,consts:[["title","Tool invoke",3,"description"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Namespace","controlId","ti-namespace","required",""],["dsControl","","id","ti-namespace","type","text","readonly","",3,"value"],["label","User ID","labelHint","optional","controlId","ti-user"],["dsControl","","id","ti-user","type","text","formControlName","userId","placeholder","UUID of the user \u2014 adds user-scoped overlay layers","autocomplete","off"],["label","Tool name","controlId","ti-tool","required","","hint","Exact tool name as returned by the agent definition inspect page. When not found, the error response lists all available tools for the selected namespace."],["dsControl","","mono","","id","ti-tool","type","text","formControlName","toolName","placeholder","e.g. MY_FILES__listFiles","autocomplete","off","spellcheck","false"],["label","Payload","labelHint","optional","controlId","ti-payload"],["dsControl","","mono","","id","ti-payload","formControlName","payload","rows","6","placeholder",'JSON arguments for the tool, e.g. {"path": "/some/dir"} \u2014 leave empty for tools with no input.',"spellcheck","false"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button"],["heading","Error"],[3,"heading"],[1,"ds-hint"],["dsControl","","id","ti-namespace","formControlName","namespaceId"],["value","","disabled",""],[3,"value"],["dsButton","","type","button",3,"click"],[1,"ds-pre"],[3,"variant"],[1,"ds-micro"],["dsDefinitionList",""],[1,"ds-mono"]],template:function(n,o){if(n&1&&(Is(0,"ds-page"),hg(1,"ds-section-header",0),Is(2,"form",1),Eg("ngSubmit",function(){return o.submit()}),Is(3,"ds-form-field",2),Qw(4,ue,2,1)(5,fe,1,1,"input",3),ml(),Is(6,"ds-form-field",4),hg(7,"input",5),VI(),ml(),Is(8,"ds-form-field",6),hg(9,"input",7),VI(),ml(),Is(10,"ds-form-field",8),hg(11,"textarea",9),VI(),ml(),Is(12,"ds-form-actions")(13,"button",10),UC(14),ml(),Qw(15,ge,2,0,"button",11),ml()(),Qw(16,ve,3,1,"ds-card",12),Qw(17,he,14,7,"ds-card",13),ml()),n&2){let l,v;KE(),pg("description",o.isPlatformMode?"Execute any registered tool directly \u2014 bypasses the normal agent-run pipeline. Restricted to super-admins.":"Execute a registered tool directly in this namespace \u2014 bypasses the normal agent-run pipeline."),KE(),pg("formGroup",o.form),KE(2),Kw(o.isPlatformMode?4:5),KE(3),UI(),KE(2),UI(),KE(2),UI(),KE(2),pg("disabled",o.form.invalid||o.state.isLoading()),KE(),Il(" ",o.state.isLoading()?"Running\u2026":"Run tool"," "),KE(),Kw(o.state.result()||o.state.errorMessage()?15:-1),KE(),Kw((l=o.state.errorMessage())?16:-1,l),KE(),Kw((v=o.state.result())?17:-1,v);}},dependencies:[Kt,fd,Mo,Do,Ut,Qt,fo,go,Rn,Ea,vn,yn,fn,hn,dn,at,un,mn,Ao],encapsulation:2})};export{re as ToolInvokeComponent};
@@ -1 +1 @@
1
- import {s}from'./chunk-Y0RP9yux.js';import {g,W,E as ry,G as y,x as xw,y as yl,U as UC,v as vl,K as KE,L as Lg}from'./main-NUYYC27E.js';var A=class r{route=g(W);http=g(ry);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(yl(0,"p",0),UC(1),vl()),t&2&&(KE(),Lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {s}from'./chunk-VbI0SYDI.js';import {g,W,E as ry,G as y,x as xw,y as yl,U as UC,v as vl,K as KE,L as Lg}from'./main-6TWWBEJW.js';var A=class r{route=g(W);http=g(ry);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=xw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(yl(0,"p",0),UC(1),vl()),t&2&&(KE(),Lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +1 @@
1
- import {q as k,O,i as at,n as cn,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-Y0RP9yux.js';import {g,W,F,H as we,ag as U,$ as Sr,z as zi,a1 as ma,ac as Ny,a2 as ga,aa as _r,M as U$1,P as x,O as w,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,a as hg,u as mf,w as yf,aZ as EC}from'./main-NUYYC27E.js';var Z=(n,e)=>e.key;function ee(n,e){if(n&1&&(Is(0,"p",4),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.deletion.error());}}function te(n,e){if(n&1&&(Is(0,"p",4),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.toggleError());}}function ne(n,e){n&1&&(Is(0,"p",5),UC(1,"Loading agent configs\u2026"),ml());}function ie(n,e){n&1&&(Is(0,"p",6),UC(1,"No agent configs available."),ml());}function oe(n,e){n&1&&(Is(0,"p",5),UC(1,"No agent configs match the current filter."),ml());}function ae(n,e){if(n&1){let t=aC();Is(0,"label",17)(1,"input",25,0),Eg("change",function(){mf(t);let l=EC(2),d=fC().$implicit,v=fC(2);return yf(v.toggleEnabled(d,l))}),ml(),UC(3," Enabled "),ml();}if(n&2){let t=fC().$implicit,i=fC(2);KE(),pg("checked",i.isEnabled(t))("disabled",i.isToggling()),fg("aria-label","Enabled: "+t.config.name);}}function re(n,e){if(n&1&&(Is(0,"label",17),hg(1,"input",26),UC(2," Enabled "),ml()),n&2){let t=fC().$implicit,i=fC(2);KE(),pg("checked",i.isEnabled(t)),fg("aria-label","Enabled: "+t.config.name);}}function le(n,e){n&1&&(Is(0,"ds-tag",21),UC(1,"Read-only"),ml());}function ce(n,e){if(n&1){let t=aC();Is(0,"button",27),Eg("click",function(){mf(t);let l=fC(2).$implicit,d=fC(2);return yf(d.launch(l))}),UC(1," Launch "),ml();}if(n&2){let t=fC(2).$implicit;fg("aria-label","Launch "+t.config.name);}}function se(n,e){if(n&1){let t=aC();Is(0,"button",27),Eg("click",function(){mf(t);let l=fC(2).$implicit,d=fC(2);return yf(d.edit(l))}),UC(1," Edit "),ml();}if(n&2){let t=fC(2).$implicit;fg("aria-label","Edit "+t.config.name);}}function de(n,e){if(n&1){let t=aC();Is(0,"button",27),Eg("click",function(){mf(t);let l=fC().$implicit,d=fC(2);return yf(d.inspect(l))}),UC(1," Inspect "),ml(),Qw(2,ce,2,1,"button",28),Qw(3,se,2,1,"button",28);}if(n&2){let t=fC().$implicit,i=fC(2);fg("aria-label","Inspect "+t.config.name),KE(2),Kw(i.canLaunch(t)?2:-1),KE(),Kw(t.scope==="namespace"?3:-1);}}function ge(n,e){if(n&1){let t=aC();Is(0,"agentos-row-delete-action",29),Eg("deleteRequested",function(){mf(t);let l=fC().$implicit,d=fC(2);return yf(d.deletion.request(l.key))})("deleteConfirmed",function(){mf(t);let l=fC().$implicit,d=fC(2);return yf(d.confirmDelete(l))})("deleteCancelled",function(){mf(t);let l=fC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let t=fC().$implicit,i=fC(2);pg("rowKey",t.key)("rowLabel",t.config.name)("state",i.deletion);}}function me(n,e){if(n&1&&(Is(0,"tr",10)(1,"td",13),UC(2),ml(),Is(3,"td",14),UC(4),ml(),Is(5,"td",15),UC(6),ml(),Is(7,"td",16),Qw(8,ae,4,3,"label",17)(9,re,3,2,"label",17),ml(),Is(10,"td",18)(11,"div",19)(12,"ds-tag",20),UC(13),ml(),Qw(14,le,2,0,"ds-tag",21),ml()(),Is(15,"td",22)(16,"div",23),Qw(17,de,4,3),Qw(18,ge,1,3,"agentos-row-delete-action",24),ml()()()),n&2){let t=e.$implicit,i=fC(2);KE(2),Lg(t.config.name),KE(2),Il(" ",t.config.description||"\u2014"," "),KE(2),Lg(i.mode(t)),KE(2),Kw(t.scope==="namespace"?8:9),KE(4),pg("variant",t.scope==="platform"?"neutral":"accent"),KE(),Lg(t.scope==="platform"?"Platform":"Namespace"),KE(),Kw(t.scope==="platform"?14:-1),KE(3),Kw(i.deletion.confirmingId()!==t.key?17:-1),KE(),Kw(t.scope==="namespace"?18:-1);}}function pe(n,e){if(n&1&&(Is(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),UC(5,"Name"),ml(),Is(6,"th",11),UC(7,"Description"),ml(),Is(8,"th",11),UC(9,"Execution mode"),ml(),Is(10,"th",11),UC(11,"Enabled"),ml(),Is(12,"th",11),UC(13,"Scope"),ml(),Is(14,"th",11)(15,"span",12),UC(16,"Actions"),ml()()()(),Is(17,"tbody",9),eC(18,me,19,9,"tr",10,Z),ml()()()),n&2){let t=fC();KE(18),tC(t.rowFilter.filteredRows());}}var X=class n{route=g(W);router=g(F);destroyRef=g(we);controller=g(U);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();rows=zi([]);togglingKey=zi(null);toggleError=zi(null);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),this.isEnabled(e)?"Enabled":"Disabled",e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(ma(()=>(this.isLoading.set(true),Ny({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(ga(()=>_r([])))}))));constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,config:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,config:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}toggleEnabled(e,t){let i=e.config.id;if(e.scope==="platform"||!i||this.togglingKey()!==null){t.checked=this.isEnabled(e);return}let l=this.isEnabled(e);this.toggleError.set(null),this.togglingKey.set(e.key),(l?this.controller.disableAgentConfig(i):this.controller.enableAgentConfig(i)).pipe(U$1(this.destroyRef)).subscribe({next:v=>{this.rows.update(Y=>Y.map(w$1=>w$1.key===e.key?x(w({},w$1),{config:v}):w$1)),t.checked=v.enabled===true,this.togglingKey.set(null);},error:()=>{t.checked=l,this.toggleError.set(`${l?"Disabling":"Enabling"} "${e.config.name}" failed. Try again.`),this.togglingKey.set(null);}});}isToggling(){return this.togglingKey()!==null}isEnabled(e){return e.config.enabled===true}confirmDelete(e){e.scope==="platform"||!e.config.id||this.deletion.execute(e.key,{request$:this.controller.deleteAgentConfig(e.config.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-namespace-agent-configs"]],decls:10,vars:4,consts:[["enabledInput",""],["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["label","Filter agent configs","placeholder","Filter agent configs\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","Agent configs"],["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","Execution mode"],["role","cell","data-label","Enabled"],["dsCheck",""],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["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","checkbox","role","switch",3,"change","checked","disabled"],["type","checkbox","disabled","",3,"checked"],["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,i){t&1&&(Is(0,"ds-section-header",1)(1,"agentos-table-filter",2),Eg("queryChange",function(d){return i.rowFilter.query.set(d)}),ml(),Is(2,"button",3),Eg("click",function(){return i.openCreateForm()}),UC(3,"New agent config"),ml()(),Qw(4,ee,2,1,"p",4),Qw(5,te,2,1,"p",4),Qw(6,ne,2,0,"p",5)(7,ie,2,0,"p",6)(8,oe,2,0,"p",5)(9,pe,20,0,"div",7)),t&2&&(KE(),pg("query",i.rowFilter.query()),KE(3),Kw(i.deletion.error()?4:-1),KE(),Kw(i.toggleError()?5:-1),KE(),Kw(i.isLoading()?6:i.rows().length===0?7:i.rowFilter.filteredRows().length===0?8:9));},dependencies:[at,cn,yn,Vo,Ao,P,P$1],encapsulation:2})};export{X as NamespaceAgentConfigsComponent};
1
+ import {q as k,O,i as at,n as cn,d as yn,V as Vo,A as Ao,j as P,r as P$1}from'./chunk-VbI0SYDI.js';import {g,W,F,J as we,ai as U,$ as Sr,z as zi,a1 as ma,ae as Ny,a2 as ga,ac as _r,M as U$1,P as x,O as w,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,a as hg,u as mf,w as yf,a_ as EC}from'./main-6TWWBEJW.js';var Z=(n,e)=>e.key;function ee(n,e){if(n&1&&(Is(0,"p",4),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.deletion.error());}}function te(n,e){if(n&1&&(Is(0,"p",4),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.toggleError());}}function ne(n,e){n&1&&(Is(0,"p",5),UC(1,"Loading agent configs\u2026"),ml());}function ie(n,e){n&1&&(Is(0,"p",6),UC(1,"No agent configs available."),ml());}function oe(n,e){n&1&&(Is(0,"p",5),UC(1,"No agent configs match the current filter."),ml());}function ae(n,e){if(n&1){let t=aC();Is(0,"label",17)(1,"input",25,0),Eg("change",function(){mf(t);let l=EC(2),d=fC().$implicit,v=fC(2);return yf(v.toggleEnabled(d,l))}),ml(),UC(3," Enabled "),ml();}if(n&2){let t=fC().$implicit,i=fC(2);KE(),pg("checked",i.isEnabled(t))("disabled",i.isToggling()),fg("aria-label","Enabled: "+t.config.name);}}function re(n,e){if(n&1&&(Is(0,"label",17),hg(1,"input",26),UC(2," Enabled "),ml()),n&2){let t=fC().$implicit,i=fC(2);KE(),pg("checked",i.isEnabled(t)),fg("aria-label","Enabled: "+t.config.name);}}function le(n,e){n&1&&(Is(0,"ds-tag",21),UC(1,"Read-only"),ml());}function ce(n,e){if(n&1){let t=aC();Is(0,"button",27),Eg("click",function(){mf(t);let l=fC(2).$implicit,d=fC(2);return yf(d.launch(l))}),UC(1," Launch "),ml();}if(n&2){let t=fC(2).$implicit;fg("aria-label","Launch "+t.config.name);}}function se(n,e){if(n&1){let t=aC();Is(0,"button",27),Eg("click",function(){mf(t);let l=fC(2).$implicit,d=fC(2);return yf(d.edit(l))}),UC(1," Edit "),ml();}if(n&2){let t=fC(2).$implicit;fg("aria-label","Edit "+t.config.name);}}function de(n,e){if(n&1){let t=aC();Is(0,"button",27),Eg("click",function(){mf(t);let l=fC().$implicit,d=fC(2);return yf(d.inspect(l))}),UC(1," Inspect "),ml(),Qw(2,ce,2,1,"button",28),Qw(3,se,2,1,"button",28);}if(n&2){let t=fC().$implicit,i=fC(2);fg("aria-label","Inspect "+t.config.name),KE(2),Kw(i.canLaunch(t)?2:-1),KE(),Kw(t.scope==="namespace"?3:-1);}}function ge(n,e){if(n&1){let t=aC();Is(0,"agentos-row-delete-action",29),Eg("deleteRequested",function(){mf(t);let l=fC().$implicit,d=fC(2);return yf(d.deletion.request(l.key))})("deleteConfirmed",function(){mf(t);let l=fC().$implicit,d=fC(2);return yf(d.confirmDelete(l))})("deleteCancelled",function(){mf(t);let l=fC(3);return yf(l.deletion.cancel())}),ml();}if(n&2){let t=fC().$implicit,i=fC(2);pg("rowKey",t.key)("rowLabel",t.config.name)("state",i.deletion);}}function me(n,e){if(n&1&&(Is(0,"tr",10)(1,"td",13),UC(2),ml(),Is(3,"td",14),UC(4),ml(),Is(5,"td",15),UC(6),ml(),Is(7,"td",16),Qw(8,ae,4,3,"label",17)(9,re,3,2,"label",17),ml(),Is(10,"td",18)(11,"div",19)(12,"ds-tag",20),UC(13),ml(),Qw(14,le,2,0,"ds-tag",21),ml()(),Is(15,"td",22)(16,"div",23),Qw(17,de,4,3),Qw(18,ge,1,3,"agentos-row-delete-action",24),ml()()()),n&2){let t=e.$implicit,i=fC(2);KE(2),Lg(t.config.name),KE(2),Il(" ",t.config.description||"\u2014"," "),KE(2),Lg(i.mode(t)),KE(2),Kw(t.scope==="namespace"?8:9),KE(4),pg("variant",t.scope==="platform"?"neutral":"accent"),KE(),Lg(t.scope==="platform"?"Platform":"Namespace"),KE(),Kw(t.scope==="platform"?14:-1),KE(3),Kw(i.deletion.confirmingId()!==t.key?17:-1),KE(),Kw(t.scope==="namespace"?18:-1);}}function pe(n,e){if(n&1&&(Is(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),UC(5,"Name"),ml(),Is(6,"th",11),UC(7,"Description"),ml(),Is(8,"th",11),UC(9,"Execution mode"),ml(),Is(10,"th",11),UC(11,"Enabled"),ml(),Is(12,"th",11),UC(13,"Scope"),ml(),Is(14,"th",11)(15,"span",12),UC(16,"Actions"),ml()()()(),Is(17,"tbody",9),eC(18,me,19,9,"tr",10,Z),ml()()()),n&2){let t=fC();KE(18),tC(t.rowFilter.filteredRows());}}var X=class n{route=g(W);router=g(F);destroyRef=g(we);controller=g(U);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();rows=zi([]);togglingKey=zi(null);toggleError=zi(null);rowFilter=O(this.rows,e=>[e.config.name,e.config.description,this.mode(e),this.isEnabled(e)?"Enabled":"Disabled",e.scope].filter(Boolean).join(" "));allConfigs$=this.refresh$.pipe(ma(()=>(this.isLoading.set(true),Ny({namespace:this.controller.listByParentAgentConfig(this.namespaceId),platform:this.controller.listPlatformAgentsAgentConfig().pipe(ga(()=>_r([])))}))));constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe({next:({namespace:e,platform:t})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,config:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,config:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}inspect(e){e.config.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","agent-configs",e.config.id,"inspect"]:["/agentos",this.namespaceId,"agent-configs",e.config.id,"inspect"]);}launch(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"launch"]);}edit(e){e.scope==="platform"||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"agent-configs",e.config.id,"edit"]);}toggleEnabled(e,t){let i=e.config.id;if(e.scope==="platform"||!i||this.togglingKey()!==null){t.checked=this.isEnabled(e);return}let l=this.isEnabled(e);this.toggleError.set(null),this.togglingKey.set(e.key),(l?this.controller.disableAgentConfig(i):this.controller.enableAgentConfig(i)).pipe(U$1(this.destroyRef)).subscribe({next:v=>{this.rows.update(Y=>Y.map(w$1=>w$1.key===e.key?x(w({},w$1),{config:v}):w$1)),t.checked=v.enabled===true,this.togglingKey.set(null);},error:()=>{t.checked=l,this.toggleError.set(`${l?"Disabling":"Enabling"} "${e.config.name}" failed. Try again.`),this.togglingKey.set(null);}});}isToggling(){return this.togglingKey()!==null}isEnabled(e){return e.config.enabled===true}confirmDelete(e){e.scope==="platform"||!e.config.id||this.deletion.execute(e.key,{request$:this.controller.deleteAgentConfig(e.config.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}canLaunch(e){return e.scope==="namespace"&&e.config.executionMode==="LOOP"}mode(e){return e.config.executionMode??(e.config.advancedExecution?"ADVANCED":"SIMPLE")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-namespace-agent-configs"]],decls:10,vars:4,consts:[["enabledInput",""],["title","Agent configs","description","Agent configurations available in this namespace, including configurations inherited from the platform."],["label","Filter agent configs","placeholder","Filter agent configs\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","Agent configs"],["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","Execution mode"],["role","cell","data-label","Enabled"],["dsCheck",""],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["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","checkbox","role","switch",3,"change","checked","disabled"],["type","checkbox","disabled","",3,"checked"],["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,i){t&1&&(Is(0,"ds-section-header",1)(1,"agentos-table-filter",2),Eg("queryChange",function(d){return i.rowFilter.query.set(d)}),ml(),Is(2,"button",3),Eg("click",function(){return i.openCreateForm()}),UC(3,"New agent config"),ml()(),Qw(4,ee,2,1,"p",4),Qw(5,te,2,1,"p",4),Qw(6,ne,2,0,"p",5)(7,ie,2,0,"p",6)(8,oe,2,0,"p",5)(9,pe,20,0,"div",7)),t&2&&(KE(),pg("query",i.rowFilter.query()),KE(3),Kw(i.deletion.error()?4:-1),KE(),Kw(i.toggleError()?5:-1),KE(),Kw(i.isLoading()?6:i.rows().length===0?7:i.rowFilter.filteredRows().length===0?8:9));},dependencies:[at,cn,yn,Vo,Ao,P,P$1],encapsulation:2})};export{X as NamespaceAgentConfigsComponent};
@@ -1 +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-Y0RP9yux.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-NUYYC27E.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)("error",e.controls.defaultValue.invalid&&e.controls.defaultValue.touched?"Default value is required.":null),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,9,"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","required","",3,"controlId","error"],["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
+ 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-VbI0SYDI.js';import {g,W,F,J as we,ai as U,z as zi,M as U$1,a2 as ga,ac 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,ao 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-6TWWBEJW.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)("error",e.controls.defaultValue.invalid&&e.controls.defaultValue.touched?"Default value is required.":null),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,9,"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","required","",3,"controlId","error"],["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,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-Y0RP9yux.js';import {g,F,H as we,ag as U$1,$ as Sr,z as zi,a1 as ma,M as U$2,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-NUYYC27E.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.deletion.error());}}function K(n,e){n&1&&(Is(0,"p",4),UC(1,"Loading agent configs\u2026"),ml());}function H(n,e){n&1&&(Is(0,"p",5),UC(1,"No platform agent configs defined yet."),ml());}function U(n,e){n&1&&(Is(0,"p",4),UC(1,"No agent configs match the current filter."),ml());}function z(n,e){if(n&1){let t=aC();Is(0,"button",19),Eg("click",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.inspect(d))}),UC(1," Inspect "),ml(),Is(2,"button",19),Eg("click",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.edit(d))}),UC(3,"Edit"),ml();}if(n&2){let t=fC().$implicit;fg("aria-label","Inspect "+t.name),KE(2),fg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=aC();Is(0,"agentos-row-delete-action",20),Eg("deleteRequested",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.deletion.request(d.id))})("deleteConfirmed",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=fC(3);return yf(d.deletion.cancel())}),ml();}if(n&2){let t=fC().$implicit,a=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&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),UC(8),ml(),Is(9,"td",16)(10,"div",17),Qw(11,z,4,2),Qw(12,G,1,3,"agentos-row-delete-action",18),ml()()()),n&2){let t=e.$implicit,a=fC(2);KE(2),Lg(t.name),KE(2),Il(" ",t.description||"\u2014"," "),KE(2),Lg(t.modelName||"\u2014"),KE(2),Lg(a.mode(t)),KE(3),Kw(a.deletion.confirmingId()!==t.id?11:-1),KE(),Kw(t.id?12:-1);}}function O(n,e){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,"Description"),ml(),Is(8,"th",10),UC(9,"Model"),ml(),Is(10,"th",10),UC(11,"Execution mode"),ml(),Is(12,"th",10)(13,"span",11),UC(14,"Actions"),ml()()()(),Is(15,"tbody",8),eC(16,J,13,6,"tr",9,B),ml()()()),n&2){let t=fC();KE(16),tC(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();configs=zi([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\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 agents"],["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","Model"],["role","cell","data-label","Execution mode"],["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"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return a.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),UC(3,"New agent config"),ml()(),Qw(4,j,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,18,0,"div",6)),t&2&&(KE(),pg("query",a.rowFilter.query()),KE(3),Kw(a.deletion.error()?4:-1),KE(),Kw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
1
+ import {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-VbI0SYDI.js';import {g,F,J as we,ai as U$1,$ as Sr,z as zi,a1 as ma,M as U$2,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-6TWWBEJW.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Is(0,"p",3),UC(1),ml()),n&2){let t=fC();KE(),Lg(t.deletion.error());}}function K(n,e){n&1&&(Is(0,"p",4),UC(1,"Loading agent configs\u2026"),ml());}function H(n,e){n&1&&(Is(0,"p",5),UC(1,"No platform agent configs defined yet."),ml());}function U(n,e){n&1&&(Is(0,"p",4),UC(1,"No agent configs match the current filter."),ml());}function z(n,e){if(n&1){let t=aC();Is(0,"button",19),Eg("click",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.inspect(d))}),UC(1," Inspect "),ml(),Is(2,"button",19),Eg("click",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.edit(d))}),UC(3,"Edit"),ml();}if(n&2){let t=fC().$implicit;fg("aria-label","Inspect "+t.name),KE(2),fg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=aC();Is(0,"agentos-row-delete-action",20),Eg("deleteRequested",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.deletion.request(d.id))})("deleteConfirmed",function(){mf(t);let d=fC().$implicit,c=fC(2);return yf(c.confirmDelete(d))})("deleteCancelled",function(){mf(t);let d=fC(3);return yf(d.deletion.cancel())}),ml();}if(n&2){let t=fC().$implicit,a=fC(2);pg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&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),UC(8),ml(),Is(9,"td",16)(10,"div",17),Qw(11,z,4,2),Qw(12,G,1,3,"agentos-row-delete-action",18),ml()()()),n&2){let t=e.$implicit,a=fC(2);KE(2),Lg(t.name),KE(2),Il(" ",t.description||"\u2014"," "),KE(2),Lg(t.modelName||"\u2014"),KE(2),Lg(a.mode(t)),KE(3),Kw(a.deletion.confirmingId()!==t.id?11:-1),KE(),Kw(t.id?12:-1);}}function O(n,e){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,"Description"),ml(),Is(8,"th",10),UC(9,"Model"),ml(),Is(10,"th",10),UC(11,"Execution mode"),ml(),Is(12,"th",10)(13,"span",11),UC(14,"Actions"),ml()()()(),Is(15,"tbody",8),eC(16,J,13,6,"tr",9,B),ml()()()),n&2){let t=fC();KE(16),tC(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Sr(void 0);isLoading=zi(true);deletion=k();configs=zi([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ma(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=xw({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\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 agents"],["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","Model"],["role","cell","data-label","Execution mode"],["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"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Is(0,"ds-section-header",0)(1,"agentos-table-filter",1),Eg("queryChange",function(c){return a.rowFilter.query.set(c)}),ml(),Is(2,"button",2),Eg("click",function(){return a.openCreateForm()}),UC(3,"New agent config"),ml()(),Qw(4,j,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,18,0,"div",6)),t&2&&(KE(),pg("query",a.rowFilter.query()),KE(3),Kw(a.deletion.error()?4:-1),KE(),Kw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};