@whoz-oss/coday-client 0.0.0-workstream-forge.261 → 0.0.0-workstream-forge.264

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 (63) hide show
  1. package/browser/{chunk-ClmH7wru.js → chunk-5l4dJKzj.js} +1 -1
  2. package/browser/chunk-6G_HDlLt.js +1 -0
  3. package/browser/{chunk-DVnreUZp.js → chunk-8ZA-dXSc.js} +1 -1
  4. package/browser/{chunk-DyMrL6Ee.js → chunk-B1-Po7IP.js} +1 -1
  5. package/browser/{chunk-BEGeHvbU.js → chunk-B1ETqMnn.js} +1 -1
  6. package/browser/{chunk-BByf0AaZ.js → chunk-B6ucC9JA.js} +1 -1
  7. package/browser/{chunk-CWxtFbYp.js → chunk-B8yw58sL.js} +1 -1
  8. package/browser/{chunk-BKhlmnMI.js → chunk-B9m_Pv-N.js} +1 -1
  9. package/browser/chunk-BAFDJC7n.js +1 -0
  10. package/browser/chunk-BCtLUKA1.js +1 -0
  11. package/browser/{chunk-DLuLiHuX.js → chunk-BEGiDML0.js} +1 -1
  12. package/browser/{chunk-C6WfP1id.js → chunk-BItNUZzz.js} +1 -1
  13. package/browser/chunk-BMgJXfSE.js +1 -0
  14. package/browser/{chunk-3LrWBzrF.js → chunk-BUdZ5OqC.js} +1 -1
  15. package/browser/{chunk-C4XRMKqd.js → chunk-BVY2wOIp.js} +1 -1
  16. package/browser/chunk-BeAWBIRs.js +671 -0
  17. package/browser/{chunk-Bxl-W5rv.js → chunk-BeGVJrPy.js} +1 -1
  18. package/browser/chunk-BfJl60vA.js +1 -0
  19. package/browser/{chunk-DI1Jsft5.js → chunk-BkRwWFjx.js} +1 -1
  20. package/browser/{chunk-CmNMnl1X.js → chunk-BoLw7dqx.js} +1 -1
  21. package/browser/{chunk-p_4THMZn.js → chunk-BzTXrMsf.js} +1 -1
  22. package/browser/{chunk-DQ6_qIZF.js → chunk-C1mIsJc9.js} +1 -1
  23. package/browser/{chunk-BJ-aqn_T.js → chunk-C3fz6Nhs.js} +1 -1
  24. package/browser/{chunk-BiY5nHbl.js → chunk-CXhczMHJ.js} +1 -1
  25. package/browser/{chunk-CrljCfTT.js → chunk-CfLZEoOb.js} +1 -1
  26. package/browser/chunk-ChYykPZM.js +1 -0
  27. package/browser/chunk-CkDaEVkZ.js +1 -0
  28. package/browser/chunk-CmjEguYB.js +1 -0
  29. package/browser/chunk-Cq9rgtVx.js +1 -0
  30. package/browser/chunk-CvFTKrrN.js +1 -0
  31. package/browser/{chunk-Cw-HKK2W.js → chunk-D15w64SG.js} +1 -1
  32. package/browser/{chunk-D61AUiEX.js → chunk-D8O-XquS.js} +1 -1
  33. package/browser/chunk-D9cyFDnZ.js +1 -0
  34. package/browser/chunk-DAC1_8mf.js +1 -0
  35. package/browser/{chunk-FMElf1Kh.js → chunk-DA_ON43Y.js} +1 -1
  36. package/browser/{chunk-B4oSnH6q.js → chunk-DSe6H4u5.js} +1 -1
  37. package/browser/{chunk-CbELThsL.js → chunk-DYGNedc1.js} +1 -1
  38. package/browser/{chunk-Cck7m2qM.js → chunk-Db_G9wnV.js} +1 -1
  39. package/browser/{chunk-CjF3kh6X.js → chunk-DxjesQXu.js} +1 -1
  40. package/browser/{chunk-CZ6YsQnn.js → chunk-IMqSwtoo.js} +1 -1
  41. package/browser/{chunk-7p42eTQE.js → chunk-MzRAkbwR.js} +1 -1
  42. package/browser/chunk-Tz-PZzVS.js +1 -0
  43. package/browser/{chunk-CBB_i9zm.js → chunk-Vn-xaj9q.js} +1 -1
  44. package/browser/{chunk-C80imceV.js → chunk-fbDk9ppW.js} +1 -1
  45. package/browser/{chunk-BL3wnbf2.js → chunk-jfM6q-6w.js} +1 -1
  46. package/browser/{chunk-B0YWgYUz.js → chunk-t3EN_XZw.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-DZHLOK7A.js → main-P6EOYPYG.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-BE-UpkfJ.js +0 -1
  51. package/browser/chunk-BXDGxrbm.js +0 -1
  52. package/browser/chunk-BduQv2OD.js +0 -1
  53. package/browser/chunk-C6mk1TXU.js +0 -1
  54. package/browser/chunk-CaSrm-yj.js +0 -1
  55. package/browser/chunk-CsMJN87z.js +0 -1
  56. package/browser/chunk-DARQ9uHM.js +0 -1
  57. package/browser/chunk-DF7k_FKN.js +0 -1
  58. package/browser/chunk-DGm40OPY.js +0 -1
  59. package/browser/chunk-DH3KwJPn.js +0 -1
  60. package/browser/chunk-DWro011L.js +0 -1
  61. package/browser/chunk-DglDAX_u.js +0 -1
  62. package/browser/chunk-Wkqwvdp3.js +0 -1
  63. package/browser/chunk-zs4CYUQt.js +0 -674
@@ -1 +1 @@
1
- import {b as hn,c as fn,r as rn,D as pn,e as at,n as ln,J as Pi,K as On}from'./chunk-zs4CYUQt.js';import {g,W as W$1,t as F,K as we,ag as U,$ as $i,o as oT,U as U$1,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,M as Mg,u as Dl,q as $w,z as zw,Q as Qw,f as fg,av as QC,aw as XC,w as pf,x as hf,ax as YD}from'./main-DZHLOK7A.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),AC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),AC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),AC(1,"User context"),hl(),Es(2,"dd",6),AC(3),hl()),t&2){let e=tC();VE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.systemPromptCollapsed()),VE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.instructionsCollapsed()),VE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),AC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),AC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),AC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),AC(3),hl(),Bw(4,ee,2,0,"span",17),Bw(5,te,2,0,"span",17),hl(),Es(6,"p",3),AC(7),hl()()),t&2){let e=n.$implicit;VE(3),Fg(e.name),VE(),Vw(e.namespaceId?-1:4),VE(),Vw(e.readOnly?5:-1),VE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),$w(1,ne,8,4,"li",15,j),hl()),t&2){let e=tC(2);VE(),zw(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),AC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),QC(1,"agentosMarkdown")),t&2){let e=tC().$implicit;dg("innerHTML",XC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Qw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=tC(3);return hf(U.toggleTool(m))}),Bw(2,ae,2,3,"div",19),Es(3,"pre",20),AC(4),hl()()();}if(t&2){let e=n.$implicit,r=tC(3);VE(),dg("heading",e.name)("open",r.isToolExpanded(e)),VE(),Vw(e.description?2:-1),VE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),$w(1,de,5,4,"li",null,z),hl()),t&2){let e=tC();VE(),zw(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd"),AC(5),hl(),Es(6,"dt"),AC(7,"Resolved model"),hl(),Es(8,"dd",6),AC(9),hl(),Es(10,"dt"),AC(11,"Provider"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt",7),AC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),AC(18),hl()(),Bw(19,W,4,1),hl()(),Bw(20,X,4,2,"ds-card"),Bw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),Bw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),Bw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=tC();VE(5),Fg(e.name),VE(4),Fg(e.resolvedModelApiName),VE(4),Fg(e.resolvedProviderName),VE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),VE(),Dl(" ",e.executionMode," "),VE(),Vw(e.userId?19:-1),VE(),Vw(e.systemPrompt?20:-1),VE(),Vw(e.instructions?21:-1),VE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),VE(),Vw(r.resolvedSkills().length===0?23:24),VE(2),dg("heading","Tools ("+e.tools.length+")"),VE(),Vw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=oT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),AC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),AC(5,"Edit config \u2192"),hl()(),Bw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;VE(4),dg("routerLink",r.editRoute()),VE(2),Vw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,hn,fn,rn,pn,at,ln,Pi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
1
+ import {v as vn,d as yn,k as dn,_ as _n,i as at,m as mn,F as Ni,G as On}from'./chunk-BeAWBIRs.js';import {g,W as W$1,t as F,K as we,ag as U,$ as $i,o as oT,U as U$1,D as Dw,au as $t,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,M as Mg,u as Dl,q as $w,z as zw,Q as Qw,f as fg,av as QC,aw as XC,w as pf,x as hf,ax as YD}from'./main-P6EOYPYG.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),AC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),AC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),AC(1,"User context"),hl(),Es(2,"dd",6),AC(3),hl()),t&2){let e=tC();VE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.systemPromptCollapsed()),VE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Qw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=tC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),AC(3),hl()()();}if(t&2){let e=tC(),r=tC();VE(),dg("open",!r.instructionsCollapsed()),VE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),AC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),AC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),AC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),AC(3),hl(),Bw(4,ee,2,0,"span",17),Bw(5,te,2,0,"span",17),hl(),Es(6,"p",3),AC(7),hl()()),t&2){let e=n.$implicit;VE(3),Fg(e.name),VE(),Vw(e.namespaceId?-1:4),VE(),Vw(e.readOnly?5:-1),VE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),$w(1,ne,8,4,"li",15,j),hl()),t&2){let e=tC(2);VE(),zw(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),AC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),QC(1,"agentosMarkdown")),t&2){let e=tC().$implicit;dg("innerHTML",XC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Qw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=tC(3);return hf(U.toggleTool(m))}),Bw(2,ae,2,3,"div",19),Es(3,"pre",20),AC(4),hl()()();}if(t&2){let e=n.$implicit,r=tC(3);VE(),dg("heading",e.name)("open",r.isToolExpanded(e)),VE(),Vw(e.description?2:-1),VE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),$w(1,de,5,4,"li",null,z),hl()),t&2){let e=tC();VE(),zw(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),AC(3,"Name"),hl(),Es(4,"dd"),AC(5),hl(),Es(6,"dt"),AC(7,"Resolved model"),hl(),Es(8,"dd",6),AC(9),hl(),Es(10,"dt"),AC(11,"Provider"),hl(),Es(12,"dd"),AC(13),hl(),Es(14,"dt",7),AC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),AC(18),hl()(),Bw(19,W,4,1),hl()(),Bw(20,X,4,2,"ds-card"),Bw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),Bw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),Bw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=tC();VE(5),Fg(e.name),VE(4),Fg(e.resolvedModelApiName),VE(4),Fg(e.resolvedProviderName),VE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),VE(),Dl(" ",e.executionMode," "),VE(),Vw(e.userId?19:-1),VE(),Vw(e.systemPrompt?20:-1),VE(),Vw(e.instructions?21:-1),VE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),VE(),Vw(r.resolvedSkills().length===0?23:24),VE(2),dg("heading","Tools ("+e.tools.length+")"),VE(),Vw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=oT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Dw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),AC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),AC(5,"Edit config \u2192"),hl()(),Bw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;VE(4),dg("routerLink",r.editRoute()),VE(2),Vw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,vn,yn,dn,_n,at,mn,Ni,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
@@ -0,0 +1 @@
1
+ import {q as k$1,O as O$1,i as at,d as yn,V as Vo,j as P,r as P$1}from'./chunk-BeAWBIRs.js';import {g,t as F,K as we,aq as k,ap as F$1,Z as Tr,$ as $i,a1 as ga,at as Cy,U as U$1,D as Dw,E as Es,R as vg,c as hl,b as AC,a as Bw,d as VE,P as dg,i as Vw,v as tC,F as Fg,q as $w,z as zw,Q as Qw,w as pf,x as hf,u as Dl,n as lg}from'./main-P6EOYPYG.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Es(0,"p",3),AC(1),hl()),o&2){let e=tC();VE(),Fg(e.deletion.error());}}function U(o,t){o&1&&(Es(0,"p",4),AC(1,"Loading AI models\u2026"),hl());}function z(o,t){o&1&&(Es(0,"p",5),AC(1,"No platform AI models defined yet."),hl());}function G(o,t){o&1&&(Es(0,"p",4),AC(1,"No AI models match the current filter."),hl());}function J(o,t){if(o&1){let e=Qw();Es(0,"button",21),vg("click",function(){pf(e);let r=tC().$implicit,m=tC(2);return hf(m.edit(r))}),AC(1,"Edit"),hl();}if(o&2){let e=tC().$implicit;lg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=Qw();Es(0,"tr",9)(1,"td",12),AC(2),hl(),Es(3,"td",13),AC(4),hl(),Es(5,"td",14),AC(6),hl(),Es(7,"td",15),AC(8),hl(),Es(9,"td",16),AC(10),hl(),Es(11,"td",17)(12,"div",18),Bw(13,J,2,1,"button",19),Es(14,"agentos-row-delete-action",20),vg("deleteRequested",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=pf(e).$implicit,m=tC(2);return hf(m.confirmDelete(r))})("deleteCancelled",function(){pf(e);let r=tC(2);return hf(r.deletion.cancel())}),hl()()()();}if(o&2){let e=t.$implicit,a=tC(2);VE(2),Fg(e.title),VE(2),Fg(e.providerName),VE(2),Dl(" ",e.model.apiModelName," "),VE(2),Fg(e.model.priority),VE(2),Dl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),VE(3),Vw(a.deletion.confirmingId()!==e.key?13:-1),VE(),dg("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),AC(5,"Name"),hl(),Es(6,"th",10),AC(7,"Provider"),hl(),Es(8,"th",10),AC(9,"API model name"),hl(),Es(10,"th",10),AC(11,"Priority"),hl(),Es(12,"th",10),AC(13,"Reasoning effort"),hl(),Es(14,"th",10)(15,"span",11),AC(16,"Actions"),hl()()()(),Es(17,"tbody",8),$w(18,O,15,9,"tr",9,K),hl()()()),o&2){let e=tC();VE(18),zw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k$1();rows=$i([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),Cy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Dw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["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","Platform 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","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&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()}),AC(3,"New AI model"),hl()(),Bw(4,H,2,1,"p",3),Bw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(VE(),dg("query",a.rowFilter.query()),VE(3),Vw(a.deletion.error()?4:-1),VE(),Vw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,yn,Vo,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-7p42eTQE.js';import {p as pt,T as Te$1,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,v as yn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,o as dn,d as cn,D as pn,e as at,i as sn,t as an}from'./chunk-zs4CYUQt.js';import {g,W,t as F,K as we$1,ag as U,ah as Fe$1,ai as ke$1,$ as $i,aj as De$1,a9 as F$1,ak as yd,o as oT,ac as by,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,v as tC,T as AI,z as zw,F as Fg,w as pf,x as hf,y as sh}from'./main-DZHLOK7A.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),AC(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=tC(2);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),AC(1,"Add an agent config"),hl(),AC(2," first. ")),n&2){let e=tC(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),AC(2," No agent configs available in this scope yet. "),Bw(3,Se,3,1),hl()()),n&2){let e=tC(2);VE(3),Vw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),VE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),AC(3,"Select an agent config\u2026"),hl(),$w(4,Ee,2,2,"option",17,ve),hl(),NI(),hl()),n&2){let e=tC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(3),zw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Qw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=tC(3);return hf(h.toggleDay(f.value))}),hl(),AC(2),hl();}if(n&2){let e=t.$implicit,l=tC(3);VE(),dg("checked",l.isDaySelected(e.value)),VE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),$w(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=tC(2);VE(2),zw(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),VE(),dg("formControl",e.endDateControl),AI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),VE(),dg("formControl",e.occurrenceCountControl),AI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),AC(1),hl()),n&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=tC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(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),NI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),$w(13,Te,2,2,"option",17,V),hl(),NI(),hl(),Bw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),NI(),Es(19,"span",22),AC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),NI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),$w(26,Me,2,2,"option",17,V),hl(),NI(),hl(),Bw(28,Pe,2,2,"ds-form-field",28),Bw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),NI(),AC(33," Enabled "),hl(),Es(34,"p",33),AC(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),NI(),hl(),Bw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),AC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=tC();return hf(f.cancel())}),AC(43,"Cancel"),hl()()();}if(n&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),VE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),VE(),dg("formControl",e.promptContentControl),AI(),VE(3),dg("formControl",e.unitControl),AI(),VE(),zw(e.schedulerUnits),VE(2),Vw(e.showDayFilter()?15:-1),VE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),VE(2),dg("formControl",e.timeUtcControl),AI(),VE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),VE(),dg("formControl",e.startDateControl),AI(),VE(2),dg("formControl",e.endTypeControl),AI(),VE(),zw(e.endTypes),VE(2),Vw(e.showEndDate()?28:-1),VE(),Vw(e.showOccurrenceCount()?29:-1),VE(3),dg("formControl",e.enabledControl),AI(),VE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(),Vw(e.errorMessage()?38:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),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:[gn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[gn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[gn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[gn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[gn.required,gn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[gn.required]}),endType:new Te$1(Fe$1.NEVER,{nonNullable:true,validators:[gn.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=ke$1;SchedulerEndType=Fe$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:Fe$1.NEVER,label:"Never"},{value:Fe$1.ON_DATE,label:"On date"},{value:Fe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$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=oT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=oT(()=>this.endTypeSignal()===Fe$1.ON_DATE);showOccurrenceCount=oT(()=>this.endTypeSignal()===Fe$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===Fe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Fe$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=Dw({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()}),AC(3),hl()(),Bw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(VE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),VE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),VE(),Vw(l.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,An,On,hn,fn,un,dn,cn,pn,at,sn,an],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Fe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Fe$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-MzRAkbwR.js';import {p as pt,T as Te$1,b as bn,K as Kt,a as fd,M as Mo,D as Do,U as Ut,P as Pn,o as Mn,Q as Qt,c as fo,g as go,t as ta,N as Nn,R as Rn,v as vn,d as yn,e as fn,l as pn,h as hn,_ as _n,i as at,u as un,n as cn}from'./chunk-BeAWBIRs.js';import {g,W,t as F,K as we$1,ag as U,ah as Fe$1,ai as ke$1,$ as $i,aj as De$1,a9 as F$1,ak as yd,o as oT,ac as by,U as U$1,a2 as ha,aa as br,N as x,L as w,D as Dw,E as Es,R as vg,b as AC,c as hl,a as Bw,d as VE,P as dg,u as Dl,i as Vw,Q as Qw,f as fg,S as NI,q as $w,v as tC,T as AI,z as zw,F as Fg,w as pf,x as hf,y as sh}from'./main-P6EOYPYG.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Es(0,"p",2),AC(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=tC(2);VE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Es(0,"a",39),AC(1,"Add an agent config"),hl(),AC(2," first. ")),n&2){let e=tC(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),AC(2," No agent configs available in this scope yet. "),Bw(3,Se,3,1),hl()()),n&2){let e=tC(2);VE(3),Vw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.id),VE(),Fg(e.name);}}function De(n,t){if(n&1&&(Es(0,"ds-form-field",11)(1,"select",40)(2,"option",41),AC(3,"Select an agent config\u2026"),hl(),$w(4,Ee,2,2,"option",17,ve),hl(),NI(),hl()),n&2){let e=tC(2);dg("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),VE(),dg("formControl",e.agentConfigIdControl),AI(),VE(3),zw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Ne(n,t){if(n&1){let e=Qw();Es(0,"label",31)(1,"input",43),vg("change",function(){let f=pf(e).$implicit,h=tC(3);return hf(h.toggleDay(f.value))}),hl(),AC(2),hl();}if(n&2){let e=t.$implicit,l=tC(3);VE(),dg("checked",l.isDaySelected(e.value)),VE(),Dl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Es(0,"ds-form-field",18)(1,"div",42),$w(2,Ne,3,2,"label",31,V),hl()()),n&2){let e=tC(2);VE(2),zw(e.dayOptions);}}function Me(n,t){if(n&1&&(Es(0,"option",17),AC(1),hl()),n&2){let e=t.$implicit;dg("value",e.value),VE(),Fg(e.label);}}function Pe(n,t){if(n&1&&(Es(0,"ds-form-field",28),fg(1,"input",44),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),VE(),dg("formControl",e.endDateControl),AI();}}function we(n,t){if(n&1&&(Es(0,"ds-form-field",29),fg(1,"input",45),NI(),hl()),n&2){let e=tC(2);dg("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),VE(),dg("formControl",e.occurrenceCountControl),AI();}}function Fe(n,t){if(n&1&&(Es(0,"ds-notice"),AC(1),hl()),n&2){let e=tC(2);VE(),Fg(e.errorMessage());}}function Oe(n,t){if(n&1){let e=Qw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let f=tC();return hf(f.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),NI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),NI(),hl(),Bw(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),NI(),hl(),Es(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),$w(13,Te,2,2,"option",17,V),hl(),NI(),hl(),Bw(15,Ie,4,0,"ds-form-field",18),Es(16,"ds-form-field",19)(17,"div",20),fg(18,"input",21),NI(),Es(19,"span",22),AC(20,"UTC"),hl()()()(),Es(21,"ds-fieldset",23)(22,"ds-form-field",24),fg(23,"input",25),NI(),hl(),Es(24,"ds-form-field",26)(25,"select",27),$w(26,Me,2,2,"option",17,V),hl(),NI(),hl(),Bw(28,Pe,2,2,"ds-form-field",28),Bw(29,we,2,2,"ds-form-field",29),hl(),Es(30,"div",30)(31,"label",31),fg(32,"input",32),NI(),AC(33," Enabled "),hl(),Es(34,"p",33),AC(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),NI(),hl(),Bw(38,Fe,2,1,"ds-notice"),Es(39,"ds-form-actions")(40,"button",36),AC(41),hl(),Es(42,"button",37),vg("click",function(){pf(e);let f=tC();return hf(f.cancel())}),AC(43,"Cancel"),hl()()();}if(n&2){let e=tC();dg("formGroup",e.form),VE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),VE(),dg("formControl",e.nameControl),AI(),VE(2),dg("formControl",e.descriptionControl),AI(),VE(),Vw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),VE(3),dg("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),VE(),dg("formControl",e.promptContentControl),AI(),VE(3),dg("formControl",e.unitControl),AI(),VE(),zw(e.schedulerUnits),VE(2),Vw(e.showDayFilter()?15:-1),VE(),dg("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),VE(2),dg("formControl",e.timeUtcControl),AI(),VE(4),dg("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),VE(),dg("formControl",e.startDateControl),AI(),VE(2),dg("formControl",e.endTypeControl),AI(),VE(),zw(e.endTypes),VE(2),Vw(e.showEndDate()?28:-1),VE(),Vw(e.showOccurrenceCount()?29:-1),VE(3),dg("formControl",e.enabledControl),AI(),VE(4),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),VE(),dg("formControl",e.externalMetadataJsonControl),AI(),VE(),Vw(e.errorMessage()?38:-1),VE(2),dg("disabled",e.form.invalid||e.isSubmitting()),VE(),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:[bn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[bn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[bn.required]}),unit:new Te$1(ke$1.WEEK,{nonNullable:true,validators:[bn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[bn.required,bn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[bn.required]}),endType:new Te$1(Fe$1.NEVER,{nonNullable:true,validators:[bn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);errorMessage=$i(null);SchedulerUnit=ke$1;SchedulerEndType=Fe$1;schedulerUnits=[{value:ke$1.WEEK,label:"Week(s)"},{value:ke$1.MONTH,label:"Month(s)"}];endTypes=[{value:Fe$1.NEVER,label:"Never"},{value:Fe$1.ON_DATE,label:"On date"},{value:Fe$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(De$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=oT(()=>this.unitSignal()===ke$1.WEEK);showEndDate=oT(()=>this.endTypeSignal()===Fe$1.ON_DATE);showOccurrenceCount=oT(()=>this.endTypeSignal()===Fe$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===Fe$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Fe$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=Dw({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()}),AC(3),hl()(),Bw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),hl()),e&2&&(VE(),dg("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),VE(2),Dl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),VE(),Vw(l.isLoading()?4:5));},dependencies:[Kt,fd,Mo,Do,Ut,Pn,Mn,Qt,fo,go,ta,Nn,Rn,vn,yn,fn,pn,hn,_n,at,un,cn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Fe$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Fe$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 {ab as N,b as hn,c as fn,u as un,d as cn,D as pn,e as at,i as sn}from'./chunk-zs4CYUQt.js';import {g,W,t as F,aU as D,ag as U,K as we,$ as $i,U as U$1,B,aV as gy,D as Dw,E as Es,R as vg,b as AC,c as hl,f as fg,a as Bw,d as VE,P as dg,i as Vw,u as Dl,v as tC,F as Fg}from'./main-DZHLOK7A.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),AC(1),hl()),l&2){let n=tC();VE(),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=Dw({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()}),AC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),AC(5," The loop configuration below is read from "),Es(6,"code"),AC(7,"AgentConfig.loopConfig"),hl(),AC(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(),Bw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),AC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),AC(16,"Cancel"),hl()()()),n&2&&(VE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),VE(),Vw(e.launchError()?11:-1),VE(2),dg("disabled",e.isLaunching()),VE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),VE(),dg("disabled",e.isLaunching()));},dependencies:[hn,fn,un,cn,pn,at,sn],encapsulation:2})};export{T as AgentConfigLaunchComponent};
1
+ import {ab as N,v as vn,d as yn,e as fn,h as hn,_ as _n,i as at,u as un}from'./chunk-BeAWBIRs.js';import {g,W,t as F,aU as D,ag as U,K as we,$ as $i,U as U$1,B,aV as gy,D as Dw,E as Es,R as vg,b as AC,c as hl,f as fg,a as Bw,d as VE,P as dg,i as Vw,u as Dl,v as tC,F as Fg}from'./main-P6EOYPYG.js';function P(l,t){if(l&1&&(Es(0,"ds-notice"),AC(1),hl()),l&2){let n=tC();VE(),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=Dw({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()}),AC(3," \u2190 Edit agent config "),hl()(),Es(4,"p",2),AC(5," The loop configuration below is read from "),Es(6,"code"),AC(7,"AgentConfig.loopConfig"),hl(),AC(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(),Bw(11,P,2,1,"ds-notice"),Es(12,"ds-form-actions")(13,"button",5),vg("click",function(){return e.launch()}),AC(14),hl(),Es(15,"button",6),vg("click",function(){return e.back()}),AC(16,"Cancel"),hl()()()),n&2&&(VE(10),dg("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),VE(),Vw(e.launchError()?11:-1),VE(2),dg("disabled",e.isLaunching()),VE(),Dl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),VE(),dg("disabled",e.isLaunching()));},dependencies:[vn,yn,fn,hn,_n,at,un],encapsulation:2})};export{T as AgentConfigLaunchComponent};