@whoz-oss/coday-client 0.0.0-workstream-forge.222 → 0.0.0-workstream-forge.224

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 (51) hide show
  1. package/browser/{chunk-BXexfMTK.js → chunk--gK-jMIE.js} +1 -1
  2. package/browser/{chunk-2u0oy3pB.js → chunk--qx2_ib6.js} +1 -1
  3. package/browser/{chunk-DTzPzIc0.js → chunk-53mXgxMW.js} +1 -1
  4. package/browser/{chunk-BgWMjUkX.js → chunk-B1jwXyDl.js} +1 -1
  5. package/browser/{chunk-BRztV5KS.js → chunk-BGQLkxpe.js} +1 -1
  6. package/browser/{chunk-CuWqEiiR.js → chunk-BH_4misH.js} +1 -1
  7. package/browser/{chunk-CIW6m5h-.js → chunk-BIndnrAd.js} +1 -1
  8. package/browser/{chunk-DueFkMuu.js → chunk-BOVza9Oc.js} +1 -1
  9. package/browser/{chunk-2O1S906W.js → chunk-BUYyTltk.js} +1 -1
  10. package/browser/{chunk-D526Porz.js → chunk-BUdJKajB.js} +1 -1
  11. package/browser/{chunk-Dn4mtCZo.js → chunk-Bcbf5ZJu.js} +1 -1
  12. package/browser/{chunk-DXD-ZIv9.js → chunk-BdH4qpp3.js} +1 -1
  13. package/browser/{chunk-DAGhNGM0.js → chunk-Bdp--jzn.js} +1 -1
  14. package/browser/{chunk-W2RB-deX.js → chunk-BipV2fi-.js} +1 -1
  15. package/browser/{chunk-BiaxZ40F.js → chunk-BkE7IVMM.js} +1 -1
  16. package/browser/{chunk-B7AKjdX_.js → chunk-BnayOCTz.js} +1 -1
  17. package/browser/{chunk-5W0A2Kue.js → chunk-Bo8gNzR7.js} +1 -1
  18. package/browser/{chunk-Cyx8tBRd.js → chunk-C7miQMml.js} +1 -1
  19. package/browser/chunk-C9gPrlew.js +1 -0
  20. package/browser/{chunk-BYALO427.js → chunk-CBwnW1o7.js} +1 -1
  21. package/browser/{chunk-CliJpUKT.js → chunk-CKn3h5cz.js} +1 -1
  22. package/browser/{chunk-BLQEGpZn.js → chunk-CVFjJCM6.js} +1 -1
  23. package/browser/{chunk-CWp__iQx.js → chunk-CZUlPZgR.js} +1 -1
  24. package/browser/{chunk-r3Ie6sEa.js → chunk-D0pOvpAQ.js} +1 -1
  25. package/browser/{chunk-CETI95mp.js → chunk-D1c_kye8.js} +1 -1
  26. package/browser/{chunk-DSLqhqjK.js → chunk-D4SsrEJb.js} +1 -1
  27. package/browser/{chunk-CfgdpEiu.js → chunk-D9d4vJPw.js} +1 -1
  28. package/browser/chunk-DHBOaxUB.js +1 -0
  29. package/browser/{chunk-BUcJXW_D.js → chunk-DMInQNg8.js} +1 -1
  30. package/browser/{chunk-C0etY4Vc.js → chunk-DQWXl_GA.js} +1 -1
  31. package/browser/{chunk-D3BSgsqF.js → chunk-DSyS0T-z.js} +1 -1
  32. package/browser/{chunk-DvqKcX7A.js → chunk-DT4HydoN.js} +11 -11
  33. package/browser/{chunk-BUMB5qoO.js → chunk-DcLCW8wp.js} +1 -1
  34. package/browser/{chunk-BBxXNycr.js → chunk-DeroUjnJ.js} +1 -1
  35. package/browser/{chunk-D7jTT9JH.js → chunk-DfvA57ML.js} +1 -1
  36. package/browser/{chunk-cS_tqqI2.js → chunk-DhAaQKGh.js} +1 -1
  37. package/browser/{chunk-B0IpC4Tx.js → chunk-DmG7zAfL.js} +1 -1
  38. package/browser/{chunk-CkGCNFHp.js → chunk-DvALfBHB.js} +1 -1
  39. package/browser/{chunk-Bt9WGCpK.js → chunk-DwYFXnu_.js} +1 -1
  40. package/browser/{chunk-DIWXU7lQ.js → chunk-LeogPf6G.js} +1 -1
  41. package/browser/{chunk-DYEst6mA.js → chunk-TghQaG_N.js} +1 -1
  42. package/browser/{chunk-DM-FW0Tn.js → chunk-WRJmHJYv.js} +1 -1
  43. package/browser/{chunk-B14dZoHL.js → chunk-YQ_DxIkl.js} +1 -1
  44. package/browser/{chunk-DADuuKw_.js → chunk-nAu5W3in.js} +1 -1
  45. package/browser/{chunk-B1I1hZNS.js → chunk-nOlo8Y_5.js} +1 -1
  46. package/browser/{chunk-Mb2Bp9Qb.js → chunk-xNbwJvC5.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-BGDYOJBA.js → main-4M5ZCKCC.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-AYvnGrVn.js +0 -1
  51. package/browser/chunk-CS0QFOWp.js +0 -1
@@ -1 +1 @@
1
- import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-B0IpC4Tx.js';import {O}from'./chunk-DueFkMuu.js';import {g,W as W$1,F,I as Ie,ag as U,ay as N,U as Ui,az as K,a8 as _,X as XC,a9 as F$1,aA as qe$1,G as U$1,a2 as da,aa as Tr,ac as Ty,ad as ne,M as x,K as w,y as yw,au as $t$1,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,aq as k,a6 as x$1,J as Jw,Z as Zw,l as lg,_ as _I,R as NI,k as cg,v as vl,H as Hw,m as Uw,O as Og,r as df,s as ff,as as kg}from'./main-BGDYOJBA.js';import {p as pt$1,T as Te,a as fn,U as Ut$1,n as nd,l as bo,x as xo,L as Lt$1,k as kn,u as vn,G as Gt$1,m as mo,b as po,$ as $r,H as qr,V as Vn,A as An,c as pn,h as hn,d as cn,r as ln,e as dn,C as mn,g as at$1,i as an,t as rn,j as ko}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';var W=class n{aiModelController=g(k);listAvailable(t){let e=this.aiModelController.listPlatformLevelAiModel().pipe(this.orEmpty("platform")),o=t?this.aiModelController.listByNamespaceIdAiModel(t).pipe(this.orEmpty("namespace")):Tr([]);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),Tr([])))}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),NC(1,"View resolved definition \u2192"),pl()),n&2){let e=Jw();ug("routerLink",e.inspectRoute());}}function ot(n,t){n&1&&(Ds(0,"ds-tag",3),NC(1,"Platform level"),pl());}function it(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function at(n,t){if(n&1&&(lg(0,"input",17),_I()),n&2){let e=Jw(2);ug("formControl",e.modelNameControl),NI();}}function lt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t;ug("ngValue",e.value),BE(),Og(e.label);}}function rt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function st(n,t){if(n&1&&(Ds(0,"optgroup",42),Hw(1,rt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().aliases);}}function dt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function ct(n,t){if(n&1&&(Ds(0,"optgroup",43),Hw(1,dt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().apiNames);}}function mt(n,t){if(n&1&&(Ds(0,"select",18)(1,"option",40),NC(2,"Select a model"),pl(),Lw(3,lt,2,2,"option",41),Lw(4,st,3,0,"optgroup",42),Lw(5,ct,3,0,"optgroup",43),pl(),_I()),n&2){let e,o=Jw(2);ug("formControl",o.modelNameControl),NI(),BE(),ug("ngValue",null),BE(2),jw((e=o.modelOptions().current)?3:-1,e),BE(),jw(o.modelOptions().aliases.length>0?4:-1),BE(),jw(o.modelOptions().apiNames.length>0?5:-1);}}function ut(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.config.integrationType);}}function gt(n,t){if(n&1&&(lg(0,"input",45),_I()),n&2){let e=Jw().$implicit;ug("formControl",e.toolsControl),cg("aria-label","Tools of "+e.config.name),NI();}}function pt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",23),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleIntegration(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,ut,2,1,"span",44),pl(),Lw(6,gt,1,2,"input",45),pl();}if(n&2){let e=t.$implicit;BE(2),ug("checked",e.enabled()),BE(2),Og(e.config.name),BE(),jw(e.config.integrationType?5:-1),BE(),jw(e.enabled()?6:-1);}}function ft(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",24),NC(2),Ds(3,"span",44),NC(4,"built-in"),pl()(),Ds(5,"select",47),mg("change",function(r){let d=df(e).$implicit,f=Jw(4);return ff(f.setBuiltInState(d,r.target.value))}),Ds(6,"option",48),NC(7),pl(),Ds(8,"option",49),NC(9,"Enabled"),pl(),Ds(10,"option",50),NC(11,"Disabled"),pl()(),Lw(12,ft,2,1,"p",13),Ds(13,"p",13),NC(14),pl()();}if(n&2){let e=t.$implicit,o=Jw(4);BE(),cg("for","built-in-"+e.type),BE(),vl(" ",e.displayName," "),BE(3),ug("id","built-in-"+e.type)("value",e.state()),BE(2),Og(o.builtInDefaultLabel(e)),BE(5),jw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Og(e.description);}}function _t(n,t){if(n&1&&(Ds(0,"span",46),NC(1,"Built-in integrations"),pl(),Hw(2,Ct,15,7,"div",10,tt)),n&2){let e=Jw(3);BE(2),Uw(e.builtInRows());}}function bt(n,t){n&1&&(Ds(0,"ds-notice",26),NC(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),Hw(1,pt,7,4,"div",10,et),Lw(3,_t,4,0),Lw(4,bt,2,0,"ds-notice",26),pl()),n&2){let e=Jw(2);BE(),Uw(e.integrationRows()),BE(2),jw(e.builtInRows().length>0?3:-1),BE(),jw(e.configAgentExposureWarning()?4:-1);}}function yt(n,t){n&1&&NC(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),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),pl());}function xt(n,t){n&1&&(Ds(0,"ds-notice"),NC(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),NC(1,"No skill available in this scope yet."),pl());}function At(n,t){n&1&&(Ds(0,"span",44),NC(1,"platform"),pl());}function wt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.description);}}function Tt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSkill(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,At,2,0,"span",44),Lw(6,wt,2,1,"span",44),pl(),Lw(7,Et,2,1,"p",13),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSkillsSelected()),BE(2),Og(e.name),BE(),jw(e.platform?5:-1),BE(),jw(e.unresolved?6:-1),BE(),jw(e.description?7:-1);}}function kt(n,t){if(n&1&&Hw(0,Tt,8,6,"div",10,qe),n&2){let e=Jw(2);Uw(e.skillRows());}}function It(n,t){if(n&1&&(Ds(0,"ds-form-field",30),lg(1,"textarea",52),_I(),Ds(2,"p",4),NC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Ds(4,"code"),NC(5,"AgentLoopPayload"),pl(),NC(6,". Leave empty if you always provide the payload at launch. "),pl()()),n&2){let e=Jw(2);ug("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),ug("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),NI();}}function Mt(n,t){n&1&&NC(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&&NC(0),n&2){let e=Jw(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),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),Lw(5,Rt,1,2),pl()),n&2){let e=Jw(2);BE(5),jw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(n,t){n&1&&(Ds(0,"ds-notice"),NC(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),NC(1,"No other agent is available in this scope yet."),pl());}function Lt(n,t){n&1&&(Ds(0,"span",44),NC(1,"pattern"),pl());}function Ot(n,t){n&1&&(Ds(0,"span",44),NC(1,"via pattern"),pl());}function Vt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Pt(n,t){if(n&1){let e=Zw();Ds(0,"button",55),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(3);return ff(d.removeSubAgent(r))}),NC(1," \xD7 "),pl();}if(n&2){let e=Jw().$implicit;cg("aria-label","Remove "+e.selector);}}function Bt(n,t){if(n&1){let e=Zw();Ds(0,"div",32)(1,"label",53)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSubAgent(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,Lt,2,0,"span",44)(6,Ot,2,0,"span",44)(7,Vt,2,1,"span",44),pl(),Lw(8,Pt,2,1,"button",54),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSubAgentsSelected()),BE(2),Og(e.name),BE(),jw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),jw(e.unresolved?8:-1);}}function $t(n,t){if(n&1&&Hw(0,Bt,9,5,"div",32,qe),n&2){let e=Jw(2);Uw(e.subAgentRows());}}function Gt(n,t){if(n&1){let e=Zw();Ds(0,"div")(1,"button",56),mg("click",function(){df(e);let r=Jw(2);return ff(r.useDefaultDelegationTimeout())}),NC(2," Use server default "),pl()();}}function Ut(n,t){n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2&&(BE(),Og(t));}function jt(n,t){if(n&1){let e=Zw();Ds(0,"button",57),mg("click",function(){df(e);let r=Jw(2);return ff(r.exportYaml())}),NC(1),pl();}if(n&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(n,t){if(n&1){let e=Zw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let r=Jw();return ff(r.submit())}),Ds(1,"ds-fieldset",7)(2,"ds-form-field",8),lg(3,"input",9),_I(),pl(),Ds(4,"div",10)(5,"label",11),lg(6,"input",12),_I(),NC(7," Enabled "),pl(),Ds(8,"p",13),NC(9,"Disabled agents are excluded from namespace resolution."),pl()(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"ds-form-field",16),Lw(13,at,1,1,"input",17)(14,mt,6,5,"select",18),pl(),Ds(15,"ds-form-field",19),lg(16,"textarea",20),_I(),pl()(),Lw(17,ht,5,2,"ds-fieldset",21),Ds(18,"ds-fieldset",22)(19,"p",4),NC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Ds(21,"code"),NC(22,"readSkill"),pl(),NC(23," and "),Ds(24,"code"),NC(25,"readSkillResource"),pl(),NC(26," tools; selecting none grants neither. "),Lw(27,yt,1,0),pl(),Ds(28,"label",11)(29,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSkills())}),pl(),Ds(30,"span",24),NC(31,"Every skill in the catalogue ("),Ds(32,"code",25),NC(33,"*"),pl(),NC(34,")"),pl()(),Ds(35,"p",13),NC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),pl(),Lw(37,vt,5,0,"ds-notice",26),Lw(38,xt,2,0,"ds-notice"),Lw(39,St,2,0,"p",4)(40,kt,2,0),pl(),Ds(41,"ds-form-field",27)(42,"select",28)(43,"option",29),NC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),Ds(45,"option",29),NC(46,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),Ds(47,"option",29),NC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),_I(),pl(),Lw(49,It,7,3,"ds-form-field",30),Ds(50,"ds-fieldset",31)(51,"p",4),NC(52," The agents this one may delegate to. Selecting at least one grants it the "),Ds(53,"code"),NC(54,"DELEGATE__delegate"),pl(),NC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Lw(56,Mt,1,0),pl(),Ds(57,"label",11)(58,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSubAgents())}),pl(),Ds(59,"span",24),NC(60,"Every agent it can reach ("),Ds(61,"code",25),NC(62,"*"),pl(),NC(63,")"),pl()(),Ds(64,"p",13),NC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),pl(),Lw(66,Ft,6,1,"ds-notice",26),Lw(67,Nt,2,0,"ds-notice"),Lw(68,Dt,2,0,"p",4)(69,$t,2,0),Ds(70,"p",4),NC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Ds(72,"code"),NC(73,"*Fixer"),pl(),NC(74," to cover BugFixer and StoryFixer. "),pl(),Ds(75,"div",32)(76,"input",33),mg("keydown.enter",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),pl(),_I(),Ds(77,"button",34),mg("click",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),NC(78," + "),pl()(),Ds(79,"ds-form-field",35),lg(80,"input",36),_I(),Lw(81,Gt,3,0,"div"),pl()(),Lw(82,Ut,2,1,"ds-notice"),Ds(83,"ds-form-actions")(84,"button",37),NC(85),pl(),Lw(86,jt,2,2,"button",38),Ds(87,"button",39),mg("click",function(){df(e);let r=Jw();return ff(r.cancel())}),NC(88,"Cancel"),pl()()();}if(n&2){let e,o=Jw();ug("formGroup",o.form),BE(3),ug("formControl",o.nameControl),NI(),BE(3),ug("formControl",o.enabledControl),NI(),BE(5),ug("formControl",o.descriptionControl),NI(),BE(2),jw(o.modelAsFreeText()?13:14),BE(3),ug("formControl",o.instructionsControl),NI(),BE(),jw(o.integrationRows().length>0||o.builtInRows().length>0?17:-1),BE(10),jw(o.isPlatformMode?27:-1),BE(2),ug("checked",o.allSkillsSelected()),BE(8),jw(o.namedSkillSelectionDropped()?37:-1),BE(),jw(o.skillCatalogueUnavailable()?38:-1),BE(),jw(o.skillRows().length===0?39:40),BE(3),ug("formControl",o.executionModeControl),NI(),BE(),ug("value",o.ExecutionMode.SIMPLE),BE(2),ug("value",o.ExecutionMode.ADVANCED),BE(2),ug("value",o.ExecutionMode.LOOP),BE(2),jw(o.isLoopMode()?49:-1),BE(7),jw(o.isPlatformMode?56:-1),BE(2),ug("checked",o.allSubAgentsSelected()),BE(8),jw(o.namedSubAgentSelectionDropped()?66:-1),BE(),jw(o.subAgentCandidatesUnavailable()?67:-1),BE(),jw(o.subAgentRows().length===0?68:69),BE(8),ug("formControl",o.newSubAgentControl),NI(),BE(),ug("disabled",!o.newSubAgentControl.value.trim()),BE(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),BE(),ug("formControl",o.delegationTimeoutControl),cg("aria-invalid",o.delegationTimeoutControl.invalid),NI(),BE(),jw(o.delegationTimeoutControl.value!==null?81:-1),BE(),jw((e=o.submitError())?82:-1,e),BE(2),ug("disabled",o.form.invalid||o.isSubmitting()),BE(),vl(" ",o.isEditMode()?"Save changes":"Create"," "),BE(),jw(o.isEditMode()?86:-1);}}var Je=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=Ui(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=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=XC(()=>{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=XC(()=>this.executionModeValue()==="LOOP");subAgentRows=Ui([]);allSubAgentsSelected=Ui(false);subAgentCandidatesUnavailable=Ui(false);namedSubAgentSelectionDropped=XC(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=XC(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=XC(()=>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=qe$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=XC(()=>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=XC(()=>{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=XC(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),da(()=>Tr(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):Tr([]),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):Tr([]),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),Tr([]))))}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()):Tr([]);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),Tr([])))}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),Tr([]))))}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=yw({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()}),NC(3," \u2190 Agent configs "),pl(),Lw(4,nt,2,1,"a",2),Lw(5,ot,2,0,"ds-tag",3),pl(),Lw(6,it,2,0,"p",4)(7,Kt,89,33,"form",5),pl()),e&2&&(BE(),ug("title",o.isEditMode()?"Edit agent config":"New agent config"),BE(3),jw(o.isEditMode()?4:-1),BE(),jw(o.isPlatformMode?5:-1),BE(),jw(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
+ import {o as o$1,r,i,l}from'./chunk-1nyEsjkY.js';import {o}from'./chunk-DmG7zAfL.js';import {O}from'./chunk-BOVza9Oc.js';import {g,W as W$1,F,I as Ie,ag as U,ay as N,U as Ui,az as K,a8 as _,X as XC,a9 as F$1,aA as qe$1,G as U$1,a2 as da,aa as Tr,ac as Ty,ad as ne,M as x,K as w,y as yw,au as $t$1,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,aq as k,a6 as x$1,J as Jw,Z as Zw,l as lg,_ as _I,R as NI,k as cg,v as vl,H as Hw,m as Uw,O as Og,r as df,s as ff,as as kg}from'./main-4M5ZCKCC.js';import {p as pt$1,T as Te,a as fn,U as Ut$1,n as nd,b 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-DT4HydoN.js';import'./chunk-DHBOaxUB.js';var W=class n{aiModelController=g(k);listAvailable(t){let e=this.aiModelController.listPlatformLevelAiModel().pipe(this.orEmpty("platform")),o=t?this.aiModelController.listByNamespaceIdAiModel(t).pipe(this.orEmpty("namespace")):Tr([]);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),Tr([])))}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),NC(1,"View resolved definition \u2192"),pl()),n&2){let e=Jw();ug("routerLink",e.inspectRoute());}}function ot(n,t){n&1&&(Ds(0,"ds-tag",3),NC(1,"Platform level"),pl());}function it(n,t){n&1&&(Ds(0,"p",4),NC(1,"Loading\u2026"),pl());}function at(n,t){if(n&1&&(lg(0,"input",17),_I()),n&2){let e=Jw(2);ug("formControl",e.modelNameControl),NI();}}function lt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t;ug("ngValue",e.value),BE(),Og(e.label);}}function rt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function st(n,t){if(n&1&&(Ds(0,"optgroup",42),Hw(1,rt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().aliases);}}function dt(n,t){if(n&1&&(Ds(0,"option",41),NC(1),pl()),n&2){let e=t.$implicit;ug("ngValue",e.value),BE(),Og(e.label);}}function ct(n,t){if(n&1&&(Ds(0,"optgroup",43),Hw(1,dt,2,2,"option",41,Ye),pl()),n&2){let e=Jw(3);BE(),Uw(e.modelOptions().apiNames);}}function mt(n,t){if(n&1&&(Ds(0,"select",18)(1,"option",40),NC(2,"Select a model"),pl(),Lw(3,lt,2,2,"option",41),Lw(4,st,3,0,"optgroup",42),Lw(5,ct,3,0,"optgroup",43),pl(),_I()),n&2){let e,o=Jw(2);ug("formControl",o.modelNameControl),NI(),BE(),ug("ngValue",null),BE(2),jw((e=o.modelOptions().current)?3:-1,e),BE(),jw(o.modelOptions().aliases.length>0?4:-1),BE(),jw(o.modelOptions().apiNames.length>0?5:-1);}}function ut(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.config.integrationType);}}function gt(n,t){if(n&1&&(lg(0,"input",45),_I()),n&2){let e=Jw().$implicit;ug("formControl",e.toolsControl),cg("aria-label","Tools of "+e.config.name),NI();}}function pt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",23),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleIntegration(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,ut,2,1,"span",44),pl(),Lw(6,gt,1,2,"input",45),pl();}if(n&2){let e=t.$implicit;BE(2),ug("checked",e.enabled()),BE(2),Og(e.config.name),BE(),jw(e.config.integrationType?5:-1),BE(),jw(e.enabled()?6:-1);}}function ft(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ct(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",24),NC(2),Ds(3,"span",44),NC(4,"built-in"),pl()(),Ds(5,"select",47),mg("change",function(r){let d=df(e).$implicit,f=Jw(4);return ff(f.setBuiltInState(d,r.target.value))}),Ds(6,"option",48),NC(7),pl(),Ds(8,"option",49),NC(9,"Enabled"),pl(),Ds(10,"option",50),NC(11,"Disabled"),pl()(),Lw(12,ft,2,1,"p",13),Ds(13,"p",13),NC(14),pl()();}if(n&2){let e=t.$implicit,o=Jw(4);BE(),cg("for","built-in-"+e.type),BE(),vl(" ",e.displayName," "),BE(3),ug("id","built-in-"+e.type)("value",e.state()),BE(2),Og(o.builtInDefaultLabel(e)),BE(5),jw(e.state()==="on"&&e.restrictedTools?12:-1),BE(2),Og(e.description);}}function _t(n,t){if(n&1&&(Ds(0,"span",46),NC(1,"Built-in integrations"),pl(),Hw(2,Ct,15,7,"div",10,tt)),n&2){let e=Jw(3);BE(2),Uw(e.builtInRows());}}function bt(n,t){n&1&&(Ds(0,"ds-notice",26),NC(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),Hw(1,pt,7,4,"div",10,et),Lw(3,_t,4,0),Lw(4,bt,2,0,"ds-notice",26),pl()),n&2){let e=Jw(2);BE(),Uw(e.integrationRows()),BE(2),jw(e.builtInRows().length>0?3:-1),BE(),jw(e.configAgentExposureWarning()?4:-1);}}function yt(n,t){n&1&&NC(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),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),pl());}function xt(n,t){n&1&&(Ds(0,"ds-notice"),NC(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),NC(1,"No skill available in this scope yet."),pl());}function At(n,t){n&1&&(Ds(0,"span",44),NC(1,"platform"),pl());}function wt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.skillCatalogueUnavailable()?"not verified":"no matching skill"," ");}}function Et(n,t){if(n&1&&(Ds(0,"p",13),NC(1),pl()),n&2){let e=Jw().$implicit;BE(),Og(e.description);}}function Tt(n,t){if(n&1){let e=Zw();Ds(0,"div",10)(1,"label",11)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSkill(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,At,2,0,"span",44),Lw(6,wt,2,1,"span",44),pl(),Lw(7,Et,2,1,"p",13),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSkillsSelected()),BE(2),Og(e.name),BE(),jw(e.platform?5:-1),BE(),jw(e.unresolved?6:-1),BE(),jw(e.description?7:-1);}}function kt(n,t){if(n&1&&Hw(0,Tt,8,6,"div",10,qe),n&2){let e=Jw(2);Uw(e.skillRows());}}function It(n,t){if(n&1&&(Ds(0,"ds-form-field",30),lg(1,"textarea",52),_I(),Ds(2,"p",4),NC(3," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),Ds(4,"code"),NC(5,"AgentLoopPayload"),pl(),NC(6,". Leave empty if you always provide the payload at launch. "),pl()()),n&2){let e=Jw(2);ug("error",e.loopConfigControl.invalid&&e.loopConfigControl.touched?"Invalid JSON \u2014 please fix the syntax.":null),BE(),ug("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),NI();}}function Mt(n,t){n&1&&NC(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&&NC(0),n&2){let e=Jw(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),NC(1," Saving with this on replaces the selection below with "),Ds(2,"code",25),NC(3,"*"),pl(),NC(4,". "),Lw(5,Rt,1,2),pl()),n&2){let e=Jw(2);BE(5),jw(e.droppedUnresolvedSubAgents()>0?5:-1);}}function Nt(n,t){n&1&&(Ds(0,"ds-notice"),NC(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),NC(1,"No other agent is available in this scope yet."),pl());}function Lt(n,t){n&1&&(Ds(0,"span",44),NC(1,"pattern"),pl());}function Ot(n,t){n&1&&(Ds(0,"span",44),NC(1,"via pattern"),pl());}function Vt(n,t){if(n&1&&(Ds(0,"span",44),NC(1),pl()),n&2){let e=Jw(4);BE(),vl(" ",e.subAgentCandidatesUnavailable()?"not verified":"no matching agent"," ");}}function Pt(n,t){if(n&1){let e=Zw();Ds(0,"button",55),mg("click",function(){df(e);let r=Jw().$implicit,d=Jw(3);return ff(d.removeSubAgent(r))}),NC(1," \xD7 "),pl();}if(n&2){let e=Jw().$implicit;cg("aria-label","Remove "+e.selector);}}function Bt(n,t){if(n&1){let e=Zw();Ds(0,"div",32)(1,"label",53)(2,"input",51),mg("change",function(){let r=df(e).$implicit,d=Jw(3);return ff(d.toggleSubAgent(r))}),pl(),Ds(3,"span",24),NC(4),pl(),Lw(5,Lt,2,0,"span",44)(6,Ot,2,0,"span",44)(7,Vt,2,1,"span",44),pl(),Lw(8,Pt,2,1,"button",54),pl();}if(n&2){let e=t.$implicit,o=Jw(3);BE(2),ug("checked",e.selected())("disabled",o.allSubAgentsSelected()),BE(2),Og(e.name),BE(),jw(e.pattern?5:e.grantedByPattern?6:e.unresolved?7:-1),BE(3),jw(e.unresolved?8:-1);}}function $t(n,t){if(n&1&&Hw(0,Bt,9,5,"div",32,qe),n&2){let e=Jw(2);Uw(e.subAgentRows());}}function Gt(n,t){if(n&1){let e=Zw();Ds(0,"div")(1,"button",56),mg("click",function(){df(e);let r=Jw(2);return ff(r.useDefaultDelegationTimeout())}),NC(2," Use server default "),pl()();}}function Ut(n,t){n&1&&(Ds(0,"ds-notice"),NC(1),pl()),n&2&&(BE(),Og(t));}function jt(n,t){if(n&1){let e=Zw();Ds(0,"button",57),mg("click",function(){df(e);let r=Jw(2);return ff(r.exportYaml())}),NC(1),pl();}if(n&2){let e=Jw(2);ug("disabled",e.isExporting()),BE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Kt(n,t){if(n&1){let e=Zw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let r=Jw();return ff(r.submit())}),Ds(1,"ds-fieldset",7)(2,"ds-form-field",8),lg(3,"input",9),_I(),pl(),Ds(4,"div",10)(5,"label",11),lg(6,"input",12),_I(),NC(7," Enabled "),pl(),Ds(8,"p",13),NC(9,"Disabled agents are excluded from namespace resolution."),pl()(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"ds-form-field",16),Lw(13,at,1,1,"input",17)(14,mt,6,5,"select",18),pl(),Ds(15,"ds-form-field",19),lg(16,"textarea",20),_I(),pl()(),Lw(17,ht,5,2,"ds-fieldset",21),Ds(18,"ds-fieldset",22)(19,"p",4),NC(20," Instruction bundles this agent can read on demand. Selecting at least one grants it the "),Ds(21,"code"),NC(22,"readSkill"),pl(),NC(23," and "),Ds(24,"code"),NC(25,"readSkillResource"),pl(),NC(26," tools; selecting none grants neither. "),Lw(27,yt,1,0),pl(),Ds(28,"label",11)(29,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSkills())}),pl(),Ds(30,"span",24),NC(31,"Every skill in the catalogue ("),Ds(32,"code",25),NC(33,"*"),pl(),NC(34,")"),pl()(),Ds(35,"p",13),NC(36," Resolved at run time, so skills added later are granted too, without editing this agent. "),pl(),Lw(37,vt,5,0,"ds-notice",26),Lw(38,xt,2,0,"ds-notice"),Lw(39,St,2,0,"p",4)(40,kt,2,0),pl(),Ds(41,"ds-form-field",27)(42,"select",28)(43,"option",29),NC(44,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),Ds(45,"option",29),NC(46,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),Ds(47,"option",29),NC(48,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),_I(),pl(),Lw(49,It,7,3,"ds-form-field",30),Ds(50,"ds-fieldset",31)(51,"p",4),NC(52," The agents this one may delegate to. Selecting at least one grants it the "),Ds(53,"code"),NC(54,"DELEGATE__delegate"),pl(),NC(55," tool; selecting none grants it no way to delegate. Entries are matched against agent names, never ids. "),Lw(56,Mt,1,0),pl(),Ds(57,"label",11)(58,"input",23),mg("change",function(){df(e);let r=Jw();return ff(r.toggleAllSubAgents())}),pl(),Ds(59,"span",24),NC(60,"Every agent it can reach ("),Ds(61,"code",25),NC(62,"*"),pl(),NC(63,")"),pl()(),Ds(64,"p",13),NC(65," Resolved at run time, so agents added later can be delegated to as well, without editing this agent. "),pl(),Lw(66,Ft,6,1,"ds-notice",26),Lw(67,Nt,2,0,"ds-notice"),Lw(68,Dt,2,0,"p",4)(69,$t,2,0),Ds(70,"p",4),NC(71," Advanced \u2014 add a glob instead of picking a name, for example "),Ds(72,"code"),NC(73,"*Fixer"),pl(),NC(74," to cover BugFixer and StoryFixer. "),pl(),Ds(75,"div",32)(76,"input",33),mg("keydown.enter",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),pl(),_I(),Ds(77,"button",34),mg("click",function(){df(e);let r=Jw();return ff(r.addSubAgent())}),NC(78," + "),pl()(),Ds(79,"ds-form-field",35),lg(80,"input",36),_I(),Lw(81,Gt,3,0,"div"),pl()(),Lw(82,Ut,2,1,"ds-notice"),Ds(83,"ds-form-actions")(84,"button",37),NC(85),pl(),Lw(86,jt,2,2,"button",38),Ds(87,"button",39),mg("click",function(){df(e);let r=Jw();return ff(r.cancel())}),NC(88,"Cancel"),pl()()();}if(n&2){let e,o=Jw();ug("formGroup",o.form),BE(3),ug("formControl",o.nameControl),NI(),BE(3),ug("formControl",o.enabledControl),NI(),BE(5),ug("formControl",o.descriptionControl),NI(),BE(2),jw(o.modelAsFreeText()?13:14),BE(3),ug("formControl",o.instructionsControl),NI(),BE(),jw(o.integrationRows().length>0||o.builtInRows().length>0?17:-1),BE(10),jw(o.isPlatformMode?27:-1),BE(2),ug("checked",o.allSkillsSelected()),BE(8),jw(o.namedSkillSelectionDropped()?37:-1),BE(),jw(o.skillCatalogueUnavailable()?38:-1),BE(),jw(o.skillRows().length===0?39:40),BE(3),ug("formControl",o.executionModeControl),NI(),BE(),ug("value",o.ExecutionMode.SIMPLE),BE(2),ug("value",o.ExecutionMode.ADVANCED),BE(2),ug("value",o.ExecutionMode.LOOP),BE(2),jw(o.isLoopMode()?49:-1),BE(7),jw(o.isPlatformMode?56:-1),BE(2),ug("checked",o.allSubAgentsSelected()),BE(8),jw(o.namedSubAgentSelectionDropped()?66:-1),BE(),jw(o.subAgentCandidatesUnavailable()?67:-1),BE(),jw(o.subAgentRows().length===0?68:69),BE(8),ug("formControl",o.newSubAgentControl),NI(),BE(),ug("disabled",!o.newSubAgentControl.value.trim()),BE(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),BE(),ug("formControl",o.delegationTimeoutControl),cg("aria-invalid",o.delegationTimeoutControl.invalid),NI(),BE(),jw(o.delegationTimeoutControl.value!==null?81:-1),BE(),jw((e=o.submitError())?82:-1,e),BE(2),ug("disabled",o.form.invalid||o.isSubmitting()),BE(),vl(" ",o.isEditMode()?"Save changes":"Create"," "),BE(),jw(o.isEditMode()?86:-1);}}var Je=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g(U);defaultsController=g(N);defaultDelegationTimeoutSeconds=Ui(null);exportService=g(K);integrationConfigState=g(O);integrationTypeController=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=XC(()=>{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=XC(()=>this.executionModeValue()==="LOOP");subAgentRows=Ui([]);allSubAgentsSelected=Ui(false);subAgentCandidatesUnavailable=Ui(false);namedSubAgentSelectionDropped=XC(()=>this.allSubAgentsSelected()&&this.subAgentRows().some(t=>t.selected()));droppedUnresolvedSubAgents=XC(()=>this.allSubAgentsSelected()?this.subAgentRows().filter(t=>t.unresolved&&t.selected()).length:0);hasAnySubAgent=XC(()=>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=qe$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=XC(()=>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=XC(()=>{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=XC(()=>this.allSkillsSelected()&&this.skillRows().some(t=>t.selected()));existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U$1(this.destroyRef),da(()=>Tr(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):Tr([]),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):Tr([]),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),Tr([]))))}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()):Tr([]);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),Tr([])))}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),Tr([]))))}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=yw({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()}),NC(3," \u2190 Agent configs "),pl(),Lw(4,nt,2,1,"a",2),Lw(5,ot,2,0,"ds-tag",3),pl(),Lw(6,it,2,0,"p",4)(7,Kt,89,33,"form",5),pl()),e&2&&(BE(),ug("title",o.isEditMode()?"Edit agent config":"New agent config"),BE(3),jw(o.isEditMode()?4:-1),BE(),jw(o.isPlatformMode?5:-1),BE(),jw(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 {D as m,z as k,O as O$1,g as at,h as hn,I as Io,j as ko,P,B as P$1}from'./chunk-DvqKcX7A.js';import {g,W as W$1,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-BGDYOJBA.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function G(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading prompts\u2026"),pl());}function O(n,e){n&1&&(Ds(0,"p",5),NC(1,"No prompts available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),NC(1,"No prompts match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",17),NC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=Zw();Ds(0,"button",23),mg("click",function(){df(t);let l=Jw(2).$implicit,m=Jw(2);return ff(m.edit(l))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=Zw();Lw(0,X,2,1,"button",21),Ds(1,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(l.key))})("deleteConfirmed",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(l))})("deleteCancelled",function(){df(t);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Ds(0,"button",20),NC(1,"Inherited"),pl());}function ee(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Lw(12,Y,2,4)(13,Z,2,0,"button",20),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.prompt.name),BE(2),vl(" ",t.prompt.description||"\u2014"," "),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?9:-1),BE(3),jw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,ee,14,6,"tr",9,U),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.promptState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.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,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return i.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New prompt"),pl()(),Lw(4,z,2,1,"p",3),Lw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(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{J as NamespacePromptsComponent};
1
+ import {D as m,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-DT4HydoN.js';import {g,W as W$1,F,I as Ie,$ as Cr,U as Ui,a1 as fa,ac as Ty,a2 as da,aa as Tr,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,r as df,s as ff,k as cg}from'./main-4M5ZCKCC.js';var U=(n,e)=>e.key;function z(n,e){if(n&1&&(Ds(0,"p",3),NC(1),pl()),n&2){let t=Jw();BE(),Og(t.deletion.error());}}function G(n,e){n&1&&(Ds(0,"p",4),NC(1,"Loading prompts\u2026"),pl());}function O(n,e){n&1&&(Ds(0,"p",5),NC(1,"No prompts available."),pl());}function Q(n,e){n&1&&(Ds(0,"p",4),NC(1,"No prompts match the current filter."),pl());}function W(n,e){n&1&&(Ds(0,"ds-tag",17),NC(1,"Read-only"),pl());}function X(n,e){if(n&1){let t=Zw();Ds(0,"button",23),mg("click",function(){df(t);let l=Jw(2).$implicit,m=Jw(2);return ff(m.edit(l))}),NC(1," Edit "),pl();}if(n&2){let t=Jw(2).$implicit;cg("aria-label","Edit "+t.prompt.name);}}function Y(n,e){if(n&1){let t=Zw();Lw(0,X,2,1,"button",21),Ds(1,"agentos-row-delete-action",22),mg("deleteRequested",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(l.key))})("deleteConfirmed",function(){df(t);let l=Jw().$implicit,m=Jw(2);return ff(m.confirmDelete(l))})("deleteCancelled",function(){df(t);let l=Jw(3);return ff(l.deletion.cancel())}),pl();}if(n&2){let t=Jw().$implicit,i=Jw(2);jw(i.deletion.confirmingId()!==t.key?0:-1),BE(),ug("rowKey",t.key)("rowLabel",t.prompt.name)("state",i.deletion);}}function Z(n,e){n&1&&(Ds(0,"button",20),NC(1,"Inherited"),pl());}function ee(n,e){if(n&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15)(7,"ds-tag",16),NC(8),pl(),Lw(9,W,2,0,"ds-tag",17),pl()(),Ds(10,"td",18)(11,"div",19),Lw(12,Y,2,4)(13,Z,2,0,"button",20),pl()()()),n&2){let t=e.$implicit;BE(2),Og(t.prompt.name),BE(2),vl(" ",t.prompt.description||"\u2014"," "),BE(3),ug("variant",t.scope==="platform"?"neutral":"accent"),BE(),Og(t.scope==="platform"?"Platform":"Namespace"),BE(),jw(t.scope==="platform"?9:-1),BE(3),jw(t.scope==="namespace"?12:13);}}function te(n,e){if(n&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Description"),pl(),Ds(8,"th",10),NC(9,"Scope"),pl(),Ds(10,"th",10)(11,"span",11),NC(12,"Actions"),pl()()()(),Ds(13,"tbody",8),Hw(14,ee,14,6,"tr",9,U),pl()()()),n&2){let t=Jw();BE(14),Uw(t.rowFilter.filteredRows());}}var J=class n{route=g(W$1);router=g(F);destroyRef=g(Ie);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();rows=Ui([]);rowFilter=O$1(this.rows,e=>[e.prompt.name,e.prompt.description,e.scope].filter(Boolean).join(" "));allPrompts$=this.refresh$.pipe(fa(()=>(this.isLoading.set(true),Ty({platform:this.promptState.listPlatform().pipe(da(()=>Tr([]))),namespace:this.promptState.listByNamespace(this.namespaceId)}))));constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe({next:({platform:e,namespace:t})=>{this.rows.set([...e.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...t.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,"prompts","new"]);}edit(e){e.scope==="platform"||!e.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"prompts",e.prompt.id,"edit"]);}confirmDelete(e){e.scope==="platform"||!e.prompt.id||this.deletion.execute(e.key,{request$:this.promptState.delete(e.prompt.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.prompt.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-prompts"]],decls:9,vars:3,consts:[["title","Prompts","description","Prompts available in this namespace, including prompts inherited from the platform."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(t,i){t&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return i.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return i.openCreateForm()}),NC(3,"New prompt"),pl()(),Lw(4,z,2,1,"p",3),Lw(5,G,2,0,"p",4)(6,O,2,0,"p",5)(7,Q,2,0,"p",4)(8,te,16,0,"div",6)),t&2&&(BE(),ug("query",i.rowFilter.query()),BE(3),jw(i.deletion.error()?4:-1),BE(),jw(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{J as NamespacePromptsComponent};
@@ -1 +1 @@
1
- import {p as pt,T as Te,a as fn,c as pn,h as hn,d as cn,r as ln,e as dn,g as at,i as an,U as Ut,n as nd,l as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,b as po,$ as $r,H as qr,V as Vn,A as An,v as va}from'./chunk-DvqKcX7A.js';import {g,W,F,I as Ie$1,aq as k,ap as F$1,a9 as F$2,a2 as da,aa as Tr,ar as Ue,X as XC,U as Ui,q as Af,G as U,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,ao as Vw,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,as as kg,r as df,s as ff}from'./main-BGDYOJBA.js';function he(r,t){r&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ve(r,t){if(r&1&&lg(0,"input",6),r&2){let e=Jw(2);ug("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Ds(0,"option",44),NC(1),pl()),r&2){let e=t.$implicit;ug("value",e.id),BE(),kg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Ds(0,"select",7)(1,"option",43),NC(2,"Select provider"),pl(),Hw(3,ye,2,3,"option",44,Fw().trackByProvider,true),pl(),_I()),r&2){let e=Jw(2);ug("formControl",e.aiProviderIdControl),NI(),BE(3),Uw(e.providers());}}function xe(r,t){if(r&1&&(Ds(0,"option",25),NC(1),pl()),r&2){let e=t.$implicit;ug("ngValue",e),BE(),Og(e.toLowerCase());}}function _e(r,t){r&1&&(Ds(0,"p",2),NC(1,"Not supported yet for Anthropic and Gemini providers."),pl());}function Me(r,t){r&1&&(Ds(0,"p",2),NC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),pl());}function Ee(r,t){r&1&&(Ds(0,"p",26),NC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),pl());}function Ae(r,t){if(r&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let u=Jw();return ff(u.submit())}),Ds(1,"ds-form-field",5),Lw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),pl(),Ds(4,"ds-form-field",8),lg(5,"input",9),_I(),pl(),Ds(6,"ds-form-field",10),lg(7,"input",11),_I(),pl(),Ds(8,"ds-form-field",12),lg(9,"input",13),_I(),pl(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"div",16)(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19),lg(16,"input",20),_I(),pl()(),Ds(17,"ds-form-field",21),lg(18,"input",22),_I(),pl(),Ds(19,"ds-form-field",23)(20,"select",24)(21,"option",25),NC(22,"Provider default"),pl(),Hw(23,xe,2,2,"option",25,Vw),pl(),_I(),Lw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Lw(27,Ee,2,0,"p",26),pl(),Ds(28,"div",27)(29,"label",28),lg(30,"input",29),_I(),Ds(31,"span",30),NC(32,"Supports advanced execution"),pl()(),Ds(33,"p",31),NC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),pl()(),Ds(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),lg(38,"input",34),_I(),pl(),Ds(39,"ds-form-field",35),lg(40,"input",36),_I(),pl()(),Ds(41,"div",16)(42,"ds-form-field",37),lg(43,"input",38),_I(),pl(),Ds(44,"ds-form-field",39),lg(45,"input",40),_I(),pl()()(),Ds(46,"ds-form-actions")(47,"button",41),NC(48),pl(),Ds(49,"button",42),mg("click",function(){df(e);let u=Jw();return ff(u.cancel())}),NC(50,"Cancel"),pl()()();}if(r&2){let e=Jw();ug("formGroup",e.form),BE(2),jw(e.isEditMode()?2:3),BE(3),ug("formControl",e.apiModelNameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.aliasControl),NI(),BE(2),ug("formControl",e.priorityControl),NI(),BE(3),ug("formControl",e.temperatureControl),NI(),BE(2),ug("formControl",e.contextWindowControl),NI(),BE(2),ug("formControl",e.maxCompletionTokensControl),NI(),BE(2),ug("formControl",e.reasoningEffortControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.reasoningEffortOptions),BE(2),jw(e.reasoningEffortUnsupported()?25:26),BE(2),jw(e.temperatureMayConflictWithEffort()?27:-1),BE(3),ug("formControl",e.supportsAdvancedExecutionControl),NI(),BE(5),ug("formGroup",e.pricingGroup),BE(3),NI(),BE(2),NI(),BE(3),NI(),BE(2),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(Ie$1);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(da(()=>Tr([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[fn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Ue);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=XC(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=XC(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);selectedProviderLabel=XC(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Af(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return c.cancel()}),NC(3," \u2190 AI models "),pl()(),Lw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),pl()),e&2&&(BE(),ug("title",c.isEditMode()?"Edit AI model":"New AI model"),BE(3),jw(c.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,qr,Vn,An,va],encapsulation:2})};export{ge as AiModelFormComponent};
1
+ import {p as pt,T as Te,a as fn,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,H as qr,V as Vn,A as An,v as va}from'./chunk-DT4HydoN.js';import {g,W,F,I as Ie$1,aq as k,ap as F$1,a9 as F$2,a2 as da,aa as Tr,ar as Ue,X as XC,U as Ui,q as Af,G as U,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,l as lg,_ as _I,H as Hw,ao as Vw,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,as as kg,r as df,s as ff}from'./main-4M5ZCKCC.js';function he(r,t){r&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ve(r,t){if(r&1&&lg(0,"input",6),r&2){let e=Jw(2);ug("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(Ds(0,"option",44),NC(1),pl()),r&2){let e=t.$implicit;ug("value",e.id),BE(),kg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(Ds(0,"select",7)(1,"option",43),NC(2,"Select provider"),pl(),Hw(3,ye,2,3,"option",44,Fw().trackByProvider,true),pl(),_I()),r&2){let e=Jw(2);ug("formControl",e.aiProviderIdControl),NI(),BE(3),Uw(e.providers());}}function xe(r,t){if(r&1&&(Ds(0,"option",25),NC(1),pl()),r&2){let e=t.$implicit;ug("ngValue",e),BE(),Og(e.toLowerCase());}}function _e(r,t){r&1&&(Ds(0,"p",2),NC(1,"Not supported yet for Anthropic and Gemini providers."),pl());}function Me(r,t){r&1&&(Ds(0,"p",2),NC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),pl());}function Ee(r,t){r&1&&(Ds(0,"p",26),NC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),pl());}function Ae(r,t){if(r&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let u=Jw();return ff(u.submit())}),Ds(1,"ds-form-field",5),Lw(2,ve,1,1,"input",6)(3,be,5,1,"select",7),pl(),Ds(4,"ds-form-field",8),lg(5,"input",9),_I(),pl(),Ds(6,"ds-form-field",10),lg(7,"input",11),_I(),pl(),Ds(8,"ds-form-field",12),lg(9,"input",13),_I(),pl(),Ds(10,"ds-form-field",14),lg(11,"input",15),_I(),pl(),Ds(12,"div",16)(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19),lg(16,"input",20),_I(),pl()(),Ds(17,"ds-form-field",21),lg(18,"input",22),_I(),pl(),Ds(19,"ds-form-field",23)(20,"select",24)(21,"option",25),NC(22,"Provider default"),pl(),Hw(23,xe,2,2,"option",25,Vw),pl(),_I(),Lw(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Lw(27,Ee,2,0,"p",26),pl(),Ds(28,"div",27)(29,"label",28),lg(30,"input",29),_I(),Ds(31,"span",30),NC(32,"Supports advanced execution"),pl()(),Ds(33,"p",31),NC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),pl()(),Ds(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),lg(38,"input",34),_I(),pl(),Ds(39,"ds-form-field",35),lg(40,"input",36),_I(),pl()(),Ds(41,"div",16)(42,"ds-form-field",37),lg(43,"input",38),_I(),pl(),Ds(44,"ds-form-field",39),lg(45,"input",40),_I(),pl()()(),Ds(46,"ds-form-actions")(47,"button",41),NC(48),pl(),Ds(49,"button",42),mg("click",function(){df(e);let u=Jw();return ff(u.cancel())}),NC(50,"Cancel"),pl()()();}if(r&2){let e=Jw();ug("formGroup",e.form),BE(2),jw(e.isEditMode()?2:3),BE(3),ug("formControl",e.apiModelNameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.aliasControl),NI(),BE(2),ug("formControl",e.priorityControl),NI(),BE(3),ug("formControl",e.temperatureControl),NI(),BE(2),ug("formControl",e.contextWindowControl),NI(),BE(2),ug("formControl",e.maxCompletionTokensControl),NI(),BE(2),ug("formControl",e.reasoningEffortControl),NI(),BE(),ug("ngValue",null),BE(2),Uw(e.reasoningEffortOptions),BE(2),jw(e.reasoningEffortUnsupported()?25:26),BE(2),jw(e.temperatureMayConflictWithEffort()?27:-1),BE(3),ug("formControl",e.supportsAdvancedExecutionControl),NI(),BE(5),ug("formGroup",e.pricingGroup),BE(3),NI(),BE(2),NI(),BE(3),NI(),BE(2),NI(),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(Ie$1);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(da(()=>Tr([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[fn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Ue);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=XC(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=XC(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);selectedProviderLabel=XC(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){Af(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=yw({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return c.cancel()}),NC(3," \u2190 AI models "),pl()(),Lw(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),pl()),e&2&&(BE(),ug("title",c.isEditMode()?"Edit AI model":"New AI model"),BE(3),jw(c.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,qr,Vn,An,va],encapsulation:2})};export{ge as AiModelFormComponent};
@@ -1,2 +1,2 @@
1
- import {v}from'./chunk-2O1S906W.js';import {I,n as nt,i as it}from'./chunk-Dn4mtCZo.js';import {g,W,F,I as Ie,U as Ui,a9 as F$1,X as XC,q as Af,G as U,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,H as Hw,ao as Vw,_ as _I,l as lg,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,k as cg,r as df,s as ff}from'./main-BGDYOJBA.js';import {T as Te,a as fn,p as pt,c as pn,h as hn,d as cn,r as ln,e as dn,g as at,i as an,t as rn,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,b as po,V as Vn,A as An}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';function Ce(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ye(i,t){if(i&1&&(Ds(0,"label",16),lg(1,"input",17),_I(),NC(2),pl()),i&2){let e=t.$implicit,n=Jw(3);BE(),ug("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Ds(0,"ds-fieldset",5),Hw(1,ye,3,4,"label",16,Fw().trackByScope,true),pl()),i&2){let e=Jw(2);ug("disabled",e.isEditMode()),BE(),Uw(e.scopeOptions);}}function fe(i,t){if(i&1&&(Ds(0,"option",8),NC(1),pl()),i&2){let e=t.$implicit,n=Jw(2);ug("value",e),BE(),Og(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Ds(0,"ds-form-field",18),lg(1,"input",19),_I(),pl()),i&2){let e=Jw().$implicit;ug("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),ug("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),cg("aria-describedby",e.hint?"as-hint-"+e.key:null),NI();}}function Ae(i,t){if(i&1&&Lw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=Jw(3);jw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Ds(0,"ds-fieldset",13),Hw(1,Ae,1,1,null,null,Fw().trackByField,true),pl()),i&2){let e=Jw(2);ug("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),Uw(e.credentialFields());}}function be(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let o=Jw();return ff(o.submit())}),Lw(1,ge,3,1,"ds-fieldset",5),Ds(2,"ds-form-field",6)(3,"select",7),Hw(4,fe,2,2,"option",8,Vw),pl(),_I(),pl(),Ds(6,"ds-form-field",9),lg(7,"input",10),_I(),pl(),Ds(8,"ds-form-field",11),lg(9,"input",12),_I(),pl(),Lw(10,ve,3,1,"ds-fieldset",13),Ds(11,"ds-form-actions")(12,"button",14),NC(13),pl(),Ds(14,"button",15),mg("click",function(){df(e);let o=Jw();return ff(o.cancel())}),NC(15,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(),jw(e.isPlatformMode?-1:1),BE(2),ug("formControl",e.authTypeControl),NI(),BE(),Uw(e.authTypeOptions),BE(3),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.credentialFields().length>0?10:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Ui(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=XC(()=>_e[this.selectedAuthType()]);isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Af(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Auth settings "),pl()(),Lw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),pl()),e&2&&(BE(),ug("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
1
+ import {v}from'./chunk-BUYyTltk.js';import {I,n as nt,i as it}from'./chunk-Bcbf5ZJu.js';import {g,W,F,I as Ie,U as Ui,a9 as F$1,X as XC,q as Af,G as U,M as x,K as w,y as yw,D as Ds,Q as mg,N as NC,p as pl,L as Lw,a as BE,P as ug,j as jw,Z as Zw,H as Hw,ao as Vw,_ as _I,l as lg,J as Jw,R as NI,m as Uw,v as vl,ae as Fw,O as Og,k as cg,r as df,s as ff}from'./main-4M5ZCKCC.js';import {T as Te,a as fn,p as pt,d as pn,h as hn,e as cn,r as ln,g as dn,i as at,j as an,t as rn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,w as pa,m as mo,c as po,V as Vn,A as An}from'./chunk-DT4HydoN.js';import'./chunk-DHBOaxUB.js';function Ce(i,t){i&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function ye(i,t){if(i&1&&(Ds(0,"label",16),lg(1,"input",17),_I(),NC(2),pl()),i&2){let e=t.$implicit,n=Jw(3);BE(),ug("formControl",n.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!n.isAdmin()),NI(),BE(),vl(" ",e.label," ");}}function ge(i,t){if(i&1&&(Ds(0,"ds-fieldset",5),Hw(1,ye,3,4,"label",16,Fw().trackByScope,true),pl()),i&2){let e=Jw(2);ug("disabled",e.isEditMode()),BE(),Uw(e.scopeOptions);}}function fe(i,t){if(i&1&&(Ds(0,"option",8),NC(1),pl()),i&2){let e=t.$implicit,n=Jw(2);ug("value",e),BE(),Og(n.authTypeLabel[e]);}}function Se(i,t){if(i&1&&(Ds(0,"ds-form-field",18),lg(1,"input",19),_I(),pl()),i&2){let e=Jw().$implicit;ug("label",e.label)("controlId","as-cred-"+e.key)("required",e.required)("hint",e.hint??null)("hintId","as-hint-"+e.key),BE(),ug("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),cg("aria-describedby",e.hint?"as-hint-"+e.key:null),NI();}}function Ae(i,t){if(i&1&&Lw(0,Se,2,11,"ds-form-field",18),i&2){let e,n=t.$implicit,o=Jw(3);jw((e=o.controlForField(n.key))?0:-1,e);}}function ve(i,t){if(i&1&&(Ds(0,"ds-fieldset",13),Hw(1,Ae,1,1,null,null,Fw().trackByField,true),pl()),i&2){let e=Jw(2);ug("hint","Values are stored encrypted and masked on read."+(e.isEditMode()?" Leave a field unchanged to keep the stored credential.":"")),BE(),Uw(e.credentialFields());}}function be(i,t){if(i&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let o=Jw();return ff(o.submit())}),Lw(1,ge,3,1,"ds-fieldset",5),Ds(2,"ds-form-field",6)(3,"select",7),Hw(4,fe,2,2,"option",8,Vw),pl(),_I(),pl(),Ds(6,"ds-form-field",9),lg(7,"input",10),_I(),pl(),Ds(8,"ds-form-field",11),lg(9,"input",12),_I(),pl(),Lw(10,ve,3,1,"ds-fieldset",13),Ds(11,"ds-form-actions")(12,"button",14),NC(13),pl(),Ds(14,"button",15),mg("click",function(){df(e);let o=Jw();return ff(o.cancel())}),NC(15,"Cancel"),pl()()();}if(i&2){let e=Jw();ug("formGroup",e.form),BE(),jw(e.isPlatformMode?-1:1),BE(2),ug("formControl",e.authTypeControl),NI(),BE(),Uw(e.authTypeOptions),BE(3),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(),jw(e.credentialFields().length>0?10:-1),BE(2),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var ke=new Set(["namespace","userOnNs","userGlobal"]),D=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),_e={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},me=class i{route=g(W);router=g(F);destroyRef=g(Ie);state=g(I);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Ui(true):F$1(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=nt;authTypeLabel=it;scopeOptions=[{value:"namespace",label:D.namespace},{value:"userOnNs",label:D.userOnNs},{value:"userGlobal",label:D.userGlobal}];nameControl=new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]});descriptionControl=new Te(null);authTypeControl=new Te("ApiKeyAuthSetting",{nonNullable:true,validators:[fn.required]});scopeControl=new Te("namespace",{nonNullable:true});form=new pt({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new Te("",{nonNullable:true});usernameControl=new Te("",{nonNullable:true});passwordControl=new Te("",{nonNullable:true});tokenControl=new Te("",{nonNullable:true});discoveryUrlControl=new Te("",{nonNullable:true});authorizationUrlControl=new Te("",{nonNullable:true});tokenUrlControl=new Te("",{nonNullable:true});clientIdControl=new Te("",{nonNullable:true});clientSecretControl=new Te("",{nonNullable:true});scopesControl=new Te("",{nonNullable:true});resourceUrlControl=new Te("",{nonNullable:true});selectedAuthType=F$1(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=XC(()=>_e[this.selectedAuthType()]);isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Af(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,n=t.get("authSettingId");if(n){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let o=this.parseScope(e.get("scope"));this.scopeControl.setValue(o);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&ke.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,n=e.username??"",o=e.password??"";this.usernameControl.setValue(n),this.passwordControl.setValue(o),this.initialCredentials.username=n,this.initialCredentials.password=o;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,n=this.authTypeControl.value,o=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(n,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,o,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,n){let o={name:e,description:n};switch(t){case "ApiKeyAuthSetting":return x(w({},o),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},o),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},o),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},o),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},o),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},o),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=yw({type:i,selectors:[["agentos-auth-setting-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to auth settings",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["legend","Configuration scope",3,"disabled"],["label","Auth type","controlId","as-auth-type","required",""],["dsControl","","id","as-auth-type",3,"formControl"],[3,"value"],["label","Name","controlId","as-name","required",""],["dsControl","","id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",3,"formControl"],["label","Description","controlId","as-description"],["dsControl","","id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",3,"formControl"],["legend","Credentials",3,"hint"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsCheck",""],["type","radio",3,"formControl","value","disabled"],[3,"label","controlId","required","hint","hintId"],["dsControl","",3,"id","type","placeholder","formControl","autocomplete"]],template:function(e,n){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return n.cancel()}),NC(3," \u2190 Auth settings "),pl()(),Lw(4,Ce,2,0,"p",2)(5,be,16,8,"form",3),pl()),e&2&&(BE(),ug("title",n.isEditMode()?"Edit auth setting":"New auth setting"),BE(3),jw(n.isLoading()?4:5));},dependencies:[pn,hn,cn,ln,dn,at,an,rn,Ut,nd,bo,xo,Lt,Gt,pa,mo,po,Vn,An],encapsulation:2})};
2
2
  export{me as AuthSettingFormComponent};
@@ -0,0 +1 @@
1
+ import {f,y,p as pt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,k as kn,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,g as dn,i as at,j as an}from'./chunk-DT4HydoN.js';import {g,W,F,E as J,I as Ie,X as XC,U as Ui,q as Af,G as U,K as w,M as x,y as yw,D as Ds,l as lg,L as Lw,p as pl,P as ug,a as BE,j as jw,N as NC,Z as Zw,Q as mg,_ as _I,J as Jw,R as NI,k as cg,v as vl,r as df,s as ff}from'./main-4M5ZCKCC.js';var ie=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function le(n){return ie.test(n)}function ne(n=()=>true){return t=>{let e=(t.value??"").trim();return !n()||e===""||le(e)?null:{absolutePath:true}}}function se(n,t){n&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function de(n,t){if(n&1){let e=Zw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Jw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),_I(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),_I(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),_I(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),_I(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),_I(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),_I(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),_I(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(f){df(e);let re=Jw();return ff(re.onMaxToolRoundsInput(f))}),pl(),_I(),pl(),Ds(17,"ds-form-field",21)(18,"select",22)(19,"option",23),NC(20,"Inherit platform default"),pl(),Ds(21,"option",24),NC(22,"Yes"),pl(),Ds(23,"option",25),NC(24,"No"),pl()(),_I(),pl(),Ds(25,"ds-form-actions")(26,"button",26),NC(27),pl(),Ds(28,"button",27),mg("click",function(){df(e);let f=Jw();return ff(f.cancel())}),NC(29,"Cancel"),pl()()();}if(n&2){let e=Jw();ug("formGroup",e.form),BE(2),ug("formControl",e.nameControl),NI(),BE(2),ug("formControl",e.descriptionControl),NI(),BE(2),ug("formControl",e.externalIdControl),NI(),BE(2),ug("formControl",e.defaultAgentNameControl),NI(),BE(2),ug("formControl",e.configPathControl),NI(),BE(),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),BE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),NI(),BE(),ug("hint",e.runCostThresholdHint()),BE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),NI(),BE(),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),BE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),NI(),BE(2),ug("formControl",e.adminCanListAllCasesControl),NI(),BE(8),ug("disabled",e.form.invalid||e.isSubmitting()),BE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var me=1,ce=2147483647,he=n=>n===true?"yes":n===false?"no":"inherit",ue=n=>n==="yes"?true:n==="no"?false:void 0,ae=class n{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=XC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=XC(()=>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=XC(()=>{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=XC(()=>{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:[ne(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(me),fn.max(ce),fn.pattern(/^\d+$/)]}),adminCanListAllCases:new Te("inherit",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}get adminCanListAllCasesControl(){return this.form.controls.adminCanListAllCases}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.adminCanListAllCasesControl.setValue(he(e.adminCanListAllCases)),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,adminCanListAllCases:ue(this.adminCanListAllCasesControl.value)}),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||n)};static \u0275cmp=yw({type:n,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Admins can list all cases","controlId","ns-admin-list-all-cases","hintId","ns-admin-list-all-cases-hint","hint","Gives the administrators of this namespace a Mine / All cases switch in the case drawer. It only changes what the drawer lists, not who may open a case. Inherit follows the platform default (off unless the server sets AGENTOS_CASE_ADMIN_LIST_ALL_CASES_DEFAULT)."],["dsControl","","id","ns-admin-list-all-cases","aria-describedby","ns-admin-list-all-cases-hint",3,"formControl"],["value","inherit"],["value","yes"],["value","no"],["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),Lw(2,se,2,0,"p",2)(3,de,30,20,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),BE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),BE(),jw(u.isLoading()?2:3));},dependencies:[Ut,nd,bo,xo,Lt,kn,Gt,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{ae as NamespaceFormComponent};
@@ -1 +1 @@
1
- import {O as O$1}from'./chunk-B1I1hZNS.js';import {I}from'./chunk-Dn4mtCZo.js';import {O}from'./chunk-DueFkMuu.js';import {g,I as Ie$1,U as Ui,X as XC,a9 as F,at as wy,ad as ne,G as U,y as yw,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,N as NC,Z as Zw,Q as mg,J as Jw,P as ug,_ as _I,H as Hw,O as Og,R as NI,m as Uw,v as vl,ae as Fw,r as df,s as ff,M as x,K as w}from'./main-BGDYOJBA.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,l as bo,x as xo,L as Lt,G as Gt,m as mo,b as po,A as An,v as va,c as pn,h as hn,d as cn,Z as un,e as dn,g as at,i as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),NC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Se(o,e){if(o&1){let t=Zw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Jw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),NC(4,"Email"),pl(),Ds(5,"dd"),NC(6),pl(),Ds(7,"dt"),NC(8,"External ID"),pl(),Ds(9,"dd"),NC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),_I(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),_I(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),_I(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Hw(20,xe,2,2,"option",27,ye),pl(),_I(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),NC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Jw(2);return ff(s.cancelEditing())}),NC(26,"Cancel"),pl()()();}if(o&2){let t=Jw(),l=Jw();ug("formGroup",l.form),BE(6),Og(t.email),BE(4),Og(t.externalId),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),NI(),BE(),Uw(l.languageOptions),BE(3),ug("disabled",l.isSaving()),BE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),NC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=Zw();Ds(0,"span",38),NC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.confirmDelete(s))}),NC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Jw(6);return ff(s.cancelDelete())}),NC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=Zw();Ds(0,"button",40),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.armDelete(s))}),NC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),NC(2),pl(),Ds(3,"span",36),NC(4),pl(),Lw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Jw(5);BE(2),Og(t.name),BE(2),Og(t.subtitle),BE(),jw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),NC(1),pl(),Ds(2,"ul",33),Hw(3,De,7,3,"li",34,Fw().trackEntry,true),pl()),o&2){let t=e.$implicit;BE(),Og(t.title),BE(2),Uw(t.entries);}}function Ve(o,e){if(o&1&&Hw(0,we,5,1,null,null,Ce),o&2){let t=Jw(3);Uw(t.recapSections());}}function Ue(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),NC(3,"Email"),pl(),Ds(4,"dd"),NC(5),pl(),Ds(6,"dt"),NC(7,"External ID"),pl(),Ds(8,"dd"),NC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),NC(13,"First name"),pl(),Ds(14,"dd"),NC(15),pl(),Ds(16,"dt"),NC(17,"Last name"),pl(),Ds(18,"dd"),NC(19),pl(),Ds(20,"dt"),NC(21,"Bio"),pl(),Ds(22,"dd"),NC(23),pl(),Ds(24,"dt"),NC(25,"Language"),pl(),Ds(26,"dd"),NC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Jw(2);return ff(s.startEditing())}),NC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Jw(2);return ff(s.toggleOverrides())}),Lw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Jw(),l=Jw();BE(5),Og(t.email),BE(4),Og(t.externalId),BE(6),Og(t.firstname||"\u2014"),BE(4),Og(t.lastname||"\u2014"),BE(4),Og(t.bio||"\u2014"),BE(4),Og(t.preferredLanguage||"\u2014"),BE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),jw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setShowTechnical(s))}),pl()()(),Lw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Jw();BE(),ug("hint",t.activeVariantDescription()),BE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),ug("options",t.modeOptions())("value",t.shownMode()),BE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),jw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),NC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=XC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=XC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=XC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=XC(()=>d(this.themeVariant()).label);activeVariantDescription=XC(()=>d(this.themeVariant()).description);modeOptions=XC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=XC(()=>this.modeOverridden()?v(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=XC(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=Ui(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;BE(2),jw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
1
+ import {O as O$1}from'./chunk-nOlo8Y_5.js';import {I}from'./chunk-Bcbf5ZJu.js';import {O}from'./chunk-BOVza9Oc.js';import {g,I as Ie$1,U as Ui,X as XC,a9 as F,at as wy,ad as ne,G as U,y as yw,D as Ds,l as lg,L as Lw,p as pl,a as BE,j as jw,N as NC,Z as Zw,Q as mg,J as Jw,P as ug,_ as _I,H as Hw,O as Og,R as NI,m as Uw,v as vl,ae as Fw,r as df,s as ff,M as x,K as w}from'./main-4M5ZCKCC.js';import {y,N as D,Q as B,R as a,p as pt,T as Te$1,X as f,Y as A,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,A as An,v as va,d as pn,h as hn,e as cn,Z as un,g as dn,i as at,j as an,q as sn,a0 as Ti,K as Oi,a1 as d,a2 as v}from'./chunk-DT4HydoN.js';import'./chunk-DHBOaxUB.js';var ye=(o,e)=>e.value,Ce=(o,e)=>e.title;function be(o,e){o&1&&(Ds(0,"p",2),NC(1,"Loading\u2026"),pl());}function xe(o,e){if(o&1&&(Ds(0,"option",27),NC(1),pl()),o&2){let t=e.$implicit;ug("value",t.value),BE(),Og(t.label);}}function Se(o,e){if(o&1){let t=Zw();Ds(0,"form",15),mg("ngSubmit",function(){df(t);let s=Jw(2);return ff(s.save())}),Ds(1,"ds-group",16)(2,"dl",17)(3,"dt"),NC(4,"Email"),pl(),Ds(5,"dd"),NC(6),pl(),Ds(7,"dt"),NC(8,"External ID"),pl(),Ds(9,"dd"),NC(10),pl()()(),Ds(11,"ds-group",18)(12,"ds-form-field",19),lg(13,"input",20),_I(),pl(),Ds(14,"ds-form-field",21),lg(15,"input",22),_I(),pl(),Ds(16,"ds-form-field",23),lg(17,"textarea",24),_I(),pl(),Ds(18,"ds-form-field",25)(19,"select",26),Hw(20,xe,2,2,"option",27,ye),pl(),_I(),pl()(),Ds(22,"ds-form-actions")(23,"button",28),NC(24),pl(),Ds(25,"button",29),mg("click",function(){df(t);let s=Jw(2);return ff(s.cancelEditing())}),NC(26,"Cancel"),pl()()();}if(o&2){let t=Jw(),l=Jw();ug("formGroup",l.form),BE(6),Og(t.email),BE(4),Og(t.externalId),BE(3),NI(),BE(2),NI(),BE(2),NI(),BE(2),NI(),BE(),Uw(l.languageOptions),BE(3),ug("disabled",l.isSaving()),BE(),vl(" ",l.isSaving()?"Saving\u2026":"Save changes"," ");}}function Ee(o,e){o&1&&(Ds(0,"p",2),NC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),pl());}function Pe(o,e){if(o&1){let t=Zw();Ds(0,"span",38),NC(1,"Delete?"),pl(),Ds(2,"button",39),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.confirmDelete(s))}),NC(3,"Confirm"),pl(),Ds(4,"button",40),mg("click",function(){df(t);let s=Jw(6);return ff(s.cancelDelete())}),NC(5,"Cancel"),pl();}}function Te(o,e){if(o&1){let t=Zw();Ds(0,"button",40),mg("click",function(){df(t);let s=Jw().$implicit,m=Jw(5);return ff(m.armDelete(s))}),NC(1,"Delete"),pl();}}function De(o,e){if(o&1&&(Ds(0,"li",34)(1,"span",35),NC(2),pl(),Ds(3,"span",36),NC(4),pl(),Lw(5,Pe,6,0)(6,Te,2,0,"button",37),pl()),o&2){let t=e.$implicit,l=Jw(5);BE(2),Og(t.name),BE(2),Og(t.subtitle),BE(),jw(l.isPendingDelete(t)?5:6);}}function we(o,e){if(o&1&&(Ds(0,"span",32),NC(1),pl(),Ds(2,"ul",33),Hw(3,De,7,3,"li",34,Fw().trackEntry,true),pl()),o&2){let t=e.$implicit;BE(),Og(t.title),BE(2),Uw(t.entries);}}function Ve(o,e){if(o&1&&Hw(0,we,5,1,null,null,Ce),o&2){let t=Jw(3);Uw(t.recapSections());}}function Ue(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",16)(1,"dl",17)(2,"dt"),NC(3,"Email"),pl(),Ds(4,"dd"),NC(5),pl(),Ds(6,"dt"),NC(7,"External ID"),pl(),Ds(8,"dd"),NC(9),pl()()(),Ds(10,"ds-group",18)(11,"dl",17)(12,"dt"),NC(13,"First name"),pl(),Ds(14,"dd"),NC(15),pl(),Ds(16,"dt"),NC(17,"Last name"),pl(),Ds(18,"dd"),NC(19),pl(),Ds(20,"dt"),NC(21,"Bio"),pl(),Ds(22,"dd"),NC(23),pl(),Ds(24,"dt"),NC(25,"Language"),pl(),Ds(26,"dd"),NC(27),pl()()(),Ds(28,"ds-form-actions")(29,"button",30),mg("click",function(){df(t);let s=Jw(2);return ff(s.startEditing())}),NC(30,"Edit profile"),pl()(),Ds(31,"ds-disclosure",31),mg("toggled",function(){df(t);let s=Jw(2);return ff(s.toggleOverrides())}),Lw(32,Ee,2,0,"p",2)(33,Ve,2,0),pl();}if(o&2){let t=Jw(),l=Jw();BE(5),Og(t.email),BE(4),Og(t.externalId),BE(6),Og(t.firstname||"\u2014"),BE(4),Og(t.lastname||"\u2014"),BE(4),Og(t.bio||"\u2014"),BE(4),Og(t.preferredLanguage||"\u2014"),BE(4),ug("heading","My global user configurations ("+l.recap().total+")")("open",l.isOverridesExpanded()),BE(),jw(l.recap().total===0?32:33);}}function Me(o,e){if(o&1){let t=Zw();Ds(0,"ds-group",3)(1,"ds-form-field",4)(2,"ds-segmented",5),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setThemeVariant(s))}),pl()(),Ds(3,"ds-form-field",6)(4,"ds-segmented",7),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setTheme(s))}),pl()()(),Ds(5,"ds-group",8)(6,"ds-form-field",9)(7,"ds-segmented",10),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setEnterKeyBehavior(s))}),pl()()(),Ds(8,"ds-group",11)(9,"ds-form-field",12)(10,"ds-segmented",13),mg("valueChange",function(s){df(t);let m=Jw();return ff(m.setShowTechnical(s))}),pl()()(),Lw(11,Se,27,5,"form",14)(12,Ue,34,9);}if(o&2){let t=Jw();BE(),ug("hint",t.activeVariantDescription()),BE(),ug("options",t.themeVariantOptions)("value",t.themeVariant()),BE(),ug("hint",t.modeOverridden()?t.activeVariantLabel()+" does not support this mode; your choice is kept for other skins.":null),BE(),ug("options",t.modeOptions())("value",t.shownMode()),BE(3),ug("options",t.enterKeyOptions)("value",t.enterKeyBehavior()),BE(3),ug("options",t.showTechnicalOptions)("value",t.showTechnical()),BE(),jw(t.isEditing()?11:12);}}function Ie(o,e){o&1&&(Ds(0,"p",2),NC(1,"Unable to load profile."),pl());}var ve=class o{userState=g(y);destroyRef=g(Ie$1);integrationState=g(O);providerState=g(O$1);authSettingState=g(I);themePort=g(D);preferencesPort=g(B);isEditing=Ui(false);isLoading=Ui(false);isSaving=Ui(false);isOverridesExpanded=Ui(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=XC(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=XC(()=>this.themePort.theme().variant);themeVariantOptions=a.map(({id:e,label:t,description:l})=>({value:e,label:t,description:l}));modeOverridden=XC(()=>!A(this.themeVariant(),this.themeMode()));activeVariantLabel=XC(()=>d(this.themeVariant()).label);activeVariantDescription=XC(()=>d(this.themeVariant()).description);modeOptions=XC(()=>this.themeOptions.map(e=>x(w({},e),{disabled:this.isModeDisabled(e.value)})));shownMode=XC(()=>this.modeOverridden()?v(this.themeVariant(),this.themeMode(),false):this.themeMode());enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];showTechnical=this.preferencesPort.showTechnical;showTechnicalOptions=[{value:true,label:"Shown"},{value:false,label:"Hidden"}];languageOptions=[{value:"",label:"No preference (English fallback)"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"es",label:"Spanish"},{value:"pt",label:"Portuguese"},{value:"it",label:"Italian"},{value:"nl",label:"Dutch"},{value:"pl",label:"Polish"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"}];form=new pt({firstname:new Te$1("",{nonNullable:true}),lastname:new Te$1("",{nonNullable:true}),bio:new Te$1("",{nonNullable:true}),preferredLanguage:new Te$1("",{nonNullable:true})});recap=F(wy([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ne(([e,t,l])=>{let s=e.map(g=>({category:"integration",id:g.id??"",name:g.name,subtitle:g.integrationType})),m=t.map(g=>({category:"aiProvider",id:g.id??"",name:g.name,subtitle:g.apiType})),I=l.map(g=>({category:"authSetting",id:g.id??"",name:g.name,subtitle:g.authType}));return {integrations:s,aiProviders:m,authSettings:I,total:s.length+m.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});recapSections=XC(()=>{let e=this.recap();return [{title:"Integrations",entries:e.integrations},{title:"AI Providers",entries:e.aiProviders},{title:"My global auth settings",entries:e.authSettings}].filter(t=>t.entries.length>0)});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(e){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:e});}setThemeVariant(e){f(e)&&this.themePort.setTheme({variant:e,mode:this.themePort.theme().mode});}isModeDisabled(e){return !A(this.themeVariant(),e)}setEnterKeyBehavior(e){this.preferencesPort.setEnterKeyBehavior(e);}setShowTechnical(e){this.preferencesPort.setShowTechnical(e);}save(){if(this.isSaving())return;this.isSaving.set(true);let e=this.form.controls.preferredLanguage.value.trim();this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0,preferredLanguage:e||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)});}toggleOverrides(){this.isOverridesExpanded.update(e=>!e),this.pendingDeleteKey.set(null);}pendingDeleteKey=Ui(null);isPendingDelete(e){return this.pendingDeleteKey()===this.entryKey(e)}armDelete(e){e.id&&this.pendingDeleteKey.set(this.entryKey(e));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(e){if(!e.id)return;this.pendingDeleteKey.set(null),(e.category==="integration"?this.integrationState.delete(e.id,"userGlobal"):e.category==="authSetting"?this.authSettingState.delete(e.id,"userGlobal"):this.providerState.delete(e.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:l=>{console.error(`[UserProfile] Delete failed for ${e.category}:${e.id}:`,l);}});}entryKey(e){return `${e.category}:${e.id}`}trackEntry(e,t){return this.entryKey(t)}syncFormFromState(){let e=this.currentUser();e&&this.form.setValue({firstname:e.firstname??"",lastname:e.lastname??"",bio:e.bio??"",preferredLanguage:e.preferredLanguage??""});}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=yw({type:o,selectors:[["agentos-user-profile"]],decls:5,vars:1,consts:[["framed",""],["title","My profile"],[1,"ds-hint"],["heading","Appearance"],["label","Skin",3,"hint"],["label","Skin",3,"valueChange","options","value"],["label","Mode",3,"hint"],["label","Color mode",3,"valueChange","options","value"],["heading","Composer"],["label","Enter key","hint",'In "New line" mode, press Ctrl or Cmd + Enter to send.'],["label","Enter key behavior",3,"valueChange","options","value"],["heading","Case chat"],["label","Technical logs","hint","Show system log lines (agent status, tool selection...) in the case chat."],["label","Technical logs",3,"valueChange","options","value"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["heading","Identity"],["dsDefinitionList",""],["heading","Profile"],["label","First name","controlId","up-firstname"],["dsControl","","id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name"],["label","Last name","controlId","up-lastname"],["dsControl","","id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name"],["label","Bio","controlId","up-bio"],["dsControl","","id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4"],["label","Language","controlId","up-preferredLanguage"],["dsControl","","id","up-preferredLanguage","formControlName","preferredLanguage"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsButton","","variant","primary","type","button",3,"click"],[3,"toggled","heading","open"],[1,"ds-micro"],[1,"ds-list"],[1,"ds-row"],[1,"ds-strong","ds-row__grow"],[1,"ds-meta"],["dsButton","","variant","ghost","type","button"],[1,"ds-error"],["dsButton","","variant","danger","type","button",3,"click"],["dsButton","","variant","ghost","type","button",3,"click"]],template:function(t,l){if(t&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Lw(2,be,2,0,"p",2)(3,Me,13,11)(4,Ie,2,0,"p",2),pl()),t&2){let s;BE(2),jw(l.isLoading()?2:(s=l.currentUser())?3:4,s);}},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,An,va,pn,hn,cn,un,dn,at,an,sn,Ti,Oi],encapsulation:2})};export{ve as UserProfileComponent};
@@ -1 +1 @@
1
- import {I as I$1}from'./chunk-Dn4mtCZo.js';import {g,F,I as Ie,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-BGDYOJBA.js';import {z as k,O as O$1,g as at,h as hn,I as Io,P,B as P$1}from'./chunk-DvqKcX7A.js';import'./chunk-AYvnGrVn.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Ds(0,"p",3),NC(1),pl()),e&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading auth settings\u2026"),pl());}function H(e,t){e&1&&(Ds(0,"p",5),NC(1,"No platform auth settings defined yet."),pl());}function U(e,t){e&1&&(Ds(0,"p",4),NC(1,"No auth settings match the current filter."),pl());}function z(e,t){if(e&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.onEdit(d))}),NC(1," Edit "),pl();}if(e&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=Zw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.onDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(e&2){let n=Jw().$implicit,a=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15),Lw(7,z,2,1,"button",16),Lw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),e&2){let n=t.$implicit,a=Jw(2);BE(2),Og(n.name),BE(2),vl(" ",n.authType," "),BE(3),jw(a.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(e,t){if(e&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Authentication type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,B),pl()()()),e&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(Ie);state=g(I$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();settings=Ui([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(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()}),NC(3,"New auth setting"),pl()(),Lw(4,j,2,1,"p",3),Lw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
1
+ import {I as I$1}from'./chunk-Bcbf5ZJu.js';import {g,F,I as Ie,$ as Cr,U as Ui,a1 as fa,G as U$1,y as yw,D as Ds,Q as mg,p as pl,N as NC,L as Lw,a as BE,P as ug,j as jw,J as Jw,O as Og,H as Hw,m as Uw,v as vl,Z as Zw,k as cg,r as df,s as ff}from'./main-4M5ZCKCC.js';import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-DT4HydoN.js';import'./chunk-DHBOaxUB.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Ds(0,"p",3),NC(1),pl()),e&2){let n=Jw();BE(),Og(n.deletion.error());}}function K(e,t){e&1&&(Ds(0,"p",4),NC(1,"Loading auth settings\u2026"),pl());}function H(e,t){e&1&&(Ds(0,"p",5),NC(1,"No platform auth settings defined yet."),pl());}function U(e,t){e&1&&(Ds(0,"p",4),NC(1,"No auth settings match the current filter."),pl());}function z(e,t){if(e&1){let n=Zw();Ds(0,"button",18),mg("click",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.onEdit(d))}),NC(1," Edit "),pl();}if(e&2){let n=Jw().$implicit;cg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=Zw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Jw().$implicit,m=Jw(2);return ff(m.onDelete(d))})("deleteCancelled",function(){df(n);let d=Jw(3);return ff(d.deletion.cancel())}),pl();}if(e&2){let n=Jw().$implicit,a=Jw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Ds(0,"tr",9)(1,"td",12),NC(2),pl(),Ds(3,"td",13),NC(4),pl(),Ds(5,"td",14)(6,"div",15),Lw(7,z,2,1,"button",16),Lw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),e&2){let n=t.$implicit,a=Jw(2);BE(2),Og(n.name),BE(2),vl(" ",n.authType," "),BE(3),jw(a.deletion.confirmingId()!==n.id?7:-1),BE(),jw(n.id?8:-1);}}function O(e,t){if(e&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),NC(5,"Name"),pl(),Ds(6,"th",10),NC(7,"Authentication type"),pl(),Ds(8,"th",10)(9,"span",11),NC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Hw(12,J,9,4,"tr",9,B),pl()()()),e&2){let n=Jw();BE(12),Uw(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(Ie);state=g(I$1);refresh$=new Cr(void 0);isLoading=Ui(true);deletion=k();settings=Ui([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=yw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(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()}),NC(3,"New auth setting"),pl()(),Lw(4,j,2,1,"p",3),Lw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),ug("query",a.rowFilter.query()),BE(3),jw(a.deletion.error()?4:-1),BE(),jw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};