@whoz-oss/coday-client 0.0.0-workstream-forge.171 → 0.0.0-workstream-forge.172

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 (80) hide show
  1. package/browser/chunk-8GkesQ0k.js +1 -0
  2. package/browser/chunk-Azkube5e.js +1 -0
  3. package/browser/chunk-B6Yr3RDc.js +1 -0
  4. package/browser/{chunk-D8_LjQNu.js → chunk-B7CFfwor.js} +11 -11
  5. package/browser/chunk-BAmUhuXv.js +1 -0
  6. package/browser/chunk-BCFG3cAt.js +1 -0
  7. package/browser/chunk-BCFOIPzr.js +1 -0
  8. package/browser/chunk-BHRpnB0r.js +1 -0
  9. package/browser/{chunk-CNU0caUf.js → chunk-BPkdfsYS.js} +1 -1
  10. package/browser/{chunk-P4r1dEyn.js → chunk-BU5NDNAL.js} +1 -1
  11. package/browser/{chunk-DLChehGS.js → chunk-Bb_Z6sgc.js} +1 -1
  12. package/browser/chunk-BgvdBMGK.js +1 -0
  13. package/browser/{chunk-BE2gr3p6.js → chunk-Bk8l2wLo.js} +1 -1
  14. package/browser/chunk-BlpzRg0n.js +1 -0
  15. package/browser/{chunk-DFBs-RE9.js → chunk-BpmC_e5B.js} +1 -1
  16. package/browser/chunk-By0AYWlV.js +1 -0
  17. package/browser/chunk-C2do5buM.js +1 -0
  18. package/browser/chunk-CDfJLQb0.js +1 -0
  19. package/browser/chunk-CFTZLmDK.js +1 -0
  20. package/browser/{chunk-DW2g7bf8.js → chunk-C_2XXNbn.js} +1 -1
  21. package/browser/chunk-CbCz42Oe.js +1 -0
  22. package/browser/chunk-CcnD-khz.js +2 -0
  23. package/browser/chunk-CmJpcitD.js +1 -0
  24. package/browser/chunk-CmaAeOoQ.js +1 -0
  25. package/browser/chunk-Cnx9Er_d.js +2 -0
  26. package/browser/chunk-D-Fk7tKq.js +1 -0
  27. package/browser/chunk-D84tLLZv.js +1 -0
  28. package/browser/{chunk-dhR_kF8u.js → chunk-D9CvLQsC.js} +1 -1
  29. package/browser/chunk-DBoYNp5Y.js +1 -0
  30. package/browser/chunk-DFeu1IE1.js +1 -0
  31. package/browser/{chunk-BvstaQVd.js → chunk-DG9i3ksz.js} +1 -1
  32. package/browser/{chunk-BTy6yKH4.js → chunk-DK_JhKAm.js} +1 -1
  33. package/browser/{chunk-DviWI6ZH.js → chunk-DNLvVWb0.js} +1 -1
  34. package/browser/chunk-DZz2LVJ1.js +1 -0
  35. package/browser/chunk-Dc2iz8II.js +1 -0
  36. package/browser/{chunk-BKo5gTaz.js → chunk-DdNbpTgI.js} +1 -1
  37. package/browser/chunk-DeRoM7DQ.js +1 -0
  38. package/browser/{chunk-Blgx9AFm.js → chunk-Df4ffgbb.js} +1 -1
  39. package/browser/chunk-DxIjlwnT.js +1 -0
  40. package/browser/{chunk-xALPtt6X.js → chunk-DzCB16yn.js} +1 -1
  41. package/browser/{chunk-DQWi-xSi.js → chunk-H7vIl5DX.js} +1 -1
  42. package/browser/chunk-JFcgVIrZ.js +1 -0
  43. package/browser/chunk-W06JlWhl.js +1 -0
  44. package/browser/{chunk-DrpC3fGm.js → chunk-Xi3S8PpM.js} +1 -1
  45. package/browser/chunk-jYaGAlaB.js +1 -0
  46. package/browser/{chunk-xgxXbGGi.js → chunk-qz6FbyLX.js} +1 -1
  47. package/browser/index.html +4 -4
  48. package/browser/main-5RLWJYOC.js +564 -0
  49. package/browser/styles-VTJT2VI6.css +1 -0
  50. package/package.json +1 -1
  51. package/browser/chunk-71J15-v3.js +0 -1
  52. package/browser/chunk-8jObMYuf.js +0 -1
  53. package/browser/chunk-B3NozCkD.js +0 -1
  54. package/browser/chunk-BIQHTDel.js +0 -2
  55. package/browser/chunk-BPKteNGV.js +0 -1
  56. package/browser/chunk-BT-NlYaf.js +0 -1
  57. package/browser/chunk-BU3k32e3.js +0 -1
  58. package/browser/chunk-B_QodpYG.js +0 -1
  59. package/browser/chunk-Bq24Rml2.js +0 -1
  60. package/browser/chunk-C5m9mgHu.js +0 -1
  61. package/browser/chunk-C_OMTp5P.js +0 -1
  62. package/browser/chunk-CeHH5awD.js +0 -1
  63. package/browser/chunk-CnV27gYr.js +0 -1
  64. package/browser/chunk-Co0A853g.js +0 -1
  65. package/browser/chunk-CoRwPlfd.js +0 -2
  66. package/browser/chunk-D-BPxKQ6.js +0 -1
  67. package/browser/chunk-D2S3Krd9.js +0 -1
  68. package/browser/chunk-DDOr2TDF.js +0 -1
  69. package/browser/chunk-DVl0k4as.js +0 -1
  70. package/browser/chunk-DYTKtJg4.js +0 -1
  71. package/browser/chunk-DZQmSPQb.js +0 -1
  72. package/browser/chunk-DcZyBFc0.js +0 -1
  73. package/browser/chunk-DrWMSNHn.js +0 -1
  74. package/browser/chunk-DsTtqeXD.js +0 -1
  75. package/browser/chunk-EVTfRXob.js +0 -1
  76. package/browser/chunk-EnGHXwUB.js +0 -1
  77. package/browser/chunk-m9jY08fz.js +0 -1
  78. package/browser/chunk-w5fqwHg4.js +0 -1
  79. package/browser/main-YWZOZ7BG.js +0 -564
  80. package/browser/styles-FNIV4SFO.css +0 -1
