@whoz-oss/coday-client 0.0.0-workstream-forge.174 → 0.0.0-workstream-forge.176

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-EYD9zhHn.js → chunk-0BNWiX7D.js} +1 -1
  2. package/browser/{chunk-DYJuiWfW.js → chunk-9ueom5De.js} +1 -1
  3. package/browser/{chunk-Bl1tYksF.js → chunk-AaFDZl6Z.js} +1 -1
  4. package/browser/{chunk-pzVsG328.js → chunk-BR-5Au2Z.js} +1 -1
  5. package/browser/{chunk-CvNJFt8x.js → chunk-BUWl4c14.js} +1 -1
  6. package/browser/{chunk-Bp6Gq-Dc.js → chunk-BaDE7xKv.js} +1 -1
  7. package/browser/{chunk-BAKVIDen.js → chunk-Bfi8cg9e.js} +1 -1
  8. package/browser/{chunk-BUflawI3.js → chunk-BkqWs4rr.js} +1 -1
  9. package/browser/{chunk-BhWuGdEN.js → chunk-Bm4Tg0x5.js} +1 -1
  10. package/browser/{chunk-C2YemXdZ.js → chunk-BpJMaJFx.js} +1 -1
  11. package/browser/{chunk-CKiLuQFk.js → chunk-BqHxNtaE.js} +1 -1
  12. package/browser/{chunk-DDz-Pegy.js → chunk-Bs8w6Vpo.js} +1 -1
  13. package/browser/{chunk-DXAEOZdK.js → chunk-Bvt8e4iS.js} +1 -1
  14. package/browser/{chunk-KXo9hugg.js → chunk-Byp2Kb8V.js} +1 -1
  15. package/browser/{chunk-BAzrPfVo.js → chunk-C-o2MYpi.js} +1 -1
  16. package/browser/{chunk--RuxhGbv.js → chunk-C642zuK0.js} +1 -1
  17. package/browser/{chunk-DSMyAk88.js → chunk-C9JqGG6H.js} +1 -1
  18. package/browser/{chunk-Dmzz40x7.js → chunk-CGTC28jK.js} +1 -1
  19. package/browser/{chunk-zJN7xh5t.js → chunk-CJ7ucGNe.js} +1 -1
  20. package/browser/{chunk-04_sOTTU.js → chunk-Cbge0VeG.js} +1 -1
  21. package/browser/{chunk-RFzc8BMm.js → chunk-CbhhHOWw.js} +1 -1
  22. package/browser/{chunk-Df35lXxH.js → chunk-CoOWaN_P.js} +1 -1
  23. package/browser/{chunk-DlC9BBW9.js → chunk-CuNMKAVw.js} +1 -1
  24. package/browser/{chunk-C1_RDQ6a.js → chunk-Cwy7lann.js} +1 -1
  25. package/browser/{chunk-B28h64OU.js → chunk-Cy6LoztM.js} +1 -1
  26. package/browser/{chunk-BzXEZzAO.js → chunk-CzinaUsz.js} +1 -1
  27. package/browser/{chunk-Fem-i7zu.js → chunk-D1JOCtgw.js} +1 -1
  28. package/browser/{chunk-knFGDN5j.js → chunk-D4TrJsZD.js} +1 -1
  29. package/browser/{chunk-CHfdKVCn.js → chunk-DMYr01nE.js} +1 -1
  30. package/browser/{chunk--imgNMKh.js → chunk-DOBELEtj.js} +1 -1
  31. package/browser/chunk-DeQOcTxZ.js +668 -0
  32. package/browser/{chunk-zxNRyIEC.js → chunk-Dg-bjWHO.js} +1 -1
  33. package/browser/{chunk-cX2sgV10.js → chunk-Dqo0K8ka.js} +1 -1
  34. package/browser/{chunk-rxt7ASlY.js → chunk-Dvxze2ht.js} +1 -1
  35. package/browser/{chunk-D9h4MuDW.js → chunk-YkIwrd-W.js} +1 -1
  36. package/browser/{chunk-BZ27AGeb.js → chunk-_gtDJLMD.js} +1 -1
  37. package/browser/chunk-c8JwL_5n.js +1 -0
  38. package/browser/{chunk-oSPZOgi0.js → chunk-fyclQ-oW.js} +1 -1
  39. package/browser/{chunk-CuQzeX42.js → chunk-fzkXwZ8m.js} +1 -1
  40. package/browser/{chunk-BYIEWcxl.js → chunk-fzt0u0U7.js} +1 -1
  41. package/browser/{chunk-7IEeHimQ.js → chunk-gED0F9cF.js} +1 -1
  42. package/browser/{chunk-TMdUALnf.js → chunk-m4MQGFs3.js} +1 -1
  43. package/browser/{chunk-DoADEwZ9.js → chunk-mzGD7t-J.js} +1 -1
  44. package/browser/{chunk-ClXLPnzi.js → chunk-nfjj7zn6.js} +1 -1
  45. package/browser/{chunk-nXCMX_XM.js → chunk-qoIZ3288.js} +1 -1
  46. package/browser/{chunk-_gpyQyb1.js → chunk-wmYIOt3w.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-BDHAW6RK.js → main-VHZF3DP6.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-BuYWQnhP.js +0 -668
  51. package/browser/chunk-ETz6T3aD.js +0 -1
@@ -1 +1 @@
1
- import {p}from'./chunk-BuYWQnhP.js';import {g,W,t as Xm,u as y,m as mw,h as hl,M as MC,b as gl,j as jE,O as Og}from'./main-BDHAW6RK.js';var A=class r{route=g(W);http=g(Xm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=mw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),MC(1),gl()),t&2&&(jE(),Og(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
1
+ import {p}from'./chunk-DeQOcTxZ.js';import {g,W,t as Xm,u as y,m as mw,h as hl,M as MC,b as gl,j as jE,O as Og}from'./main-VHZF3DP6.js';var A=class r{route=g(W);http=g(Xm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=mw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(hl(0,"p",0),MC(1),gl()),t&2&&(jE(),Og(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1,2 +1,2 @@
1
- import {R}from'./chunk-ClXLPnzi.js';import {g,W,aS as L,I as Ie,U as Ui,K as KC,aT as Be,aj as Ty,x as U,a2 as da,aa as Cr,m as mw,D as Ds,l as lg,P as Pw,a as pl,N as mg,j as jE,L as Lw,G as ug,M as MC,q as qw,Q as SI,V as Vw,X as Xw,T as MI,H as Hw,v as vl,aq as kg,k as df,n as ff,O as Og}from'./main-BDHAW6RK.js';import {a3 as id,o as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a5 as da$1,a9 as Ni,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-BuYWQnhP.js';import'./chunk-ETz6T3aD.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Ds(0,"p",1),MC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function re(i,t){if(i&1){let e=qw();Ds(0,"div")(1,"button",23),mg("click",function(){df(e);let s=Xw(2);return ff(s.retryLoad())}),MC(2,"Retry loading"),pl()();}}function ce(i,t){if(i&1&&(lg(0,"br"),MC(1)),i&2){let e=Xw(3);jE(),vl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Ds(0,"ds-notice",3),MC(1),Pw(2,ce,2,1),pl()),i&2){let e=Xw(2);ug("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),jE(),vl(" Repository: ",e.checkoutStatus()," "),jE(),Lw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Ds(0,"option",12),MC(1),pl()),i&2){let e=t.$implicit,c=Xw(2);ug("value",e.id),jE(),kg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Ds(0,"p",13),MC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function pe(i,t){if(i&1){let e=qw();Ds(0,"button",24),mg("click",function(){df(e);let s=Xw(2);return ff(s.remove())}),MC(1," Remove association "),pl();}if(i&2){let e=Xw(2);ug("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=qw();Pw(0,se,2,1,"ds-notice"),Pw(1,re,3,0,"div"),Pw(2,de,3,3,"ds-notice",3),Ds(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.repositoryUrl.set(s))}),pl(),SI(),pl(),Ds(6,"ds-form-field",7)(7,"input",8),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.mainBranch.set(s))}),pl(),SI(),pl(),Ds(8,"ds-form-field",9)(9,"select",10),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.serviceAuthSettingId.set(s))}),Ds(10,"option",11),MC(11,"Select an auth setting\u2026"),pl(),Vw(12,le,2,3,"option",12,oe),pl(),SI(),Pw(14,me,2,0,"p",13),pl()(),Ds(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.autoWorktree.set(s))}),pl(),SI(),MC(19," Offer a worktree to every new top-level case "),pl(),Ds(20,"p",18),MC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),pl()(),Ds(22,"ds-form-field",19)(23,"input",20),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.setupCommand.set(s))}),pl(),SI(),Ds(24,"p",13),MC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),pl()()(),Ds(26,"ds-form-actions")(27,"button",21),mg("click",function(){df(e);let s=Xw();return ff(s.save())}),MC(28),pl(),Pw(29,pe,2,1,"button",22),pl();}if(i&2){let e=Xw();Lw(e.errorMessage()?0:-1),jE(),Lw(e.associationLoaded()?-1:1),jE(),Lw(e.isAssociated()&&e.checkoutStatus()?2:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(2),ug("ngModel",e.repositoryUrl()),MI(),jE(2),ug("ngModel",e.mainBranch()),MI(),jE(2),ug("ngModel",e.serviceAuthSettingId()),MI(),jE(3),Hw(e.eligibleAuthSettings()),jE(2),Lw(e.eligibleAuthSettings().length===0?14:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(3),ug("ngModel",e.autoWorktree()),MI(),jE(5),ug("ngModel",e.setupCommand()),MI(),jE(4),ug("disabled",!e.canSave()),jE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),jE(),Lw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(R);destroyRef=g(Ie);isLoading=Ui(true);isSaving=Ui(false);confirmingRemove=Ui(false);associationLoaded=Ui(false);errorMessage=Ui(null);association=Ui(null);authSettings=Ui([]);repositoryUrl=Ui("");mainBranch=Ui("main");serviceAuthSettingId=Ui("");autoWorktree=Ui(false);setupCommand=Ui("");namespaceId="";isAssociated=KC(()=>this.association()?.associated===true);eligibleAuthSettings=KC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=KC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=KC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Be;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ty({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),da(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),da(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Pw(2,ae,2,0,"p",1)(3,ue,30,14),pl(),Ds(4,"ds-confirm-dialog",2),mg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),pl()),e&2&&(jE(2),Lw(c.isLoading()?2:3),jE(2),ug("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da$1,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
1
+ import {R}from'./chunk-nfjj7zn6.js';import {g,W,aS as L,I as Ie,U as Ui,K as KC,aT as Be,aj as Ty,x as U,a2 as da,aa as Cr,m as mw,D as Ds,l as lg,P as Pw,a as pl,N as mg,j as jE,L as Lw,G as ug,M as MC,q as qw,Q as SI,V as Vw,X as Xw,T as MI,H as Hw,v as vl,aq as kg,k as df,n as ff,O as Og}from'./main-VHZF3DP6.js';import {a3 as id,o as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a5 as da$1,a9 as Ni,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-DeQOcTxZ.js';import'./chunk-c8JwL_5n.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Ds(0,"p",1),MC(1,"Loading\u2026"),pl());}function se(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function re(i,t){if(i&1){let e=qw();Ds(0,"div")(1,"button",23),mg("click",function(){df(e);let s=Xw(2);return ff(s.retryLoad())}),MC(2,"Retry loading"),pl()();}}function ce(i,t){if(i&1&&(lg(0,"br"),MC(1)),i&2){let e=Xw(3);jE(),vl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Ds(0,"ds-notice",3),MC(1),Pw(2,ce,2,1),pl()),i&2){let e=Xw(2);ug("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),jE(),vl(" Repository: ",e.checkoutStatus()," "),jE(),Lw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Ds(0,"option",12),MC(1),pl()),i&2){let e=t.$implicit,c=Xw(2);ug("value",e.id),jE(),kg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Ds(0,"p",13),MC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function pe(i,t){if(i&1){let e=qw();Ds(0,"button",24),mg("click",function(){df(e);let s=Xw(2);return ff(s.remove())}),MC(1," Remove association "),pl();}if(i&2){let e=Xw(2);ug("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=qw();Pw(0,se,2,1,"ds-notice"),Pw(1,re,3,0,"div"),Pw(2,de,3,3,"ds-notice",3),Ds(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.repositoryUrl.set(s))}),pl(),SI(),pl(),Ds(6,"ds-form-field",7)(7,"input",8),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.mainBranch.set(s))}),pl(),SI(),pl(),Ds(8,"ds-form-field",9)(9,"select",10),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.serviceAuthSettingId.set(s))}),Ds(10,"option",11),MC(11,"Select an auth setting\u2026"),pl(),Vw(12,le,2,3,"option",12,oe),pl(),SI(),Pw(14,me,2,0,"p",13),pl()(),Ds(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.autoWorktree.set(s))}),pl(),SI(),MC(19," Offer a worktree to every new top-level case "),pl(),Ds(20,"p",18),MC(21," The creator checks the box when creating the case; it is unchecked by default, and a case created without it has no Git. Applies to cases created from now on: turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),pl()(),Ds(22,"ds-form-field",19)(23,"input",20),mg("ngModelChange",function(s){df(e);let u=Xw();return ff(u.setupCommand.set(s))}),pl(),SI(),Ds(24,"p",13),MC(25," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),pl()()(),Ds(26,"ds-form-actions")(27,"button",21),mg("click",function(){df(e);let s=Xw();return ff(s.save())}),MC(28),pl(),Pw(29,pe,2,1,"button",22),pl();}if(i&2){let e=Xw();Lw(e.errorMessage()?0:-1),jE(),Lw(e.associationLoaded()?-1:1),jE(),Lw(e.isAssociated()&&e.checkoutStatus()?2:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(2),ug("ngModel",e.repositoryUrl()),MI(),jE(2),ug("ngModel",e.mainBranch()),MI(),jE(2),ug("ngModel",e.serviceAuthSettingId()),MI(),jE(3),Hw(e.eligibleAuthSettings()),jE(2),Lw(e.eligibleAuthSettings().length===0?14:-1),jE(),ug("disabled",!e.associationLoaded()||e.isSaving()),jE(3),ug("ngModel",e.autoWorktree()),MI(),jE(5),ug("ngModel",e.setupCommand()),MI(),jE(4),ug("disabled",!e.canSave()),jE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),jE(),Lw(e.isAssociated()?29:-1);}}var ge=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],he={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},ne=class i{route=g(W);gitApi=g(L);authSettingState=g(R);destroyRef=g(Ie);isLoading=Ui(true);isSaving=Ui(false);confirmingRemove=Ui(false);associationLoaded=Ui(false);errorMessage=Ui(null);association=Ui(null);authSettings=Ui([]);repositoryUrl=Ui("");mainBranch=Ui("main");serviceAuthSettingId=Ui("");autoWorktree=Ui(false);setupCommand=Ui("");namespaceId="";isAssociated=KC(()=>this.association()?.associated===true);eligibleAuthSettings=KC(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=KC(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=KC(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Be;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),Ty({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),da(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||this.confirmingRemove.set(true);}confirmRemove(){this.confirmingRemove.set(false),!(!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated())&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),da(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),Cr(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-git"]],decls:5,vars:2,consts:[["title","Git repository","description","Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, the new-case form offers a worktree, and a case created with one gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows."],[1,"ds-hint"],["title","Remove the repository association?","message","Existing workspaces keep their worktree.","confirmLabel","Remove","cancelLabel","Cancel",3,"confirmed","cancelled","open"],[3,"tone"],["legend","Repository",3,"disabled"],["label","Repository URL","controlId","git-url","hint","HTTPS only, without credentials in the URL."],["dsControl","","id","git-url","type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",3,"ngModelChange","ngModel"],["label","Main branch","controlId","git-branch","hint","New worktrees start at this branch\u2019s commit, without creating a branch."],["dsControl","","id","git-branch","type","text","placeholder","main","name","mainBranch",3,"ngModelChange","ngModel"],["label","Service account","controlId","git-auth","hint","Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case."],["dsControl","","id","git-auth","name","serviceAuthSettingId",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"ds-hint","ds-hint--warning"],["legend","Automation",3,"disabled"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],[1,"ds-hint","ds-indent"],["label","Setup command (optional)","controlId","git-setup"],["dsControl","","mono","","id","git-setup","type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",3,"ngModelChange","ngModel"],["id","git-save","dsButton","","variant","primary","type","button",3,"click","disabled"],["id","git-remove","dsButton","","variant","danger","type","button",3,"disabled"],["id","git-retry","dsButton","","type","button",3,"click"],["id","git-remove","dsButton","","variant","danger","type","button",3,"click","disabled"]],template:function(e,c){e&1&&(Ds(0,"ds-page"),lg(1,"ds-section-header",0),Pw(2,ae,2,0,"p",1)(3,ue,30,14),pl(),Ds(4,"ds-confirm-dialog",2),mg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),pl()),e&2&&(jE(2),Lw(c.isLoading()?2:3),jE(2),ug("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da$1,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
2
2
  export{ne as NamespaceGitComponent};
@@ -1 +1 @@
1
- import {D as m,z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-BuYWQnhP.js';import {g,F,I as Ie,$ as wr,U as Ui,a1 as fa,x as U$1,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,v as vl,q as qw,e as cg,k as df,n as ff}from'./main-BDHAW6RK.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),MC(1),pl()),t&2){let n=Xw();jE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),MC(1,"Loading prompts\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),MC(1,"No platform prompts defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),MC(1,"No prompts match the current filter."),pl());}function z(t,e){if(t&1){let n=qw();Ds(0,"button",18),mg("click",function(){df(n);let m=Xw().$implicit,p=Xw(2);return ff(p.edit(m))}),MC(1,"Edit"),pl();}if(t&2){let n=Xw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=qw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let m=Xw().$implicit,p=Xw(2);return ff(p.deletion.request(m.id))})("deleteConfirmed",function(){df(n);let m=Xw().$implicit,p=Xw(2);return ff(p.confirmDelete(m))})("deleteCancelled",function(){df(n);let m=Xw(3);return ff(m.deletion.cancel())}),pl();}if(t&2){let n=Xw().$implicit,r=Xw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15),Pw(7,z,2,1,"button",16),Pw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Xw(2);jE(2),Og(n.name),jE(2),vl(" ",n.description||"\u2014"," "),jE(3),Lw(r.deletion.confirmingId()!==n.id?7:-1),jE(),Lw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Description"),pl(),Ds(8,"th",10)(9,"span",11),MC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Vw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Xw();jE(12),Hw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);promptState=g(m);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();prompts=Ui([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=mw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["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","Platform 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","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,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return r.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),MC(3,"New prompt"),pl()(),Pw(4,A,2,1,"p",3),Pw(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&&(jE(),ug("query",r.rowFilter.query()),jE(3),Lw(r.deletion.error()?4:-1),jE(),Lw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
1
+ import {D as m,z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-DeQOcTxZ.js';import {g,F,I as Ie,$ as wr,U as Ui,a1 as fa,x as U$1,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,v as vl,q as qw,e as cg,k as df,n as ff}from'./main-VHZF3DP6.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),MC(1),pl()),t&2){let n=Xw();jE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),MC(1,"Loading prompts\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),MC(1,"No platform prompts defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),MC(1,"No prompts match the current filter."),pl());}function z(t,e){if(t&1){let n=qw();Ds(0,"button",18),mg("click",function(){df(n);let m=Xw().$implicit,p=Xw(2);return ff(p.edit(m))}),MC(1,"Edit"),pl();}if(t&2){let n=Xw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=qw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let m=Xw().$implicit,p=Xw(2);return ff(p.deletion.request(m.id))})("deleteConfirmed",function(){df(n);let m=Xw().$implicit,p=Xw(2);return ff(p.confirmDelete(m))})("deleteCancelled",function(){df(n);let m=Xw(3);return ff(m.deletion.cancel())}),pl();}if(t&2){let n=Xw().$implicit,r=Xw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15),Pw(7,z,2,1,"button",16),Pw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Xw(2);jE(2),Og(n.name),jE(2),vl(" ",n.description||"\u2014"," "),jE(3),Lw(r.deletion.confirmingId()!==n.id?7:-1),jE(),Lw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Description"),pl(),Ds(8,"th",10)(9,"span",11),MC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Vw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Xw();jE(12),Hw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);promptState=g(m);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();prompts=Ui([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=mw({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["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","Platform 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","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,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(p){return r.rowFilter.query.set(p)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),MC(3,"New prompt"),pl()(),Pw(4,A,2,1,"p",3),Pw(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&&(jE(),ug("query",r.rowFilter.query()),jE(3),Lw(r.deletion.error()?4:-1),jE(),Lw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
@@ -1 +1 @@
1
- import {z as k$1,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-BuYWQnhP.js';import {g,F,I as Ie,ao as k,an as F$1,$ as wr,U as Ui,a1 as fa,ar as wy,x as U$1,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,k as df,n as ff,v as vl,e as cg}from'./main-BDHAW6RK.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),MC(1),pl()),o&2){let e=Xw();jE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),MC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),MC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),MC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=qw();Ds(0,"button",21),mg("click",function(){df(e);let r=Xw().$implicit,m=Xw(2);return ff(m.edit(r))}),MC(1,"Edit"),pl();}if(o&2){let e=Xw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=qw();Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15),MC(8),pl(),Ds(9,"td",16),MC(10),pl(),Ds(11,"td",17)(12,"div",18),Pw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Xw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Xw(2);jE(2),Og(e.title),jE(2),Og(e.providerName),jE(2),vl(" ",e.model.apiModelName," "),jE(2),Og(e.model.priority),jE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),jE(3),Lw(a.deletion.confirmingId()!==e.key?13:-1),jE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Provider"),pl(),Ds(8,"th",10),MC(9,"API model name"),pl(),Ds(10,"th",10),MC(11,"Priority"),pl(),Ds(12,"th",10),MC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),MC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Vw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Xw();jE(18),Hw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New AI model"),pl()(),Pw(4,H,2,1,"p",3),Pw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
1
+ import {z as k$1,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-DeQOcTxZ.js';import {g,F,I as Ie,ao as k,an as F$1,$ as wr,U as Ui,a1 as fa,ar as wy,x as U$1,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,k as df,n as ff,v as vl,e as cg}from'./main-VHZF3DP6.js';var K=(o,t)=>t.key;function H(o,t){if(o&1&&(Ds(0,"p",3),MC(1),pl()),o&2){let e=Xw();jE(),Og(e.deletion.error());}}function U(o,t){o&1&&(Ds(0,"p",4),MC(1,"Loading AI models\u2026"),pl());}function z(o,t){o&1&&(Ds(0,"p",5),MC(1,"No platform AI models defined yet."),pl());}function G(o,t){o&1&&(Ds(0,"p",4),MC(1,"No AI models match the current filter."),pl());}function J(o,t){if(o&1){let e=qw();Ds(0,"button",21),mg("click",function(){df(e);let r=Xw().$implicit,m=Xw(2);return ff(m.edit(r))}),MC(1,"Edit"),pl();}if(o&2){let e=Xw().$implicit;cg("aria-label","Edit "+e.title);}}function O(o,t){if(o&1){let e=qw();Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14),MC(6),pl(),Ds(7,"td",15),MC(8),pl(),Ds(9,"td",16),MC(10),pl(),Ds(11,"td",17)(12,"div",18),Pw(13,J,2,1,"button",19),Ds(14,"agentos-row-delete-action",20),mg("deleteRequested",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.deletion.request(r.key))})("deleteConfirmed",function(){let r=df(e).$implicit,m=Xw(2);return ff(m.confirmDelete(r))})("deleteCancelled",function(){df(e);let r=Xw(2);return ff(r.deletion.cancel())}),pl()()()();}if(o&2){let e=t.$implicit,a=Xw(2);jE(2),Og(e.title),jE(2),Og(e.providerName),jE(2),vl(" ",e.model.apiModelName," "),jE(2),Og(e.model.priority),jE(2),vl(" ",e.model.reasoningEffort?e.model.reasoningEffort.toLowerCase():"\u2014"," "),jE(3),Lw(a.deletion.confirmingId()!==e.key?13:-1),jE(),ug("rowKey",e.key)("rowLabel",e.title)("state",a.deletion);}}function Q(o,t){if(o&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Provider"),pl(),Ds(8,"th",10),MC(9,"API model name"),pl(),Ds(10,"th",10),MC(11,"Priority"),pl(),Ds(12,"th",10),MC(13,"Reasoning effort"),pl(),Ds(14,"th",10)(15,"span",11),MC(16,"Actions"),pl()()()(),Ds(17,"tbody",8),Vw(18,O,15,9,"tr",9,K),pl()()()),o&2){let e=Xw();jE(18),Hw(e.rowFilter.filteredRows());}}var j=class o{router=g(F);destroyRef=g(Ie);aiModelController=g(k);aiProviderController=g(F$1);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k$1();rows=Ui([]);rowFilter=O$1(this.rows,t=>[t.title,t.model.apiModelName,t.providerName].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),wy([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")]))),U$1(this.destroyRef)).subscribe({next:([t,e])=>{let a=new Map(e.map(r=>[r.id??"",r.name]));this.rows.set(t.map((r,m)=>({key:r.id??`model:${m}`,model:r,title:r.alias??r.apiModelName,providerName:a.get(r.aiProviderId)??r.aiProviderId}))),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}edit(t){t.model.id&&this.router.navigate(["/agentos","admin","ai-models",t.model.id,"edit"]);}confirmDelete(t){t.model.id&&this.deletion.execute(t.key,{request$:this.aiModelController.deleteAiModel(t.model.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.title}" failed. Try again.`});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-platform-ai-models"]],decls:9,vars:3,consts:[["title","Platform AI models","description","AI models shared across every namespace."],["label","Filter AI models","placeholder","Filter AI models\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform AI models"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Provider"],["role","cell","data-label","API model name",1,"settings-table__secondary"],["role","cell","data-label","Priority"],["role","cell","data-label","Reasoning effort"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,a){e&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return a.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return a.openCreateForm()}),MC(3,"New AI model"),pl()(),Pw(4,H,2,1,"p",3),Pw(5,U,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,Q,20,0,"div",6)),e&2&&(jE(),ug("query",a.rowFilter.query()),jE(3),Lw(a.deletion.error()?4:-1),jE(),Lw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{j as PlatformAiModelsComponent};
@@ -1 +1 @@
1
- import {O as O$1}from'./chunk-Bl1tYksF.js';import {g,F,I as Ie,ad as G$1,$ as wr,U as Ui,a1 as fa,x as U$1,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,e as cg,k as df,n as ff}from'./main-BDHAW6RK.js';import {z as k,O as O$2,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-BuYWQnhP.js';import'./chunk-ETz6T3aD.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),MC(1),pl()),t&2){let n=Xw();jE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),MC(1,"Loading integrations\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),MC(1,"No platform integrations defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),MC(1,"No integrations match the current filter."),pl());}function z(t,e){if(t&1){let n=qw();Ds(0,"button",18),mg("click",function(){df(n);let d=Xw().$implicit,m=Xw(2);return ff(m.edit(d))}),MC(1,"Edit"),pl();}if(t&2){let n=Xw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=qw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Xw().$implicit,m=Xw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Xw().$implicit,m=Xw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(n);let d=Xw(3);return ff(d.deletion.cancel())}),pl();}if(t&2){let n=Xw().$implicit,r=Xw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15),Pw(7,z,2,1,"button",16),Pw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Xw(2);jE(2),Og(n.name),jE(2),Og(n.integrationType),jE(3),Lw(r.deletion.confirmingId()!==n.id?7:-1),jE(),Lw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Type"),pl(),Ds(8,"th",10)(9,"span",11),MC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Vw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Xw();jE(12),Hw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);state=g(O$1);integrationConfigController=g(G$1);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();configs=Ui([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.integrationConfigController.deleteIntegrationConfig(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=mw({type:t,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\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 integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","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,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),MC(3,"New integration"),pl()(),Pw(4,A,2,1,"p",3),Pw(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&&(jE(),ug("query",r.rowFilter.query()),jE(3),Lw(r.deletion.error()?4:-1),jE(),Lw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
1
+ import {O as O$1}from'./chunk-AaFDZl6Z.js';import {g,F,I as Ie,ad as G$1,$ as wr,U as Ui,a1 as fa,x as U$1,m as mw,D as Ds,N as mg,a as pl,M as MC,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,V as Vw,H as Hw,q as qw,e as cg,k as df,n as ff}from'./main-VHZF3DP6.js';import {z as k,O as O$2,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-DeQOcTxZ.js';import'./chunk-c8JwL_5n.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(Ds(0,"p",3),MC(1),pl()),t&2){let n=Xw();jE(),Og(n.deletion.error());}}function K(t,e){t&1&&(Ds(0,"p",4),MC(1,"Loading integrations\u2026"),pl());}function H(t,e){t&1&&(Ds(0,"p",5),MC(1,"No platform integrations defined yet."),pl());}function U(t,e){t&1&&(Ds(0,"p",4),MC(1,"No integrations match the current filter."),pl());}function z(t,e){if(t&1){let n=qw();Ds(0,"button",18),mg("click",function(){df(n);let d=Xw().$implicit,m=Xw(2);return ff(m.edit(d))}),MC(1,"Edit"),pl();}if(t&2){let n=Xw().$implicit;cg("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=qw();Ds(0,"agentos-row-delete-action",19),mg("deleteRequested",function(){df(n);let d=Xw().$implicit,m=Xw(2);return ff(m.deletion.request(d.id))})("deleteConfirmed",function(){df(n);let d=Xw().$implicit,m=Xw(2);return ff(m.confirmDelete(d))})("deleteCancelled",function(){df(n);let d=Xw(3);return ff(d.deletion.cancel())}),pl();}if(t&2){let n=Xw().$implicit,r=Xw(2);ug("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(Ds(0,"tr",9)(1,"td",12),MC(2),pl(),Ds(3,"td",13),MC(4),pl(),Ds(5,"td",14)(6,"div",15),Pw(7,z,2,1,"button",16),Pw(8,G,1,3,"agentos-row-delete-action",17),pl()()()),t&2){let n=e.$implicit,r=Xw(2);jE(2),Og(n.name),jE(2),Og(n.integrationType),jE(3),Lw(r.deletion.confirmingId()!==n.id?7:-1),jE(),Lw(n.id?8:-1);}}function O(t,e){if(t&1&&(Ds(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),MC(5,"Name"),pl(),Ds(6,"th",10),MC(7,"Type"),pl(),Ds(8,"th",10)(9,"span",11),MC(10,"Actions"),pl()()()(),Ds(11,"tbody",8),Vw(12,J,9,4,"tr",9,j),pl()()()),t&2){let n=Xw();jE(12),Hw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(Ie);state=g(O$1);integrationConfigController=g(G$1);refresh$=new wr(void 0);isLoading=Ui(true);deletion=k();configs=Ui([]);rowFilter=O$2(this.configs,e=>[e.name,e.integrationType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(fa(()=>(this.isLoading.set(true),this.state.loadPlatformConfigs())),U$1(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"]);}edit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.integrationConfigController.deleteIntegrationConfig(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=mw({type:t,selectors:[["agentos-platform-integration-configs"]],decls:9,vars:3,consts:[["title","Platform integrations","description","Integration configurations shared across every namespace."],["label","Filter integrations","placeholder","Filter integrations\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 integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","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,r){n&1&&(Ds(0,"ds-section-header",0)(1,"agentos-table-filter",1),mg("queryChange",function(m){return r.rowFilter.query.set(m)}),pl(),Ds(2,"button",2),mg("click",function(){return r.openCreateForm()}),MC(3,"New integration"),pl()(),Pw(4,A,2,1,"p",3),Pw(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&&(jE(),ug("query",r.rowFilter.query()),jE(3),Lw(r.deletion.error()?4:-1),jE(),Lw(r.isLoading()?5:r.configs().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{B as PlatformIntegrationConfigsComponent};
@@ -0,0 +1 @@
1
+ import {a1 as fa,a2 as da,aa as Cr,aC as Uy}from'./main-VHZF3DP6.js';function i(t,o,p){return t.pipe(fa(()=>o().pipe(da(()=>Cr(p)))),Uy({bufferSize:1,refCount:true}))}export{i};
@@ -1 +1 @@
1
- import {d as pn,h as hn,q as on,C as mn,i as at,s as sn,K as Oi,M as On}from'./chunk-BuYWQnhP.js';import {g,W as W$1,F,I as Ie,ae as U,U as Ui,K as KC,x as U$1,m as mw,as as $t,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,S as Sg,v as vl,V as Vw,H as Hw,q as qw,l as lg,at as $C,au as GC,k as df,n as ff,av as ZD}from'./main-BDHAW6RK.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Ds(0,"p",3),MC(1,"Loading\u2026"),pl());}function Q(t,n){t&1&&(Ds(0,"ds-notice"),MC(1,"Failed to load agent definition."),pl());}function W(t,n){if(t&1&&(Ds(0,"dt"),MC(1,"User context"),pl(),Ds(2,"dd",6),MC(3),pl()),t&2){let e=Xw();jE(3),Og(e.userId);}}function X(t,n){if(t&1){let e=qw();Ds(0,"ds-card")(1,"ds-disclosure",12),mg("toggled",function(){df(e);let m=Xw(2);return ff(m.toggleSystemPrompt())}),Ds(2,"pre",13),MC(3),pl()()();}if(t&2){let e=Xw(),r=Xw();jE(),ug("open",!r.systemPromptCollapsed()),jE(2),Og(e.systemPrompt);}}function Y(t,n){if(t&1){let e=qw();Ds(0,"ds-card")(1,"ds-disclosure",14),mg("toggled",function(){df(e);let m=Xw(2);return ff(m.toggleInstructions())}),Ds(2,"pre",13),MC(3),pl()()();}if(t&2){let e=Xw(),r=Xw();jE(),ug("open",!r.instructionsCollapsed()),jE(2),Og(e.instructions);}}function Z(t,n){t&1&&(Ds(0,"p",3),MC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),pl());}function ee(t,n){t&1&&(Ds(0,"span",17),MC(1,"platform"),pl());}function te(t,n){t&1&&(Ds(0,"span",17),MC(1,"SKILL.md"),pl());}function ne(t,n){if(t&1&&(Ds(0,"li",15)(1,"span")(2,"span",16),MC(3),pl(),Pw(4,ee,2,0,"span",17),Pw(5,te,2,0,"span",17),pl(),Ds(6,"p",3),MC(7),pl()()),t&2){let e=n.$implicit;jE(3),Og(e.name),jE(),Lw(e.namespaceId?-1:4),jE(),Lw(e.readOnly?5:-1),jE(2),Og(e.description);}}function ie(t,n){if(t&1&&(Ds(0,"ul",11),Vw(1,ne,8,4,"li",15,j),pl()),t&2){let e=Xw(2);jE(),Hw(e.resolvedSkills());}}function oe(t,n){t&1&&(Ds(0,"p",3),MC(1,"No tools available for this agent."),pl());}function ae(t,n){if(t&1&&(lg(0,"div",19),$C(1,"agentosMarkdown")),t&2){let e=Xw().$implicit;ug("innerHTML",GC(1,1,e.description),ZD);}}function de(t,n){if(t&1){let e=qw();Ds(0,"li")(1,"ds-disclosure",18),mg("toggled",function(){let m=df(e).$implicit,U=Xw(3);return ff(U.toggleTool(m))}),Pw(2,ae,2,3,"div",19),Ds(3,"pre",20),MC(4),pl()()();}if(t&2){let e=n.$implicit,r=Xw(3);jE(),ug("heading",e.name)("open",r.isToolExpanded(e)),jE(),Lw(e.description?2:-1),jE(2),Og(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Ds(0,"ul",11),Vw(1,de,5,4,"li",null,z),pl()),t&2){let e=Xw();jE(),Hw(e.tools);}}function se(t,n){if(t&1&&(Ds(0,"ds-card",4)(1,"dl",5)(2,"dt"),MC(3,"Name"),pl(),Ds(4,"dd"),MC(5),pl(),Ds(6,"dt"),MC(7,"Resolved model"),pl(),Ds(8,"dd",6),MC(9),pl(),Ds(10,"dt"),MC(11,"Provider"),pl(),Ds(12,"dd"),MC(13),pl(),Ds(14,"dt",7),MC(15,"Execution mode"),pl(),Ds(16,"dd",8)(17,"span",9),MC(18),pl()(),Pw(19,W,4,1),pl()(),Pw(20,X,4,2,"ds-card"),Pw(21,Y,4,2,"ds-card"),Ds(22,"ds-card",10),Pw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),pl(),Ds(25,"ds-card",10),Pw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),pl()),t&2){let e=n,r=Xw();jE(5),Og(e.name),jE(4),Og(e.resolvedModelApiName),jE(4),Og(e.resolvedProviderName),jE(4),Sg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),jE(),vl(" ",e.executionMode," "),jE(),Lw(e.userId?19:-1),jE(),Lw(e.systemPrompt?20:-1),jE(),Lw(e.instructions?21:-1),jE(),ug("heading","Skills ("+r.resolvedSkills().length+")"),jE(),Lw(r.resolvedSkills().length===0?23:24),jE(2),ug("heading","Tools ("+e.tools.length+")"),jE(),Lw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=Ui(true);hasError=Ui(false);definition=Ui(null);expandedTools=Ui(new Set);resolvedSkills=KC(()=>this.definition()?.skills??[]);systemPromptCollapsed=Ui(true);instructionsCollapsed=Ui(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=mw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.back()}),MC(3," \u2190 Agent configs "),pl(),Ds(4,"a",2),MC(5,"Edit config \u2192"),pl()(),Pw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),pl()),e&2){let m;jE(4),ug("routerLink",r.editRoute()),jE(2),Lw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,pn,hn,on,mn,at,sn,Oi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
1
+ import {d as pn,h as hn,q as on,C as mn,i as at,s as sn,K as Oi,M as On}from'./chunk-DeQOcTxZ.js';import {g,W as W$1,F,I as Ie,ae as U,U as Ui,K as KC,x as U$1,m as mw,as as $t,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,L as Lw,X as Xw,O as Og,S as Sg,v as vl,V as Vw,H as Hw,q as qw,l as lg,at as $C,au as GC,k as df,n as ff,av as ZD}from'./main-VHZF3DP6.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Ds(0,"p",3),MC(1,"Loading\u2026"),pl());}function Q(t,n){t&1&&(Ds(0,"ds-notice"),MC(1,"Failed to load agent definition."),pl());}function W(t,n){if(t&1&&(Ds(0,"dt"),MC(1,"User context"),pl(),Ds(2,"dd",6),MC(3),pl()),t&2){let e=Xw();jE(3),Og(e.userId);}}function X(t,n){if(t&1){let e=qw();Ds(0,"ds-card")(1,"ds-disclosure",12),mg("toggled",function(){df(e);let m=Xw(2);return ff(m.toggleSystemPrompt())}),Ds(2,"pre",13),MC(3),pl()()();}if(t&2){let e=Xw(),r=Xw();jE(),ug("open",!r.systemPromptCollapsed()),jE(2),Og(e.systemPrompt);}}function Y(t,n){if(t&1){let e=qw();Ds(0,"ds-card")(1,"ds-disclosure",14),mg("toggled",function(){df(e);let m=Xw(2);return ff(m.toggleInstructions())}),Ds(2,"pre",13),MC(3),pl()()();}if(t&2){let e=Xw(),r=Xw();jE(),ug("open",!r.instructionsCollapsed()),jE(2),Og(e.instructions);}}function Z(t,n){t&1&&(Ds(0,"p",3),MC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),pl());}function ee(t,n){t&1&&(Ds(0,"span",17),MC(1,"platform"),pl());}function te(t,n){t&1&&(Ds(0,"span",17),MC(1,"SKILL.md"),pl());}function ne(t,n){if(t&1&&(Ds(0,"li",15)(1,"span")(2,"span",16),MC(3),pl(),Pw(4,ee,2,0,"span",17),Pw(5,te,2,0,"span",17),pl(),Ds(6,"p",3),MC(7),pl()()),t&2){let e=n.$implicit;jE(3),Og(e.name),jE(),Lw(e.namespaceId?-1:4),jE(),Lw(e.readOnly?5:-1),jE(2),Og(e.description);}}function ie(t,n){if(t&1&&(Ds(0,"ul",11),Vw(1,ne,8,4,"li",15,j),pl()),t&2){let e=Xw(2);jE(),Hw(e.resolvedSkills());}}function oe(t,n){t&1&&(Ds(0,"p",3),MC(1,"No tools available for this agent."),pl());}function ae(t,n){if(t&1&&(lg(0,"div",19),$C(1,"agentosMarkdown")),t&2){let e=Xw().$implicit;ug("innerHTML",GC(1,1,e.description),ZD);}}function de(t,n){if(t&1){let e=qw();Ds(0,"li")(1,"ds-disclosure",18),mg("toggled",function(){let m=df(e).$implicit,U=Xw(3);return ff(U.toggleTool(m))}),Pw(2,ae,2,3,"div",19),Ds(3,"pre",20),MC(4),pl()()();}if(t&2){let e=n.$implicit,r=Xw(3);jE(),ug("heading",e.name)("open",r.isToolExpanded(e)),jE(),Lw(e.description?2:-1),jE(2),Og(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Ds(0,"ul",11),Vw(1,de,5,4,"li",null,z),pl()),t&2){let e=Xw();jE(),Hw(e.tools);}}function se(t,n){if(t&1&&(Ds(0,"ds-card",4)(1,"dl",5)(2,"dt"),MC(3,"Name"),pl(),Ds(4,"dd"),MC(5),pl(),Ds(6,"dt"),MC(7,"Resolved model"),pl(),Ds(8,"dd",6),MC(9),pl(),Ds(10,"dt"),MC(11,"Provider"),pl(),Ds(12,"dd"),MC(13),pl(),Ds(14,"dt",7),MC(15,"Execution mode"),pl(),Ds(16,"dd",8)(17,"span",9),MC(18),pl()(),Pw(19,W,4,1),pl()(),Pw(20,X,4,2,"ds-card"),Pw(21,Y,4,2,"ds-card"),Ds(22,"ds-card",10),Pw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),pl(),Ds(25,"ds-card",10),Pw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),pl()),t&2){let e=n,r=Xw();jE(5),Og(e.name),jE(4),Og(e.resolvedModelApiName),jE(4),Og(e.resolvedProviderName),jE(4),Sg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),jE(),vl(" ",e.executionMode," "),jE(),Lw(e.userId?19:-1),jE(),Lw(e.systemPrompt?20:-1),jE(),Lw(e.instructions?21:-1),jE(),ug("heading","Skills ("+r.resolvedSkills().length+")"),jE(),Lw(r.resolvedSkills().length===0?23:24),jE(2),ug("heading","Tools ("+e.tools.length+")"),jE(),Lw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(Ie);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=Ui(true);hasError=Ui(false);definition=Ui(null);expandedTools=Ui(new Set);resolvedSkills=KC(()=>this.definition()?.skills??[]);systemPromptCollapsed=Ui(true);instructionsCollapsed=Ui(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=mw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.back()}),MC(3," \u2190 Agent configs "),pl(),Ds(4,"a",2),MC(5,"Edit config \u2192"),pl()(),Pw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),pl()),e&2){let m;jE(4),ug("routerLink",r.editRoute()),jE(2),Lw(r.isLoading()?6:r.hasError()?7:(m=r.definition())?8:-1,m);}},dependencies:[$t,pn,hn,on,mn,at,sn,Oi,On],encapsulation:2})};export{K as AgentConfigInspectComponent};
@@ -1 +1 @@
1
- import {f,y,a as pt,T as Te,b as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-BuYWQnhP.js';import {g,W,F,J,I as Ie,K as KC,U as Ui,A as Af,x as U,z as w,E as x,m as mw,D as Ds,l as lg,P as Pw,a as pl,G as ug,j as jE,L as Lw,M as MC,q as qw,N as mg,Q as SI,X as Xw,T as MI,e as cg,v as vl,k as df,n as ff}from'./main-BDHAW6RK.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Xw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),SI(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),SI(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),SI(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),SI(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),SI(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),SI(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Xw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),SI(),pl(),Ds(17,"ds-form-actions")(18,"button",21),MC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Xw();return ff(p.cancel())}),MC(21,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(2),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.externalIdControl),MI(),jE(2),ug("formControl",e.defaultAgentNameControl),MI(),jE(2),ug("formControl",e.configPathControl),MI(),jE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),jE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),MI(),jE(),ug("hint",e.runCostThresholdHint()),jE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),MI(),jE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),jE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=KC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=KC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=KC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=KC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),jE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),jE(),Lw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
1
+ import {f,y,a as pt,T as Te,b as fn,U as Ut,n as nd,L as Lt,k as kn,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,i as at,j as an}from'./chunk-DeQOcTxZ.js';import {g,W,F,J,I as Ie,K as KC,U as Ui,A as Af,x as U,z as w,E as x,m as mw,D as Ds,l as lg,P as Pw,a as pl,G as ug,j as jE,L as Lw,M as MC,q as qw,N as mg,Q as SI,X as Xw,T as MI,e as cg,v as vl,k as df,n as ff}from'./main-VHZF3DP6.js';var ne=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function re(i){return ne.test(i)}function ee(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||re(e)?null:{absolutePath:true}}}function ae(i,t){i&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function ie(i,t){if(i&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let p=Xw();return ff(p.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"textarea",8),SI(),pl(),Ds(5,"ds-form-field",9),lg(6,"input",10),SI(),pl(),Ds(7,"ds-form-field",11),lg(8,"input",12),SI(),pl(),Ds(9,"ds-form-field",13),lg(10,"input",14),SI(),pl(),Ds(11,"ds-form-field",15),lg(12,"input",16),SI(),pl(),Ds(13,"ds-form-field",17),lg(14,"input",18),SI(),pl(),Ds(15,"ds-form-field",19)(16,"input",20),mg("input",function(p){df(e);let oe=Xw();return ff(oe.onMaxToolRoundsInput(p))}),pl(),SI(),pl(),Ds(17,"ds-form-actions")(18,"button",21),MC(19),pl(),Ds(20,"button",22),mg("click",function(){df(e);let p=Xw();return ff(p.cancel())}),MC(21,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(2),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.externalIdControl),MI(),jE(2),ug("formControl",e.defaultAgentNameControl),MI(),jE(2),ug("formControl",e.configPathControl),MI(),jE(),ug("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),jE(),ug("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),cg("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),MI(),jE(),ug("hint",e.runCostThresholdHint()),jE(),ug("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),MI(),jE(),ug("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),jE(),ug("formControl",e.maxToolRoundsControl),cg("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var le=1,se=2147483647,te=class i{route=g(W);router=g(F);namespaceController=g(J);destroyRef=g(Ie);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=KC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=KC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=KC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=KC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ee(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[fn.min(le),fn.max(se),fn.pattern(/^\d+$/)]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}maxToolRoundsUnparsable=Ui(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);existingNamespace=null;constructor(){Af(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(Ds(0,"ds-page",0),lg(1,"ds-section-header",1),Pw(2,ae,2,0,"p",2)(3,ie,22,19,"form",3),pl()),e&2&&(ug("framed",!u.isEditMode()),jE(),ug("title",u.isEditMode()?"Edit namespace":"New namespace"),jE(),Lw(u.isLoading()?2:3));},dependencies:[Ut,nd,Lt,kn,mo,po,$r,Vn,An,pn,hn,cn,dn,at,an],encapsulation:2})};export{te as NamespaceFormComponent};
@@ -1 +1 @@
1
- import {D as m,a as pt,E as Bt,T as Te,b as fn,U as Ut,n as nd,o as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-BuYWQnhP.js';import {g,W,F,I as Ie,ae as U,U as Ui,x as U$1,a2 as da,aa as Cr,E as x,z as w,m as mw,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,v as vl,L as Lw,q as qw,l as lg,Q as SI,V as Vw,al as jw,X as Xw,T as MI,O as Og,H as Hw,e as cg,k as df,n as ff}from'./main-BDHAW6RK.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Xw(3);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),MC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),jE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),MC(3,"\u2014 None \u2014"),pl(),Vw(4,ge,2,2,"option",24,ce),pl(),SI(),pl()),o&2){let e=Xw(3);jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(),ug("ngValue",null),jE(2),Hw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Pw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Xw(2);Lw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),MC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=qw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),SI(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),SI(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),SI(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeParameter(d))}),MC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),jE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),jE(),ug("id","param-name-"+r),MI(),jE(),ug("controlId","param-desc-"+r),jE(),ug("id","param-desc-"+r),MI(),jE(),ug("controlId","param-default-"+r),jE(),ug("id","param-default-"+r),MI();}}function _e(o,t){if(o&1){let e=qw();Ds(0,"div",14)(1,"span",33),MC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),SI(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeContentEntry(d))}),MC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Xw(2);jE(2),Og(r+1),jE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),jE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),MI(),jE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),MC(1),pl()),o&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=qw();Ds(0,"button",37),mg("click",function(){df(e);let d=Xw(2);return ff(d.exportYaml())}),MC(1),pl();}if(o&2){let e=Xw(2);ug("disabled",e.isExporting()),jE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Xw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),MC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),MC(10),pl(),MC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Pw(13,ve,2,0,"p",2),Vw(14,he,10,8,"div",11,jw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addParameter())}),MC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),MC(21," Each content entry is a command. Use "),Ds(22,"code"),MC(23,"@AgentName"),pl(),MC(24," to target an agent, "),Ds(25,"code"),MC(26,"/promptName param1 param2"),pl(),MC(27," to call another prompt, and "),Ds(28,"code"),MC(29),pl(),MC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Vw(32,_e,7,5,"div",14,jw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addContentEntry())}),MC(36,"+ Add content entry"),pl()()()(),Pw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),SI(),pl(),Ds(40,"ds-form-actions")(41,"button",17),MC(42),pl(),Pw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Xw();return ff(d.cancel())}),MC(45,"Cancel"),pl()()();}if(o&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.availableAgentConfigs().length>0?5:-1),jE(5),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","parameters"),jE(),Lw(e.parametersArray.length===0?13:-1),jE(),Hw(e.parametersArray.controls),jE(15),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","content"),jE(),Hw(e.contentArray.controls),jE(5),Lw(e.errorMessage()?37:-1),jE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),jE(),Lw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),da(()=>Cr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),da(()=>Cr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),MC(3),pl()(),Pw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(jE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),jE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),jE(),Lw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
1
+ import {D as m,a as pt,E as Bt,T as Te,b as fn,U as Ut,n as nd,o as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-DeQOcTxZ.js';import {g,W,F,I as Ie,ae as U,U as Ui,x as U$1,a2 as da,aa as Cr,E as x,z as w,m as mw,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,v as vl,L as Lw,q as qw,l as lg,Q as SI,V as Vw,al as jw,X as Xw,T as MI,O as Og,H as Hw,e as cg,k as df,n as ff}from'./main-VHZF3DP6.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function fe(o,t){if(o&1&&(Ds(0,"ds-form-field",20),lg(1,"input",22),pl()),o&2){let e=Xw(3);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Ds(0,"option",24),MC(1),pl()),o&2){let e=t.$implicit;ug("ngValue",e.id),jE(),Og(e.name);}}function Ce(o,t){if(o&1&&(Ds(0,"ds-form-field",21)(1,"select",23)(2,"option",24),MC(3,"\u2014 None \u2014"),pl(),Vw(4,ge,2,2,"option",24,ce),pl(),SI(),pl()),o&2){let e=Xw(3);jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(),ug("ngValue",null),jE(2),Hw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Pw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Xw(2);Lw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Ds(0,"p",2),MC(1,"No parameters defined."),pl());}function he(o,t){if(o&1){let e=qw();Ds(0,"div",11)(1,"div",25)(2,"ds-form-field",26),lg(3,"input",27),SI(),pl(),Ds(4,"ds-form-field",28),lg(5,"input",29),SI(),pl(),Ds(6,"ds-form-field",30),lg(7,"input",31),SI(),pl()(),Ds(8,"button",32),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeParameter(d))}),MC(9," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index;ug("formGroupName",r),jE(2),ug("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),jE(),ug("id","param-name-"+r),MI(),jE(),ug("controlId","param-desc-"+r),jE(),ug("id","param-desc-"+r),MI(),jE(),ug("controlId","param-default-"+r),jE(),ug("id","param-default-"+r),MI();}}function _e(o,t){if(o&1){let e=qw();Ds(0,"div",14)(1,"span",33),MC(2),pl(),Ds(3,"ds-form-field",34),lg(4,"textarea",35),SI(),pl(),Ds(5,"button",36),mg("click",function(){let d=df(e).$index,m=Xw(2);return ff(m.removeContentEntry(d))}),MC(6," \xD7 "),pl()();}if(o&2){let e=t.$implicit,r=t.$index,d=Xw(2);jE(2),Og(r+1),jE(),ug("error",e.invalid&&e.touched?"Content entry must not be blank.":null),jE(),ug("formControlName",r),cg("aria-label","Content entry "+(r+1)),MI(),jE(),ug("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Ds(0,"ds-notice"),MC(1),pl()),o&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function be(o,t){if(o&1){let e=qw();Ds(0,"button",37),mg("click",function(){df(e);let d=Xw(2);return ff(d.exportYaml())}),MC(1),pl();}if(o&2){let e=Xw(2);ug("disabled",e.isExporting()),jE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let d=Xw();return ff(d.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,ye,2,1),Ds(6,"ds-fieldset",9)(7,"p",2),MC(8," Each parameter must have a name and a default value. Use "),Ds(9,"code"),MC(10),pl(),MC(11," in content entries to reference them. "),pl(),Ds(12,"div",10),Pw(13,ve,2,0,"p",2),Vw(14,he,10,8,"div",11,jw),Ds(16,"div")(17,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addParameter())}),MC(18,"+ Add parameter"),pl()()()(),Ds(19,"ds-fieldset",13)(20,"p",2),MC(21," Each content entry is a command. Use "),Ds(22,"code"),MC(23,"@AgentName"),pl(),MC(24," to target an agent, "),Ds(25,"code"),MC(26,"/promptName param1 param2"),pl(),MC(27," to call another prompt, and "),Ds(28,"code"),MC(29),pl(),MC(30," for parameter placeholders. "),pl(),Ds(31,"div",10),Vw(32,_e,7,5,"div",14,jw),Ds(34,"div")(35,"button",12),mg("click",function(){df(e);let d=Xw();return ff(d.addContentEntry())}),MC(36,"+ Add content entry"),pl()()()(),Pw(37,xe,2,1,"ds-notice"),Ds(38,"ds-form-field",15),lg(39,"textarea",16),SI(),pl(),Ds(40,"ds-form-actions")(41,"button",17),MC(42),pl(),Pw(43,be,2,2,"button",18),Ds(44,"button",19),mg("click",function(){df(e);let d=Xw();return ff(d.cancel())}),MC(45,"Cancel"),pl()()();}if(o&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.availableAgentConfigs().length>0?5:-1),jE(5),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","parameters"),jE(),Lw(e.parametersArray.length===0?13:-1),jE(),Hw(e.parametersArray.controls),jE(15),Og(e.paramPlaceholderSyntax),jE(2),ug("formArrayName","content"),jE(),Hw(e.contentArray.controls),jE(5),Lw(e.errorMessage()?37:-1),jE(),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),jE(),Lw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(Ie);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);isExporting=Ui(false);errorMessage=Ui(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),da(()=>Cr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),da(()=>Cr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=mw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return r.cancel()}),MC(3),pl()(),Pw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),pl()),e&2&&(jE(),ug("title",r.isEditMode()?"Edit prompt":"New prompt"),jE(2),vl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),jE(),Lw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-zJN7xh5t.js';import {a as pt,T as Te$1,b as fn,U as Ut,n as nd,o as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-BuYWQnhP.js';import {g,W,F,I as Ie$1,ae as U,af as Ne$1,ag as Ue,U as Ui,ah as ke$1,a9 as F$1,ai as md,K as KC,aj as Ty,x as U$1,a2 as da,aa as Cr,E as x,z as w,m as mw,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,v as vl,L as Lw,q as qw,l as lg,Q as SI,V as Vw,X as Xw,T as MI,H as Hw,O as Og,k as df,n as ff,o as oh}from'./main-BDHAW6RK.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Xw(2);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),MC(1,"Add an agent config"),pl(),MC(2," first. ")),n&2){let e=Xw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),MC(2," No agent configs available in this scope yet. "),Pw(3,Se,3,1),pl()()),n&2){let e=Xw(2);jE(3),Lw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),jE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),MC(3,"Select an agent config\u2026"),pl(),Vw(4,Ee,2,2,"option",17,ve),pl(),SI(),pl()),n&2){let e=Xw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(3),Hw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),jE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=qw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Xw(3);return ff(h.toggleDay(f.value))}),pl(),MC(2),pl();}if(n&2){let e=t.$implicit,l=Xw(3);jE(),ug("checked",l.isDaySelected(e.value)),jE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Vw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Xw(2);jE(2),Hw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),jE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),SI(),pl()),n&2){let e=Xw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),jE(),ug("formControl",e.endDateControl),MI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),SI(),pl()),n&2){let e=Xw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),jE(),ug("formControl",e.occurrenceCountControl),MI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),MC(1),pl()),n&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Xw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),SI(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Vw(13,Te,2,2,"option",17,V),pl(),SI(),pl(),Pw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),SI(),Ds(19,"span",22),MC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),SI(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Vw(26,Me,2,2,"option",17,V),pl(),SI(),pl(),Pw(28,Pe,2,2,"ds-form-field",28),Pw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),SI(),MC(33," Enabled "),pl(),Ds(34,"p",33),MC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),SI(),pl(),Pw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),MC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Xw();return ff(f.cancel())}),MC(43,"Cancel"),pl()()();}if(n&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),jE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),jE(),ug("formControl",e.promptContentControl),MI(),jE(3),ug("formControl",e.unitControl),MI(),jE(),Hw(e.schedulerUnits),jE(2),Lw(e.showDayFilter()?15:-1),jE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),jE(2),ug("formControl",e.timeUtcControl),MI(),jE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),jE(),ug("formControl",e.startDateControl),MI(),jE(2),ug("formControl",e.endTypeControl),MI(),jE(),Hw(e.endTypes),jE(2),Lw(e.showEndDate()?28:-1),jE(),Lw(e.showOccurrenceCount()?29:-1),jE(3),ug("formControl",e.enabledControl),MI(),jE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(),Lw(e.errorMessage()?38:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ue.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(Ne$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ue;SchedulerEndType=Ne$1;schedulerUnits=[{value:Ue.WEEK,label:"Week(s)"},{value:Ue.MONTH,label:"Month(s)"}];endTypes=[{value:Ne$1.NEVER,label:"Never"},{value:Ne$1.ON_DATE,label:"On date"},{value:Ne$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ke$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=KC(()=>this.unitSignal()===Ue.WEEK);showEndDate=KC(()=>this.endTypeSignal()===Ne$1.ON_DATE);showOccurrenceCount=KC(()=>this.endTypeSignal()===Ne$1.OCCURRENCES);agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ty({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(da(()=>Cr([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Ne$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Ne$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),MC(3),pl()(),Pw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(jE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),jE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),jE(),Lw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Ne$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Ne$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
1
+ import {c}from'./chunk-CJ7ucGNe.js';import {a as pt,T as Te$1,b as fn,U as Ut,n as nd,o as bo,x as xo,L as Lt,k as kn,u as vn,G as Gt,m as mo,c as po,$ as $r,V as Vn,A as An,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an,t as rn}from'./chunk-DeQOcTxZ.js';import {g,W,F,I as Ie$1,ae as U,af as Ne$1,ag as Ue,U as Ui,ah as ke$1,a9 as F$1,ai as md,K as KC,aj as Ty,x as U$1,a2 as da,aa as Cr,E as x,z as w,m as mw,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,v as vl,L as Lw,q as qw,l as lg,Q as SI,V as Vw,X as Xw,T as MI,H as Hw,O as Og,k as df,n as ff,o as oh}from'./main-VHZF3DP6.js';var V=(n,t)=>t.value,ve=(n,t)=>t.id;function be(n,t){n&1&&(Ds(0,"p",2),MC(1,"Loading\u2026"),pl());}function _e(n,t){if(n&1&&(Ds(0,"ds-form-field",9),lg(1,"input",38),pl()),n&2){let e=Xw(2);jE(),ug("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function Se(n,t){if(n&1&&(Ds(0,"a",39),MC(1,"Add an agent config"),pl(),MC(2," first. ")),n&2){let e=Xw(3);ug("href","/agentos/"+e.namespaceId+"/agent-configs/new",oh);}}function xe(n,t){if(n&1&&(Ds(0,"ds-form-field",10)(1,"p",2),MC(2," No agent configs available in this scope yet. "),Pw(3,Se,3,1),pl()()),n&2){let e=Xw(2);jE(3),Lw(e.isPlatformMode?-1:3);}}function Ee(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.id),jE(),Og(e.name);}}function De(n,t){if(n&1&&(Ds(0,"ds-form-field",11)(1,"select",40)(2,"option",41),MC(3,"Select an agent config\u2026"),pl(),Vw(4,Ee,2,2,"option",17,ve),pl(),SI(),pl()),n&2){let e=Xw(2);ug("error",e.agentConfigIdControl.invalid&&e.agentConfigIdControl.touched?"Agent Config is required.":null),jE(),ug("formControl",e.agentConfigIdControl),MI(),jE(3),Hw(e.availableAgentConfigs());}}function Te(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),jE(),Og(e.label);}}function Ne(n,t){if(n&1){let e=qw();Ds(0,"label",31)(1,"input",43),mg("change",function(){let f=df(e).$implicit,h=Xw(3);return ff(h.toggleDay(f.value))}),pl(),MC(2),pl();}if(n&2){let e=t.$implicit,l=Xw(3);jE(),ug("checked",l.isDaySelected(e.value)),jE(),vl(" ",e.label," ");}}function Ie(n,t){if(n&1&&(Ds(0,"ds-form-field",18)(1,"div",42),Vw(2,Ne,3,2,"label",31,V),pl()()),n&2){let e=Xw(2);jE(2),Hw(e.dayOptions);}}function Me(n,t){if(n&1&&(Ds(0,"option",17),MC(1),pl()),n&2){let e=t.$implicit;ug("value",e.value),jE(),Og(e.label);}}function Pe(n,t){if(n&1&&(Ds(0,"ds-form-field",28),lg(1,"input",44),SI(),pl()),n&2){let e=Xw(2);ug("error",e.form.hasError("endDateRequired")&&e.endDateControl.touched?"End date is required.":null),jE(),ug("formControl",e.endDateControl),MI();}}function we(n,t){if(n&1&&(Ds(0,"ds-form-field",29),lg(1,"input",45),SI(),pl()),n&2){let e=Xw(2);ug("error",e.form.hasError("occurrenceCountRequired")&&e.occurrenceCountControl.touched?"Must be at least 1.":null),jE(),ug("formControl",e.occurrenceCountControl),MI();}}function Fe(n,t){if(n&1&&(Ds(0,"ds-notice"),MC(1),pl()),n&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function Oe(n,t){if(n&1){let e=qw();Ds(0,"form",4),mg("ngSubmit",function(){df(e);let f=Xw();return ff(f.submit())}),Ds(1,"ds-form-field",5),lg(2,"input",6),SI(),pl(),Ds(3,"ds-form-field",7),lg(4,"input",8),SI(),pl(),Pw(5,_e,2,1,"ds-form-field",9)(6,xe,4,1,"ds-form-field",10)(7,De,6,2,"ds-form-field",11),Ds(8,"ds-form-field",12),lg(9,"textarea",13),SI(),pl(),Ds(10,"ds-fieldset",14)(11,"ds-form-field",15)(12,"select",16),Vw(13,Te,2,2,"option",17,V),pl(),SI(),pl(),Pw(15,Ie,4,0,"ds-form-field",18),Ds(16,"ds-form-field",19)(17,"div",20),lg(18,"input",21),SI(),Ds(19,"span",22),MC(20,"UTC"),pl()()()(),Ds(21,"ds-fieldset",23)(22,"ds-form-field",24),lg(23,"input",25),SI(),pl(),Ds(24,"ds-form-field",26)(25,"select",27),Vw(26,Me,2,2,"option",17,V),pl(),SI(),pl(),Pw(28,Pe,2,2,"ds-form-field",28),Pw(29,we,2,2,"ds-form-field",29),pl(),Ds(30,"div",30)(31,"label",31),lg(32,"input",32),SI(),MC(33," Enabled "),pl(),Ds(34,"p",33),MC(35,"When disabled, the scheduled prompt is saved but will not run on schedule."),pl()(),Ds(36,"ds-form-field",34),lg(37,"textarea",35),SI(),pl(),Pw(38,Fe,2,1,"ds-notice"),Ds(39,"ds-form-actions")(40,"button",36),MC(41),pl(),Ds(42,"button",37),mg("click",function(){df(e);let f=Xw();return ff(f.cancel())}),MC(43,"Cancel"),pl()()();}if(n&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(),Lw(e.isEditMode()?5:e.availableAgentConfigs().length===0?6:7),jE(3),ug("error",e.promptContentControl.invalid&&e.promptContentControl.touched?"Opening message is required.":null),jE(),ug("formControl",e.promptContentControl),MI(),jE(3),ug("formControl",e.unitControl),MI(),jE(),Hw(e.schedulerUnits),jE(2),Lw(e.showDayFilter()?15:-1),jE(),ug("error",e.timeUtcControl.invalid&&e.timeUtcControl.touched?"Valid time is required (HH:mm).":null),jE(2),ug("formControl",e.timeUtcControl),MI(),jE(4),ug("error",e.startDateControl.invalid&&e.startDateControl.touched?"Start date is required.":null),jE(),ug("formControl",e.startDateControl),MI(),jE(2),ug("formControl",e.endTypeControl),MI(),jE(),Hw(e.endTypes),jE(2),Lw(e.showEndDate()?28:-1),jE(),Lw(e.showOccurrenceCount()?29:-1),jE(3),ug("formControl",e.enabledControl),MI(),jE(4),ug("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),jE(),ug("formControl",e.externalMetadataJsonControl),MI(),jE(),Lw(e.errorMessage()?38:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isEditMode()?"Save changes":"Create scheduled prompt"," ");}}var ye=class n{route=g(W);router=g(F);destroyRef=g(Ie$1);state=g(c);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te$1("",{nonNullable:true,validators:[fn.required]}),description:new Te$1(null),agentConfigId:new Te$1("",{nonNullable:true,validators:[fn.required]}),promptContent:new Te$1("",{nonNullable:true,validators:[fn.required]}),unit:new Te$1(Ue.WEEK,{nonNullable:true,validators:[fn.required]}),days:new Te$1([],{nonNullable:true}),timeUtc:new Te$1("09:00",{nonNullable:true,validators:[fn.required,fn.pattern(/^([01]\d|2[0-3]):[0-5]\d$/)]}),startDate:new Te$1("",{nonNullable:true,validators:[fn.required]}),endType:new Te$1(Ne$1.NEVER,{nonNullable:true,validators:[fn.required]}),endDate:new Te$1(null),occurrenceCount:new Te$1(null),enabled:new Te$1(true,{nonNullable:true}),externalMetadataJson:new Te$1("",{nonNullable:true,validators:[ke]})},{validators:[Ae,Ve]});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get promptContentControl(){return this.form.controls.promptContent}get unitControl(){return this.form.controls.unit}get daysControl(){return this.form.controls.days}get timeUtcControl(){return this.form.controls.timeUtc}get startDateControl(){return this.form.controls.startDate}get endTypeControl(){return this.form.controls.endType}get endDateControl(){return this.form.controls.endDate}get occurrenceCountControl(){return this.form.controls.occurrenceCount}get enabledControl(){return this.form.controls.enabled}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}isEditMode=Ui(false);isSubmitting=Ui(false);isLoading=Ui(false);errorMessage=Ui(null);SchedulerUnit=Ue;SchedulerEndType=Ne$1;schedulerUnits=[{value:Ue.WEEK,label:"Week(s)"},{value:Ue.MONTH,label:"Month(s)"}];endTypes=[{value:Ne$1.NEVER,label:"Never"},{value:Ne$1.ON_DATE,label:"On date"},{value:Ne$1.OCCURRENCES,label:"After N occurrences"}];dayOptions=Object.entries(ke$1).map(([t,e])=>({value:t,label:e}));unitSignal=F$1(this.unitControl.valueChanges.pipe(md(this.unitControl.value)));endTypeSignal=F$1(this.endTypeControl.valueChanges.pipe(md(this.endTypeControl.value)));showDayFilter=KC(()=>this.unitSignal()===Ue.WEEK);showEndDate=KC(()=>this.endTypeSignal()===Ne$1.ON_DATE);showOccurrenceCount=KC(()=>this.endTypeSignal()===Ne$1.OCCURRENCES);agentConfigs=Ui([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){this.startDateControl.setValue(Re());let t=this.route.snapshot.paramMap.get("scheduledPromptId");t?(this.isEditMode.set(true),this.loadPromptAndResources(t)):this.loadResources();}loadPromptAndResources(t){this.isLoading.set(true),Ty({prompt:this.state.getById(t),agentConfigs:this.agentConfigs$()}).pipe(U$1(this.destroyRef)).subscribe({next:({prompt:e,agentConfigs:l})=>{this.existingPrompt=e,this.agentConfigs.set(l),this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadResources(){this.agentConfigs$().pipe(U$1(this.destroyRef)).subscribe(t=>this.agentConfigs.set(t));}agentConfigs$(){return (this.isPlatformMode?this.agentConfigController.listPlatformAgentsAgentConfig():this.agentConfigController.listByParentAgentConfig(this.namespaceId)).pipe(da(()=>Cr([])))}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId),this.promptContentControl.setValue(t.promptContent),this.unitControl.setValue(t.recurrence.unit),this.daysControl.setValue(t.recurrence.days??[]),this.timeUtcControl.setValue(t.recurrence.timeUtc),this.startDateControl.setValue(t.planning.startDate),this.endTypeControl.setValue(t.planning.endType),this.endDateControl.setValue(t.planning.endDate??null),this.occurrenceCountControl.setValue(t.planning.maxOccurrenceCount??null),this.enabledControl.setValue(t.enabled),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}isDaySelected(t){return this.daysControl.value.includes(t)}toggleDay(t){let e=this.daysControl.value,l=e.includes(t)?e.filter(f=>f!==t):[...e,t];this.daysControl.setValue(l);}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=this.endTypeControl.value,l=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,agentConfigId:t?this.existingPrompt.agentConfigId:this.agentConfigIdControl.value,promptContent:this.promptContentControl.value.trim(),recurrence:{unit:this.unitControl.value,days:this.daysControl.value,timeUtc:this.timeUtcControl.value},planning:{startDate:this.startDateControl.value,endType:e,endDate:e===Ne$1.ON_DATE?this.endDateControl.value??void 0:void 0,maxOccurrenceCount:e===Ne$1.OCCURRENCES?this.occurrenceCountControl.value??void 0:void 0},enabled:this.enabledControl.value,removed:this.existingPrompt?.removed??false,externalMetadata:(()=>{let h=this.externalMetadataJsonControl.value.trim();return h?JSON.parse(h):null})()});(t?this.state.update(this.existingPrompt.id,l):this.state.create(l)).pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:h=>{this.isSubmitting.set(false),h.status===409?this.errorMessage.set(`A scheduled prompt named "${l.name}" already exists in this scope.`):h.status===400?this.errorMessage.set(h.error?.message??"Invalid scheduled prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","scheduled-prompts"]):this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts"]);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=mw({type:n,selectors:[["agentos-scheduled-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to scheduled prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","sp-name","required","","hint",'Free-form name (e.g. "Weekly Report"). Cannot be changed after creation.',3,"error"],["dsControl","","id","sp-name","type","text","placeholder","e.g. Weekly Report","autocomplete","off",3,"formControl"],["label","Description","controlId","sp-description"],["dsControl","","id","sp-description","type","text","placeholder","Optional \u2014 short description","autocomplete","off",3,"formControl"],["label","Agent Config","required","","hint","Agent Config cannot be changed after creation."],["label","Agent Config","required",""],["label","Agent Config","controlId","sp-agent-config","required","","hint","Immutable after creation.",3,"error"],["label","Opening message","controlId","sp-prompt-content","required","","hint","The message sent to the agent when the scheduled prompt fires.",3,"error"],["dsControl","","id","sp-prompt-content","rows","6","placeholder","Enter the message sent to the agent when the scheduled prompt fires\u2026",3,"formControl"],["legend","Recurrence"],["label","Unit","controlId","sp-unit","required",""],["dsControl","","id","sp-unit",3,"formControl"],[3,"value"],["label","Days of week","hint","Leave empty to run every day of the week."],["label","Time (UTC)","controlId","sp-time","required","",3,"error"],[1,"ds-inline"],["dsControl","","id","sp-time","type","time",3,"formControl"],[1,"ds-meta"],["legend","Planning"],["label","Start date","controlId","sp-start-date","required","",3,"error"],["dsControl","","id","sp-start-date","type","date",3,"formControl"],["label","Ends","controlId","sp-end-type","required",""],["dsControl","","id","sp-end-type",3,"formControl"],["label","End date","controlId","sp-end-date","required","",3,"error"],["label","Number of occurrences","controlId","sp-occurrence-count","required","",3,"error"],[1,"ds-stack","ds-stack--sm"],["dsCheck",""],["type","checkbox",3,"formControl"],[1,"ds-hint","ds-indent"],["label","External Metadata","controlId","sp-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","sp-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["dsControl","","type","text","readonly","",3,"value"],[3,"href"],["dsControl","","id","sp-agent-config",3,"formControl"],["value","","disabled",""],[1,"ds-inline","ds-inline--wrap"],["type","checkbox",3,"change","checked"],["dsControl","","id","sp-end-date","type","date",3,"formControl"],["dsControl","","id","sp-occurrence-count","type","number","min","1",1,"ds-control--narrow",3,"formControl"]],template:function(e,l){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return l.cancel()}),MC(3),pl()(),Pw(4,be,2,0,"p",2)(5,Oe,44,22,"form",3),pl()),e&2&&(jE(),ug("title",l.isEditMode()?"Edit scheduled prompt":"New scheduled prompt"),jE(2),vl(" \u2190 ",l.isPlatformMode?"Platform scheduled prompts":"Scheduled prompts"," "),jE(),Lw(l.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,kn,vn,Gt,mo,po,$r,Vn,An,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};function Ae(n){let t=n.get("endType")?.value,e=n.get("endDate")?.value;return t===Ne$1.ON_DATE&&!e?{endDateRequired:true}:null}function Ve(n){let t=n.get("endType")?.value,e=n.get("occurrenceCount")?.value;return t===Ne$1.OCCURRENCES&&(e==null||e<1)?{occurrenceCountRequired:true}:null}function ke(n){let t=n.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}function Re(){let n=new Date,t=n.getFullYear(),e=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return `${t}-${e}-${l}`}export{ye as ScheduledPromptFormComponent};
@@ -1 +1 @@
1
- import {o}from'./chunk-nXCMX_XM.js';import {a as pt,T as Te,b as fn,U as Ut,n as nd,L as Lt,m as mo,c as po,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an,l as ko}from'./chunk-BuYWQnhP.js';import {g,W,F,I as Ie,U as Ui,x as U,E as x,z as w,m as mw,as as $t,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,L as Lw,X as Xw,q as qw,l as lg,Q as SI,V as Vw,al as jw,T as MI,H as Hw,v as vl,k as df,n as ff,O as Og}from'./main-BDHAW6RK.js';function ie(i,t){if(i&1&&(Ds(0,"a",2),MC(1,"View skill \u2192"),pl()),i&2){let e=Xw();ug("routerLink",e.inspectRoute());}}function oe(i,t){i&1&&(Ds(0,"ds-tag",3),MC(1,"Platform level"),pl());}function ne(i,t){i&1&&(Ds(0,"p",4),MC(1,"Loading\u2026"),pl());}function re(i,t){if(i&1){let e=qw();Ds(0,"div",15)(1,"div",19),lg(2,"input",20),SI(),Ds(3,"button",21),mg("click",function(){let l=df(e).$implicit,te=Xw(2);return ff(te.removeResource(l))}),MC(4," \xD7 "),pl()(),lg(5,"textarea",22),SI(),pl();}if(i&2){let e=t.$implicit;jE(2),ug("formControl",e.path),MI(),jE(3),ug("formControl",e.content),MI();}}function ae(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function se(i,t){if(i&1){let e=qw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let l=Xw();return ff(l.submit())}),Ds(1,"ds-form-field",7),lg(2,"input",8),SI(),pl(),Ds(3,"ds-form-field",9),lg(4,"textarea",10),SI(),pl(),Ds(5,"ds-form-field",11),lg(6,"textarea",12),SI(),pl(),Ds(7,"ds-form-field",13)(8,"div",14),Vw(9,re,6,2,"div",15,jw),Ds(11,"div")(12,"button",16),mg("click",function(){df(e);let l=Xw();return ff(l.addResource())}),MC(13,"+ Add resource"),pl()()()(),Pw(14,ae,2,1,"ds-notice"),Ds(15,"ds-form-actions")(16,"button",17),MC(17),pl(),Ds(18,"button",18),mg("click",function(){df(e);let l=Xw();return ff(l.cancel())}),MC(19,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"A valid, non-empty name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.bodyControl),MI(),jE(3),Hw(e.resourceRows()),jE(5),Lw(e.errorMessage()?14:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isSubmitting()?"Saving\u2026":e.isEditMode()?"Save changes":"Create"," ");}}var ee=class i{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isEditMode=Ui(false);isLoading=Ui(false);isSubmitting=Ui(false);errorMessage=Ui(null);existingSkill=null;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(100),fn.pattern(/^[a-zA-Z0-9_.-]+( [a-zA-Z0-9_.-]+)*$/)]}),description:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(500),fn.pattern(/\S/)]}),body:new Te("",{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})});resourceRows=Ui([]);get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get bodyControl(){return this.form.controls.body}ngOnInit(){let t=this.route.snapshot.paramMap.get("skillId");t&&(this.isEditMode.set(true),this.isLoading.set(true),this.skillState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{if(e.readOnly){this.router.navigate(this.inspectRoute());return}this.existingSkill=e,this.form.patchValue({name:e.name,description:e.description,body:e.body}),this.resourceRows.set(Object.entries(e.resources??{}).map(([o,l])=>({path:new Te(o,{nonNullable:true}),content:new Te(l,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}}));}addResource(){this.resourceRows.update(t=>[...t,{path:new Te("",{nonNullable:true}),content:new Te("",{nonNullable:true})}]);}removeResource(t){this.resourceRows.update(e=>e.filter(o=>o!==t));}buildResourcesPayload(){let t=this.resourceRows().map(e=>[e.path.value.trim(),e.content.value]).filter(([e])=>e.length>0);return Object.fromEntries(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=x(w({},this.existingSkill??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim(),body:this.bodyControl.value,resources:this.buildResourcesPayload()});(this.isEditMode()?this.skillState.update(this.existingSkill?.id??"",t):this.skillState.create(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:o=>{this.isSubmitting.set(false),o.status===409?this.errorMessage.set(`A skill named "${this.nameControl.value.trim()}" already exists in this scope.`):o.status===400?this.errorMessage.set("The server rejected this skill. A filesystem-backed skill cannot be modified."):this.errorMessage.set("Saving the skill failed.");}});}cancel(){this.navigateBack();}inspectRoute(){let t=this.route.snapshot.paramMap.get("skillId")??"";return this.isPlatformMode?["/agentos","admin","skills",t,"inspect"]:["/agentos",this.namespaceId,"skills",t,"inspect"]}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-skill-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to skills",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"],["label","Name","controlId","skill-name","hint","The value an agent's skillSelectors entry must match. Letters, digits, dash, dot, underscore and single spaces; 100 characters max.",3,"error"],["dsControl","","id","skill-name","type","text","autocomplete","off",3,"formControl"],["label","Description","controlId","skill-description","hint","This is what the agent sees in its skill catalog \u2014 it decides from this line alone whether to read the skill. 500 characters max."],["dsControl","","id","skill-description","rows","2",3,"formControl"],["label","Body","controlId","skill-body","hint","Markdown instructions returned verbatim by the readSkill tool when the agent asks for this skill."],["dsControl","","mono","","id","skill-body","rows","16",3,"formControl"],["label","Resources","hint","Optional files the agent can read with readSkillResource, by relative path."],[1,"ds-stack"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],[1,"ds-inline"],["dsControl","","mono","","type","text","placeholder","e.g. references/checklist.md","aria-label","Resource path","autocomplete","off",3,"formControl"],["dsButton","","variant","icon-danger","type","button","title","Remove","aria-label","Remove resource",3,"click"],["dsControl","","mono","","rows","4","aria-label","Resource content",3,"formControl"]],template:function(e,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),MC(3,"\u2190 Skills"),pl(),Pw(4,ie,2,1,"a",2),Pw(5,oe,2,0,"ds-tag",3),pl(),Pw(6,ne,2,0,"p",4)(7,se,20,8,"form",5),pl()),e&2&&(jE(),ug("title",o.isEditMode()?"Edit skill":"New skill"),jE(3),Lw(o.isEditMode()?4:-1),jE(),Lw(o.isPlatformMode?5:-1),jE(),Lw(o.isLoading()?6:7));},dependencies:[Ut,nd,Lt,mo,po,Vn,An,$t,pn,hn,cn,dn,mn,at,an,ko],encapsulation:2})};export{ee as SkillFormComponent};
1
+ import {o}from'./chunk-qoIZ3288.js';import {a as pt,T as Te,b as fn,U as Ut,n as nd,L as Lt,m as mo,c as po,V as Vn,A as An,d as pn,h as hn,e as cn,g as dn,C as mn,i as at,j as an,l as ko}from'./chunk-DeQOcTxZ.js';import {g,W,F,I as Ie,U as Ui,x as U,E as x,z as w,m as mw,as as $t,D as Ds,N as mg,M as MC,a as pl,P as Pw,j as jE,G as ug,L as Lw,X as Xw,q as qw,l as lg,Q as SI,V as Vw,al as jw,T as MI,H as Hw,v as vl,k as df,n as ff,O as Og}from'./main-VHZF3DP6.js';function ie(i,t){if(i&1&&(Ds(0,"a",2),MC(1,"View skill \u2192"),pl()),i&2){let e=Xw();ug("routerLink",e.inspectRoute());}}function oe(i,t){i&1&&(Ds(0,"ds-tag",3),MC(1,"Platform level"),pl());}function ne(i,t){i&1&&(Ds(0,"p",4),MC(1,"Loading\u2026"),pl());}function re(i,t){if(i&1){let e=qw();Ds(0,"div",15)(1,"div",19),lg(2,"input",20),SI(),Ds(3,"button",21),mg("click",function(){let l=df(e).$implicit,te=Xw(2);return ff(te.removeResource(l))}),MC(4," \xD7 "),pl()(),lg(5,"textarea",22),SI(),pl();}if(i&2){let e=t.$implicit;jE(2),ug("formControl",e.path),MI(),jE(3),ug("formControl",e.content),MI();}}function ae(i,t){if(i&1&&(Ds(0,"ds-notice"),MC(1),pl()),i&2){let e=Xw(2);jE(),Og(e.errorMessage());}}function se(i,t){if(i&1){let e=qw();Ds(0,"form",6),mg("ngSubmit",function(){df(e);let l=Xw();return ff(l.submit())}),Ds(1,"ds-form-field",7),lg(2,"input",8),SI(),pl(),Ds(3,"ds-form-field",9),lg(4,"textarea",10),SI(),pl(),Ds(5,"ds-form-field",11),lg(6,"textarea",12),SI(),pl(),Ds(7,"ds-form-field",13)(8,"div",14),Vw(9,re,6,2,"div",15,jw),Ds(11,"div")(12,"button",16),mg("click",function(){df(e);let l=Xw();return ff(l.addResource())}),MC(13,"+ Add resource"),pl()()()(),Pw(14,ae,2,1,"ds-notice"),Ds(15,"ds-form-actions")(16,"button",17),MC(17),pl(),Ds(18,"button",18),mg("click",function(){df(e);let l=Xw();return ff(l.cancel())}),MC(19,"Cancel"),pl()()();}if(i&2){let e=Xw();ug("formGroup",e.form),jE(),ug("error",e.nameControl.invalid&&e.nameControl.touched?"A valid, non-empty name is required.":null),jE(),ug("formControl",e.nameControl),MI(),jE(2),ug("formControl",e.descriptionControl),MI(),jE(2),ug("formControl",e.bodyControl),MI(),jE(3),Hw(e.resourceRows()),jE(5),Lw(e.errorMessage()?14:-1),jE(2),ug("disabled",e.form.invalid||e.isSubmitting()),jE(),vl(" ",e.isSubmitting()?"Saving\u2026":e.isEditMode()?"Save changes":"Create"," ");}}var ee=class i{route=g(W);router=g(F);destroyRef=g(Ie);skillState=g(o);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isEditMode=Ui(false);isLoading=Ui(false);isSubmitting=Ui(false);errorMessage=Ui(null);existingSkill=null;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(100),fn.pattern(/^[a-zA-Z0-9_.-]+( [a-zA-Z0-9_.-]+)*$/)]}),description:new Te("",{nonNullable:true,validators:[fn.required,fn.maxLength(500),fn.pattern(/\S/)]}),body:new Te("",{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})});resourceRows=Ui([]);get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get bodyControl(){return this.form.controls.body}ngOnInit(){let t=this.route.snapshot.paramMap.get("skillId");t&&(this.isEditMode.set(true),this.isLoading.set(true),this.skillState.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{if(e.readOnly){this.router.navigate(this.inspectRoute());return}this.existingSkill=e,this.form.patchValue({name:e.name,description:e.description,body:e.body}),this.resourceRows.set(Object.entries(e.resources??{}).map(([o,l])=>({path:new Te(o,{nonNullable:true}),content:new Te(l,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}}));}addResource(){this.resourceRows.update(t=>[...t,{path:new Te("",{nonNullable:true}),content:new Te("",{nonNullable:true})}]);}removeResource(t){this.resourceRows.update(e=>e.filter(o=>o!==t));}buildResourcesPayload(){let t=this.resourceRows().map(e=>[e.path.value.trim(),e.content.value]).filter(([e])=>e.length>0);return Object.fromEntries(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true),this.errorMessage.set(null);let t=x(w({},this.existingSkill??{}),{namespaceId:this.namespaceId??null,name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim(),body:this.bodyControl.value,resources:this.buildResourcesPayload()});(this.isEditMode()?this.skillState.update(this.existingSkill?.id??"",t):this.skillState.create(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:o=>{this.isSubmitting.set(false),o.status===409?this.errorMessage.set(`A skill named "${this.nameControl.value.trim()}" already exists in this scope.`):o.status===400?this.errorMessage.set("The server rejected this skill. A filesystem-backed skill cannot be modified."):this.errorMessage.set("Saving the skill failed.");}});}cancel(){this.navigateBack();}inspectRoute(){let t=this.route.snapshot.paramMap.get("skillId")??"";return this.isPlatformMode?["/agentos","admin","skills",t,"inspect"]:["/agentos",this.namespaceId,"skills",t,"inspect"]}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","skills"]):this.router.navigate(["/agentos",this.namespaceId,"skills"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=mw({type:i,selectors:[["agentos-skill-form"]],decls:8,vars:4,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to skills",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"],["label","Name","controlId","skill-name","hint","The value an agent's skillSelectors entry must match. Letters, digits, dash, dot, underscore and single spaces; 100 characters max.",3,"error"],["dsControl","","id","skill-name","type","text","autocomplete","off",3,"formControl"],["label","Description","controlId","skill-description","hint","This is what the agent sees in its skill catalog \u2014 it decides from this line alone whether to read the skill. 500 characters max."],["dsControl","","id","skill-description","rows","2",3,"formControl"],["label","Body","controlId","skill-body","hint","Markdown instructions returned verbatim by the readSkill tool when the agent asks for this skill."],["dsControl","","mono","","id","skill-body","rows","16",3,"formControl"],["label","Resources","hint","Optional files the agent can read with readSkillResource, by relative path."],[1,"ds-stack"],[1,"ds-stack","ds-stack--sm"],["dsButton","","variant","ghost","type","button",3,"click"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],[1,"ds-inline"],["dsControl","","mono","","type","text","placeholder","e.g. references/checklist.md","aria-label","Resource path","autocomplete","off",3,"formControl"],["dsButton","","variant","icon-danger","type","button","title","Remove","aria-label","Remove resource",3,"click"],["dsControl","","mono","","rows","4","aria-label","Resource content",3,"formControl"]],template:function(e,o){e&1&&(Ds(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),mg("click",function(){return o.cancel()}),MC(3,"\u2190 Skills"),pl(),Pw(4,ie,2,1,"a",2),Pw(5,oe,2,0,"ds-tag",3),pl(),Pw(6,ne,2,0,"p",4)(7,se,20,8,"form",5),pl()),e&2&&(jE(),ug("title",o.isEditMode()?"Edit skill":"New skill"),jE(3),Lw(o.isEditMode()?4:-1),jE(),Lw(o.isPlatformMode?5:-1),jE(),Lw(o.isLoading()?6:7));},dependencies:[Ut,nd,Lt,mo,po,Vn,An,$t,pn,hn,cn,dn,mn,at,an,ko],encapsulation:2})};export{ee as SkillFormComponent};