@whoz-oss/coday-client 0.0.0-workstream-forge.233 → 0.0.0-workstream-forge.234

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 (50) hide show
  1. package/browser/chunk-2gGq060a.js +1 -0
  2. package/browser/{chunk-BSCoGKQH.js → chunk-58tiRI-H.js} +1 -1
  3. package/browser/{chunk-BmWGkbfS.js → chunk-6YBD0GhT.js} +1 -1
  4. package/browser/{chunk-oglfMLBg.js → chunk-AtCYApei.js} +1 -1
  5. package/browser/{chunk-DFBrAyo5.js → chunk-B1xRCZ-V.js} +1 -1
  6. package/browser/{chunk-DKNVANEr.js → chunk-B97Q0PCu.js} +1 -1
  7. package/browser/{chunk-BUAyDXTF.js → chunk-BHKhFWCm.js} +1 -1
  8. package/browser/{chunk-By1CBVie.js → chunk-BLevlpuu.js} +1 -1
  9. package/browser/{chunk-CXeXS2-8.js → chunk-BRekDeCw.js} +1 -1
  10. package/browser/{chunk-BEtE9u4S.js → chunk-BUfak7ZR.js} +1 -1
  11. package/browser/{chunk-k4Z-nQ9G.js → chunk-BZQ9JxtK.js} +1 -1
  12. package/browser/{chunk-ByIZOfZp.js → chunk-BjniM4kn.js} +1 -1
  13. package/browser/{chunk-D25q4NMm.js → chunk-BlPBulzu.js} +1 -1
  14. package/browser/{chunk-D98SYWQ_.js → chunk-Bqg4NsQw.js} +1 -1
  15. package/browser/{chunk-DPZEV56F.js → chunk-BtAgB7lp.js} +1 -1
  16. package/browser/{chunk-Df9nff1i.js → chunk-BwLhUg85.js} +1 -1
  17. package/browser/{chunk-BvB8BwW-.js → chunk-C4CShhcg.js} +1 -1
  18. package/browser/{chunk-BTyI5T9m.js → chunk-C4FZ3_Nh.js} +1 -1
  19. package/browser/{chunk-DrtsXIGf.js → chunk-C57r8bJB.js} +1 -1
  20. package/browser/{chunk-CkYlNhz9.js → chunk-CHLgsXpc.js} +1 -1
  21. package/browser/{chunk-BRhYc841.js → chunk-CWww3DEx.js} +1 -1
  22. package/browser/{chunk-D4MihuHS.js → chunk-CYwBGwuM.js} +1 -1
  23. package/browser/{chunk-DQpYayn2.js → chunk-Cii8kID2.js} +1 -1
  24. package/browser/{chunk-DDqlkc9R.js → chunk-CjEtYpc7.js} +1 -1
  25. package/browser/{chunk-DAJa9g45.js → chunk-CrvFTHbA.js} +1 -1
  26. package/browser/{chunk-Dje4hFK9.js → chunk-CseRCWgR.js} +1 -1
  27. package/browser/{chunk-BhiMaXTc.js → chunk-Ct896VFa.js} +1 -1
  28. package/browser/{chunk-Cs_kiN3M.js → chunk-CyEpqhHA.js} +1 -1
  29. package/browser/{chunk-DgP8Uad-.js → chunk-D2h70wlj.js} +1 -1
  30. package/browser/{chunk-BxyJxLnM.js → chunk-D5fiBKR6.js} +1 -1
  31. package/browser/{chunk-DLa-RTUD.js → chunk-DFkt8tY0.js} +1 -1
  32. package/browser/{chunk-DPJF32r4.js → chunk-DKN9kTwu.js} +1 -1
  33. package/browser/{chunk-D-GH6Vwh.js → chunk-DKkNMT3S.js} +1 -1
  34. package/browser/{chunk-BHFL0zBW.js → chunk-DMaZtyPG.js} +1 -1
  35. package/browser/{chunk-DofPUUm1.js → chunk-DRUw-4Lk.js} +1 -1
  36. package/browser/{chunk-ZSYVOgwG.js → chunk-Dz39nB4A.js} +1 -1
  37. package/browser/{chunk-DrUGsskB.js → chunk-KQaRB5fZ.js} +1 -1
  38. package/browser/{chunk-vbsIYZk_.js → chunk-NuH8shYm.js} +1 -1
  39. package/browser/{chunk-D4Ru-LHQ.js → chunk-OhgFuyjp.js} +1 -1
  40. package/browser/{chunk-D73N8VqQ.js → chunk-TWv3ObgU.js} +1 -1
  41. package/browser/{chunk-SfXGcx_u.js → chunk-XnJGN0OJ.js} +1 -1
  42. package/browser/{chunk-DU2T72t1.js → chunk-bCI6skcH.js} +5 -5
  43. package/browser/{chunk-CW0Xz9Gc.js → chunk-d7XsX4kM.js} +1 -1
  44. package/browser/{chunk-BL4O5z35.js → chunk-iEPxdwNo.js} +1 -1
  45. package/browser/{chunk-BeFHuscX.js → chunk-paKwZTsF.js} +1 -1
  46. package/browser/{chunk-CGIofH1S.js → chunk-pbgW0Sdk.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-WGM2SCAZ.js → main-PUOSMZMX.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-BSwOttIr.js +0 -1
@@ -0,0 +1 @@
1
+ import {a1 as ga,a2 as ha,aa as br,aD as $y}from'./main-PUOSMZMX.js';function i(t,o,p){return t.pipe(ga(()=>o().pipe(ha(()=>br(p)))),$y({bufferSize:1,refCount:true}))}export{i};
@@ -1 +1 @@
1
- import {c}from'./chunk-BeFHuscX.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-DU2T72t1.js';import {g,W,q as F,I as we,$ as $i,ac as by,a2 as ha,aa as br,K as U,N as x,L as w,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-WGM2SCAZ.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function Y(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function z(n,t){n&1&&(Es(0,"p",5),xC(1,"No scheduled prompts available."),hl());}function G(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function Q(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.prompt.description);}}function X(n,t){n&1&&(Es(0,"ds-tag",20),xC(1,"Read-only"),hl());}function Z(n,t){if(n&1){let e=Yw();Es(0,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.toggle(l))}),xC(1),hl(),Es(2,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.edit(l))}),xC(3," Edit "),hl();}if(n&2){let e=eC(2).$implicit;BE(),Fg(e.prompt.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Yw();jw(0,Z,4,2),Es(1,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.deletion.request(l.key))})("deleteConfirmed",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.confirmDelete(l))})("deleteCancelled",function(){pf(e);let l=eC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);Bw(i.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Es(0,"button",23),xC(1,"Inherited"),hl());}function ne(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,Q,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19)(12,"ds-tag",17),xC(13),hl(),jw(14,X,2,0,"ds-tag",20),hl()(),Es(15,"td",21)(16,"div",22),jw(17,ee,2,4)(18,te,2,0,"button",23),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.prompt.name),BE(),Bw(e.prompt.description?4:-1),BE(2),Fg(i.scheduleLabel(e.prompt)),BE(2),dg("variant",e.prompt.enabled?"accent":"outline"),BE(),Fg(e.prompt.enabled?"Enabled":"Disabled"),BE(3),dg("variant",e.scope==="platform"?"neutral":"accent"),BE(),Fg(e.scope==="platform"?"Platform":"Namespace"),BE(),Bw(e.scope==="platform"?14:-1),BE(3),Bw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,19,9,"tr",9,J),hl()()()),n&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){by({platform:this.state.listPlatform().pipe(ha(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return i.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,O,2,1,"p",3),jw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-paKwZTsF.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-bCI6skcH.js';import {g,W,q as F,I as we,$ as $i,ac as by,a2 as ha,aa as br,K as U,N as x,L as w,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-PUOSMZMX.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function Y(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function z(n,t){n&1&&(Es(0,"p",5),xC(1,"No scheduled prompts available."),hl());}function G(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function Q(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.prompt.description);}}function X(n,t){n&1&&(Es(0,"ds-tag",20),xC(1,"Read-only"),hl());}function Z(n,t){if(n&1){let e=Yw();Es(0,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.toggle(l))}),xC(1),hl(),Es(2,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.edit(l))}),xC(3," Edit "),hl();}if(n&2){let e=eC(2).$implicit;BE(),Fg(e.prompt.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Yw();jw(0,Z,4,2),Es(1,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.deletion.request(l.key))})("deleteConfirmed",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.confirmDelete(l))})("deleteCancelled",function(){pf(e);let l=eC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);Bw(i.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Es(0,"button",23),xC(1,"Inherited"),hl());}function ne(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,Q,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19)(12,"ds-tag",17),xC(13),hl(),jw(14,X,2,0,"ds-tag",20),hl()(),Es(15,"td",21)(16,"div",22),jw(17,ee,2,4)(18,te,2,0,"button",23),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.prompt.name),BE(),Bw(e.prompt.description?4:-1),BE(2),Fg(i.scheduleLabel(e.prompt)),BE(2),dg("variant",e.prompt.enabled?"accent":"outline"),BE(),Fg(e.prompt.enabled?"Enabled":"Disabled"),BE(3),dg("variant",e.scope==="platform"?"neutral":"accent"),BE(),Fg(e.scope==="platform"?"Platform":"Namespace"),BE(),Bw(e.scope==="platform"?14:-1),BE(3),Bw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,19,9,"tr",9,J),hl()()()),n&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){by({platform:this.state.listPlatform().pipe(ha(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return i.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,O,2,1,"p",3),jw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -1 +1 @@
1
- import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-DU2T72t1.js';import {g,W,q as F,aU as D,ag as U,I as we,$ as $i,K as U$1,B,aV as gy,v as vw,E as Es,Q as vg,x as xC,a as hl,f as fg,j as jw,b as BE,P as dg,c as Bw,s as Dl,t as eC,F as Fg}from'./main-WGM2SCAZ.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),xC(1),hl()),l&2){let n=eC();BE(),Fg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=$i("");launchError=$i(null);isLaunching=$i(false);isLoading=$i(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield gy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield gy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield gy(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=vw({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return e.back()}),xC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),xC(5," The loop configuration below is read from "),Es(6,"code"),xC(7,"AgentConfig.loopConfig"),hl(),xC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),hl(),Es(9,"ds-form-field",3),fg(10,"textarea",4),hl(),jw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),xC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),xC(16,"Cancel"),hl()()()),n&2&&(BE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),BE(),Bw(e.launchError()?11:-1),BE(2),dg("disabled",e.isLaunching()),BE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),BE(),dg("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
1
+ import {ab as N,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-bCI6skcH.js';import {g,W,q as F,aU as D,ag as U,I as we,$ as $i,K as U$1,B,aV as gy,v as vw,E as Es,Q as vg,x as xC,a as hl,f as fg,j as jw,b as BE,P as dg,c as Bw,s as Dl,t as eC,F as Fg}from'./main-PUOSMZMX.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),xC(1),hl()),l&2){let n=eC();BE(),Fg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=$i("");launchError=$i(null);isLaunching=$i(false);isLoading=$i(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield gy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield gy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield gy(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=vw({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return e.back()}),xC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),xC(5," The loop configuration below is read from "),Es(6,"code"),xC(7,"AgentConfig.loopConfig"),hl(),xC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),hl(),Es(9,"ds-form-field",3),fg(10,"textarea",4),hl(),jw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),xC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),xC(16,"Cancel"),hl()()()),n&2&&(BE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),BE(),Bw(e.launchError()?11:-1),BE(2),dg("disabled",e.isLaunching()),BE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),BE(),dg("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
@@ -1 +1 @@
1
- import {s}from'./chunk-DU2T72t1.js';import {g,W,J as Jm,G as y,v as vw,d as gl,x as xC,m as ml,b as BE,F as Fg}from'./main-WGM2SCAZ.js';var A=class r{route=g(W);http=g(Jm);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=vw({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&&(gl(0,"p",0),xC(1),ml()),t&2&&(BE(),Fg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {s}from'./chunk-bCI6skcH.js';import {g,W,J as Jm,G as y,v as vw,d as gl,x as xC,m as ml,b as BE,F as Fg}from'./main-PUOSMZMX.js';var A=class r{route=g(W);http=g(Jm);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=vw({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&&(gl(0,"p",0),xC(1),ml()),t&2&&(BE(),Fg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-BeFHuscX.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-DU2T72t1.js';import {g,W,q as F,I as we$1,ag as U,ah as ke$1,ai as Ne$1,$ as $i,aj as Fe$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-WGM2SCAZ.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-paKwZTsF.js';import {p as pt,T as Te$1,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-bCI6skcH.js';import {g,W,q as F,I as we$1,ag as U,ah as ke$1,ai as Ne$1,$ as $i,aj as Fe$1,a9 as F$1,ak as yd,r as rT,ac as by,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,t as eC,S as xI,k as $w,F as Fg,u as pf,w as hf,y as sh}from'./main-PUOSMZMX.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function _e(n,t){if(n&1&&(Es(0,"ds-form-field",9),fg(1,"input",38),hl()),n&2){let e=eC(2);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),xC(1,"Add an agent config"),hl(),xC(2," first. ")),n&2){let e=eC(3);dg("href","/agentos/"+e.namespaceId+"/agent-configs/new",sh);}}function xe(n,t){if(n&1&&(Es(0,"ds-form-field",10)(1,"p",2),xC(2," No agent configs available in this scope yet. "),jw(3,Se,3,1),hl()()),n&2){let e=eC(2);BE(3),Bw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),BE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),xC(3,"Select an agent config\u2026"),hl(),Uw(4,Ee,2,2,"option",17,ve),hl(),MI(),hl()),n&2){let e=eC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(3),$w(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Yw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=eC(3);return hf(h.toggleDay(f.value))}),hl(),xC(2),hl();}if(n&2){let e=t.$implicit,l=eC(3);BE(),dg("checked",l.isDaySelected(e.value)),BE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),Uw(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=eC(2);BE(2),$w(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),xC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),BE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),BE(),dg("formControl",e.endDateControl),xI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),MI(),hl()),n&2){let e=eC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),BE(),dg("formControl",e.occurrenceCountControl),xI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),xC(1),hl()),n&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=eC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Es(8,"ds-form-field",12),fg(9,"textarea",13),MI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Uw(13,Te,2,2,"option",17,V),hl(),MI(),hl(),jw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),MI(),Es(19,"span",22),xC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),MI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),Uw(26,Me,2,2,"option",17,V),hl(),MI(),hl(),jw(28,Pe,2,2,"ds-form-field",28),jw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),MI(),xC(33," Enabled "),hl(),Es(34,"p",33),xC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),hl()(),Es(36,"ds-form-field",34),fg(37,"textarea",35),MI(),hl(),jw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),xC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=eC();return hf(f.cancel())}),xC(43,"Cancel"),hl()()();}if(n&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),BE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),BE(),dg("formControl",e.promptContentControl),xI(),BE(3),dg("formControl",e.unitControl),xI(),BE(),$w(e.schedulerUnits),BE(2),Bw(e.showDayFilter()?15:-1),BE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),BE(2),dg("formControl",e.timeUtcControl),xI(),BE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),BE(),dg("formControl",e.startDateControl),xI(),BE(2),dg("formControl",e.endTypeControl),xI(),BE(),$w(e.endTypes),BE(2),Bw(e.showEndDate()?28:-1),BE(),Bw(e.showOccurrenceCount()?29:-1),BE(3),dg("formControl",e.enabledControl),xI(),BE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(),Bw(e.errorMessage()?38:-1),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(we$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ne$1.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(ke$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=Ne$1;SchedulerEndType=ke$1;schedulerUnits=[{value:Ne$1.WEEK,label:"Week(s)"},{value:Ne$1.MONTH,label:"Month(s)"}];endTypes=[{value:ke$1.NEVER,label:"Never"},{value:ke$1.ON_DATE,label:"On date"},{value:ke$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(Fe$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(yd(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(yd(this.endTypeControl.value)));showDayFilter=rT(()=>this.unitSignal()===Ne$1.WEEK);showEndDate=rT(()=>this.endTypeSignal()===ke$1.ON_DATE);showOccurrenceCount=rT(()=>this.endTypeSignal()===ke$1.OCCURRENCES);agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),by({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(ha(()=>br([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===ke$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===ke$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return l.cancel()}),xC(3),hl()(),jw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(BE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),BE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),BE(),Bw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===ke$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===ke$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
@@ -1 +1 @@
1
- import {O as O$1}from'./chunk-DgP8Uad-.js';import {I}from'./chunk-DLa-RTUD.js';import {O}from'./chunk-Dje4hFK9.js';import {g,I as we$1,$ as $i,r as rT,a9 as F,at as Cy,ad as ne,K as U,v as vw,E as Es,f as fg,j as jw,a as hl,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,t as eC,P as dg,R as MI,U as Uw,F as Fg,S as xI,k as $w,s as Dl,ae as Pw,u as pf,w as hf,N as x,L as w}from'./main-WGM2SCAZ.js';import {y,R as k,X as B,Y as a,p as pt,T as Te$1,Z as v,a0 as V,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,a1 as un,g as dn,i as at,j as an,q as sn,a2 as Ti,K as Oi,a3 as m,a4 as S}from'./chunk-DU2T72t1.js';import'./chunk-BSwOttIr.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(o,e){if(o&1&&(Es(0,"option",27),xC(1),hl()),o&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Se(o,e){if(o&1){let t=Yw();Es(0,"form",15),vg("ngSubmit",function(){pf(t);let s=eC(2);return hf(s.save())}),Es(1,"ds-group",16)(2,"dl",17)(3,"dt"),xC(4,"Email"),hl(),Es(5,"dd"),xC(6),hl(),Es(7,"dt"),xC(8,"External ID"),hl(),Es(9,"dd"),xC(10),hl()()(),Es(11,"ds-group",18)(12,"ds-form-field",19),fg(13,"input",20),MI(),hl(),Es(14,"ds-form-field",21),fg(15,"input",22),MI(),hl(),Es(16,"ds-form-field",23),fg(17,"textarea",24),MI(),hl(),Es(18,"ds-form-field",25)(19,"select",26),Uw(20,xe,2,2,"option",27,ye),hl(),MI(),hl()(),Es(22,"ds-form-actions")(23,"button",28),xC(24),hl(),Es(25,"button",29),vg("click",function(){pf(t);let s=eC(2);return hf(s.cancelEditing())}),xC(26,"Cancel"),hl()()();}if(o&2){let t=eC(),l=eC();dg("formGroup",l.form),BE(6),Fg(t.email),BE(4),Fg(t.externalId),BE(3),xI(),BE(2),xI(),BE(2),xI(),BE(2),xI(),BE(),$w(l.languageOptions),BE(3),dg("disabled",l.isSaving()),BE(),Dl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Es(0,"p",2),xC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),hl());}function Pe(o,e){if(o&1){let t=Yw();Es(0,"span",38),xC(1,"Delete?"),hl(),Es(2,"button",39),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.confirmDelete(s))}),xC(3,"Confirm"),hl(),Es(4,"button",40),vg("click",function(){pf(t);let s=eC(6);return hf(s.cancelDelete())}),xC(5,"Cancel"),hl();}}function Te(o,e){if(o&1){let t=Yw();Es(0,"button",40),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.armDelete(s))}),xC(1,"Delete"),hl();}}function De(o,e){if(o&1&&(Es(0,"li",34)(1,"span",35),xC(2),hl(),Es(3,"span",36),xC(4),hl(),jw(5,Pe,6,0)(6,Te,2,0,"button",37),hl()),o&2){let t=e.$implicit,l=eC(5);BE(2),Fg(t.name),BE(2),Fg(t.subtitle),BE(),Bw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Es(0,"span",32),xC(1),hl(),Es(2,"ul",33),Uw(3,De,7,3,"li",34,Pw().trackEntry,true),hl()),o&2){let t=e.$implicit;BE(),Fg(t.title),BE(2),$w(t.entries);}}function Ve(o,e){if(o&1&&Uw(0,we,5,1,null,null,Ce),o&2){let t=eC(3);$w(t.recapSections());}}function Ue(o,e){if(o&1){let t=Yw();Es(0,"ds-group",16)(1,"dl",17)(2,"dt"),xC(3,"Email"),hl(),Es(4,"dd"),xC(5),hl(),Es(6,"dt"),xC(7,"External ID"),hl(),Es(8,"dd"),xC(9),hl()()(),Es(10,"ds-group",18)(11,"dl",17)(12,"dt"),xC(13,"First name"),hl(),Es(14,"dd"),xC(15),hl(),Es(16,"dt"),xC(17,"Last name"),hl(),Es(18,"dd"),xC(19),hl(),Es(20,"dt"),xC(21,"Bio"),hl(),Es(22,"dd"),xC(23),hl(),Es(24,"dt"),xC(25,"Language"),hl(),Es(26,"dd"),xC(27),hl()()(),Es(28,"ds-form-actions")(29,"button",30),vg("click",function(){pf(t);let s=eC(2);return hf(s.startEditing())}),xC(30,"Edit profile"),hl()(),Es(31,"ds-disclosure",31),vg("toggled",function(){pf(t);let s=eC(2);return hf(s.toggleOverrides())}),jw(32,Ee,2,0,"p",2)(33,Ve,2,0),hl();}if(o&2){let t=eC(),l=eC();BE(5),Fg(t.email),BE(4),Fg(t.externalId),BE(6),Fg(t.firstname||"\u2014"),BE(4),Fg(t.lastname||"\u2014"),BE(4),Fg(t.bio||"\u2014"),BE(4),Fg(t.preferredLanguage||"\u2014"),BE(4),dg("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),Bw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Yw();Es(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setThemeVariant(s))}),hl()(),Es(3,"ds-form-field",6)(4,"ds-segmented",7),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setTheme(s))}),hl()()(),Es(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setEnterKeyBehavior(s))}),hl()()(),Es(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setShowTechnical(s))}),hl()()(),jw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=eC();BE(),dg("hint",t.activeVariantDescription()),BE(),dg("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),dg("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),dg("options",t.modeOptions())("value",t.shownMode()),BE(3),dg("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),dg("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),Bw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Es(0,"p",2),xC(1,"Unable to load profile."),hl());}var ve=class o{userState=g(y);destroyRef=g(we$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(k);preferencesPort=g(B);isEditing=$i(false);isLoading=$i(false);isSaving=$i(false);isOverridesExpanded=$i(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=rT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=rT(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=rT(()=>!V(this.themeVariant(),this.themeMode()));activeVariantLabel=rT(()=>m(this.themeVariant()).label);activeVariantDescription=rT(()=>m(this.themeVariant()).description);modeOptions=rT(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=rT(()=>this.modeOverridden()?S(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(Cy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=rT(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){v(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !V(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=$i(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),hl()),t&2){let s;BE(2),Bw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
1
+ import {O as O$1}from'./chunk-D2h70wlj.js';import {I}from'./chunk-DFkt8tY0.js';import {O}from'./chunk-CseRCWgR.js';import {g,I as we$1,$ as $i,r as rT,a9 as F,at as Cy,ad as ne,K as U,v as vw,E as Es,f as fg,j as jw,a as hl,b as BE,c as Bw,x as xC,Y as Yw,Q as vg,t as eC,P as dg,R as MI,U as Uw,F as Fg,S as xI,k as $w,s as Dl,ae as Pw,u as pf,w as hf,N as x,L as w}from'./main-PUOSMZMX.js';import {y,R as k,X as B,Y as a,p as pt,T as Te$1,Z as v,a0 as V,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,a1 as un,g as dn,i as at,j as an,q as sn,a2 as Ti,K as Oi,a3 as m,a4 as S}from'./chunk-bCI6skcH.js';import'./chunk-2gGq060a.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function xe(o,e){if(o&1&&(Es(0,"option",27),xC(1),hl()),o&2){let t=e.$implicit;dg("value",t.value),BE(),Fg(t.label);}}function Se(o,e){if(o&1){let t=Yw();Es(0,"form",15),vg("ngSubmit",function(){pf(t);let s=eC(2);return hf(s.save())}),Es(1,"ds-group",16)(2,"dl",17)(3,"dt"),xC(4,"Email"),hl(),Es(5,"dd"),xC(6),hl(),Es(7,"dt"),xC(8,"External ID"),hl(),Es(9,"dd"),xC(10),hl()()(),Es(11,"ds-group",18)(12,"ds-form-field",19),fg(13,"input",20),MI(),hl(),Es(14,"ds-form-field",21),fg(15,"input",22),MI(),hl(),Es(16,"ds-form-field",23),fg(17,"textarea",24),MI(),hl(),Es(18,"ds-form-field",25)(19,"select",26),Uw(20,xe,2,2,"option",27,ye),hl(),MI(),hl()(),Es(22,"ds-form-actions")(23,"button",28),xC(24),hl(),Es(25,"button",29),vg("click",function(){pf(t);let s=eC(2);return hf(s.cancelEditing())}),xC(26,"Cancel"),hl()()();}if(o&2){let t=eC(),l=eC();dg("formGroup",l.form),BE(6),Fg(t.email),BE(4),Fg(t.externalId),BE(3),xI(),BE(2),xI(),BE(2),xI(),BE(2),xI(),BE(),$w(l.languageOptions),BE(3),dg("disabled",l.isSaving()),BE(),Dl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Es(0,"p",2),xC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),hl());}function Pe(o,e){if(o&1){let t=Yw();Es(0,"span",38),xC(1,"Delete?"),hl(),Es(2,"button",39),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.confirmDelete(s))}),xC(3,"Confirm"),hl(),Es(4,"button",40),vg("click",function(){pf(t);let s=eC(6);return hf(s.cancelDelete())}),xC(5,"Cancel"),hl();}}function Te(o,e){if(o&1){let t=Yw();Es(0,"button",40),vg("click",function(){pf(t);let s=eC().$implicit,m=eC(5);return hf(m.armDelete(s))}),xC(1,"Delete"),hl();}}function De(o,e){if(o&1&&(Es(0,"li",34)(1,"span",35),xC(2),hl(),Es(3,"span",36),xC(4),hl(),jw(5,Pe,6,0)(6,Te,2,0,"button",37),hl()),o&2){let t=e.$implicit,l=eC(5);BE(2),Fg(t.name),BE(2),Fg(t.subtitle),BE(),Bw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Es(0,"span",32),xC(1),hl(),Es(2,"ul",33),Uw(3,De,7,3,"li",34,Pw().trackEntry,true),hl()),o&2){let t=e.$implicit;BE(),Fg(t.title),BE(2),$w(t.entries);}}function Ve(o,e){if(o&1&&Uw(0,we,5,1,null,null,Ce),o&2){let t=eC(3);$w(t.recapSections());}}function Ue(o,e){if(o&1){let t=Yw();Es(0,"ds-group",16)(1,"dl",17)(2,"dt"),xC(3,"Email"),hl(),Es(4,"dd"),xC(5),hl(),Es(6,"dt"),xC(7,"External ID"),hl(),Es(8,"dd"),xC(9),hl()()(),Es(10,"ds-group",18)(11,"dl",17)(12,"dt"),xC(13,"First name"),hl(),Es(14,"dd"),xC(15),hl(),Es(16,"dt"),xC(17,"Last name"),hl(),Es(18,"dd"),xC(19),hl(),Es(20,"dt"),xC(21,"Bio"),hl(),Es(22,"dd"),xC(23),hl(),Es(24,"dt"),xC(25,"Language"),hl(),Es(26,"dd"),xC(27),hl()()(),Es(28,"ds-form-actions")(29,"button",30),vg("click",function(){pf(t);let s=eC(2);return hf(s.startEditing())}),xC(30,"Edit profile"),hl()(),Es(31,"ds-disclosure",31),vg("toggled",function(){pf(t);let s=eC(2);return hf(s.toggleOverrides())}),jw(32,Ee,2,0,"p",2)(33,Ve,2,0),hl();}if(o&2){let t=eC(),l=eC();BE(5),Fg(t.email),BE(4),Fg(t.externalId),BE(6),Fg(t.firstname||"\u2014"),BE(4),Fg(t.lastname||"\u2014"),BE(4),Fg(t.bio||"\u2014"),BE(4),Fg(t.preferredLanguage||"\u2014"),BE(4),dg("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),Bw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Yw();Es(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setThemeVariant(s))}),hl()(),Es(3,"ds-form-field",6)(4,"ds-segmented",7),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setTheme(s))}),hl()()(),Es(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setEnterKeyBehavior(s))}),hl()()(),Es(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),vg("valueChange",function(s){pf(t);let m=eC();return hf(m.setShowTechnical(s))}),hl()()(),jw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=eC();BE(),dg("hint",t.activeVariantDescription()),BE(),dg("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),dg("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),dg("options",t.modeOptions())("value",t.shownMode()),BE(3),dg("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),dg("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),Bw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Es(0,"p",2),xC(1,"Unable to load profile."),hl());}var ve=class o{userState=g(y);destroyRef=g(we$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(k);preferencesPort=g(B);isEditing=$i(false);isLoading=$i(false);isSaving=$i(false);isOverridesExpanded=$i(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=rT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=rT(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=rT(()=>!V(this.themeVariant(),this.themeMode()));activeVariantLabel=rT(()=>m(this.themeVariant()).label);activeVariantDescription=rT(()=>m(this.themeVariant()).description);modeOptions=rT(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=rT(()=>this.modeOverridden()?S(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(Cy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=rT(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){v(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !V(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=$i(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Es(0,"ds-page",0),fg(1,"ds-section-header",1),jw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),hl()),t&2){let s;BE(2),Bw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
@@ -1 +1 @@
1
- import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-DU2T72t1.js';import {g,W,q as F,I as we,ag as U,$ as $i,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,am as Vw,t as eC,S as xI,F as Fg,k as $w,l as lg,u as pf,w as hf}from'./main-WGM2SCAZ.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=eC(3);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),xC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),BE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),xC(3,"\u2014 None \u2014"),hl(),Uw(4,ge,2,2,"option",24,ce),hl(),MI(),hl()),o&2){let e=eC(3);BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(),dg("ngValue",null),BE(2),$w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&jw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=eC(2);Bw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),xC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Yw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),MI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),MI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),MI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeParameter(d))}),xC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),BE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),dg("id","param-name-"+r),xI(),BE(),dg("controlId","param-desc-"+r),BE(),dg("id","param-desc-"+r),xI(),BE(),dg("controlId","param-default-"+r),BE(),dg("id","param-default-"+r),xI();}}function _e(o,t){if(o&1){let e=Yw();Es(0,"div",14)(1,"span",33),xC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),MI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeContentEntry(d))}),xC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=eC(2);BE(2),Fg(r+1),BE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),xI(),BE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),xC(1),hl()),o&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Yw();Es(0,"button",37),vg("click",function(){pf(e);let d=eC(2);return hf(d.exportYaml())}),xC(1),hl();}if(o&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=eC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),xC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),xC(10),hl(),xC(11," in content entries to reference them. "),hl(),Es(12,"div",10),jw(13,ve,2,0,"p",2),Uw(14,he,10,8,"div",11,Vw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addParameter())}),xC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),xC(21," Each content entry is a command. Use "),Es(22,"code"),xC(23,"@AgentName"),hl(),xC(24," to target an agent, "),Es(25,"code"),xC(26,"/promptName param1 param2"),hl(),xC(27," to call another prompt, and "),Es(28,"code"),xC(29),hl(),xC(30," for parameter placeholders. "),hl(),Es(31,"div",10),Uw(32,_e,7,5,"div",14,Vw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addContentEntry())}),xC(36,"+ Add content entry"),hl()()()(),jw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),MI(),hl(),Es(40,"ds-form-actions")(41,"button",17),xC(42),hl(),jw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=eC();return hf(d.cancel())}),xC(45,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.availableAgentConfigs().length>0?5:-1),BE(5),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","parameters"),BE(),Bw(e.parametersArray.length===0?13:-1),BE(),$w(e.parametersArray.controls),BE(15),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","content"),BE(),$w(e.contentArray.controls),BE(5),Bw(e.errorMessage()?37:-1),BE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),Bw(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:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});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=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);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),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).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:[fn.required,fn.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:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.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=vw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3),hl()(),jw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),Bw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],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 {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-bCI6skcH.js';import {g,W,q as F,I as we,ag as U,$ as $i,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,am as Vw,t as eC,S as xI,F as Fg,k as $w,l as lg,u as pf,w as hf}from'./main-PUOSMZMX.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=eC(3);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),xC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),BE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),xC(3,"\u2014 None \u2014"),hl(),Uw(4,ge,2,2,"option",24,ce),hl(),MI(),hl()),o&2){let e=eC(3);BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(),dg("ngValue",null),BE(2),$w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&jw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=eC(2);Bw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),xC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Yw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),MI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),MI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),MI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeParameter(d))}),xC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),BE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),dg("id","param-name-"+r),xI(),BE(),dg("controlId","param-desc-"+r),BE(),dg("id","param-desc-"+r),xI(),BE(),dg("controlId","param-default-"+r),BE(),dg("id","param-default-"+r),xI();}}function _e(o,t){if(o&1){let e=Yw();Es(0,"div",14)(1,"span",33),xC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),MI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeContentEntry(d))}),xC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=eC(2);BE(2),Fg(r+1),BE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),xI(),BE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),xC(1),hl()),o&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Yw();Es(0,"button",37),vg("click",function(){pf(e);let d=eC(2);return hf(d.exportYaml())}),xC(1),hl();}if(o&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=eC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),xC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),xC(10),hl(),xC(11," in content entries to reference them. "),hl(),Es(12,"div",10),jw(13,ve,2,0,"p",2),Uw(14,he,10,8,"div",11,Vw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addParameter())}),xC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),xC(21," Each content entry is a command. Use "),Es(22,"code"),xC(23,"@AgentName"),hl(),xC(24," to target an agent, "),Es(25,"code"),xC(26,"/promptName param1 param2"),hl(),xC(27," to call another prompt, and "),Es(28,"code"),xC(29),hl(),xC(30," for parameter placeholders. "),hl(),Es(31,"div",10),Uw(32,_e,7,5,"div",14,Vw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addContentEntry())}),xC(36,"+ Add content entry"),hl()()()(),jw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),MI(),hl(),Es(40,"ds-form-actions")(41,"button",17),xC(42),hl(),jw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=eC();return hf(d.cancel())}),xC(45,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.availableAgentConfigs().length>0?5:-1),BE(5),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","parameters"),BE(),Bw(e.parametersArray.length===0?13:-1),BE(),$w(e.parametersArray.controls),BE(15),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","content"),BE(),$w(e.contentArray.controls),BE(5),Bw(e.errorMessage()?37:-1),BE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),Bw(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:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});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=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);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),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).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:[fn.required,fn.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:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.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=vw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3),hl()(),jw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),Bw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],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 {z as k$1,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-DU2T72t1.js';import {g,W as W$1,q as F,I as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,K as U,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-WGM2SCAZ.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function W(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading AI models\u2026"),hl());}function X(i,e){i&1&&(Es(0,"p",5),xC(1,"No AI models configured."),hl());}function Y(i,e){i&1&&(Es(0,"p",4),xC(1,"No AI models match the current filter."),hl());}function Z(i,e){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function ee(i,e){if(i&1){let t=Yw();Es(0,"button",24),vg("click",function(){pf(t);let s=eC(2).$implicit,m=eC(2);return hf(m.edit(s))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit,n=eC(2);lg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Yw();jw(0,ee,2,1,"button",22),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==t.key?0:-1),BE(),dg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Es(0,"button",21),xC(1,"Inherited"),hl());}function ne(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15)(8,"div",16)(9,"ds-tag",17),xC(10),hl(),jw(11,Z,2,0,"ds-tag",18),hl()(),Es(12,"td",19)(13,"div",20),jw(14,te,2,4)(15,ie,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,n=eC(2);BE(2),Fg(n.title(t)),BE(2),Fg(t.providerName),BE(2),Dl(" ",t.model.apiModelName," "),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?11:-1),BE(3),Bw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Provider"),hl(),Es(8,"th",10),xC(9,"API model name"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,16,7,"tr",9,G),hl()()()),i&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ha(()=>br([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ga(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return by({namespace:br(e),platform:br(t),providers:br(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ha(()=>br([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["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","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return n.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New AI model"),hl()(),jw(4,Q,2,1,"p",3),jw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
1
+ import {z as k$1,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-bCI6skcH.js';import {g,W as W$1,q as F,I as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,K as U,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-PUOSMZMX.js';var G=(i,e)=>e.key;function Q(i,e){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let t=eC();BE(),Fg(t.deletion.error());}}function W(i,e){i&1&&(Es(0,"p",4),xC(1,"Loading AI models\u2026"),hl());}function X(i,e){i&1&&(Es(0,"p",5),xC(1,"No AI models configured."),hl());}function Y(i,e){i&1&&(Es(0,"p",4),xC(1,"No AI models match the current filter."),hl());}function Z(i,e){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function ee(i,e){if(i&1){let t=Yw();Es(0,"button",24),vg("click",function(){pf(t);let s=eC(2).$implicit,m=eC(2);return hf(m.edit(s))}),xC(1,"Edit"),hl();}if(i&2){let t=eC(2).$implicit,n=eC(2);lg("aria-label","Edit "+n.title(t));}}function te(i,e){if(i&1){let t=Yw();jw(0,ee,2,1,"button",22),Es(1,"agentos-row-delete-action",23),vg("deleteRequested",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.deletion.request(s.key))})("deleteConfirmed",function(){pf(t);let s=eC().$implicit,m=eC(2);return hf(m.confirmDelete(s))})("deleteCancelled",function(){pf(t);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(i&2){let t=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==t.key?0:-1),BE(),dg("rowKey",t.key)("rowLabel",n.title(t))("state",n.deletion);}}function ie(i,e){i&1&&(Es(0,"button",21),xC(1,"Inherited"),hl());}function ne(i,e){if(i&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15)(8,"div",16)(9,"ds-tag",17),xC(10),hl(),jw(11,Z,2,0,"ds-tag",18),hl()(),Es(12,"td",19)(13,"div",20),jw(14,te,2,4)(15,ie,2,0,"button",21),hl()()()),i&2){let t=e.$implicit,n=eC(2);BE(2),Fg(n.title(t)),BE(2),Fg(t.providerName),BE(2),Dl(" ",t.model.apiModelName," "),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?11:-1),BE(3),Bw(t.scope==="namespace"?14:15);}}function oe(i,e){if(i&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Provider"),hl(),Es(8,"th",10),xC(9,"API model name"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,16,7,"tr",9,G),hl()()()),i&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var z=class i{route=g(W$1);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O(this.rows,e=>[e.model.alias,e.model.apiModelName,e.providerName,e.scope].filter(Boolean).join(" "));data$=this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(ha(()=>br([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)}).pipe(ga(({namespace:e,platform:t,providers:n})=>{let s=[...new Set([...t,...e].map(m=>m.aiProviderId))];return by({namespace:br(e),platform:br(t),providers:br(n),referencedProviders:this.aiProviderController.getByIdsAiProvider({ids:s,withRemoved:false}).pipe(ha(()=>br([])))})})))));constructor(){this.data$.pipe(U(this.destroyRef)).subscribe({next:({namespace:e,platform:t,providers:n,referencedProviders:s})=>{let m=new Map([...s,...n].map(c=>[c.id??"",c.name]));this.rows.set([...t.map((c,g)=>({key:`platform:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"platform"})),...e.map((c,g)=>({key:`namespace:${c.id??g}`,model:c,providerName:m.get(c.aiProviderId)??c.aiProviderId,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"]);}edit(e){e.scope==="platform"||!e.model.id||this.router.navigate(["/agentos",this.namespaceId,"ai-models",e.model.id,"edit"]);}title(e){return e.model.alias??e.model.apiModelName}confirmDelete(e){e.scope==="platform"||!e.model.id||this.deletion.execute(e.key,{request$:this.aiModelController.deleteAiModel(e.model.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${this.title(e)}" failed. Try again.`});}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-namespace-ai-models"]],decls:9,vars:3,consts:[["title","AI models","description","AI models configured for this namespace, including models inherited from the platform."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["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","AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,n){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return n.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New AI model"),hl()(),jw(4,Q,2,1,"p",3),jw(5,W,2,0,"p",4)(6,X,2,0,"p",5)(7,Y,2,0,"p",4)(8,oe,18,0,"div",6)),t&2&&(BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw(n.isLoading()?5:n.rows().length===0?6:n.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{z as NamespaceAiModelsComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-Df9nff1i.js';import {I}from'./chunk-DLa-RTUD.js';import {g,W,q as F,I as we,$ as $i,K as U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,z as DC,l as lg,s as Dl,U as Uw,k as $w,Y as Yw,u as pf,w as hf}from'./main-WGM2SCAZ.js';import {z as k,O,a5 as w,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-DU2T72t1.js';import'./chunk-BSwOttIr.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let e=eC();BE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),xC(1),hl()),i&2){let e=t;DC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),BE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),xC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),xC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),xC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),xC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),xC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),xC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Yw();Es(0,"span",26),xC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=eC(4);return hf(r.cancelConnect())}),xC(3," Cancel "),hl();}if(i&2){let e=eC(2).$implicit;BE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Yw();Es(0,"span",28),xC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.confirmReset(r))}),xC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=eC(4);return hf(r.cancelReset())}),xC(5," Cancel "),hl();}if(i&2){let e=eC(2).$implicit,n=eC(2);BE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),BE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Yw();Es(0,"button",29),vg("click",function(){pf(e);let r=eC(3).$implicit,d=eC(2);return hf(d.requestReset(r))}),xC(1," Disconnect "),hl();}if(i&2){let e=eC(3).$implicit,n=eC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Yw();Es(0,"button",29),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.connect(r))}),xC(1),hl(),jw(2,ce,2,2,"button",30);}if(i&2){let e=eC(2).$implicit,n=eC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),Bw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&jw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=eC().$implicit,n=eC(2);Bw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Yw();Es(0,"button",27),vg("click",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.duplicate(r))}),xC(1," Duplicate "),hl();}if(i&2){let e=eC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Yw();Es(0,"button",27),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.edit(r))}),xC(1," Edit "),hl();}if(i&2){let e=eC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Yw();jw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=eC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),xC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),xC(2),hl(),Es(3,"td",14),xC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),xC(8),hl(),jw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),jw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),jw(16,pe,3,1),jw(17,ue,2,1,"button",24),jw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=eC(2);BE(2),Fg(e.config.name),BE(2),Dl(" ",e.config.authType," "),BE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Fg(e.scopeLabel),BE(),Bw(e.canMutate?-1:9),BE(2),Bw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),Bw(n.isOAuth(e)?16:-1),BE(),Bw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),Bw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),xC(5,"Name"),hl(),Es(6,"th",11),xC(7,"Authentication type"),hl(),Es(8,"th",11),xC(9,"Scope"),hl(),Es(10,"th",11),xC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),xC(14,"Actions"),hl()()()(),Es(15,"tbody",9),Uw(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,X,2,1,"p",3),jw(5,Z,2,4,"p",4),jw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw((r=n.actionMessage())?5:-1,r),BE(),Bw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-BwLhUg85.js';import {I}from'./chunk-DFkt8tY0.js';import {g,W,q as F,I as we,$ as $i,K as U,ad as ne$1,a1 as ga,aa as br,aL as ui,a2 as ha,ac as by,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,z as DC,l as lg,s as Dl,U as Uw,k as $w,Y as Yw,u as pf,w as hf}from'./main-PUOSMZMX.js';import {z as k,O,a5 as w,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-bCI6skcH.js';import'./chunk-2gGq060a.js';var Q=(i,t)=>t.key;function X(i,t){if(i&1&&(Es(0,"p",3),xC(1),hl()),i&2){let e=eC();BE(),Fg(e.deletion.error());}}function Z(i,t){if(i&1&&(Es(0,"p"),xC(1),hl()),i&2){let e=t;DC(e.kind==="error"?"settings-table__error":"settings-table__status"),lg("role",e.kind==="error"?"alert":"status"),BE(),Dl(" ",e.text," ");}}function ee(i,t){i&1&&(Es(0,"p",5),xC(1,"Loading auth settings\u2026"),hl());}function te(i,t){i&1&&(Es(0,"p",6),xC(1,"No auth settings available."),hl());}function ne(i,t){i&1&&(Es(0,"p",5),xC(1,"No auth settings match the current filter."),hl());}function ie(i,t){i&1&&(Es(0,"ds-tag",18),xC(1,"Read-only"),hl());}function oe(i,t){i&1&&(Es(0,"ds-tag",20),xC(1,"Connected"),hl());}function ae(i,t){i&1&&(Es(0,"ds-tag",18),xC(1,"Not connected"),hl());}function se(i,t){i&1&&(Es(0,"span",21),xC(1,"\u2014"),hl());}function re(i,t){if(i&1){let e=Yw();Es(0,"span",26),xC(1,"Waiting for authorization\u2026"),hl(),Es(2,"button",27),vg("click",function(){pf(e);let r=eC(4);return hf(r.cancelConnect())}),xC(3," Cancel "),hl();}if(i&2){let e=eC(2).$implicit;BE(2),lg("aria-label","Stop waiting for the authorization of "+e.config.name);}}function le(i,t){if(i&1){let e=Yw();Es(0,"span",28),xC(1,"Disconnect?"),hl(),Es(2,"button",29),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.confirmReset(r))}),xC(3),hl(),Es(4,"button",29),vg("click",function(){pf(e);let r=eC(4);return hf(r.cancelReset())}),xC(5," Cancel "),hl();}if(i&2){let e=eC(2).$implicit,n=eC(2);BE(2),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Confirm disconnecting "+e.config.name),BE(),Dl(" ",n.resettingKey()===e.key?"Disconnecting\u2026":"Confirm"," "),BE(),dg("disabled",n.resettingKey()===e.key),lg("aria-label","Cancel disconnecting "+e.config.name);}}function ce(i,t){if(i&1){let e=Yw();Es(0,"button",29),vg("click",function(){pf(e);let r=eC(3).$implicit,d=eC(2);return hf(d.requestReset(r))}),xC(1," Disconnect "),hl();}if(i&2){let e=eC(3).$implicit,n=eC(2);dg("disabled",n.connectingKey()!==null),lg("aria-label","Disconnect "+e.config.name);}}function de(i,t){if(i&1){let e=Yw();Es(0,"button",29),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.connect(r))}),xC(1),hl(),jw(2,ce,2,2,"button",30);}if(i&2){let e=eC(2).$implicit,n=eC(2);dg("disabled",n.connectingKey()!==null||n.resettingKey()!==null),lg("aria-label",(n.connectionOf(e)==="connected"?"Reconnect ":"Connect ")+e.config.name),BE(),Dl(" ",n.connectionOf(e)==="connected"?"Reconnect":"Connect"," "),BE(),Bw(n.connectionOf(e)==="connected"?2:-1);}}function pe(i,t){if(i&1&&jw(0,re,4,1)(1,le,6,5)(2,de,3,4),i&2){let e=eC().$implicit,n=eC(2);Bw(n.connectingKey()===e.key?0:n.resetConfirmingKey()===e.key?1:n.deletion.confirmingId()!==e.key?2:-1);}}function ue(i,t){if(i&1){let e=Yw();Es(0,"button",27),vg("click",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.duplicate(r))}),xC(1," Duplicate "),hl();}if(i&2){let e=eC().$implicit;lg("aria-label","Duplicate "+e.config.name);}}function _e(i,t){if(i&1){let e=Yw();Es(0,"button",27),vg("click",function(){pf(e);let r=eC(2).$implicit,d=eC(2);return hf(d.edit(r))}),xC(1," Edit "),hl();}if(i&2){let e=eC(2).$implicit;lg("aria-label","Edit "+e.config.name);}}function me(i,t){if(i&1){let e=Yw();jw(0,_e,2,1,"button",24),Es(1,"agentos-row-delete-action",31),vg("deleteRequested",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.deletion.request(r.key))})("deleteConfirmed",function(){pf(e);let r=eC().$implicit,d=eC(2);return hf(d.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=eC(3);return hf(r.deletion.cancel())}),hl();}if(i&2){let e=eC().$implicit,n=eC(2);Bw(n.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.config.name)("state",n.deletion);}}function ge(i,t){i&1&&(Es(0,"button",25),xC(1,"Inherited"),hl());}function he(i,t){if(i&1&&(Es(0,"tr",10)(1,"td",13),xC(2),hl(),Es(3,"td",14),xC(4),hl(),Es(5,"td",15)(6,"div",16)(7,"ds-tag",17),xC(8),hl(),jw(9,ie,2,0,"ds-tag",18),hl()(),Es(10,"td",19),jw(11,oe,2,0,"ds-tag",20)(12,ae,2,0,"ds-tag",18)(13,se,2,0,"span",21),hl(),Es(14,"td",22)(15,"div",23),jw(16,pe,3,1),jw(17,ue,2,1,"button",24),jw(18,me,2,4)(19,ge,2,0,"button",25),hl()()()),i&2){let e=t.$implicit,n=eC(2);BE(2),Fg(e.config.name),BE(2),Dl(" ",e.config.authType," "),BE(3),dg("variant",e.scopeLabel==="Platform"?"neutral":e.scopeLabel==="Personal"?"outline":"accent"),BE(),Fg(e.scopeLabel),BE(),Bw(e.canMutate?-1:9),BE(2),Bw(n.isOAuth(e)&&n.connectionOf(e)==="connected"?11:n.isOAuth(e)&&n.connectionOf(e)==="disconnected"?12:13),BE(5),Bw(n.isOAuth(e)?16:-1),BE(),Bw(n.deletion.confirmingId()!==e.key&&n.resetConfirmingKey()!==e.key&&n.connectingKey()!==e.key?17:-1),BE(),Bw(e.canMutate?18:19);}}function Ce(i,t){if(i&1&&(Es(0,"div",7)(1,"table",8)(2,"thead",9)(3,"tr",10)(4,"th",11),xC(5,"Name"),hl(),Es(6,"th",11),xC(7,"Authentication type"),hl(),Es(8,"th",11),xC(9,"Scope"),hl(),Es(10,"th",11),xC(11,"Connection"),hl(),Es(12,"th",11)(13,"span",12),xC(14,"Actions"),hl()()()(),Es(15,"tbody",9),Uw(16,he,20,9,"tr",10,Q),hl()()()),i&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var fe=new Set(["OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"]),J=class i{route=g(W);router=g(F);destroyRef=g(we);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=$i(false);isLoading=$i(true);rows=$i([]);deletion=k();connections=$i({});connectingKey=$i(null);resetConfirmingKey=$i(null);resettingKey=$i(null);actionMessage=$i(null);connectAttempt=null;connectPopup=null;connectionsLoad=null;rowFilter=O(this.rows,t=>[t.config.name,t.config.authType,t.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U(this.destroyRef)).subscribe(t=>{let e=t.get("namespaceId")??"";e&&e!==this.namespaceId&&(this.namespaceId=e),this.state.setNamespace(e);}),this.route.paramMap.pipe(ne$1(t=>t.get("namespaceId")??""),ga(t=>t?this.namespaceRole.isAdminOfNamespace$(t):br(false)),U(this.destroyRef)).subscribe(t=>this.isAdmin.set(t)),this.state.vm$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.rows.set(this.toRows(t)),this.isLoading.set(false),this.loadConnections();},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(t){!t.canMutate||!t.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",t.config.id,"edit"],{queryParams:{scope:t.scope}});}confirmDelete(t){!t.canMutate||!t.config.id||this.deletion.execute(t.key,{request$:this.state.delete(t.config.id,t.scope).pipe(U(this.destroyRef)),errorMessage:`Deleting "${t.config.name}" failed. Try again.`});}isOAuth(t){return fe.has(t.config.authType)}connectionOf(t){return this.connections()[t.key]??"unknown"}connect(t){let e=t.config.id;if(!e||this.connectingKey()||this.resettingKey())return;let n=w();if(!n){this.actionMessage.set({kind:"error",text:"The browser blocked the authorization window. Allow pop-ups for this site and try again."});return}this.actionMessage.set(null),this.resetConfirmingKey.set(null),this.connectPopup=n,this.connectingKey.set(t.key),this.connectAttempt=this.state.connect(e,this.namespaceParam(),r=>n.location.href=r,()=>n.closed).pipe(ui(()=>{this.connectingKey.set(null),this.connectAttempt=null,this.connectPopup=null;}),U(this.destroyRef)).subscribe({next:r=>this.onConnectOutcome(t,r,n),error:()=>{n.close(),this.actionMessage.set({kind:"error",text:`Connecting "${t.config.name}" failed. Check that its OAuth settings are complete, then try again.`});}});}cancelConnect(){this.connectAttempt?.unsubscribe(),this.connectPopup?.close();}requestReset(t){this.resettingKey()||this.connectingKey()||(this.actionMessage.set(null),this.resetConfirmingKey.set(t.key));}cancelReset(){this.resettingKey()||this.resetConfirmingKey.set(null);}confirmReset(t){let e=t.config.id;!e||this.resettingKey()||this.resetConfirmingKey()!==t.key||(this.resettingKey.set(t.key),this.state.resetCredential(e,this.namespaceParam()).pipe(U(this.destroyRef)).subscribe({next:()=>{this.resettingKey.set(null),this.resetConfirmingKey.set(null),this.loadConnections();},error:()=>{this.resettingKey.set(null),this.actionMessage.set({kind:"error",text:`Disconnecting "${t.config.name}" failed. Try again.`});}}));}duplicate(t){if(!t.config.id)return;let e=t.scope==="platform"||t.scope==="namespace"&&!this.isAdmin()?"userOnNs":t.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:e,template:t.config.id,templateScope:t.scope}});}onConnectOutcome(t,e,n){n.close(),this.loadConnections(),e==="abandoned"?this.actionMessage.set({kind:"info",text:`The authorization window was closed before "${t.config.name}" got connected.`}):e==="timeout"&&this.actionMessage.set({kind:"info",text:`No authorization was received for "${t.config.name}" in time. Try again.`});}namespaceParam(){return this.namespaceId||void 0}loadConnections(){this.connectionsLoad?.unsubscribe();let t=this.rows().filter(e=>this.isOAuth(e)&&e.config.id).map(e=>this.state.getConnection(e.config.id,this.namespaceParam()).pipe(ne$1(n=>[e.key,n.connected?"connected":"disconnected"]),ha(()=>br([e.key,"unknown"]))));if(t.length===0){this.connections.set({});return}this.connectionsLoad=by(t).pipe(U(this.destroyRef)).subscribe(e=>this.connections.set(Object.fromEntries(e)));}toRows(t){return [...this.mapScope(t.platform,"platform","Platform",false),...this.mapScope(t.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(t.userOnNs,"userOnNs","Personal",true),...this.mapScope(t.userGlobal,"userGlobal","Personal",true)]}mapScope(t,e,n,r){return t.map((d,Y)=>({key:`${e}:${d.id??Y}`,config:d,scope:e,scopeLabel:n,canMutate:r}))}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=vw({type:i,selectors:[["agentos-auth-settings-all-scopes"]],decls:10,vars:4,consts:[["title","Auth settings","description","Authentication settings available in this namespace, including inherited platform and personal entries."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],[3,"class"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Connection"],["variant","accent"],[1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["role","status",1,"settings-table__confirm-label"],["type","button",3,"click"],[1,"settings-table__confirm-label"],["type","button",3,"click","disabled"],["type","button",3,"disabled"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,n){if(e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(d){return n.rowFilter.query.set(d)}),hl(),Es(2,"button",2),vg("click",function(){return n.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,X,2,1,"p",3),jw(5,Z,2,4,"p",4),jw(6,ee,2,0,"p",5)(7,te,2,0,"p",6)(8,ne,2,0,"p",5)(9,Ce,18,0,"div",7)),e&2){let r;BE(),dg("query",n.rowFilter.query()),BE(3),Bw(n.deletion.error()?4:-1),BE(),Bw((r=n.actionMessage())?5:-1,r),BE(),Bw(n.isLoading()?6:n.rows().length===0?7:n.rowFilter.filteredRows().length===0?8:9);}},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{J as AuthSettingsAllScopesComponent};
@@ -1 +1 @@
1
- import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-DU2T72t1.js';import {g,q as F,I as we,ag as U$1,Z as Tr,$ as $i,a1 as ga,K as U$2,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-WGM2SCAZ.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function K(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading agent configs\u2026"),hl());}function H(n,e){n&1&&(Es(0,"p",5),xC(1,"No platform agent configs defined yet."),hl());}function U(n,e){n&1&&(Es(0,"p",4),xC(1,"No agent configs match the current filter."),hl());}function z(n,e){if(n&1){let t=Yw();Es(0,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.inspect(d))}),xC(1," Inspect "),hl(),Es(2,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.edit(d))}),xC(3,"Edit"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","Inspect "+t.name),BE(2),lg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",20),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,a=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15),xC(8),hl(),Es(9,"td",16)(10,"div",17),jw(11,z,4,2),jw(12,G,1,3,"agentos-row-delete-action",18),hl()()()),n&2){let t=e.$implicit,a=eC(2);BE(2),Fg(t.name),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(t.modelName||"\u2014"),BE(2),Fg(a.mode(t)),BE(3),Bw(a.deletion.confirmingId()!==t.id?11:-1),BE(),Bw(t.id?12:-1);}}function O(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Model"),hl(),Es(10,"th",10),xC(11,"Execution mode"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,J,13,6,"tr",9,B),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(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=vw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New agent config"),hl()(),jw(4,j,2,1,"p",3),jw(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&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
1
+ import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-bCI6skcH.js';import {g,q as F,I as we,ag as U$1,Z as Tr,$ as $i,a1 as ga,K as U$2,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,u as pf,w as hf,l as lg}from'./main-PUOSMZMX.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function K(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading agent configs\u2026"),hl());}function H(n,e){n&1&&(Es(0,"p",5),xC(1,"No platform agent configs defined yet."),hl());}function U(n,e){n&1&&(Es(0,"p",4),xC(1,"No agent configs match the current filter."),hl());}function z(n,e){if(n&1){let t=Yw();Es(0,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.inspect(d))}),xC(1," Inspect "),hl(),Es(2,"button",19),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.edit(d))}),xC(3,"Edit"),hl();}if(n&2){let t=eC().$implicit;lg("aria-label","Inspect "+t.name),BE(2),lg("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",20),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.deletion.request(d.id))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,a=eC(2);dg("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14),xC(6),hl(),Es(7,"td",15),xC(8),hl(),Es(9,"td",16)(10,"div",17),jw(11,z,4,2),jw(12,G,1,3,"agentos-row-delete-action",18),hl()()()),n&2){let t=e.$implicit,a=eC(2);BE(2),Fg(t.name),BE(2),Dl(" ",t.description||"\u2014"," "),BE(2),Fg(t.modelName||"\u2014"),BE(2),Fg(a.mode(t)),BE(3),Bw(a.deletion.confirmingId()!==t.id?11:-1),BE(),Bw(t.id?12:-1);}}function O(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Model"),hl(),Es(10,"th",10),xC(11,"Execution mode"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,J,13,6,"tr",9,B),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();configs=$i([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(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=vw({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&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New agent config"),hl()(),jw(4,j,2,1,"p",3),jw(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&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
@@ -1 +1 @@
1
- import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-BL4O5z35.js';import {J as s,z as k,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-DU2T72t1.js';import {g,W,q as F,I as we,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,ad as ne$1,K as U,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,as as Pg,Y as Yw,u as pf,w as hf,l as lg}from'./main-WGM2SCAZ.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function ee(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading skills\u2026"),hl());}function te(n,e){n&1&&(Es(0,"p",5),xC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),hl());}function ne(n,e){n&1&&(Es(0,"p",4),xC(1,"No skills match the current filter."),hl());}function ie(n,e){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let t=eC().$implicit;BE(),Pg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Es(0,"ds-tag",20),xC(1,"Read-only"),hl());}function oe(n,e){n&1&&(Es(0,"ds-tag",21),xC(1,"SKILL.md"),hl());}function le(n,e){if(n&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let d=eC(2).$implicit,c=eC(2);return hf(c.edit(d))}),xC(1,"Edit"),hl();}if(n&2){let t=eC(2).$implicit;lg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.inspect(d))}),xC(1," View "),hl(),jw(2,le,2,1,"button",26);}if(n&2){let t=eC().$implicit,a=eC(2);lg("aria-label","View "+t.skill.name),BE(2),Bw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",27),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.requestDelete(d))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,a=eC(2);dg("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,ie,2,2,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16),xC(8),hl(),Es(9,"td",17)(10,"div",18)(11,"ds-tag",19),xC(12),hl(),jw(13,ae,2,0,"ds-tag",20),jw(14,oe,2,0,"ds-tag",21),hl()(),Es(15,"td",22)(16,"div",23),jw(17,re,3,2),jw(18,se,1,3,"agentos-row-delete-action",24),hl()()()),n&2){let t=e.$implicit,a=eC(2);BE(3),Fg(t.skill.name),BE(),Bw(t.namedByAgents>0?4:-1),BE(2),Dl(" ",t.skill.description||"\u2014"," "),BE(2),Fg(a.resourceCount(t.skill)),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?13:-1),BE(),Bw(t.skill.readOnly?14:-1),BE(3),Bw(a.deletion.confirmingId()!==t.key?17:-1),BE(),Bw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Resources"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ce,19,10,"tr",9,Y),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(we);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();rows=$i([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({platform:this.skillState.listPlatform().pipe(ha(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:by({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ha(()=>br([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),ha(()=>br([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["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","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New skill"),hl()(),jw(4,Z,2,1,"p",3),jw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{Q as NamespaceSkillsComponent};
1
+ import {a}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-iEPxdwNo.js';import {J as s,z as k,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-bCI6skcH.js';import {g,W,q as F,I as we,Z as Tr,$ as $i,a1 as ga,ac as by,a2 as ha,aa as br,ad as ne$1,K as U,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,as as Pg,Y as Yw,u as pf,w as hf,l as lg}from'./main-PUOSMZMX.js';var Y=(n,e)=>e.key;function Z(n,e){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let t=eC();BE(),Fg(t.deletion.error());}}function ee(n,e){n&1&&(Es(0,"p",4),xC(1,"Loading skills\u2026"),hl());}function te(n,e){n&1&&(Es(0,"p",5),xC(1," No skills defined yet. Add one above, or drop a SKILL.md under the namespace config path. "),hl());}function ne(n,e){n&1&&(Es(0,"p",4),xC(1,"No skills match the current filter."),hl());}function ie(n,e){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let t=eC().$implicit;BE(),Pg(" named by ",t.namedByAgents," ",t.namedByAgents===1?"agent":"agents"," ");}}function ae(n,e){n&1&&(Es(0,"ds-tag",20),xC(1,"Read-only"),hl());}function oe(n,e){n&1&&(Es(0,"ds-tag",21),xC(1,"SKILL.md"),hl());}function le(n,e){if(n&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let d=eC(2).$implicit,c=eC(2);return hf(c.edit(d))}),xC(1,"Edit"),hl();}if(n&2){let t=eC(2).$implicit;lg("aria-label","Edit "+t.skill.name);}}function re(n,e){if(n&1){let t=Yw();Es(0,"button",25),vg("click",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.inspect(d))}),xC(1," View "),hl(),jw(2,le,2,1,"button",26);}if(n&2){let t=eC().$implicit,a=eC(2);lg("aria-label","View "+t.skill.name),BE(2),Bw(a.isMutable(t)?2:-1);}}function se(n,e){if(n&1){let t=Yw();Es(0,"agentos-row-delete-action",27),vg("deleteRequested",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.requestDelete(d))})("deleteConfirmed",function(){pf(t);let d=eC().$implicit,c=eC(2);return hf(c.confirmDelete(d))})("deleteCancelled",function(){pf(t);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(n&2){let t=eC().$implicit,a=eC(2);dg("rowKey",t.key)("rowLabel",t.skill.name)("state",a.deletion);}}function ce(n,e){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,ie,2,2,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16),xC(8),hl(),Es(9,"td",17)(10,"div",18)(11,"ds-tag",19),xC(12),hl(),jw(13,ae,2,0,"ds-tag",20),jw(14,oe,2,0,"ds-tag",21),hl()(),Es(15,"td",22)(16,"div",23),jw(17,re,3,2),jw(18,se,1,3,"agentos-row-delete-action",24),hl()()()),n&2){let t=e.$implicit,a=eC(2);BE(3),Fg(t.skill.name),BE(),Bw(t.namedByAgents>0?4:-1),BE(2),Dl(" ",t.skill.description||"\u2014"," "),BE(2),Fg(a.resourceCount(t.skill)),BE(3),dg("variant",t.scope==="platform"?"neutral":"accent"),BE(),Fg(t.scope==="platform"?"Platform":"Namespace"),BE(),Bw(t.scope==="platform"?13:-1),BE(),Bw(t.skill.readOnly?14:-1),BE(3),Bw(a.deletion.confirmingId()!==t.key?17:-1),BE(),Bw(a.isMutable(t)?18:-1);}}function de(n,e){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Description"),hl(),Es(8,"th",10),xC(9,"Resources"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ce,19,10,"tr",9,Y),hl()()()),n&2){let t=eC();BE(16),$w(t.rowFilter.filteredRows());}}var Q=class n{route=g(W);router=g(F);destroyRef=g(we);skillState=g(o);agentState=g(s);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();rows=$i([]);rowFilter=O(this.rows,e=>[e.skill.name,e.skill.description,e.scope].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),by({platform:this.skillState.listPlatform().pipe(ha(()=>br([]))),namespace:this.skillState.listByNamespace(this.namespaceId),agents:by({namespace:this.agentState.listByNamespace(this.namespaceId),platform:this.agentState.listPlatform().pipe(ha(()=>br([])))}).pipe(ne$1(({namespace:e,platform:t})=>[...e,...t]),ha(()=>br([])))}))),U(this.destroyRef)).subscribe({next:({platform:e,namespace:t,agents:a$1})=>{let d=(c,_,W)=>({key:`${_}:${c.id??W}`,skill:c,scope:_,namedByAgents:a$1.filter(X=>a(X.skillSelectors,c.name)==="named").length});this.rows.set([...e.map((c,_)=>d(c,"platform",_)),...t.map((c,_)=>d(c,"namespace",_))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}resourceCount(e){return Object.keys(e.resources??{}).length}isMutable(e){return e.scope==="namespace"&&e.skill.readOnly!==true&&!!e.skill.id}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"skills","new"]);}inspect(e){e.skill.id&&this.router.navigate(e.scope==="platform"?["/agentos","admin","skills",e.skill.id,"inspect"]:["/agentos",this.namespaceId,"skills",e.skill.id,"inspect"]);}edit(e){!this.isMutable(e)||!e.skill.id||this.router.navigate(["/agentos",this.namespaceId,"skills",e.skill.id,"edit"]);}requestDelete(e){this.deletion.request(e.key);}confirmDelete(e){if(!this.isMutable(e)||!e.skill.id)return;let t=e.namedByAgents;this.deletion.execute(e.key,{request$:this.skillState.delete(e.skill.id).pipe(U(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:a=>a.status===400?`"${e.skill.name}" is defined by a SKILL.md file and cannot be deleted through the API.`:`Deleting "${e.skill.name}" failed.${t>0?` ${t} agent(s) still name it.`:""}`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-namespace-skills"]],decls:9,vars:3,consts:[["title","Skills","description","Skills available in this namespace, including skills inherited from the platform."],["label","Filter skills","placeholder","Filter skills\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Skills"],["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","Description",1,"settings-table__secondary"],["role","cell","data-label","Resources"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["variant","neutral"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return a.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New skill"),hl()(),jw(4,Z,2,1,"p",3),jw(5,ee,2,0,"p",4)(6,te,2,0,"p",5)(7,ne,2,0,"p",4)(8,de,18,0,"div",6)),t&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{Q as NamespaceSkillsComponent};
@@ -1 +1 @@
1
- import {I as I$1}from'./chunk-DLa-RTUD.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-WGM2SCAZ.js';import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-DU2T72t1.js';import'./chunk-BSwOttIr.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Es(0,"p",3),xC(1),hl()),e&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(e,t){e&1&&(Es(0,"p",4),xC(1,"Loading auth settings\u2026"),hl());}function H(e,t){e&1&&(Es(0,"p",5),xC(1,"No platform auth settings defined yet."),hl());}function U(e,t){e&1&&(Es(0,"p",4),xC(1,"No auth settings match the current filter."),hl());}function z(e,t){if(e&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onEdit(d))}),xC(1," Edit "),hl();}if(e&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onDelete(d))})("deleteCancelled",function(){pf(n);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(e&2){let n=eC().$implicit,a=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),e&2){let n=t.$implicit,a=eC(2);BE(2),Fg(n.name),BE(2),Dl(" ",n.authType," "),BE(3),Bw(a.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(e,t){if(e&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Authentication type"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,B),hl()()()),e&2){let n=eC();BE(12),$w(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(we);state=g(I$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();settings=$i([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\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 auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,j,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
1
+ import {I as I$1}from'./chunk-DFkt8tY0.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-PUOSMZMX.js';import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-bCI6skcH.js';import'./chunk-2gGq060a.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Es(0,"p",3),xC(1),hl()),e&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(e,t){e&1&&(Es(0,"p",4),xC(1,"Loading auth settings\u2026"),hl());}function H(e,t){e&1&&(Es(0,"p",5),xC(1,"No platform auth settings defined yet."),hl());}function U(e,t){e&1&&(Es(0,"p",4),xC(1,"No auth settings match the current filter."),hl());}function z(e,t){if(e&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onEdit(d))}),xC(1," Edit "),hl();}if(e&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onDelete(d))})("deleteCancelled",function(){pf(n);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(e&2){let n=eC().$implicit,a=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),e&2){let n=t.$implicit,a=eC(2);BE(2),Fg(n.name),BE(2),Dl(" ",n.authType," "),BE(3),Bw(a.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(e,t){if(e&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Authentication type"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,B),hl()()()),e&2){let n=eC();BE(12),$w(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(we);state=g(I$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();settings=$i([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\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 auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,j,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};