@@ -0,0 +1 @@
1
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-C2do5buM.js';import {O}from'./chunk-Azkube5e.js';import {g,W as W$1,F,I as Ie,ae as $$1,aw as U,U as Ui,ax as K,a8 as G,K as KC,a9 as F$1,ay as Te$1,x as U$1,a2 as da,aa as Cr,aj as Ty,az as ne,E as x,z as w,m as mw,as as $t$1,D as Ds,J as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,L as Lw,ao as N,a6 as x$1,X as Xw,q as qw,l as lg,N as SI,Q as MI,e as cg,v as vl,V as Vw,H as Hw,O as Og,k as df,n as ff,aq as kg}from'./main-5RLWJYOC.js';import {a as pt$1,T as Te,b as fn,U as Ut$1,n as nd,o as bo,x as xo,L as Lt$1,k as kn,u as vn,G as Gt$1,m as mo,c as po,$ as $r,H as qr,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$1,j as an,t as rn,l as ko}from'./chunk-B7CFfwor.js';import'./chunk-D84tLLZv.js';var W=class n{aiModelController=g(N);listAvailable(t){let e=this.aiModelController.listPlatformLevelAiModel().pipe(this.orEmpty("platform")),o=t?this.aiModelController.listByNamespaceIdAiModel(t).pipe(this.orEmpty("namespace")):Cr([]);return Ty({platform:e,namespace:o}).pipe(ne(({platform:r,namespace:d})=>[...r,...d]))}orEmpty(t){return da(e=>(console.error(`[ai-model-state] failed to load the ${t} AI models`,e),Cr([])))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x$1({token:n,factory:n.\u0275fac,providedIn:"root"})};var D="*";function Ge(n){return (n??[]).some(t=>t.trim()===D)}function Ue(n){let t=(n??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D).map(e=>e.toLowerCase());return new Set(t)}function H(n){return n.includes(D)}function Xe(n){let t=n.replace(/[\\.[\]{}()^$|]/g,"\\$&").replace(/\*/g,".*");try{return new RegExp(`^${t}$`,"i")}catch(e){return null}}function z(n,t){return (t??[]).map(e=>e.trim()).filter(e=>e.length>0&&e!==D&&H(e)).some(e=>Xe(e)?.test(n)??false)}var je="AGENTOS_CONFIG",Qe=new Set(["HTTP_API","MCP_HTTP","MCP_STDIO","BASH","TMUX","GIT"]);function Ke(n){return n.configEnabled&&(n.hasSubAgents||n.integrationTypes.some(t=>Qe.has(t)))}var $=n=>n.trim().toLowerCase();function Ze(n,t){let e=o=>o.namespaceId?1:0;return e(n)-e(t)||n.priority-t.priority}var We=(n,t)=>n.label.localeCompare(t.label);function He(n,t){let e=new Map;for(let _ of n){let m=_.alias?.trim();if(!m)continue;let I=e.get($(m));(!I||Ze(_,I)>0)&&e.set($(m),_);}let o=[...e.values()].map(_=>({value:_.alias.trim(),label:`${_.alias.trim()} (${_.apiModelName})`})).sort(We),r=new Set,d=[];for(let _ of n){let m=_.apiModelName?.trim();!m||r.has($(m))||(r.add($(m)),e.has($(m))||d.push({value:m,label:m}));}d.sort(We);let f=t??"";if(f.trim().length===0||[...o,...d].some(_=>_.value===f))return {aliases:o,apiNames:d,current:null};let S=e.has($(f))||r.has($(f));return {aliases:o,apiNames:d,current:{value:f,label:S?f:`${f} (not in the list)`}}}var Ye=(n,t)=>t.value,et=(n,t)=>t.config.id,tt=(n,t)=>t.type,qe=(n,t)=>t.selector;function nt(n,t){if(n&1&&(Ds(0,"a",2),MC(1,"View resolved definition \u2192"),pl()),n&2){let e=Xw();ug("routerLink",e.inspectRoute());}}function ot(n,t){n&1&&(Ds(0,"ds-tag",3),MC(1,"Platform level"),pl());}function it(n,t){n&1&&(Ds(0,"p",4),MC(1,"Loading\u2026"),pl());}function at(n,t){if(n&1&&(lg(0,"input",17),SI()),n&2){let e=Xw(2);ug("formControl",e.modelNameControl),MI();}}function lt(n,t){if(n&1&&(Ds(0,"option",41),MC(1),pl()),n&2){let e=t;ug("ngValue",e.value),jE(),Og(e.label);}}function rt(n,t){if(n&1&&(Ds(0,"option",41),MC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),jE(),Og(e.label);}}function st(n,t){if(n&1&&(Ds(0,"optgroup",42),Vw(1,rt,2,2,"option",41,Ye),pl()),n&2){let e=Xw(3);jE(),Hw(e.modelOptions().aliases);}}function dt(n,t){if(n&1&&(Ds(0,"option",41),MC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),jE(),Og(e.label);}}function ct(n,t){if(n&1&&(Ds(0,"optgroup",43),Vw(1,dt,2,2,"option",41,Ye),pl()),n&2){let e=Xw(3);jE(),Hw(e.modelOptions().apiNames);}}function mt(n,t){if(n&1&&(Ds(0,"select",18)(1,"option",40),MC(2,"Select a model"),pl(),Pw(3,lt,2,2,"option",41),Pw(4,st,3,0,"optgroup",42),Pw(5,ct,3,0,"optgroup",43),pl(),SI()),n&2){let e,o=Xw(2);ug("formControl",o.modelNameControl),MI(),jE(),ug("ngValue",null),jE(2),Lw((e=o.modelOptions().current)?3:-1,e),jE(),Lw(o.modelOptions().aliases.length>0?4:-1),jE(),Lw(o.modelOptions().apiNames.length>0?5:-1);}}function ut(n,t){if(n&1&&(Ds(0,"span",44),MC(1),pl()),n&2){let e=Xw().$implicit;jE(),Og(e.config.integrationType);}}function gt(n,t){if(n&1&&(lg(0,"input",45),SI()),n&2){let e=Xw().$implicit;ug("formControl",e.toolsControl),cg("aria-label","Tools of "+e.config.name),MI();}}function pt(n,t){if(n&1){let e=qw();Ds(0,"div",10)(1,"label",11)(2,"input",23),mg("change",function(){let r=df(e).$implicit,d=Xw(3);return ff(d.toggleIntegration(r))}),pl(),Ds(3,"span",24),MC(4),pl(),Pw(5,ut,2,1,"span",44),pl(),Pw(6,gt,1,2,"input",45),pl();}if(n&2){let e=t.$implicit;jE(2),ug("checked",e.enabled()),jE(2),Og(e.config.name),jE(),Lw(e.config.integrationType?5:-1),jE(),Lw(e.enabled()?6:-1);}}function ft(n,t){if(n&1&&(Ds(0,"p",13),MC(1),pl()),n&2){let e=Xw().$implicit;jE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(n,t){if(n&1){let e=qw();Ds(0,"div",10)(1,"label",24),MC(2),Ds(3,"span",44),MC(4,"built-in"),pl()(),Ds(5,"select",47),mg("change",function(r){let d=df(e).$implicit,f=Xw(4);return ff(f.setBuiltInState(d,r.target.value))}),Ds(6,"option",48),MC(7),pl(),Ds(8,"option",49),MC(9,"Enabled"),pl(),Ds(10,"option",50),MC(11,"Disabled"),pl()(),Pw(12,ft,2,1,"p",13),Ds(13,"p",13),MC(14),pl()();}if(n&2){let e=t.$implicit,o=Xw(4);jE(),cg("for","built-in-"+e.type),jE(),vl(" ",e.displayName," "),jE(3),ug("id","built-in-"+e.type)("value",e.state()),jE(2),Og(o.builtInDefaultLabel(e)),jE(5),Lw(e.state()==="on"&&e.restrictedTools?12:-1),jE(2),Og(e.description);}}function _t(n,t){if(n&1&&(Ds(0,"span",46),MC(1,"Built-in integrations"),pl(),Vw(2,Ct,15,7,"div",10,tt)),n&2){let e=Xw(3);jE(2),Hw(e.builtInRows());}}function bt(n,t){n&1&&(Ds(0,"ds-notice",26),MC(1," This agent can read the AgentOS configuration and also has a network integration or sub-agents: what it reads could be sent outside without any confirmation. Prefer a dedicated configuration agent without them. "),pl());}function ht(n,t){if(n&1&&(Ds(0,"ds-fieldset",21),Vw(1,pt,7,4,"div",10,et),Pw(3,_t,4,0),Pw(4,bt,2,0,"ds-notice",26),pl()),n&2){let e=Xw(2);jE(),Hw(e.integrationRows()),jE(2),Lw(e.builtInRows().length>0?3:-1),jE(),Lw(e.configAgentExposureWarning()?4:-1);}}function yt(n,t){n&1&&MC(0," A platform config can only list platform skills here: namespace skills are resolved per namespace when the agent runs. ");}function vt(n,t){n&1&&(Ds(0,"ds-notice",26),MC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),MC(3,"*"),pl(),MC(4,". "),pl());}function xt(n,t){n&1&&(Ds(0,"ds-notice"),MC(1," The skill catalogue could not be loaded. What this agent already declares is listed below and preserved on save. "),pl());}function St(n,t){n&1&&(Ds(0,"p",4),MC(1,"No skill available in this scope yet."),pl());}function At(n,t){n&1&&(Ds(0,"span",44),MC(1,"platform"),pl());}function wt(n,t){if(n&1&&(Ds(0,"span",44),MC(1),pl()),n&2){let e=Xw(4);jE(),vl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(n,t){if(n&1&&(Ds(0,"p",13),MC(1),pl()),n&2){let e=Xw().$implicit;jE(),Og(e.description);}}function Tt(n,t){if(n&1){let e=qw();Ds(0,"div",10)(1,"label",11)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Xw(3);return ff(d.toggleSkill(r))}),pl(),Ds(3,"span",24),MC(4),pl(),Pw(5,At,2,0,"span",44),Pw(6,wt,2,1,"span",44),pl(),Pw(7,Et,2,1,"p",13),pl();}if(n&2){let e=t.$implicit,o=Xw(3);jE(2),ug("checked",e.selected())("disabled",o.allSkillsSelected()),jE(2),Og(e.name),jE(),Lw(e.platform?5:-1),jE(),Lw(e.unresolved?6:-1),jE(),Lw(e.description?7:-1);}}function kt(n,t){if(n&1&&Vw(0,Tt,8,6,"div",10,qe),n&2){let e=Xw(2);Hw(e.skillRows());}}function It(n,t){if(n&1&&(Ds(0,"ds-form-field",30),lg(1,"textarea",52),SI(),Ds(2,"p",4),MC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Ds(4,"code"),MC(5,"AgentLoopPayload"),pl(),MC(6,". Leave empty if you always provide the payload at launch. "),pl()()),n&2){let e=Xw(2);ug("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),jE(),ug("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),MI();}}function Mt(n,t){n&1&&MC(0," A platform config can only list platform agents here: a namespace's agents are resolved per namespace when the agent runs. ");}function Rt(n,t){if(n&1&&MC(0),n&2){let e=Xw(3);kg(" That deletes ",e.droppedUnresolvedSubAgents()," flagged ",e.droppedUnresolvedSubAgents()===1?"selector":"selectors"," nothing matched, which this form cannot restore. ");}}function Ft(n,t){if(n&1&&(Ds(0,"ds-notice",26),MC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),MC(3,"*"),pl(),MC(4,". "),Pw(5,Rt,1,2),pl()),n&2){let e=Xw(2);jE(5),Lw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(n,t){n&1&&(Ds(0,"ds-notice"),MC(1," The list of agents could not be loaded. What this agent already declares is listed below and preserved on save. "),pl());}function Dt(n,t){n&1&&(Ds(0,"p",4),MC(1,"No other agent is available in this scope yet."),pl());}function Lt(n,t){n&1&&(Ds(0,"span",44),MC(1,"pattern"),pl());}function Ot(n,t){n&1&&(Ds(0,"span",44),MC(1,"via pattern"),pl());}function Vt(n,t){if(n&1&&(Ds(0,"span",44),MC(1),pl()),n&2){let e=Xw(4);jE(),vl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Pt(n,t){if(n&1){let e=qw();Ds(0,"button",55),mg("click",function(){df(e);let r=Xw().$implicit,d=Xw(3);return ff(d.removeSubAgent(r))}),MC(1," \xD7 "),pl();}if(n&2){let e=Xw().$implicit;cg("aria-label","Remove "+e.selector);}}function Bt(n,t){if(n&1){let e=qw();Ds(0,"div",32)(1,"label",53)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Xw(3);return ff(d.toggleSubAgent(r))}),pl(),Ds(3,"span",24),MC(4),pl(),Pw(5,Lt,2,0,"span",44)(6,Ot,2,0,"span",44)(7,Vt,2,1,"span",44),pl(),Pw(8,Pt,2,1,"button",54),pl();}if(n&2){let e=t.$implicit,o=Xw(3);jE(2),ug("checked",e.selected())("disabled",o.allSubAgentsSelected()),jE(2),Og(e.name),jE(),Lw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),jE(3),Lw(e.unresolved?8:-1);}}function $t(n,t){if(n&1&&Vw(0,Bt,9,5,"div",32,qe),n&2){let e=Xw(2);Hw(e.subAgentRows());}}function Gt(n,t){if(n&1){let e=qw();Ds(0,"div")(1,"button",56),mg("click",function(){df(e);let r=Xw(2);return ff(r.useDefaultDelegationTimeout())}),MC(2," Use server default "),pl()();}}function Ut(n,t){n&1&&(Ds(0,"ds-notice"),MC(1),pl()),n&2&&(jE(),Og(t));}function jt(n,t){if(n&1){let e=qw();Ds(0,"button",57),mg("click",function(){df(e);let r=Xw(2);return ff(r.exportYaml())}),MC(1),pl();}if(n&2){let e=Xw(2);ug("disabled",e.isExporting()),jE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(n,t){if(n&1){let e=qw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let r=Xw();return ff(r.submit())}),Ds(1,"ds-fieldset",7)(2,"ds-form-field",8),lg(3,"input",9),SI(),pl(),Ds(4,"div",10)(5,"label",11),lg(6,"input",12),SI(),MC(7," Enabled "),pl(),Ds(8,"p",13),MC(9,"Disabled agents are excluded from namespace resolution."),pl()(),Ds(10,"ds-form-field",14),lg(11,"input",15),SI(),pl(),Ds(12,"ds-form-field",16),Pw(13,at,1,1,"input",17)(14,mt,6,5,"select",18),pl(),Ds(15,"ds-form-field",19),lg(16,"textarea",20),SI(),pl()(),Pw(17,ht,5,2,"ds-fieldset",21),Ds(18,"ds-fieldset",22)(19,"p",4),MC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Ds(21,"code"),MC(22,"readSkill"),pl(),MC(23," and "),Ds(24,"code"),MC(25,"readSkillResource"),pl(),MC(26," tools; selecting none grants neither. "),Pw(27,yt,1,0),pl(),Ds(28,"label",11)(29,"input",23),mg("change",function(){df(e);let r=Xw();return ff(r.toggleAllSkills())}),pl(),Ds(30,"span",24),MC(31,"Every skill in the catalogue ("),Ds(32,"code",25),MC(33,"*"),pl(),MC(34,")"),pl()(),Ds(35,"p",13),MC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),pl(),Pw(37,vt,5,0,"ds-notice",26),Pw(38,xt,2,0,"ds-notice"),Pw(39,St,2,0,"p",4)(40,kt,2,0),pl(),Ds(41,"ds-form-field",27)(42,"select",28)(43,"option",29),MC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),Ds(45,"option",29),MC(46,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),Ds(47,"option",29),MC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),SI(),pl(),Pw(49,It,7,3,"ds-form-field",30),Ds(50,"ds-fieldset",31)(51,"p",4),MC(52," The agents this one may delegate to. Selecting at least one grants it the "),Ds(53,"code"),MC(54,"DELEGATE__delegate"),pl(),MC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Pw(56,Mt,1,0),pl(),Ds(57,"label",11)(58,"input",23),mg("change",function(){df(e);let r=Xw();return ff(r.toggleAllSubAgents())}),pl(),Ds(59,"span",24),MC(60,"Every agent it can reach ("),Ds(61,"code",25),MC(62,"*"),pl(),MC(63,")"),pl()(),Ds(64,"p",13),MC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),pl(),Pw(66,Ft,6,1,"ds-notice",26),Pw(67,Nt,2,0,"ds-notice"),Pw(68,Dt,2,0,"p",4)(69,$t,2,0),Ds(70,"p",4),MC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Ds(72,"code"),MC(73,"*Fixer"),pl(),MC(74," to cover BugFixer and StoryFixer. "),pl(),Ds(75,"div",32)(76,"input",33),mg("keydown.enter",function(){df(e);let r=Xw();return ff(r.addSubAgent())}),pl(),SI(),Ds(77,"button",34),mg("click",function(){df(e);let r=Xw();return ff(r.addSubAgent())}),MC(78," + "),pl()(),Ds(79,"ds-form-field",35),lg(80,"input",36),SI(),Pw(81,Gt,3,0,"div"),pl()(),Pw(82,Ut,2,1,"ds-notice"),Ds(83,"ds-form-actions")(84,"button",37),MC(85),pl(),Pw(86,jt,2,2,"button",38),Ds(87,"button",39),mg("click",function(){df(e);let r=Xw();return ff(r.cancel())}),MC(88,"Cancel"),pl()()();}if(n&2){let e,o=Xw();ug("formGroup",o.form),jE(3),ug("formControl",o.nameControl),MI(),jE(3),ug("formControl",o.enabledControl),MI(),jE(5),ug("formControl",o.descriptionControl),MI(),jE(2),Lw(o.modelAsFreeText()?13:14),jE(3),ug("formControl",o.instructionsControl),MI(),jE(),Lw(o.integrationRows().length>0||o.builtInRows().length>0?17:-1),jE(10),Lw(o.isPlatformMode?27:-1),jE(2),ug("checked",o.allSkillsSelected()),jE(8),Lw(o.namedSkillSelectionDropped()?37:-1),jE(),Lw(o.skillCatalogueUnavailable()?38:-1),jE(),Lw(o.skillRows().length===0?39:40),jE(3),ug("formControl",o.executionModeControl),MI(),jE(),ug("value",o.ExecutionMode.SIMPLE),jE(2),ug("value",o.ExecutionMode.ADVANCED),jE(2),ug("value",o.ExecutionMode.LOOP),jE(2),Lw(o.isLoopMode()?49:-1),jE(7),Lw(o.isPlatformMode?56:-1),jE(2),ug("checked",o.allSubAgentsSelected()),jE(8),Lw(o.namedSubAgentSelectionDropped()?66:-1),jE(),Lw(o.subAgentCandidatesUnavailable()?67:-1),jE(),Lw(o.subAgentRows().length===0?68:69),jE(8),ug("formControl",o.newSubAgentControl),MI(),jE(),ug("disabled",!o.newSubAgentControl.value.trim()),jE(2),ug("hint",o.delegationTimeoutHint())("error",o.delegationTimeoutControl.invalid?"Enter a valid positive whole number of seconds, or leave empty to inherit the server default.":null),jE(),ug("formControl",o.delegationTimeoutControl),cg("aria-invalid",o.delegationTimeoutControl.invalid),MI(),jE(),Lw(o.delegationTimeoutControl.value!==null?81:-1),jE(),Lw((e=o.submitError())?82:-1,e),jE(2),ug("disabled",o.form.invalid||o.isSubmitting()),jE(),vl(" ",o.isEditMode()?"Save changes":"Create"," "),jE(),Lw(o.isEditMode()?86:-1);}}var Je=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g($$1);defaultsController=g(U);defaultDelegationTimeoutSeconds=Ui(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=g(G);skillState=g(o);aiModelState=g(W);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt$1({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),modelName:new Te(null,{validators:[fn.required,n.notBlankValidator]}),instructions:new Te(null),executionMode:new Te("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new Te(null,{validators:[fn.min(1),fn.max(2147483647),fn.pattern(/^\d+$/)]}),enabled:new Te(false,{nonNullable:true}),loopConfig:new Te(null,{validators:[n.jsonValidator]})});static notBlankValidator(t){let e=t.value;return typeof e=="string"&&e.length>0&&e.trim().length===0?{required:true}:null}static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(o){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}delegationTimeoutHint=KC(()=>{let t=this.defaultDelegationTimeoutSeconds();return `How long each delegation launched by this agent waits without activity from the sub-agent, including its own delegations. When it runs out, the sub-agent and its active descendants are stopped and can be resumed. Leave empty to use the server default${t!==null?`: ${t} s (${t/60} min)`:""}.`});get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=KC(()=>this.executionModeValue()==="LOOP");subAgentRows=Ui([]);allSubAgentsSelected=Ui(false);subAgentCandidatesUnavailable=Ui(false);namedSubAgentSelectionDropped=KC(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=KC(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=KC(()=>this.allSubAgentsSelected()||this.subAgentRows().some(t=>t.selected()));newSubAgentControl=new Te("",{nonNullable:true});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);submitError=Ui(null);ExecutionMode=Te$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=Ui([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}configAgentExposureWarning=KC(()=>Ke({configEnabled:this.builtInRows().some(t=>t.type===je&&t.state()==="on"),integrationTypes:this.integrationRows().filter(t=>t.enabled()).map(t=>t.config.integrationType),hasSubAgents:this.hasAnySubAgent()}));modelOptions=Ui({aliases:[],apiNames:[],current:null});modelCatalogueLoaded=Ui(false);modelAsFreeText=KC(()=>{let{aliases:t,apiNames:e}=this.modelOptions();return this.modelCatalogueLoaded()&&t.length+e.length===0});applyModelCatalogue(t,e){this.modelOptions.set(He(t,e)),this.modelCatalogueLoaded.set(true);}integrationRows=Ui([]);skillRows=Ui([]);allSkillsSelected=Ui(false);skillCatalogueUnavailable=Ui(false);namedSkillSelectionDropped=KC(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),da(()=>Cr(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),Ty({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Cr([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:o,platformIntegrations:r,builtInTypes:d,skillCatalogue:f,delegationCandidates:S,models:_})=>{this.existingConfig=e,this.applyModelCatalogue(_,e.modelName??null),this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let m=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(m),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let I=[...r,...o];this.integrationRows.set(this.buildIntegrationRows(I,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(d,e.integrations??void 0)),this.allSubAgentsSelected.set(Ge(e.subAgents)),this.subAgentRows.set(this.buildSubAgentRows(S,e.subAgents,e.name)),this.allSkillsSelected.set(o$1(e.skillSelectors)),this.skillRows.set(this.buildSkillRows(f,e.skillSelectors)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){Ty({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):Cr([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes(),skillCatalogue:this.loadSkillCatalogue(),delegationCandidates:this.loadDelegationCandidates(),models:this.aiModelState.listAvailable(this.namespaceId)}).pipe(U$1(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:o,builtInTypes:r,skillCatalogue:d,delegationCandidates:f,models:S})=>{this.applyModelCatalogue(S,null);let _=[...o,...e];this.integrationRows.set(this.buildIntegrationRows(_,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(r,t??void 0)),this.allSubAgentsSelected.set(false),this.subAgentRows.set(this.buildSubAgentRows(f,void 0,null)),this.allSkillsSelected.set(false),this.skillRows.set(this.buildSkillRows(d,void 0));}});}loadSkillCatalogue(){return (this.namespaceId?this.skillState.listEffective(this.namespaceId):this.skillState.listPlatform().pipe(ne(e=>e.map(o=>({id:o.id??"",name:o.name,description:o.description,namespaceId:o.namespaceId??null,readOnly:o.readOnly===true}))))).pipe(da(e=>(console.error("[agent-config-form] failed to load the skill catalogue",e),this.skillCatalogueUnavailable.set(true),Cr([]))))}buildSkillRows(t,e){let r$1=(e??[]).map(m=>m.trim()).filter(m=>m.length>0).filter(m=>m!==r),d=i(r$1),f=new Set(t.map(m=>m.name.toLowerCase())),S=t.map(m=>({selector:m.name,name:m.name,description:m.description,platform:m.namespaceId==null,unresolved:false,selected:Ui(d.has(m.name.toLowerCase()))})),_=new Set;for(let m of r$1){let I=l(m).toLowerCase();f.has(I)||_.has(I)||(_.add(I),S.push({selector:m,name:m,description:"",platform:false,unresolved:true,selected:Ui(true)}));}return S}toggleSkill(t){t.selected.update(e=>!e);}toggleAllSkills(){this.allSkillsSelected.update(t=>!t);}buildSkillSelectorsPayload(){if(this.allSkillsSelected())return [r];let t=this.skillRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}loadDelegationCandidates(){let t=this.agentConfigController.listPlatformAgentsAgentConfig(false).pipe(this.orNoCandidates()),e=this.namespaceId?this.agentConfigController.listByParentAgentConfig(this.namespaceId,false).pipe(this.orNoCandidates()):Cr([]);return Ty({platform:t,namespace:e}).pipe(ne(({platform:o,namespace:r})=>[...o,...r]),ne(o=>o.map(r=>r.name).filter(r=>r.length>0)),ne(o=>n.dedupeByKey(o)))}orNoCandidates(){return da(t=>(console.error("[agent-config-form] failed to load the delegation candidates",t),this.subAgentCandidatesUnavailable.set(true),Cr([])))}static dedupeByKey(t){let e=new Set;return t.filter(o=>{let r=o.toLowerCase();return e.has(r)?false:(e.add(r),true)})}buildSubAgentRows(t,e,o){let r=Ue(e),d=o?.toLowerCase()??null,f=t.filter(b=>{let G=b.toLowerCase();return G!==d||r.has(G)}),S=new Set(f.map(b=>b.toLowerCase())),_=f.map(b=>({selector:b,name:b,unresolved:false,pattern:false,grantedByPattern:z(b,e),selected:Ui(r.has(b.toLowerCase()))})),m=new Set,I=(e??[]).map(b=>b.trim()).filter(b=>b.length>0&&b!==D);for(let b of I){let G=b.toLowerCase();S.has(G)||m.has(G)||(m.add(G),_.push({selector:b,name:b,unresolved:true,pattern:H(b),grantedByPattern:false,selected:Ui(true)}));}return _}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(ne(t=>t.filter(e=>!e.configSchema)),da(t=>(console.error("[agent-config-form] failed to load integration types",t),Cr([]))))}buildIntegrationRows(t,e){return t.map(o=>{let r=o.name??"",d=e?.[r],f=e!=null&&r in e,S=Array.isArray(d)?d.join(", "):"";return {config:o,enabled:Ui(f),toolsControl:new Te(S,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(o=>{let r=e!=null&&o.type in e,d=e?.[o.type],f=r?Array.isArray(d)&&d.length===0?"off":"on":"default";return {type:o.type,displayName:o.displayName,description:o.description,enabledByDefault:o.enabledByDefault===true,state:Ui(f),restrictedTools:Array.isArray(d)&&d.length>0?d:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();if(!t)return;let e=this.subAgentRows().find(o=>o.selector.toLowerCase()===t.toLowerCase());e?e.selected.set(true):t===D?this.allSubAgentsSelected.set(true):this.subAgentRows.update(o=>this.withPatternGrants([...o,{selector:t,name:t,unresolved:true,pattern:H(t),grantedByPattern:false,selected:Ui(true)}])),this.newSubAgentControl.reset("");}removeSubAgent(t){let e=t.selector.toLowerCase();this.subAgentRows.update(o=>this.withPatternGrants(o.filter(r=>r.selector.toLowerCase()!==e)));}toggleSubAgent(t){t.selected.update(e=>!e),t.pattern&&this.subAgentRows.update(e=>this.withPatternGrants(e));}withPatternGrants(t){let e=this.allSubAgentsSelected()?[]:t.filter(o=>o.selected()).map(o=>o.selector);return t.map(o=>o.unresolved?o:x(w({},o),{grantedByPattern:z(o.name,e)}))}toggleAllSubAgents(){this.allSubAgentsSelected.update(t=>!t),this.subAgentRows.update(t=>this.withPatternGrants(t));}buildSubAgentsPayload(){if(this.allSubAgentsSelected())return [D];let t=this.subAgentRows().filter(e=>e.selected()).map(e=>e.selector);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let o of this.integrationRows().filter(r=>r.enabled())){let r=o.config.name??"",d=o.toolsControl.value.trim();t[r]=d===""?null:d.split(",").map(f=>f.trim()).filter(f=>f.length>0);}for(let o of this.builtInRows()){let r=o.state();r==="on"?t[o.type]=o.restrictedTools??null:r==="off"&&(t[o.type]=[]);}let e=new Set([...this.integrationRows().map(o=>o.config.name??""),...this.builtInRows().map(o=>o.type)]);for(let[o,r]of Object.entries(this.existingConfig?.integrations??{}))e.has(o)||(t[o]=r);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.submitError.set(null),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),skillSelectors:this.buildSkillSelectorsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:o=>{this.isSubmitting.set(false),this.submitError.set(n.serverMessage(o));}});}static serverMessage(t){let o=t?.error?.message;if(typeof o=="string"&&o.trim().length>0)return o;let r=t?.status;return r===0?"The server could not be reached. The agent was not saved.":typeof r=="number"&&r>=500?`The server failed to save the agent (HTTP ${r}). Nothing was changed.`:"The server refused the save and gave no reason. Check the values and try again."}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let o=new Blob([e],{type:"application/yaml"}),r=URL.createObjectURL(o),d=document.createElement("a");d.href=r,d.download=`${this.existingConfig?.name??"agent"}.yaml`,d.click(),URL.revokeObjectURL(r),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-agent-config-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],["headerMeta","","variant","outline"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Agent"],["label","Name","controlId","agent-config-name","required",""],["dsControl","","id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",3,"formControl"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","Description","controlId","agent-config-description"],["dsControl","","id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",3,"formControl"],["label","Model","controlId","agent-config-model-name","required","","hint","Aliases are matched first, then API model names. Resolved when the agent runs."],["dsControl","","id","agent-config-model-name","type","text","placeholder","Model alias or name to use, e.g. BIG","autocomplete","off",3,"formControl"],["dsControl","","id","agent-config-model-name",3,"formControl"],["label","Instructions","controlId","agent-config-instructions"],["dsControl","","id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",3,"formControl"],["legend","Integrations","hint","Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration."],["legend","Skills"],["type","checkbox",3,"change","checked"],[1,"ds-strong"],[1,"ds-code"],["tone","warning"],["label","Execution mode","controlId","agent-config-execution-mode","hint",'SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks and requires a model that supports advanced execution, otherwise the agent fails to run. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu.'],["dsControl","","id","agent-config-execution-mode",3,"formControl"],[3,"value"],["label","Loop configuration (JSON)","controlId","agent-config-loop-config",3,"error"],["legend","Sub-agents"],[1,"ds-inline"],["dsControl","","type","text","aria-label","New sub-agent pattern","placeholder","e.g. *Fixer","autocomplete","off",3,"keydown.enter","formControl"],["dsButton","","variant","icon","type","button","title","Add pattern","aria-label","Add pattern",3,"click","disabled"],["label","Delegation timeout (seconds)","controlId","delegation-timeout","hintId","delegation-timeout-hint","errorId","delegation-timeout-error",3,"hint","error"],["dsControl","","id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["disabled","",3,"ngValue"],[3,"ngValue"],["label","Aliases"],["label","API model names"],[1,"ds-meta"],["dsControl","","type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"ds-indent",3,"formControl"],[1,"ds-micro"],["dsControl","",1,"ds-indent","ds-control--auto",3,"change","id","value"],["value","default"],["value","on"],["value","off"],["type","checkbox",3,"change","checked","disabled"],["dsControl","","mono","","id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",3,"placeholder","formControl"],["dsCheck","",1,"ds-grow"],["dsButton","","variant","icon-danger","type","button","title","Remove"],["dsButton","","variant","icon-danger","type","button","title","Remove",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),MC(3," \u2190 Agent configs "),pl(),Pw(4,nt,2,1,"a",2),Pw(5,ot,2,0,"ds-tag",3),pl(),Pw(6,it,2,0,"p",4)(7,Kt,89,33,"form",5),pl()),e&2&&(jE(),ug("title",o.isEditMode()?"Edit agent config":"New agent config"),jE(3),Lw(o.isEditMode()?4:-1),jE(),Lw(o.isPlatformMode?5:-1),jE(),Lw(o.isLoading()?6:7));},dependencies:[Ut$1,nd,bo,xo,Lt$1,kn,vn,Gt$1,mo,po,$r,qr,Vn,An,$t$1,pn,hn,cn,ln,dn,mn,at$1,an,rn,ko],encapsulation:2})};export{Je as AgentConfigFormComponent};
@@ -1 +1 @@
1
- import {a8 as O,d as pn,h as hn,e as cn,g as dn,B as mn,i as at,j as an}from'./chunk-D8_LjQNu.js';import {g,W,F,aN as F$1,a9 as $,I as Ie,U as Ui,x as U,B,aO as hy,m as mw,D as Ds,N as mg,M as MC,a as pl,l as lg,P as Pw,j as jE,J as ug,L as Lw,v as vl,X as Xw,O as Og}from'./main-YWZOZ7BG.js';function P(l,t){if(l&1&&(Ds(0,"ds-notice"),MC(1),pl()),l&2){let n=Xw();jE(),Og(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(F$1);caseState=g(O);agentConfigController=g($);destroyRef=g(Ie);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=Ui("");launchError=Ui(null);isLaunching=Ui(false);isLoading=Ui(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U(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 hy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield hy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield hy(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=mw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return e.back()}),MC(3," \u2190 Edit agent config "),pl()(),Ds(4,"p",2),MC(5," The loop configuration below is read from "),Ds(6,"code"),MC(7,"AgentConfig.loopConfig"),pl(),MC(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. "),pl(),Ds(9,"ds-form-field",3),lg(10,"textarea",4),pl(),Pw(11,P,2,1,"ds-notice"),Ds(12,"ds-form-actions")(13,"button",5),mg("click",function(){return e.launch()}),MC(14),pl(),Ds(15,"button",6),mg("click",function(){return e.back()}),MC(16,"Cancel"),pl()()()),n&2&&(jE(10),ug("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),jE(),Lw(e.launchError()?11:-1),jE(2),ug("disabled",e.isLaunching()),jE(),vl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),jE(),ug("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
1
+ import {a8 as O,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an}from'./chunk-B7CFfwor.js';import {g,W,F,aQ as F$1,ae as $,I as Ie,U as Ui,x as U,B,aR as hy,m as mw,D as Ds,J as mg,M as MC,a as pl,l as lg,P as Pw,j as jE,G as ug,L as Lw,v as vl,X as Xw,O as Og}from'./main-5RLWJYOC.js';function P(l,t){if(l&1&&(Ds(0,"ds-notice"),MC(1),pl()),l&2){let n=Xw();jE(),Og(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(F$1);caseState=g(O);agentConfigController=g($);destroyRef=g(Ie);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=Ui("");launchError=Ui(null);isLaunching=Ui(false);isLoading=Ui(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U(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 hy(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield hy(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield hy(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=mw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return e.back()}),MC(3," \u2190 Edit agent config "),pl()(),Ds(4,"p",2),MC(5," The loop configuration below is read from "),Ds(6,"code"),MC(7,"AgentConfig.loopConfig"),pl(),MC(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. "),pl(),Ds(9,"ds-form-field",3),lg(10,"textarea",4),pl(),Pw(11,P,2,1,"ds-notice"),Ds(12,"ds-form-actions")(13,"button",5),mg("click",function(){return e.launch()}),MC(14),pl(),Ds(15,"button",6),mg("click",function(){return e.back()}),MC(16,"Cancel"),pl()()()),n&2&&(jE(10),ug("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),jE(),Lw(e.launchError()?11:-1),jE(2),ug("disabled",e.isLaunching()),jE(),vl(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),jE(),ug("disabled",e.isLaunching()));},dependencies:[pn,hn,cn,dn,mn,at,an],encapsulation:2})};export{T as AgentConfigLaunchComponent};
@@ -0,0 +1 @@
1
+ import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-CbCz42Oe.js';import {R}from'./chunk-JFcgVIrZ.js';import {g,W as W$1,F,I as Ie,U as Ui,x as U$1,az as ne$1,a1 as fa,aa as Cr,m as mw,D as Ds,J as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,v as vl,q as qw,e as cg,k as df,n as ff}from'./main-5RLWJYOC.js';import {z as k,O,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-B7CFfwor.js';import'./chunk-D84tLLZv.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let t=Xw();jE(),Og(t.deletion.error());}}function J(n,e){n&1&&(Ds(0,"p",4),MC(1,"Loading auth settings\u2026"),pl());}function Q(n,e){n&1&&(Ds(0,"p",5),MC(1,"No auth settings available."),pl());}function W(n,e){n&1&&(Ds(0,"p",4),MC(1,"No auth settings match the current filter."),pl());}function X(n,e){n&1&&(Ds(0,"ds-tag",17),MC(1,"Read-only"),pl());}function Y(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let c=Xw().$implicit,d=Xw(2);return ff(d.duplicate(c))}),MC(1," Duplicate "),pl();}if(n&2){let t=Xw().$implicit;cg("aria-label","Duplicate "+t.config.name);}}function Z(n,e){if(n&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let c=Xw(2).$implicit,d=Xw(2);return ff(d.edit(c))}),MC(1," Edit "),pl();}if(n&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function ee(n,e){if(n&1){let t=qw();Pw(0,Z,2,1,"button",20),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let c=Xw().$implicit,d=Xw(2);return ff(d.deletion.request(c.key))})("deleteConfirmed",function(){df(t);let c=Xw().$implicit,d=Xw(2);return ff(d.confirmDelete(c))})("deleteCancelled",function(){df(t);let c=Xw(3);return ff(c.deletion.cancel())}),pl();}if(n&2){let t=Xw().$implicit,a=Xw(2);Lw(a.deletion.confirmingId()!==t.key?0:-1),jE(),ug("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function te(n,e){n&1&&(Ds(0,"button",21),MC(1,"Inherited"),pl());}function ne(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,X,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Pw(12,Y,2,1,"button",20),Pw(13,ee,2,4)(14,te,2,0,"button",21),pl()()()),n&2){let t=e.$implicit,a=Xw(2);jE(2),Og(t.config.name),jE(2),vl(" ",t.config.authType," "),jE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),jE(),Og(t.scopeLabel),jE(),Lw(t.canMutate?-1:9),jE(3),Lw(a.deletion.confirmingId()!==t.key?12:-1),jE(),Lw(t.canMutate?13:14);}}function ie(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Authentication type"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,ne,15,7,"tr",9,U),pl()()()),n&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var K=class n$1{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O(this.rows,e=>[e.config.name,e.config.authType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne$1(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Cr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"auth-settings",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"auth-settings","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,a,c){return e.map((d,H)=>({key:`${t}:${d.id??H}`,config:d,scope:t,scopeLabel:a,canMutate:c}))}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=mw({type:n$1,selectors:[["agentos-auth-settings-all-scopes"]],decls:9,vars:3,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"],["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","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["type","button","disabled",""],["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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(d){return a.rowFilter.query.set(d)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New auth setting"),pl()(),Pw(4,z,2,1,"p",3),Pw(5,J,2,0,"p",4)(6,Q,2,0,"p",5)(7,W,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(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{K as AuthSettingsAllScopesComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-DcZyBFc0.js';import {z as A,F as F$1,i as at,h as hn,I as Io,q as ko,E,O as O$1}from'./chunk-D8_LjQNu.js';import {g,W,F,I as Ie,U as Ui,ae as Ty,af as da,a3 as Cr,x as U,C as x,z as w,ab as Ee,ag as Se,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,J as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,k as df,n as ff,e as cg}from'./main-YWZOZ7BG.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let e=Xw();jE(),Og(e.deletion.error());}}function Y(n,t){n&1&&(Ds(0,"p",4),MC(1,"Loading scheduled prompts\u2026"),pl());}function z(n,t){n&1&&(Ds(0,"p",5),MC(1,"No scheduled prompts available."),pl());}function G(n,t){n&1&&(Ds(0,"p",4),MC(1,"No scheduled prompts match the current filter."),pl());}function Q(n,t){if(n&1&&(Ds(0,"span",14),MC(1),pl()),n&2){let e=Xw().$implicit;jE(),Og(e.prompt.description);}}function X(n,t){n&1&&(Ds(0,"ds-tag",20),MC(1,"Read-only"),pl());}function Z(n,t){if(n&1){let e=qw();Ds(0,"button",25),mg("click",function(){df(e);let l=Xw(2).$implicit,p=Xw(2);return ff(p.toggle(l))}),MC(1),pl(),Ds(2,"button",25),mg("click",function(){df(e);let l=Xw(2).$implicit,p=Xw(2);return ff(p.edit(l))}),MC(3," Edit "),pl();}if(n&2){let e=Xw(2).$implicit;jE(),Og(e.prompt.enabled?"Disable":"Enable"),jE(),cg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=qw();Pw(0,Z,4,2),Ds(1,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(e);let l=Xw().$implicit,p=Xw(2);return ff(p.deletion.request(l.key))})("deleteConfirmed",function(){df(e);let l=Xw().$implicit,p=Xw(2);return ff(p.confirmDelete(l))})("deleteCancelled",function(){df(e);let l=Xw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let e=Xw().$implicit,i=Xw(2);Lw(i.deletion.confirmingId()!==e.key?0:-1),jE(),ug("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Ds(0,"button",23),MC(1,"Inherited"),pl());}function ne(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),MC(3),pl(),Pw(4,Q,2,1,"span",14),pl(),Ds(5,"td",15),MC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),MC(9),pl()(),Ds(10,"td",18)(11,"div",19)(12,"ds-tag",17),MC(13),pl(),Pw(14,X,2,0,"ds-tag",20),pl()(),Ds(15,"td",21)(16,"div",22),Pw(17,ee,2,4)(18,te,2,0,"button",23),pl()()()),n&2){let e=t.$implicit,i=Xw(2);jE(3),Og(e.prompt.name),jE(),Lw(e.prompt.description?4:-1),jE(2),Og(i.scheduleLabel(e.prompt)),jE(2),ug("variant",e.prompt.enabled?"accent":"outline"),jE(),Og(e.prompt.enabled?"Enabled":"Disabled"),jE(3),ug("variant",e.scope==="platform"?"neutral":"accent"),jE(),Og(e.scope==="platform"?"Platform":"Namespace"),jE(),Lw(e.scope==="platform"?14:-1),jE(3),Lw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Schedule"),pl(),Ds(8,"th",10),MC(9,"Status"),pl(),Ds(10,"th",10),MC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),MC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Vw(16,ne,19,9,"tr",9,J),pl()()()),n&2){let e=Xw();jE(16),Hw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(Ie);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Ui([]);isLoading=Ui(true);deletion=A();rowFilter=F$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(){Ty({platform:this.state.listPlatform().pipe(da(()=>Cr([]))),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===Ee.WEEK?"week":"month",l=e.unit===Ee.WEEK&&e.days?.length?` (${e.days.map(p=>Se[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=mw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return i.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),MC(3,"New scheduled prompt"),pl()(),Pw(4,O,2,1,"p",3),Pw(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&&(jE(),ug("query",i.rowFilter.query()),jE(3),Lw(i.deletion.error()?4:-1),jE(),Lw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,E,O$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-BAmUhuXv.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-B7CFfwor.js';import {g,W,F,I as Ie,U as Ui,aj as Ty,a2 as da,aa as Cr,x as U,E as x,z as w,ag as Ve,ak as Me,m as mw,D as Ds,J as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,k as df,n as ff,e as cg}from'./main-5RLWJYOC.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Ds(0,"p",3),MC(1),pl()),n&2){let e=Xw();jE(),Og(e.deletion.error());}}function Y(n,t){n&1&&(Ds(0,"p",4),MC(1,"Loading scheduled prompts\u2026"),pl());}function z(n,t){n&1&&(Ds(0,"p",5),MC(1,"No scheduled prompts available."),pl());}function G(n,t){n&1&&(Ds(0,"p",4),MC(1,"No scheduled prompts match the current filter."),pl());}function Q(n,t){if(n&1&&(Ds(0,"span",14),MC(1),pl()),n&2){let e=Xw().$implicit;jE(),Og(e.prompt.description);}}function X(n,t){n&1&&(Ds(0,"ds-tag",20),MC(1,"Read-only"),pl());}function Z(n,t){if(n&1){let e=qw();Ds(0,"button",25),mg("click",function(){df(e);let l=Xw(2).$implicit,p=Xw(2);return ff(p.toggle(l))}),MC(1),pl(),Ds(2,"button",25),mg("click",function(){df(e);let l=Xw(2).$implicit,p=Xw(2);return ff(p.edit(l))}),MC(3," Edit "),pl();}if(n&2){let e=Xw(2).$implicit;jE(),Og(e.prompt.enabled?"Disable":"Enable"),jE(),cg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=qw();Pw(0,Z,4,2),Ds(1,"agentos-row-delete-action",24),mg("deleteRequested",function(){df(e);let l=Xw().$implicit,p=Xw(2);return ff(p.deletion.request(l.key))})("deleteConfirmed",function(){df(e);let l=Xw().$implicit,p=Xw(2);return ff(p.confirmDelete(l))})("deleteCancelled",function(){df(e);let l=Xw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let e=Xw().$implicit,i=Xw(2);Lw(i.deletion.confirmingId()!==e.key?0:-1),jE(),ug("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Ds(0,"button",23),MC(1,"Inherited"),pl());}function ne(n,t){if(n&1&&(Ds(0,"tr",9)(1,"td",12)(2,"span",13),MC(3),pl(),Pw(4,Q,2,1,"span",14),pl(),Ds(5,"td",15),MC(6),pl(),Ds(7,"td",16)(8,"ds-tag",17),MC(9),pl()(),Ds(10,"td",18)(11,"div",19)(12,"ds-tag",17),MC(13),pl(),Pw(14,X,2,0,"ds-tag",20),pl()(),Ds(15,"td",21)(16,"div",22),Pw(17,ee,2,4)(18,te,2,0,"button",23),pl()()()),n&2){let e=t.$implicit,i=Xw(2);jE(3),Og(e.prompt.name),jE(),Lw(e.prompt.description?4:-1),jE(2),Og(i.scheduleLabel(e.prompt)),jE(2),ug("variant",e.prompt.enabled?"accent":"outline"),jE(),Og(e.prompt.enabled?"Enabled":"Disabled"),jE(3),ug("variant",e.scope==="platform"?"neutral":"accent"),jE(),Og(e.scope==="platform"?"Platform":"Namespace"),jE(),Lw(e.scope==="platform"?14:-1),jE(3),Lw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Schedule"),pl(),Ds(8,"th",10),MC(9,"Status"),pl(),Ds(10,"th",10),MC(11,"Scope"),pl(),Ds(12,"th",10)(13,"span",11),MC(14,"Actions"),pl()()()(),Ds(15,"tbody",8),Vw(16,ne,19,9,"tr",9,J),pl()()()),n&2){let e=Xw();jE(16),Hw(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(Ie);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=Ui([]);isLoading=Ui(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(){Ty({platform:this.state.listPlatform().pipe(da(()=>Cr([]))),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===Ve.WEEK?"week":"month",l=e.unit===Ve.WEEK&&e.days?.length?` (${e.days.map(p=>Me[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=mw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return i.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),MC(3,"New scheduled prompt"),pl()(),Pw(4,O,2,1,"p",3),Pw(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&&(jE(),ug("query",i.rowFilter.query()),jE(3),Lw(i.deletion.error()?4:-1),jE(),Lw(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 {C as m,a as pt,D as Bt,T as Te,b as fn,U as Ut,n as nd,l 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,H as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,B as mn,i as at,j as an}from'./chunk-D8_LjQNu.js';import {g,W,F,I as Ie,a9 as $,U as Ui,x as U,af as da,a3 as Cr,C as x,z as w,m as mw,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,J as ug,v as vl,L as Lw,q as qw,l as lg,Q as SI,V as Vw,ah as jw,X as Xw,T as MI,O as Og,H as Hw,e as cg,k as df,n as ff}from'./main-YWZOZ7BG.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Xw(3);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),MC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),jE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),MC(3,"\u2014 None \u2014"),pl(),Vw(4,ge,2,2,"option",24,ce),pl(),SI(),pl()),o&2){let e=Xw(3);jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(),ug("ngValue",null),jE(2),Hw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Pw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Xw(2);Lw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),MC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=qw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),SI(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),SI(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),SI(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeParameter(d))}),MC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),jE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),jE(),ug("id","param-name-"+r),MI(),jE(),ug("controlId","param-desc-"+r),jE(),ug("id","param-desc-"+r),MI(),jE(),ug("controlId","param-default-"+r),jE(),ug("id","param-default-"+r),MI();}}function _e(o,t){if(o&1){let e=qw();Ds(0,"div",14)(1,"span",33),MC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),SI(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeContentEntry(d))}),MC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Xw(2);jE(2),Og(r+1),jE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),jE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),MI(),jE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),MC(1),pl()),o&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=qw();Ds(0,"button",37),mg("click",function(){df(e);let d=Xw(2);return ff(d.exportYaml())}),MC(1),pl();}if(o&2){let e=Xw(2);ug("disabled",e.isExporting()),jE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Xw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),MC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),MC(10),pl(),MC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Pw(13,ve,2,0,"p",2),Vw(14,he,10,8,"div",11,jw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addParameter())}),MC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),MC(21," Each content entry is a command. Use "),Ds(22,"code"),MC(23,"@AgentName"),pl(),MC(24," to target an agent, "),Ds(25,"code"),MC(26,"/promptName param1 param2"),pl(),MC(27," to call another prompt, and "),Ds(28,"code"),MC(29),pl(),MC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Vw(32,_e,7,5,"div",14,jw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addContentEntry())}),MC(36,"+ Add content entry"),pl()()()(),Pw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),SI(),pl(),Ds(40,"ds-form-actions")(41,"button",17),MC(42),pl(),Pw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Xw();return ff(d.cancel())}),MC(45,"Cancel"),pl()()();}if(o&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.availableAgentConfigs().length>0?5:-1),jE(5),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","parameters"),jE(),Lw(e.parametersArray.length===0?13:-1),jE(),Hw(e.parametersArray.controls),jE(15),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","content"),jE(),Hw(e.contentArray.controls),jE(5),Lw(e.errorMessage()?37:-1),jE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),jE(),Lw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g($);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=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);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(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(this.destroyRef),da(()=>Cr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),da(()=>Cr([]))).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(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(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=mw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),MC(3),pl()(),Pw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(jE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),jE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),jE(),Lw(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,a as pt,E as Bt,T as Te,b as fn,U as Ut,n as nd,o 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-B7CFfwor.js';import {g,W,F,I as Ie,ae as $,U as Ui,x as U,a2 as da,aa as Cr,E as x,z as w,m as mw,D as Ds,J as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,v as vl,L as Lw,q as qw,l as lg,N as SI,V as Vw,al as jw,X as Xw,Q as MI,O as Og,H as Hw,e as cg,k as df,n as ff}from'./main-5RLWJYOC.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Xw(3);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),MC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),jE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),MC(3,"\u2014 None \u2014"),pl(),Vw(4,ge,2,2,"option",24,ce),pl(),SI(),pl()),o&2){let e=Xw(3);jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(),ug("ngValue",null),jE(2),Hw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Pw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Xw(2);Lw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),MC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=qw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),SI(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),SI(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),SI(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeParameter(d))}),MC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),jE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),jE(),ug("id","param-name-"+r),MI(),jE(),ug("controlId","param-desc-"+r),jE(),ug("id","param-desc-"+r),MI(),jE(),ug("controlId","param-default-"+r),jE(),ug("id","param-default-"+r),MI();}}function _e(o,t){if(o&1){let e=qw();Ds(0,"div",14)(1,"span",33),MC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),SI(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeContentEntry(d))}),MC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Xw(2);jE(2),Og(r+1),jE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),jE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),MI(),jE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),MC(1),pl()),o&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=qw();Ds(0,"button",37),mg("click",function(){df(e);let d=Xw(2);return ff(d.exportYaml())}),MC(1),pl();}if(o&2){let e=Xw(2);ug("disabled",e.isExporting()),jE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Xw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),MC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),MC(10),pl(),MC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Pw(13,ve,2,0,"p",2),Vw(14,he,10,8,"div",11,jw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addParameter())}),MC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),MC(21," Each content entry is a command. Use "),Ds(22,"code"),MC(23,"@AgentName"),pl(),MC(24," to target an agent, "),Ds(25,"code"),MC(26,"/promptName param1 param2"),pl(),MC(27," to call another prompt, and "),Ds(28,"code"),MC(29),pl(),MC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Vw(32,_e,7,5,"div",14,jw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addContentEntry())}),MC(36,"+ Add content entry"),pl()()()(),Pw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),SI(),pl(),Ds(40,"ds-form-actions")(41,"button",17),MC(42),pl(),Pw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Xw();return ff(d.cancel())}),MC(45,"Cancel"),pl()()();}if(o&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.availableAgentConfigs().length>0?5:-1),jE(5),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","parameters"),jE(),Lw(e.parametersArray.length===0?13:-1),jE(),Hw(e.parametersArray.controls),jE(15),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","content"),jE(),Hw(e.contentArray.controls),jE(5),Lw(e.errorMessage()?37:-1),jE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),jE(),Lw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g($);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=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);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(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(this.destroyRef),da(()=>Cr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U(this.destroyRef),da(()=>Cr([]))).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(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(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=mw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),MC(3),pl()(),Pw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(jE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),jE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),jE(),Lw(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};
@@ -0,0 +1 @@
1
+ import {i}from'./chunk-D84tLLZv.js';import {y}from'./chunk-B7CFfwor.js';import {g,aD as X,$ as wr,ar as wy,a1 as fa,a2 as da,aa as Cr,az as ne,aC as Uy,E as x,z as w,a5 as yd,a6 as x$1}from'./main-5RLWJYOC.js';var q=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],J={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},E="none",C="me",I={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},U={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function v(n){let t=I[n.authType];return t?x(w({},n),{authType:t}):n}function d(n){return B(n)}function O(n){return n.map(B)}function B(n){let t=n;if(typeof t.authType=="string"){let e=U[t.authType];if(e)return x(w({},t),{authType:e})}return n}var R=class n{controller=g(X);userState=g(y);refresh$=new wr(void 0);namespaceId$=new wr(null);vm$=wy([this.namespaceId$,this.refresh$]).pipe(fa(([t])=>{let e=this.loadPlatformSettings().pipe(da(()=>Cr([])));return t?wy([e,this.loadNamespaceSettings(t).pipe(da(()=>Cr([]))),this.loadUserSettings(t).pipe(da(()=>Cr([]))),this.loadUserSettings("global").pipe(da(()=>Cr([])))]).pipe(ne(([i,s,u,p])=>({platform:i,namespace:s,userOnNs:u,userGlobal:p}))):wy([e,this.loadNamespaceSettings("").pipe(da(()=>Cr([]))),this.loadUserSettings("global").pipe(da(()=>Cr([])))]).pipe(ne(([i,s,u])=>({platform:i,namespace:s,userOnNs:[],userGlobal:u})))}),Uy({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?E:t;return this.controller.listAuthSetting(e,C).pipe(ne(i=>O(i)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(E).pipe(ne(t=>O(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>O(e))):Cr([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(i=>d(i)))}create(t,e,i){let u=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!u)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(i===void 0||i===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!i)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let p=v(x(w({},t),{namespaceId:e==="namespace"||e==="userOnNs"?i??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?u:void 0}));return this.controller.createAuthSetting(p).pipe(ne(_=>d(_)),yd(()=>this.refresh()))}update(t,e,i){let s=v(x(w({},e),{namespaceId:i.namespaceId,userId:i.userId,authType:i.authType}));return this.controller.updateAuthSetting(t,s).pipe(ne(u=>d(u)),yd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(yd(()=>this.refresh()))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=x$1({token:n,factory:n.\u0275fac,providedIn:"root"})};export{J,R,q};
@@ -0,0 +1 @@
1
+ import {c}from'./chunk-BAmUhuXv.js';import {a as pt,T as Te$1,b as fn,U as Ut,n as nd,o 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-B7CFfwor.js';import {g,W,F,I as Ie$1,ae as $,af as Se$1,ag as Ve$1,U as Ui,ah as qe,a9 as F$1,ai as md,K as KC,aj as Ty,x as U,a2 as da,aa as Cr,E as x,z as w,m as mw,D as Ds,J as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,v as vl,L as Lw,q as qw,l as lg,N as SI,V as Vw,X as Xw,Q as MI,H as Hw,O as Og,k as df,n as ff,o as oh}from'./main-5RLWJYOC.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Xw(2);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),MC(1,"Add an agent config"),pl(),MC(2," first. ")),n&2){let e=Xw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),MC(2," No agent configs available in this scope yet. "),Pw(3,Se,3,1),pl()()),n&2){let e=Xw(2);jE(3),Lw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),jE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),MC(3,"Select an agent config\u2026"),pl(),Vw(4,Ee,2,2,"option",17,ve),pl(),SI(),pl()),n&2){let e=Xw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(3),Hw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),jE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=qw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Xw(3);return ff(h.toggleDay(f.value))}),pl(),MC(2),pl();}if(n&2){let e=t.$implicit,l=Xw(3);jE(),ug("checked",l.isDaySelected(e.value)),jE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Vw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Xw(2);jE(2),Hw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),jE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),SI(),pl()),n&2){let e=Xw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),jE(),ug("formControl",e.endDateControl),MI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),SI(),pl()),n&2){let e=Xw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),jE(),ug("formControl",e.occurrenceCountControl),MI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),MC(1),pl()),n&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Xw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),SI(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Vw(13,Te,2,2,"option",17,V),pl(),SI(),pl(),Pw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),SI(),Ds(19,"span",22),MC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),SI(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Vw(26,Me,2,2,"option",17,V),pl(),SI(),pl(),Pw(28,Pe,2,2,"ds-form-field",28),Pw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),SI(),MC(33," Enabled "),pl(),Ds(34,"p",33),MC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),SI(),pl(),Pw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),MC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Xw();return ff(f.cancel())}),MC(43,"Cancel"),pl()()();}if(n&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),jE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),jE(),ug("formControl",e.promptContentControl),MI(),jE(3),ug("formControl",e.unitControl),MI(),jE(),Hw(e.schedulerUnits),jE(2),Lw(e.showDayFilter()?15:-1),jE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),jE(2),ug("formControl",e.timeUtcControl),MI(),jE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),jE(),ug("formControl",e.startDateControl),MI(),jE(2),ug("formControl",e.endTypeControl),MI(),jE(),Hw(e.endTypes),jE(2),Lw(e.showEndDate()?28:-1),jE(),Lw(e.showOccurrenceCount()?29:-1),jE(3),ug("formControl",e.enabledControl),MI(),jE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(),Lw(e.errorMessage()?38:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(c);agentConfigController=g($);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(Ve$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(Se$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=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ve$1;SchedulerEndType=Se$1;schedulerUnits=[{value:Ve$1.WEEK,label:"Week(s)"},{value:Ve$1.MONTH,label:"Month(s)"}];endTypes=[{value:Se$1.NEVER,label:"Never"},{value:Se$1.ON_DATE,label:"On date"},{value:Se$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(qe).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=KC(()=>this.unitSignal()===Ve$1.WEEK);showEndDate=KC(()=>this.endTypeSignal()===Se$1.ON_DATE);showOccurrenceCount=KC(()=>this.endTypeSignal()===Se$1.OCCURRENCES);agentConfigs=Ui([]);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),Ty({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U(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(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(da(()=>Cr([])))}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===Se$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Se$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(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=mw({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&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),MC(3),pl()(),Pw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(jE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),jE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),jE(),Lw(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===Se$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Se$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 {f,y,a as pt,T as Te,b as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-D8_LjQNu.js';import {g,W,F,G,I as Ie,K as KC,U as Ui,A as Af,x as U,z as w,C as x,m as mw,D as Ds,l as lg,P as Pw,a as pl,J as ug,j as jE,L as Lw,M as MC,q as qw,N as mg,Q as SI,X as Xw,T as MI,e as cg,v as vl,k as df,n as ff}from'./main-YWZOZ7BG.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Xw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),SI(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),SI(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),SI(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),SI(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),SI(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),SI(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Xw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),SI(),pl(),Ds(17,"ds-form-actions")(18,"button",21),MC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Xw();return ff(p.cancel())}),MC(21,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(2),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.externalIdControl),MI(),jE(2),ug("formControl",e.defaultAgentNameControl),MI(),jE(2),ug("formControl",e.configPathControl),MI(),jE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),jE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),MI(),jE(),ug("hint",e.runCostThresholdHint()),jE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),MI(),jE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),jE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(G);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=KC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=KC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=KC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=KC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),jE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),jE(),Lw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
1
+ import {f,y,a as pt,T as Te,b as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-B7CFfwor.js';import {g,W,F,_,I as Ie,K as KC,U as Ui,A as Af,x as U,z as w,E as x,m as mw,D as Ds,l as lg,P as Pw,a as pl,G as ug,j as jE,L as Lw,M as MC,q as qw,J as mg,N as SI,X as Xw,Q as MI,e as cg,v as vl,k as df,n as ff}from'./main-5RLWJYOC.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Xw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),SI(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),SI(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),SI(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),SI(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),SI(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),SI(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Xw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),SI(),pl(),Ds(17,"ds-form-actions")(18,"button",21),MC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Xw();return ff(p.cancel())}),MC(21,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(2),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.externalIdControl),MI(),jE(2),ug("formControl",e.defaultAgentNameControl),MI(),jE(2),ug("formControl",e.configPathControl),MI(),jE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),jE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),MI(),jE(),ug("hint",e.runCostThresholdHint()),jE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),MI(),jE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),jE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(_);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=KC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=KC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=KC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=KC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),jE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),jE(),Lw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
@@ -0,0 +1 @@
1
+ import {z as k$1,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-B7CFfwor.js';import {g,F,I as Ie,ao as N,an as k,$ as wr,U as Ui,a1 as fa,ar as wy,x as U$1,m as mw,D as Ds,J as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,k as df,n as ff,v as vl,e as cg}from'./main-5RLWJYOC.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),MC(1),pl()),o&2){let e=Xw();jE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),MC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),MC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),MC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=qw();Ds(0,"button",21),mg("click",function(){df(e);let r=Xw().$implicit,m=Xw(2);return ff(m.edit(r))}),MC(1,"Edit"),pl();}if(o&2){let e=Xw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=qw();Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15),MC(8),pl(),Ds(9,"td",16),MC(10),pl(),Ds(11,"td",17)(12,"div",18),Pw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Xw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Xw(2);jE(2),Og(e.title),jE(2),Og(e.providerName),jE(2),vl(" ",e.model.apiModelName," "),jE(2),Og(e.model.priority),jE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),jE(3),Lw(a.deletion.confirmingId()!==e.key?13:-1),jE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Provider"),pl(),Ds(8,"th",10),MC(9,"API model name"),pl(),Ds(10,"th",10),MC(11,"Priority"),pl(),Ds(12,"th",10),MC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),MC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Vw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Xw();jE(18),Hw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(N);aiProviderController=g(k);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([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=mw({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&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New AI model"),pl()(),Pw(4,H,2,1,"p",3),Pw(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&&(jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
@@ -1 +1 @@
1
- import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-Co0A853g.js';import {v}from'./chunk-CnV27gYr.js';import {g,W as W$1,F,I as Ie,U as Ui,x as U$1,av as ne,a8 as fa,a3 as Cr,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,J as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,e as cg,k as df,n as ff}from'./main-YWZOZ7BG.js';import {z as A,F as F$1,i as at,h as hn,I as Io,q as ko,E,O as O$1}from'./chunk-D8_LjQNu.js';import'./chunk-DVl0k4as.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Ds(0,"p",3),MC(1),pl()),i&2){let t=Xw();jE(),Og(t.deletion.error());}}function z(i,e){i&1&&(Ds(0,"p",4),MC(1,"Loading AI providers\u2026"),pl());}function J(i,e){i&1&&(Ds(0,"p",5),MC(1,"No AI providers available."),pl());}function Q(i,e){i&1&&(Ds(0,"p",4),MC(1,"No AI providers match the current filter."),pl());}function W(i,e){i&1&&(Ds(0,"ds-tag",17),MC(1,"Read-only"),pl());}function X(i,e){if(i&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let d=Xw().$implicit,c=Xw(2);return ff(c.duplicate(d))}),MC(1," Duplicate "),pl();}if(i&2){let t=Xw().$implicit;cg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let d=Xw(2).$implicit,c=Xw(2);return ff(c.edit(d))}),MC(1," Edit "),pl();}if(i&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=qw();Pw(0,Y,2,1,"button",20),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Xw().$implicit,c=Xw(2);return ff(c.deletion.request(d.key))})("deleteConfirmed",function(){df(t);let d=Xw().$implicit,c=Xw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Xw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Xw().$implicit,r=Xw(2);Lw(r.deletion.confirmingId()!==t.key?0:-1),jE(),ug("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Ds(0,"button",21),MC(1,"Inherited"),pl());}function te(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Pw(12,X,2,1,"button",20),Pw(13,Z,2,4)(14,ee,2,0,"button",21),pl()()()),i&2){let t=e.$implicit,r=Xw(2);jE(2),Og(t.config.name),jE(2),Og(t.config.apiType),jE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),jE(),Og(t.scopeLabel),jE(),Lw(t.canMutate?-1:9),jE(3),Lw(r.deletion.confirmingId()!==t.key?12:-1),jE(),Lw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"API type"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,te,15,7,"tr",9,H),pl()()()),i&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=A();rowFilter=F$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Cr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",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"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return r.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),MC(3,"New AI provider"),pl()(),Pw(4,U,2,1,"p",3),Pw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(jE(),ug("query",r.rowFilter.query()),jE(3),Lw(r.deletion.error()?4:-1),jE(),Lw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,E,O$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};
1
+ import {n}from'./chunk-CfgXrte_.js';import {O}from'./chunk-CmaAeOoQ.js';import {v}from'./chunk-CbCz42Oe.js';import {g,W as W$1,F,I as Ie,U as Ui,x as U$1,az as ne,a1 as fa,aa as Cr,m as mw,D as Ds,J as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,e as cg,k as df,n as ff}from'./main-5RLWJYOC.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-B7CFfwor.js';import'./chunk-D84tLLZv.js';var H=(i,e)=>e.key;function U(i,e){if(i&1&&(Ds(0,"p",3),MC(1),pl()),i&2){let t=Xw();jE(),Og(t.deletion.error());}}function z(i,e){i&1&&(Ds(0,"p",4),MC(1,"Loading AI providers\u2026"),pl());}function J(i,e){i&1&&(Ds(0,"p",5),MC(1,"No AI providers available."),pl());}function Q(i,e){i&1&&(Ds(0,"p",4),MC(1,"No AI providers match the current filter."),pl());}function W(i,e){i&1&&(Ds(0,"ds-tag",17),MC(1,"Read-only"),pl());}function X(i,e){if(i&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let d=Xw().$implicit,c=Xw(2);return ff(c.duplicate(d))}),MC(1," Duplicate "),pl();}if(i&2){let t=Xw().$implicit;cg("aria-label","Duplicate "+t.config.name);}}function Y(i,e){if(i&1){let t=qw();Ds(0,"button",22),mg("click",function(){df(t);let d=Xw(2).$implicit,c=Xw(2);return ff(c.edit(d))}),MC(1," Edit "),pl();}if(i&2){let t=Xw(2).$implicit;cg("aria-label","Edit "+t.config.name);}}function Z(i,e){if(i&1){let t=qw();Pw(0,Y,2,1,"button",20),Ds(1,"agentos-row-delete-action",23),mg("deleteRequested",function(){df(t);let d=Xw().$implicit,c=Xw(2);return ff(c.deletion.request(d.key))})("deleteConfirmed",function(){df(t);let d=Xw().$implicit,c=Xw(2);return ff(c.confirmDelete(d))})("deleteCancelled",function(){df(t);let d=Xw(3);return ff(d.deletion.cancel())}),pl();}if(i&2){let t=Xw().$implicit,r=Xw(2);Lw(r.deletion.confirmingId()!==t.key?0:-1),jE(),ug("rowKey",t.key)("rowLabel",t.config.name)("state",r.deletion);}}function ee(i,e){i&1&&(Ds(0,"button",21),MC(1,"Inherited"),pl());}function te(i,e){if(i&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),MC(8),pl(),Pw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Pw(12,X,2,1,"button",20),Pw(13,Z,2,4)(14,ee,2,0,"button",21),pl()()()),i&2){let t=e.$implicit,r=Xw(2);jE(2),Og(t.config.name),jE(2),Og(t.config.apiType),jE(3),ug("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),jE(),Og(t.scopeLabel),jE(),Lw(t.canMutate?-1:9),jE(3),Lw(r.deletion.confirmingId()!==t.key?12:-1),jE(),Lw(t.canMutate?13:14);}}function ie(i,e){if(i&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"API type"),pl(),Ds(8,"th",10),MC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),MC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Vw(14,te,15,7,"tr",9,H),pl()()()),i&2){let t=Xw();jE(14),Hw(t.rowFilter.filteredRows());}}var G=class i{route=g(W$1);router=g(F);destroyRef=g(Ie);state=g(O);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=Ui(false);isLoading=Ui(true);rows=Ui([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.apiType,e.scopeLabel].join(" "));ngOnInit(){this.route.paramMap.pipe(U$1(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t);}),this.route.paramMap.pipe(ne(e=>e.get("namespaceId")??""),fa(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Cr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:n(this.isAdmin())}});}edit(e){!e.canMutate||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"ai-providers",e.config.id,"edit"],{queryParams:{scope:e.scope}});}confirmDelete(e){!e.canMutate||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}duplicate(e){if(!e.config.id)return;let t=e.scope==="platform"||e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",false),...this.mapScope(e.namespace,"namespace","Namespace",this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",true),...this.mapScope(e.userGlobal,"userGlobal","Personal",true)]}mapScope(e,t,r,d){return e.map((c,K)=>({key:`${t}:${c.id??K}`,config:c,scope:t,scopeLabel:r,canMutate:d}))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-ai-providers-all-scopes"]],decls:9,vars:3,consts:[["title","AI providers","description","AI providers available in this namespace, including inherited platform and personal entries."],["label","Filter AI providers","placeholder","Filter AI providers\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","AI providers"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","API type",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"],["type","button","disabled",""],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,r){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(c){return r.rowFilter.query.set(c)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),MC(3,"New AI provider"),pl()(),Pw(4,U,2,1,"p",3),Pw(5,z,2,0,"p",4)(6,J,2,0,"p",5)(7,Q,2,0,"p",4)(8,ie,16,0,"div",6)),t&2&&(jE(),ug("query",r.rowFilter.query()),jE(3),Lw(r.deletion.error()?4:-1),jE(),Lw(r.isLoading()?5:r.rows().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{G as AiProvidersAllScopesComponent};