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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/browser/{chunk-DMaZtyPG.js → chunk-1eRn_62f.js} +1 -1
  2. package/browser/{chunk-iEPxdwNo.js → chunk-2_zz7NAC.js} +1 -1
  3. package/browser/{chunk-D5fiBKR6.js → chunk-AyHTO4Sx.js} +1 -1
  4. package/browser/{chunk-6YBD0GhT.js → chunk-B-B5NvWL.js} +1 -1
  5. package/browser/{chunk-CWww3DEx.js → chunk-B1vEKrz_.js} +1 -1
  6. package/browser/{chunk-BwLhUg85.js → chunk-B6qP3Hvp.js} +1 -1
  7. package/browser/{chunk-BtAgB7lp.js → chunk-BRida568.js} +1 -1
  8. package/browser/{chunk-C57r8bJB.js → chunk-BXNum5Uv.js} +1 -1
  9. package/browser/{chunk-CjEtYpc7.js → chunk-BXWcQ9nJ.js} +1 -1
  10. package/browser/{chunk-D2h70wlj.js → chunk-BiTjjS7f.js} +1 -1
  11. package/browser/{chunk-Cii8kID2.js → chunk-BmA5vDQy.js} +1 -1
  12. package/browser/{chunk-BZQ9JxtK.js → chunk-BxmI0rEJ.js} +1 -1
  13. package/browser/{chunk-CHLgsXpc.js → chunk-BzHtPq4J.js} +1 -1
  14. package/browser/{chunk-paKwZTsF.js → chunk-C9uCCw8u.js} +1 -1
  15. package/browser/{chunk-C4CShhcg.js → chunk-CFbt2W-4.js} +1 -1
  16. package/browser/{chunk-NuH8shYm.js → chunk-CJA7LP9I.js} +1 -1
  17. package/browser/{chunk-BUfak7ZR.js → chunk-CMTE1K7b.js} +1 -1
  18. package/browser/{chunk-CyEpqhHA.js → chunk-CQe9V6Kx.js} +1 -1
  19. package/browser/{chunk-AtCYApei.js → chunk-CRTm3TW7.js} +1 -1
  20. package/browser/{chunk-TWv3ObgU.js → chunk-CWVqBlP_.js} +1 -1
  21. package/browser/{chunk-BlPBulzu.js → chunk-Ck42W3Td.js} +1 -1
  22. package/browser/{chunk-DRUw-4Lk.js → chunk-ClfOew6l.js} +1 -1
  23. package/browser/{chunk-OhgFuyjp.js → chunk-CuBq-gTP.js} +1 -1
  24. package/browser/{chunk-C4FZ3_Nh.js → chunk-CxGrMAsv.js} +1 -1
  25. package/browser/{chunk-Dz39nB4A.js → chunk-D0VIctP9.js} +1 -1
  26. package/browser/{chunk-Bqg4NsQw.js → chunk-D4dSdxUc.js} +1 -1
  27. package/browser/{chunk-BLevlpuu.js → chunk-D6Jd9h9a.js} +1 -1
  28. package/browser/{chunk-B1xRCZ-V.js → chunk-DGjD1lCO.js} +1 -1
  29. package/browser/{chunk-DKN9kTwu.js → chunk-DHNEs7J8.js} +1 -1
  30. package/browser/{chunk-CYwBGwuM.js → chunk-DKozzs8J.js} +1 -1
  31. package/browser/{chunk-CrvFTHbA.js → chunk-DWhB9E6K.js} +1 -1
  32. package/browser/{chunk-BHKhFWCm.js → chunk-DZLxIPvO.js} +1 -1
  33. package/browser/chunk-DbZbECFq.js +1 -0
  34. package/browser/{chunk-DFkt8tY0.js → chunk-DdQVnFkx.js} +1 -1
  35. package/browser/{chunk-58tiRI-H.js → chunk-DgjvisKR.js} +1 -1
  36. package/browser/{chunk-KQaRB5fZ.js → chunk-DrL2kj2Q.js} +1 -1
  37. package/browser/{chunk-XnJGN0OJ.js → chunk-Dsli5F3b.js} +1 -1
  38. package/browser/{chunk-BjniM4kn.js → chunk-Dv--4A7A.js} +1 -1
  39. package/browser/{chunk-DKkNMT3S.js → chunk-HNne7KzG.js} +1 -1
  40. package/browser/{chunk-bCI6skcH.js → chunk-Ncao0R2n.js} +16 -16
  41. package/browser/{chunk-CseRCWgR.js → chunk-Xi-gu1fS.js} +1 -1
  42. package/browser/{chunk-B97Q0PCu.js → chunk-h4Ucvwue.js} +1 -1
  43. package/browser/{chunk-BRekDeCw.js → chunk-jbtuI0D4.js} +1 -1
  44. package/browser/{chunk-pbgW0Sdk.js → chunk-kgDzsPcI.js} +1 -1
  45. package/browser/{chunk-Ct896VFa.js → chunk-ldd-YZJ3.js} +1 -1
  46. package/browser/{chunk-d7XsX4kM.js → chunk-pTZfve8g.js} +1 -1
  47. package/browser/index.html +1 -1
  48. package/browser/{main-PUOSMZMX.js → main-6MVJZWGK.js} +1 -1
  49. package/package.json +1 -1
  50. package/browser/chunk-2gGq060a.js +0 -1
@@ -1 +1 @@
1
- import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-bCI6skcH.js';import {g,W,q as F,I as we,ag as U,$ as $i,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,am as Vw,t as eC,S as xI,F as Fg,k as $w,l as lg,u as pf,w as hf}from'./main-PUOSMZMX.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=eC(3);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),xC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),BE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),xC(3,"\u2014 None \u2014"),hl(),Uw(4,ge,2,2,"option",24,ce),hl(),MI(),hl()),o&2){let e=eC(3);BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(),dg("ngValue",null),BE(2),$w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&jw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=eC(2);Bw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),xC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Yw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),MI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),MI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),MI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeParameter(d))}),xC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),BE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),dg("id","param-name-"+r),xI(),BE(),dg("controlId","param-desc-"+r),BE(),dg("id","param-desc-"+r),xI(),BE(),dg("controlId","param-default-"+r),BE(),dg("id","param-default-"+r),xI();}}function _e(o,t){if(o&1){let e=Yw();Es(0,"div",14)(1,"span",33),xC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),MI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeContentEntry(d))}),xC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=eC(2);BE(2),Fg(r+1),BE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),xI(),BE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),xC(1),hl()),o&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Yw();Es(0,"button",37),vg("click",function(){pf(e);let d=eC(2);return hf(d.exportYaml())}),xC(1),hl();}if(o&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=eC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),xC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),xC(10),hl(),xC(11," in content entries to reference them. "),hl(),Es(12,"div",10),jw(13,ve,2,0,"p",2),Uw(14,he,10,8,"div",11,Vw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addParameter())}),xC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),xC(21," Each content entry is a command. Use "),Es(22,"code"),xC(23,"@AgentName"),hl(),xC(24," to target an agent, "),Es(25,"code"),xC(26,"/promptName param1 param2"),hl(),xC(27," to call another prompt, and "),Es(28,"code"),xC(29),hl(),xC(30," for parameter placeholders. "),hl(),Es(31,"div",10),Uw(32,_e,7,5,"div",14,Vw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addContentEntry())}),xC(36,"+ Add content entry"),hl()()()(),jw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),MI(),hl(),Es(40,"ds-form-actions")(41,"button",17),xC(42),hl(),jw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=eC();return hf(d.cancel())}),xC(45,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.availableAgentConfigs().length>0?5:-1),BE(5),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","parameters"),BE(),Bw(e.parametersArray.length===0?13:-1),BE(),$w(e.parametersArray.controls),BE(15),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","content"),BE(),$w(e.contentArray.controls),BE(5),Bw(e.errorMessage()?37:-1),BE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),Bw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3),hl()(),jw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),Bw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
1
+ import {D as m,p as pt,E as Bt,T as Te,a as fn,U as Ut,n as nd,b as bo,x as xo,L as Lt,G as Gt,m as mo,c as po,V as Vn,A as An,v as va,F as go,_ as _o,d as pn,h as hn,e as cn,r as ln,g as dn,C as mn,i as at,j as an}from'./chunk-Ncao0R2n.js';import {g,W,q as F,I as we,ag as U,$ as $i,K as U$1,a2 as ha,aa as br,N as x,L as w,v as vw,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,s as Dl,c as Bw,Y as Yw,f as fg,R as MI,U as Uw,am as Vw,t as eC,S as xI,F as Fg,k as $w,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(Es(0,"p",2),xC(1,"Loading\u2026"),hl());}function fe(o,t){if(o&1&&(Es(0,"ds-form-field",20),fg(1,"input",22),hl()),o&2){let e=eC(3);BE(),dg("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(Es(0,"option",24),xC(1),hl()),o&2){let e=t.$implicit;dg("ngValue",e.id),BE(),Fg(e.name);}}function Ce(o,t){if(o&1&&(Es(0,"ds-form-field",21)(1,"select",23)(2,"option",24),xC(3,"\u2014 None \u2014"),hl(),Uw(4,ge,2,2,"option",24,ce),hl(),MI(),hl()),o&2){let e=eC(3);BE(),dg("formControl",e.agentConfigIdControl),xI(),BE(),dg("ngValue",null),BE(2),$w(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&jw(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=eC(2);Bw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(Es(0,"p",2),xC(1,"No parameters defined."),hl());}function he(o,t){if(o&1){let e=Yw();Es(0,"div",11)(1,"div",25)(2,"ds-form-field",26),fg(3,"input",27),MI(),hl(),Es(4,"ds-form-field",28),fg(5,"input",29),MI(),hl(),Es(6,"ds-form-field",30),fg(7,"input",31),MI(),hl()(),Es(8,"button",32),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeParameter(d))}),xC(9," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index;dg("formGroupName",r),BE(2),dg("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),BE(),dg("id","param-name-"+r),xI(),BE(),dg("controlId","param-desc-"+r),BE(),dg("id","param-desc-"+r),xI(),BE(),dg("controlId","param-default-"+r),BE(),dg("id","param-default-"+r),xI();}}function _e(o,t){if(o&1){let e=Yw();Es(0,"div",14)(1,"span",33),xC(2),hl(),Es(3,"ds-form-field",34),fg(4,"textarea",35),MI(),hl(),Es(5,"button",36),vg("click",function(){let d=pf(e).$index,m=eC(2);return hf(m.removeContentEntry(d))}),xC(6," \xD7 "),hl()();}if(o&2){let e=t.$implicit,r=t.$index,d=eC(2);BE(2),Fg(r+1),BE(),dg("error",e.invalid&&e.touched?"Content entry must not be blank.":null),BE(),dg("formControlName",r),lg("aria-label","Content entry "+(r+1)),xI(),BE(),dg("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(Es(0,"ds-notice"),xC(1),hl()),o&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function be(o,t){if(o&1){let e=Yw();Es(0,"button",37),vg("click",function(){pf(e);let d=eC(2);return hf(d.exportYaml())}),xC(1),hl();}if(o&2){let e=eC(2);dg("disabled",e.isExporting()),BE(),Dl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Yw();Es(0,"form",4),vg("ngSubmit",function(){pf(e);let d=eC();return hf(d.submit())}),Es(1,"ds-form-field",5),fg(2,"input",6),MI(),hl(),Es(3,"ds-form-field",7),fg(4,"input",8),MI(),hl(),jw(5,ye,2,1),Es(6,"ds-fieldset",9)(7,"p",2),xC(8," Each parameter must have a name and a default value. Use "),Es(9,"code"),xC(10),hl(),xC(11," in content entries to reference them. "),hl(),Es(12,"div",10),jw(13,ve,2,0,"p",2),Uw(14,he,10,8,"div",11,Vw),Es(16,"div")(17,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addParameter())}),xC(18,"+ Add parameter"),hl()()()(),Es(19,"ds-fieldset",13)(20,"p",2),xC(21," Each content entry is a command. Use "),Es(22,"code"),xC(23,"@AgentName"),hl(),xC(24," to target an agent, "),Es(25,"code"),xC(26,"/promptName param1 param2"),hl(),xC(27," to call another prompt, and "),Es(28,"code"),xC(29),hl(),xC(30," for parameter placeholders. "),hl(),Es(31,"div",10),Uw(32,_e,7,5,"div",14,Vw),Es(34,"div")(35,"button",12),vg("click",function(){pf(e);let d=eC();return hf(d.addContentEntry())}),xC(36,"+ Add content entry"),hl()()()(),jw(37,xe,2,1,"ds-notice"),Es(38,"ds-form-field",15),fg(39,"textarea",16),MI(),hl(),Es(40,"ds-form-actions")(41,"button",17),xC(42),hl(),jw(43,be,2,2,"button",18),Es(44,"button",19),vg("click",function(){pf(e);let d=eC();return hf(d.cancel())}),xC(45,"Cancel"),hl()()();}if(o&2){let e=eC();dg("formGroup",e.form),BE(),dg("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),BE(),dg("formControl",e.nameControl),xI(),BE(2),dg("formControl",e.descriptionControl),xI(),BE(),Bw(e.availableAgentConfigs().length>0?5:-1),BE(5),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","parameters"),BE(),Bw(e.parametersArray.length===0?13:-1),BE(),$w(e.parametersArray.controls),BE(15),Fg(e.paramPlaceholderSyntax),BE(2),dg("formArrayName","content"),BE(),$w(e.contentArray.controls),BE(5),Bw(e.errorMessage()?37:-1),BE(),dg("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),BE(),dg("formControl",e.externalMetadataJsonControl),xI(),BE(2),dg("disabled",e.form.invalid||e.isSubmitting()),BE(),Dl(" ",e.isEditMode()?"Save changes":"Create"," "),BE(),Bw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Bt([this.createContentControl()],{validators:[fn.required]}),parameters:new Bt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=$i(false);isSubmitting=$i(false);isLoading=$i(false);isExporting=$i(false);errorMessage=$i(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=$i([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),ha(()=>br([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[fn.required,fn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[fn.required,fn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[fn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=vw({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.cancel()}),xC(3),hl()(),jw(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),hl()),e&2&&(BE(),dg("title",r.isEditMode()?"Edit prompt":"New prompt"),BE(2),Dl(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),BE(),Bw(r.isLoading()?4:5));},dependencies:[Ut,nd,bo,xo,Lt,Gt,mo,po,Vn,An,va,go,_o,pn,hn,cn,ln,dn,mn,at,an],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -0,0 +1 @@
1
+ import {a1 as ga,a2 as ha,aa as br,aD as $y}from'./main-6MVJZWGK.js';function i(t,o,p){return t.pipe(ga(()=>o().pipe(ha(()=>br(p)))),$y({bufferSize:1,refCount:true}))}export{i};
@@ -1 +1 @@
1
- import {i}from'./chunk-2gGq060a.js';import {y}from'./chunk-bCI6skcH.js';import {g,aE as X,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,N as x,L as w$1,a5 as vd,aF as an,aG as Ot,aH as cn,a6 as x$1}from'./main-PUOSMZMX.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>br([])));return t?Cy([e,this.loadNamespaceSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):Cy([e,this.loadNamespaceSettings("").pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):br([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),vd(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),vd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(vd(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ga(r=>this.controller.connectAuthSetting(t,e).pipe(vd(h=>n(h.authorizationUrl)),ga(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ga(()=>this.getConnection(t,e).pipe(ha(()=>br(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
1
+ import {i}from'./chunk-DbZbECFq.js';import {y}from'./chunk-Ncao0R2n.js';import {g,aE as X,Z as Tr,at as Cy,a1 as ga,a2 as ha,aa as br,ad as ne,aD as $y,N as x,L as w$1,a5 as vd,aF as an,aG as Ot,aH as cn,a6 as x$1}from'./main-6MVJZWGK.js';var nt=["ApiKeyAuthSetting","BasicAuthAuthSetting","BearerTokenAuthSetting","OAuthDiscoverableAuthSetting","OAuthMcpDiscoverableAuthSetting","OAuthCustomAuthSetting","OAuthRegisteredAuthSetting"],it={ApiKeyAuthSetting:"API Key",BasicAuthAuthSetting:"Basic Auth (username / password)",BearerTokenAuthSetting:"Bearer Token",OAuthDiscoverableAuthSetting:"OAuth \u2014 Discovery URL",OAuthMcpDiscoverableAuthSetting:"OAuth \u2014 MCP Discoverable",OAuthCustomAuthSetting:"OAuth \u2014 Custom endpoints",OAuthRegisteredAuthSetting:"OAuth \u2014 Registered app"},R="none",w="me",b=2e3,M=15e4,P=3,L={ApiKeyAuthSetting:"API_KEY",BasicAuthAuthSetting:"BASIC_AUTH",BearerTokenAuthSetting:"BEARER_TOKEN",OAuthDiscoverableAuthSetting:"OAUTH_DISCOVERABLE",OAuthMcpDiscoverableAuthSetting:"OAUTH_MCP_DISCOVERABLE",OAuthCustomAuthSetting:"OAUTH_CUSTOM",OAuthRegisteredAuthSetting:"OAUTH_REGISTERED"},k={API_KEY:"ApiKeyAuthSetting",BASIC_AUTH:"BasicAuthAuthSetting",BEARER_TOKEN:"BearerTokenAuthSetting",OAUTH_DISCOVERABLE:"OAuthDiscoverableAuthSetting",OAUTH_MCP_DISCOVERABLE:"OAuthMcpDiscoverableAuthSetting",OAUTH_CUSTOM:"OAuthCustomAuthSetting",OAUTH_REGISTERED:"OAuthRegisteredAuthSetting"};function B(i){let t=L[i.authType];return t?x(w$1({},i),{authType:t}):i}function m(i){return U(i)}function f(i){return i.map(U)}function U(i){let t=i;if(typeof t.authType=="string"){let e=k[t.authType];if(e)return x(w$1({},t),{authType:e})}return i}function H(i,t){return t===null?true:i!==void 0&&Date.parse(i)>Date.parse(t)}var I=class i$1{controller=g(X);userState=g(y);refresh$=new Tr(void 0);namespaceId$=new Tr(null);vm$=Cy([this.namespaceId$,this.refresh$]).pipe(ga(([t])=>{let e=this.loadPlatformSettings().pipe(ha(()=>br([])));return t?Cy([e,this.loadNamespaceSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings(t).pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r,h])=>({platform:n,namespace:o,userOnNs:r,userGlobal:h}))):Cy([e,this.loadNamespaceSettings("").pipe(ha(()=>br([]))),this.loadUserSettings("global").pipe(ha(()=>br([])))]).pipe(ne(([n,o,r])=>({platform:n,namespace:o,userOnNs:[],userGlobal:r})))}),$y({bufferSize:1,refCount:true}));setNamespace(t){this.namespaceId$.value!==t&&this.namespaceId$.next(t);}refresh(){this.refresh$.next();}loadUserSettings(t){let e=t==="global"?R:t;return this.controller.listAuthSetting(e,w).pipe(ne(n=>f(n)))}userGlobal$=i(this.refresh$,()=>this.loadUserSettings("global"),[]);loadPlatformSettings(){return this.controller.listAuthSetting(R).pipe(ne(t=>f(t)))}loadNamespaceSettings(t){return t?this.controller.listAuthSetting(t).pipe(ne(e=>f(e))):br([])}getById(t,e){return this.controller.getByIdAuthSetting(t).pipe(ne(n=>m(n)))}create(t,e,n){let r=this.userState.currentUser()?.id;if((e==="userOnNs"||e==="userGlobal")&&!r)throw new Error(`Cannot create ${e} auth setting before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(e==="namespace"&&(n===void 0||n===""))throw new Error("Cannot create namespace-scoped auth setting without a namespaceId");if(e==="userOnNs"&&!n)throw new Error("Cannot create userOnNs auth setting without a namespaceId");let h=B(x(w$1({},t),{namespaceId:e==="namespace"||e==="userOnNs"?n??void 0:void 0,userId:e==="userOnNs"||e==="userGlobal"?r:void 0}));return this.controller.createAuthSetting(h).pipe(ne(A=>m(A)),vd(()=>this.refresh()))}update(t,e,n){let o=B(x(w$1({},e),{namespaceId:n.namespaceId,userId:n.userId,authType:n.authType}));return this.controller.updateAuthSetting(t,o).pipe(ne(r=>m(r)),vd(()=>this.refresh()))}delete(t,e){return this.controller.deleteAuthSetting(t).pipe(vd(()=>this.refresh()))}getConnection(t,e){return this.controller.getConnectionAuthSetting(t,e)}resetCredential(t,e){return this.controller.resetMyCredentialAuthSetting(t,e)}connect(t,e,n,o){return this.getConnection(t,e).pipe(ga(r=>this.controller.connectAuthSetting(t,e).pipe(vd(h=>n(h.authorizationUrl)),ga(()=>this.awaitNewConnection(t,e,r.connected?r.connectedAt??null:null,o)))))}awaitNewConnection(t,e,n,o){let r=0,h=0;return an(b,b).pipe(ga(()=>this.getConnection(t,e).pipe(ha(()=>br(null)))),ne(A=>(r++,A?.connected&&H(A.connectedAt,n)?"connected":r*b>=M?"timeout":o()&&++h>=P?"abandoned":null)),Ot(A=>A!==null),cn(1))}static \u0275fac=function(e){return new(e||i$1)};static \u0275prov=x$1({token:i$1,factory:i$1.\u0275fac,providedIn:"root"})};export{I,it as i,nt as n};
@@ -1 +1 @@
1
- import {c}from'./chunk-paKwZTsF.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-bCI6skcH.js';import {g,W,q as F,I as we,$ as $i,ac as by,a2 as ha,aa as br,K as U,N as x,L as w,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-PUOSMZMX.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function Y(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function z(n,t){n&1&&(Es(0,"p",5),xC(1,"No scheduled prompts available."),hl());}function G(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function Q(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.prompt.description);}}function X(n,t){n&1&&(Es(0,"ds-tag",20),xC(1,"Read-only"),hl());}function Z(n,t){if(n&1){let e=Yw();Es(0,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.toggle(l))}),xC(1),hl(),Es(2,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.edit(l))}),xC(3," Edit "),hl();}if(n&2){let e=eC(2).$implicit;BE(),Fg(e.prompt.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Yw();jw(0,Z,4,2),Es(1,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.deletion.request(l.key))})("deleteConfirmed",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.confirmDelete(l))})("deleteCancelled",function(){pf(e);let l=eC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);Bw(i.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Es(0,"button",23),xC(1,"Inherited"),hl());}function ne(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,Q,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19)(12,"ds-tag",17),xC(13),hl(),jw(14,X,2,0,"ds-tag",20),hl()(),Es(15,"td",21)(16,"div",22),jw(17,ee,2,4)(18,te,2,0,"button",23),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.prompt.name),BE(),Bw(e.prompt.description?4:-1),BE(2),Fg(i.scheduleLabel(e.prompt)),BE(2),dg("variant",e.prompt.enabled?"accent":"outline"),BE(),Fg(e.prompt.enabled?"Enabled":"Disabled"),BE(3),dg("variant",e.scope==="platform"?"neutral":"accent"),BE(),Fg(e.scope==="platform"?"Platform":"Namespace"),BE(),Bw(e.scope==="platform"?14:-1),BE(3),Bw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,19,9,"tr",9,J),hl()()()),n&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){by({platform:this.state.listPlatform().pipe(ha(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return i.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,O,2,1,"p",3),jw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
1
+ import {c}from'./chunk-C9uCCw8u.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Ncao0R2n.js';import {g,W,q as F,I as we,$ as $i,ac as by,a2 as ha,aa as br,K as U,N as x,L as w,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-6MVJZWGK.js';var J=(n,t)=>t.key;function O(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function Y(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function z(n,t){n&1&&(Es(0,"p",5),xC(1,"No scheduled prompts available."),hl());}function G(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function Q(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.prompt.description);}}function X(n,t){n&1&&(Es(0,"ds-tag",20),xC(1,"Read-only"),hl());}function Z(n,t){if(n&1){let e=Yw();Es(0,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.toggle(l))}),xC(1),hl(),Es(2,"button",25),vg("click",function(){pf(e);let l=eC(2).$implicit,p=eC(2);return hf(p.edit(l))}),xC(3," Edit "),hl();}if(n&2){let e=eC(2).$implicit;BE(),Fg(e.prompt.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.prompt.name);}}function ee(n,t){if(n&1){let e=Yw();jw(0,Z,4,2),Es(1,"agentos-row-delete-action",24),vg("deleteRequested",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.deletion.request(l.key))})("deleteConfirmed",function(){pf(e);let l=eC().$implicit,p=eC(2);return hf(p.confirmDelete(l))})("deleteCancelled",function(){pf(e);let l=eC(3);return hf(l.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);Bw(i.deletion.confirmingId()!==e.key?0:-1),BE(),dg("rowKey",e.key)("rowLabel",e.prompt.name)("state",i.deletion);}}function te(n,t){n&1&&(Es(0,"button",23),xC(1,"Inherited"),hl());}function ne(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,Q,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19)(12,"ds-tag",17),xC(13),hl(),jw(14,X,2,0,"ds-tag",20),hl()(),Es(15,"td",21)(16,"div",22),jw(17,ee,2,4)(18,te,2,0,"button",23),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.prompt.name),BE(),Bw(e.prompt.description?4:-1),BE(2),Fg(i.scheduleLabel(e.prompt)),BE(2),dg("variant",e.prompt.enabled?"accent":"outline"),BE(),Fg(e.prompt.enabled?"Enabled":"Disabled"),BE(3),dg("variant",e.scope==="platform"?"neutral":"accent"),BE(),Fg(e.scope==="platform"?"Platform":"Namespace"),BE(),Bw(e.scope==="platform"?14:-1),BE(3),Bw(e.scope==="namespace"?17:18);}}function ie(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10),xC(11,"Scope"),hl(),Es(12,"th",10)(13,"span",11),xC(14,"Actions"),hl()()()(),Es(15,"tbody",8),Uw(16,ne,19,9,"tr",9,J),hl()()()),n&2){let e=eC();BE(16),$w(e.rowFilter.filteredRows());}}var H=class n{route=g(W);router=g(F);destroyRef=g(we);state=g(c);namespaceId=this.route.snapshot.params.namespaceId;rows=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.rows,t=>[t.prompt.name,t.prompt.description,this.scheduleLabel(t.prompt),t.prompt.enabled?"Enabled":"Disabled",t.scope].filter(Boolean).join(" "));constructor(){by({platform:this.state.listPlatform().pipe(ha(()=>br([]))),namespace:this.state.listByNamespace(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({platform:t,namespace:e})=>{this.rows.set([...t.map((i,l)=>({key:`platform:${i.id??l}`,prompt:i,scope:"platform"})),...e.map((i,l)=>({key:`namespace:${i.id??l}`,prompt:i,scope:"namespace"}))]),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts","new"]);}edit(t){t.scope==="platform"||!t.prompt.id||this.router.navigate(["/agentos",this.namespaceId,"scheduled-prompts",t.prompt.id,"edit"]);}toggle(t){if(t.scope==="platform")return;(t.prompt.enabled?this.state.disable(t.prompt.id??""):this.state.enable(t.prompt.id??"")).pipe(U(this.destroyRef)).subscribe(i=>this.rows.update(l=>l.map(p=>p.key===t.key?x(w({},p),{prompt:i}):p)));}confirmDelete(t){t.scope==="platform"||!t.prompt.id||this.deletion.execute(t.key,{request$:this.state.delete(t.prompt.id).pipe(U(this.destroyRef)),onSuccess:()=>this.rows.update(e=>e.filter(i=>i.key!==t.key)),errorMessage:`Deleting "${t.prompt.name}" failed. Try again.`});}scheduleLabel(t){let e=t.recurrence,i=e.unit===Ne.WEEK?"week":"month",l=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(p=>De[p]??p).join(", ")})`:"";return `Every ${i}${l} at ${e.timeUtc} UTC`}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-scheduled-prompt-list"]],decls:9,vars:3,consts:[["title","Scheduled prompts","description","Scheduled prompts for this namespace, including schedules inherited from the platform."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],["variant","outline"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"],["type","button",3,"click"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(p){return i.rowFilter.query.set(p)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,O,2,1,"p",3),jw(5,Y,2,0,"p",4)(6,z,2,0,"p",5)(7,G,2,0,"p",4)(8,ie,18,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.rows().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{H as ScheduledPromptListComponent};
@@ -1 +1 @@
1
- import {d as pn,h as hn,o as on,C as mn,i as at,q as sn,K as Oi,M as On}from'./chunk-bCI6skcH.js';import {g,W as W$1,q as F,I as we,ag as U,$ as $i,r as rT,K as U$1,v as vw,au as $t,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,M as Mg,s as Dl,U as Uw,k as $w,Y as Yw,f as fg,av as YC,aw as KC,u as pf,w as hf,ax as YD}from'./main-PUOSMZMX.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),xC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),xC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),xC(1,"User context"),hl(),Es(2,"dd",6),xC(3),hl()),t&2){let e=eC();BE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Yw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=eC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),xC(3),hl()()();}if(t&2){let e=eC(),r=eC();BE(),dg("open",!r.systemPromptCollapsed()),BE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Yw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=eC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),xC(3),hl()()();}if(t&2){let e=eC(),r=eC();BE(),dg("open",!r.instructionsCollapsed()),BE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),xC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),xC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),xC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),xC(3),hl(),jw(4,ee,2,0,"span",17),jw(5,te,2,0,"span",17),hl(),Es(6,"p",3),xC(7),hl()()),t&2){let e=n.$implicit;BE(3),Fg(e.name),BE(),Bw(e.namespaceId?-1:4),BE(),Bw(e.readOnly?5:-1),BE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),Uw(1,ne,8,4,"li",15,j),hl()),t&2){let e=eC(2);BE(),$w(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),xC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),YC(1,"agentosMarkdown")),t&2){let e=eC().$implicit;dg("innerHTML",KC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Yw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=eC(3);return hf(U.toggleTool(m))}),jw(2,ae,2,3,"div",19),Es(3,"pre",20),xC(4),hl()()();}if(t&2){let e=n.$implicit,r=eC(3);BE(),dg("heading",e.name)("open",r.isToolExpanded(e)),BE(),Bw(e.description?2:-1),BE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),Uw(1,de,5,4,"li",null,z),hl()),t&2){let e=eC();BE(),$w(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),xC(3,"Name"),hl(),Es(4,"dd"),xC(5),hl(),Es(6,"dt"),xC(7,"Resolved model"),hl(),Es(8,"dd",6),xC(9),hl(),Es(10,"dt"),xC(11,"Provider"),hl(),Es(12,"dd"),xC(13),hl(),Es(14,"dt",7),xC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),xC(18),hl()(),jw(19,W,4,1),hl()(),jw(20,X,4,2,"ds-card"),jw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),jw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),jw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=eC();BE(5),Fg(e.name),BE(4),Fg(e.resolvedModelApiName),BE(4),Fg(e.resolvedProviderName),BE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),BE(),Dl(" ",e.executionMode," "),BE(),Bw(e.userId?19:-1),BE(),Bw(e.systemPrompt?20:-1),BE(),Bw(e.instructions?21:-1),BE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),BE(),Bw(r.resolvedSkills().length===0?23:24),BE(2),dg("heading","Tools ("+e.tools.length+")"),BE(),Bw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=rT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=vw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),xC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),xC(5,"Edit config \u2192"),hl()(),jw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;BE(4),dg("routerLink",r.editRoute()),BE(2),Bw(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,o as on,C as mn,i as at,q as sn,K as Oi,M as On}from'./chunk-Ncao0R2n.js';import {g,W as W$1,q as F,I as we,ag as U,$ as $i,r as rT,K as U$1,v as vw,au as $t,E as Es,Q as vg,x as xC,a as hl,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,M as Mg,s as Dl,U as Uw,k as $w,Y as Yw,f as fg,av as YC,aw as KC,u as pf,w as hf,ax as YD}from'./main-6MVJZWGK.js';var j=(t,n)=>n.id,z=(t,n)=>n.name;function q(t,n){t&1&&(Es(0,"p",3),xC(1,"Loading\u2026"),hl());}function Q(t,n){t&1&&(Es(0,"ds-notice"),xC(1,"Failed to load agent definition."),hl());}function W(t,n){if(t&1&&(Es(0,"dt"),xC(1,"User context"),hl(),Es(2,"dd",6),xC(3),hl()),t&2){let e=eC();BE(3),Fg(e.userId);}}function X(t,n){if(t&1){let e=Yw();Es(0,"ds-card")(1,"ds-disclosure",12),vg("toggled",function(){pf(e);let m=eC(2);return hf(m.toggleSystemPrompt())}),Es(2,"pre",13),xC(3),hl()()();}if(t&2){let e=eC(),r=eC();BE(),dg("open",!r.systemPromptCollapsed()),BE(2),Fg(e.systemPrompt);}}function Y(t,n){if(t&1){let e=Yw();Es(0,"ds-card")(1,"ds-disclosure",14),vg("toggled",function(){pf(e);let m=eC(2);return hf(m.toggleInstructions())}),Es(2,"pre",13),xC(3),hl()()();}if(t&2){let e=eC(),r=eC();BE(),dg("open",!r.instructionsCollapsed()),BE(2),Fg(e.instructions);}}function Z(t,n){t&1&&(Es(0,"p",3),xC(1," This agent declares no skill, so it gets no skill tools. Attach skills from the edit form. "),hl());}function ee(t,n){t&1&&(Es(0,"span",17),xC(1,"platform"),hl());}function te(t,n){t&1&&(Es(0,"span",17),xC(1,"SKILL.md"),hl());}function ne(t,n){if(t&1&&(Es(0,"li",15)(1,"span")(2,"span",16),xC(3),hl(),jw(4,ee,2,0,"span",17),jw(5,te,2,0,"span",17),hl(),Es(6,"p",3),xC(7),hl()()),t&2){let e=n.$implicit;BE(3),Fg(e.name),BE(),Bw(e.namespaceId?-1:4),BE(),Bw(e.readOnly?5:-1),BE(2),Fg(e.description);}}function ie(t,n){if(t&1&&(Es(0,"ul",11),Uw(1,ne,8,4,"li",15,j),hl()),t&2){let e=eC(2);BE(),$w(e.resolvedSkills());}}function oe(t,n){t&1&&(Es(0,"p",3),xC(1,"No tools available for this agent."),hl());}function ae(t,n){if(t&1&&(fg(0,"div",19),YC(1,"agentosMarkdown")),t&2){let e=eC().$implicit;dg("innerHTML",KC(1,1,e.description),YD);}}function de(t,n){if(t&1){let e=Yw();Es(0,"li")(1,"ds-disclosure",18),vg("toggled",function(){let m=pf(e).$implicit,U=eC(3);return hf(U.toggleTool(m))}),jw(2,ae,2,3,"div",19),Es(3,"pre",20),xC(4),hl()()();}if(t&2){let e=n.$implicit,r=eC(3);BE(),dg("heading",e.name)("open",r.isToolExpanded(e)),BE(),Bw(e.description?2:-1),BE(2),Fg(r.formatSchema(e.inputSchema));}}function re(t,n){if(t&1&&(Es(0,"ul",11),Uw(1,de,5,4,"li",null,z),hl()),t&2){let e=eC();BE(),$w(e.tools);}}function se(t,n){if(t&1&&(Es(0,"ds-card",4)(1,"dl",5)(2,"dt"),xC(3,"Name"),hl(),Es(4,"dd"),xC(5),hl(),Es(6,"dt"),xC(7,"Resolved model"),hl(),Es(8,"dd",6),xC(9),hl(),Es(10,"dt"),xC(11,"Provider"),hl(),Es(12,"dd"),xC(13),hl(),Es(14,"dt",7),xC(15,"Execution mode"),hl(),Es(16,"dd",8)(17,"span",9),xC(18),hl()(),jw(19,W,4,1),hl()(),jw(20,X,4,2,"ds-card"),jw(21,Y,4,2,"ds-card"),Es(22,"ds-card",10),jw(23,Z,2,0,"p",3)(24,ie,3,0,"ul",11),hl(),Es(25,"ds-card",10),jw(26,oe,2,0,"p",3)(27,re,3,0,"ul",11),hl()),t&2){let e=n,r=eC();BE(5),Fg(e.name),BE(4),Fg(e.resolvedModelApiName),BE(4),Fg(e.resolvedProviderName),BE(4),Mg("agent-config-inspect__badge--active",e.executionMode!=="SIMPLE"),BE(),Dl(" ",e.executionMode," "),BE(),Bw(e.userId?19:-1),BE(),Bw(e.systemPrompt?20:-1),BE(),Bw(e.instructions?21:-1),BE(),dg("heading","Skills ("+r.resolvedSkills().length+")"),BE(),Bw(r.resolvedSkills().length===0?23:24),BE(2),dg("heading","Tools ("+e.tools.length+")"),BE(),Bw(e.tools.length===0?26:27);}}var K=class t{route=g(W$1);router=g(F);destroyRef=g(we);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;isPlatformMode=!this.namespaceId;isLoading=$i(true);hasError=$i(false);definition=$i(null);expandedTools=$i(new Set);resolvedSkills=rT(()=>this.definition()?.skills??[]);systemPromptCollapsed=$i(true);instructionsCollapsed=$i(true);ngOnInit(){this.agentConfigController.getDefinitionAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:n=>{this.definition.set(n),this.isLoading.set(false);},error:()=>{this.hasError.set(true),this.isLoading.set(false);}});}toggleTool(n){this.expandedTools.update(e=>{let r=new Set(e);return r.has(n.name)?r.delete(n.name):r.add(n.name),r});}isToolExpanded(n){return this.expandedTools().has(n.name)}toggleSystemPrompt(){this.systemPromptCollapsed.update(n=>!n);}toggleInstructions(){this.instructionsCollapsed.update(n=>!n);}formatSchema(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch(e){return n}}editRoute(){return this.isPlatformMode?["/agentos","admin","agent-configs",this.agentConfigId,"edit"]:["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]}back(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=vw({type:t,selectors:[["agentos-agent-config-inspect"]],decls:9,vars:2,consts:[["title","Agent definition"],["dsButton","","variant","ghost","type","button","title","Back to agent configs",3,"click"],["headerMeta","",1,"ds-link",3,"routerLink"],[1,"ds-hint"],["heading","General"],["dsDefinitionList",""],[1,"ds-mono"],[1,"agent-config-inspect__dt"],[1,"agent-config-inspect__dd"],[1,"agent-config-inspect__badge"],[3,"heading"],[1,"ds-list"],["heading","System Prompt",3,"toggled","open"],[1,"ds-pre","ds-pre--prose"],["heading","Instructions",3,"toggled","open"],[1,"ds-stack","ds-stack--sm"],[1,"ds-strong"],[1,"ds-meta"],["bordered","","mono","",3,"toggled","heading","open"],[1,"ds-prose","ds-hint",3,"innerHTML"],[1,"ds-pre"]],template:function(e,r){if(e&1&&(Es(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),vg("click",function(){return r.back()}),xC(3," \u2190 Agent configs "),hl(),Es(4,"a",2),xC(5,"Edit config \u2192"),hl()(),jw(6,q,2,0,"p",3)(7,Q,2,0,"ds-notice")(8,se,28,13),hl()),e&2){let m;BE(4),dg("routerLink",r.editRoute()),BE(2),Bw(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,2 +1,2 @@
1
- import {I}from'./chunk-DFkt8tY0.js';import {g,W,aW as L,I as we,$ as $i,r as rT,aX as Be,ac as by,K as U,a2 as ha,aa as br,v as vw,E as Es,f as fg,j as jw,a as hl,Q as vg,b as BE,c as Bw,P as dg,x as xC,Y as Yw,R as MI,U as Uw,t as eC,S as xI,k as $w,s as Dl,as as Pg,u as pf,w as hf,F as Fg}from'./main-PUOSMZMX.js';import {a6 as id,b as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a8 as da,ac 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-bCI6skcH.js';import'./chunk-2gGq060a.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Es(0,"p",1),xC(1,"Loading\u2026"),hl());}function se(i,t){if(i&1&&(Es(0,"ds-notice"),xC(1),hl()),i&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function re(i,t){if(i&1){let e=Yw();Es(0,"div")(1,"button",23),vg("click",function(){pf(e);let s=eC(2);return hf(s.retryLoad())}),xC(2,"Retry loading"),hl()();}}function ce(i,t){if(i&1&&(fg(0,"br"),xC(1)),i&2){let e=eC(3);BE(),Dl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Es(0,"ds-notice",3),xC(1),jw(2,ce,2,1),hl()),i&2){let e=eC(2);dg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),BE(),Dl(" Repository: ",e.checkoutStatus()," "),BE(),Bw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Es(0,"option",12),xC(1),hl()),i&2){let e=t.$implicit,c=eC(2);dg("value",e.id),BE(),Pg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Es(0,"p",13),xC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function pe(i,t){if(i&1){let e=Yw();Es(0,"button",24),vg("click",function(){pf(e);let s=eC(2);return hf(s.remove())}),xC(1," Remove association "),hl();}if(i&2){let e=eC(2);dg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Yw();jw(0,se,2,1,"ds-notice"),jw(1,re,3,0,"div"),jw(2,de,3,3,"ds-notice",3),Es(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.repositoryUrl.set(s))}),hl(),MI(),hl(),Es(6,"ds-form-field",7)(7,"input",8),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.mainBranch.set(s))}),hl(),MI(),hl(),Es(8,"ds-form-field",9)(9,"select",10),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.serviceAuthSettingId.set(s))}),Es(10,"option",11),xC(11,"Select an auth setting\u2026"),hl(),Uw(12,le,2,3,"option",12,oe),hl(),MI(),jw(14,me,2,0,"p",13),hl()(),Es(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.autoWorktree.set(s))}),hl(),MI(),xC(19," Offer a worktree to every new top-level case "),hl(),Es(20,"p",18),xC(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. "),hl()(),Es(22,"ds-form-field",19)(23,"input",20),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.setupCommand.set(s))}),hl(),MI(),Es(24,"p",13),xC(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. "),hl()()(),Es(26,"ds-form-actions")(27,"button",21),vg("click",function(){pf(e);let s=eC();return hf(s.save())}),xC(28),hl(),jw(29,pe,2,1,"button",22),hl();}if(i&2){let e=eC();Bw(e.errorMessage()?0:-1),BE(),Bw(e.associationLoaded()?-1:1),BE(),Bw(e.isAssociated()&&e.checkoutStatus()?2:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(2),dg("ngModel",e.repositoryUrl()),xI(),BE(2),dg("ngModel",e.mainBranch()),xI(),BE(2),dg("ngModel",e.serviceAuthSettingId()),xI(),BE(3),$w(e.eligibleAuthSettings()),BE(2),Bw(e.eligibleAuthSettings().length===0?14:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(3),dg("ngModel",e.autoWorktree()),xI(),BE(5),dg("ngModel",e.setupCommand()),xI(),BE(4),dg("disabled",!e.canSave()),BE(),Dl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),BE(),Bw(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(I);destroyRef=g(we);isLoading=$i(true);isSaving=$i(false);confirmingRemove=$i(false);associationLoaded=$i(false);errorMessage=$i(null);association=$i(null);authSettings=$i([]);repositoryUrl=$i("");mainBranch=$i("main");serviceAuthSettingId=$i("");autoWorktree=$i(false);setupCommand=$i("");namespaceId="";isAssociated=rT(()=>this.association()?.associated===true);eligibleAuthSettings=rT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=rT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=rT(()=>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),by({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),ha(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(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),ha(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(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=vw({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&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),jw(2,ae,2,0,"p",1)(3,ue,30,14),hl(),Es(4,"ds-confirm-dialog",2),vg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),hl()),e&2&&(BE(2),Bw(c.isLoading()?2:3),BE(2),dg("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
1
+ import {I}from'./chunk-DdQVnFkx.js';import {g,W,aW as L,I as we,$ as $i,r as rT,aX as Be,ac as by,K as U,a2 as ha,aa as br,v as vw,E as Es,f as fg,j as jw,a as hl,Q as vg,b as BE,c as Bw,P as dg,x as xC,Y as Yw,R as MI,U as Uw,t as eC,S as xI,k as $w,s as Dl,as as Pg,u as pf,w as hf,F as Fg}from'./main-6MVJZWGK.js';import {a6 as id,b as bo,x as xo,L as Lt,u as vn,G as Gt,m as mo,a8 as da,ac 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-Ncao0R2n.js';import'./chunk-DbZbECFq.js';var oe=(i,t)=>t.id;function ae(i,t){i&1&&(Es(0,"p",1),xC(1,"Loading\u2026"),hl());}function se(i,t){if(i&1&&(Es(0,"ds-notice"),xC(1),hl()),i&2){let e=eC(2);BE(),Fg(e.errorMessage());}}function re(i,t){if(i&1){let e=Yw();Es(0,"div")(1,"button",23),vg("click",function(){pf(e);let s=eC(2);return hf(s.retryLoad())}),xC(2,"Retry loading"),hl()();}}function ce(i,t){if(i&1&&(fg(0,"br"),xC(1)),i&2){let e=eC(3);BE(),Dl("",e.association()?.checkoutFailureReason," ");}}function de(i,t){if(i&1&&(Es(0,"ds-notice",3),xC(1),jw(2,ce,2,1),hl()),i&2){let e=eC(2);dg("tone",e.checkoutStatus()===e.CheckoutStatus.FAILED?"error":e.checkoutStatus()===e.CheckoutStatus.READY?"success":"neutral"),BE(),Dl(" Repository: ",e.checkoutStatus()," "),BE(),Bw(e.association()?.checkoutFailureReason?2:-1);}}function le(i,t){if(i&1&&(Es(0,"option",12),xC(1),hl()),i&2){let e=t.$implicit,c=eC(2);dg("value",e.id),BE(),Pg("",e.name," (",c.authTypeLabel(e.authType),")");}}function me(i,t){i&1&&(Es(0,"p",13),xC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),hl());}function pe(i,t){if(i&1){let e=Yw();Es(0,"button",24),vg("click",function(){pf(e);let s=eC(2);return hf(s.remove())}),xC(1," Remove association "),hl();}if(i&2){let e=eC(2);dg("disabled",!e.associationLoaded()||e.isSaving());}}function ue(i,t){if(i&1){let e=Yw();jw(0,se,2,1,"ds-notice"),jw(1,re,3,0,"div"),jw(2,de,3,3,"ds-notice",3),Es(3,"ds-fieldset",4)(4,"ds-form-field",5)(5,"input",6),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.repositoryUrl.set(s))}),hl(),MI(),hl(),Es(6,"ds-form-field",7)(7,"input",8),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.mainBranch.set(s))}),hl(),MI(),hl(),Es(8,"ds-form-field",9)(9,"select",10),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.serviceAuthSettingId.set(s))}),Es(10,"option",11),xC(11,"Select an auth setting\u2026"),hl(),Uw(12,le,2,3,"option",12,oe),hl(),MI(),jw(14,me,2,0,"p",13),hl()(),Es(15,"ds-fieldset",14)(16,"div",15)(17,"label",16)(18,"input",17),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.autoWorktree.set(s))}),hl(),MI(),xC(19," Offer a worktree to every new top-level case "),hl(),Es(20,"p",18),xC(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. "),hl()(),Es(22,"ds-form-field",19)(23,"input",20),vg("ngModelChange",function(s){pf(e);let u=eC();return hf(u.setupCommand.set(s))}),hl(),MI(),Es(24,"p",13),xC(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. "),hl()()(),Es(26,"ds-form-actions")(27,"button",21),vg("click",function(){pf(e);let s=eC();return hf(s.save())}),xC(28),hl(),jw(29,pe,2,1,"button",22),hl();}if(i&2){let e=eC();Bw(e.errorMessage()?0:-1),BE(),Bw(e.associationLoaded()?-1:1),BE(),Bw(e.isAssociated()&&e.checkoutStatus()?2:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(2),dg("ngModel",e.repositoryUrl()),xI(),BE(2),dg("ngModel",e.mainBranch()),xI(),BE(2),dg("ngModel",e.serviceAuthSettingId()),xI(),BE(3),$w(e.eligibleAuthSettings()),BE(2),Bw(e.eligibleAuthSettings().length===0?14:-1),BE(),dg("disabled",!e.associationLoaded()||e.isSaving()),BE(3),dg("ngModel",e.autoWorktree()),xI(),BE(5),dg("ngModel",e.setupCommand()),xI(),BE(4),dg("disabled",!e.canSave()),BE(),Dl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),BE(),Bw(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(I);destroyRef=g(we);isLoading=$i(true);isSaving=$i(false);confirmingRemove=$i(false);associationLoaded=$i(false);errorMessage=$i(null);association=$i(null);authSettings=$i([]);repositoryUrl=$i("");mainBranch=$i("main");serviceAuthSettingId=$i("");autoWorktree=$i(false);setupCommand=$i("");namespaceId="";isAssociated=rT(()=>this.association()?.associated===true);eligibleAuthSettings=rT(()=>this.authSettings().filter(t=>ge.includes(t.authType)));authTypeLabel(t){return he[t??""]??t??"unknown"}canSave=rT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=rT(()=>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),by({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),ha(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(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),ha(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(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=vw({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&&(Es(0,"ds-page"),fg(1,"ds-section-header",0),jw(2,ae,2,0,"p",1)(3,ue,30,14),hl(),Es(4,"ds-confirm-dialog",2),vg("confirmed",function(){return c.confirmRemove()})("cancelled",function(){return c.confirmingRemove.set(false)}),hl()),e&2&&(BE(2),Bw(c.isLoading()?2:3),BE(2),dg("open",c.confirmingRemove()));},dependencies:[id,bo,xo,Lt,vn,Gt,mo,da,Ni,pn,hn,cn,ln,dn,mn,at,an,rn],encapsulation:2})};
2
2
  export{ne as NamespaceGitComponent};
@@ -1 +1 @@
1
- import {I as I$1}from'./chunk-DFkt8tY0.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-PUOSMZMX.js';import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-bCI6skcH.js';import'./chunk-2gGq060a.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Es(0,"p",3),xC(1),hl()),e&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(e,t){e&1&&(Es(0,"p",4),xC(1,"Loading auth settings\u2026"),hl());}function H(e,t){e&1&&(Es(0,"p",5),xC(1,"No platform auth settings defined yet."),hl());}function U(e,t){e&1&&(Es(0,"p",4),xC(1,"No auth settings match the current filter."),hl());}function z(e,t){if(e&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onEdit(d))}),xC(1," Edit "),hl();}if(e&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onDelete(d))})("deleteCancelled",function(){pf(n);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(e&2){let n=eC().$implicit,a=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),e&2){let n=t.$implicit,a=eC(2);BE(2),Fg(n.name),BE(2),Dl(" ",n.authType," "),BE(3),Bw(a.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(e,t){if(e&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Authentication type"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,B),hl()()()),e&2){let n=eC();BE(12),$w(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(we);state=g(I$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();settings=$i([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,j,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
1
+ import {I as I$1}from'./chunk-DdQVnFkx.js';import {g,q as F,I as we,Z as Tr,$ as $i,a1 as ga,K as U$1,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,s as Dl,Y as Yw,l as lg,u as pf,w as hf}from'./main-6MVJZWGK.js';import {z as k,O as O$1,i as at,h as hn,I as Io,P,B as P$1}from'./chunk-Ncao0R2n.js';import'./chunk-DbZbECFq.js';var B=(e,t)=>t.id??t.name;function j(e,t){if(e&1&&(Es(0,"p",3),xC(1),hl()),e&2){let n=eC();BE(),Fg(n.deletion.error());}}function K(e,t){e&1&&(Es(0,"p",4),xC(1,"Loading auth settings\u2026"),hl());}function H(e,t){e&1&&(Es(0,"p",5),xC(1,"No platform auth settings defined yet."),hl());}function U(e,t){e&1&&(Es(0,"p",4),xC(1,"No auth settings match the current filter."),hl());}function z(e,t){if(e&1){let n=Yw();Es(0,"button",18),vg("click",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onEdit(d))}),xC(1," Edit "),hl();}if(e&2){let n=eC().$implicit;lg("aria-label","Edit "+n.name);}}function G(e,t){if(e&1){let n=Yw();Es(0,"agentos-row-delete-action",19),vg("deleteRequested",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.deletion.request(d.id))})("deleteConfirmed",function(){pf(n);let d=eC().$implicit,m=eC(2);return hf(m.onDelete(d))})("deleteCancelled",function(){pf(n);let d=eC(3);return hf(d.deletion.cancel())}),hl();}if(e&2){let n=eC().$implicit,a=eC(2);dg("rowKey",n.id)("rowLabel",n.name)("state",a.deletion);}}function J(e,t){if(e&1&&(Es(0,"tr",9)(1,"td",12),xC(2),hl(),Es(3,"td",13),xC(4),hl(),Es(5,"td",14)(6,"div",15),jw(7,z,2,1,"button",16),jw(8,G,1,3,"agentos-row-delete-action",17),hl()()()),e&2){let n=t.$implicit,a=eC(2);BE(2),Fg(n.name),BE(2),Dl(" ",n.authType," "),BE(3),Bw(a.deletion.confirmingId()!==n.id?7:-1),BE(),Bw(n.id?8:-1);}}function O(e,t){if(e&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Authentication type"),hl(),Es(8,"th",10)(9,"span",11),xC(10,"Actions"),hl()()()(),Es(11,"tbody",8),Uw(12,J,9,4,"tr",9,B),hl()()()),e&2){let n=eC();BE(12),$w(n.rowFilter.filteredRows());}}var I=class e{router=g(F);destroyRef=g(we);state=g(I$1);refresh$=new Tr(void 0);isLoading=$i(true);deletion=k();settings=$i([]);rowFilter=O$1(this.settings,t=>[t.name,t.authType].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(ga(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())),U$1(this.destroyRef)).subscribe({next:t=>{this.settings.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","auth-settings","new"]);}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","auth-settings",t.id,"edit"]);}onDelete(t){t.id&&this.deletion.execute(t.id,{request$:this.state.delete(t.id,"platform").pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${t.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=vw({type:e,selectors:[["agentos-platform-auth-settings"]],decls:9,vars:3,consts:[["title","Platform auth settings","description","Authentication settings shared across every namespace."],["label","Filter auth settings","placeholder","Filter auth settings\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform auth settings"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Authentication type",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,a){n&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(m){return a.rowFilter.query.set(m)}),hl(),Es(2,"button",2),vg("click",function(){return a.openCreateForm()}),xC(3,"New auth setting"),hl()(),jw(4,j,2,1,"p",3),jw(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(BE(),dg("query",a.rowFilter.query()),BE(3),Bw(a.deletion.error()?4:-1),BE(),Bw(a.isLoading()?5:a.settings().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,P,P$1],encapsulation:2})};export{I as PlatformAuthSettingsComponent};
@@ -1 +1 @@
1
- import {c}from'./chunk-paKwZTsF.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-bCI6skcH.js';import {g,q as F,I as we,$ as $i,K as U$1,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-PUOSMZMX.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),xC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Yw();Es(0,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.toggle(s))}),xC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.edit(s))}),xC(3,"Edit"),hl();}if(n&2){let e=eC().$implicit;BE(),Fg(e.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Yw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,H,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19),jw(12,O,4,2),jw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.name),BE(),Bw(e.description?4:-1),BE(2),Fg(i.scheduleLabel(e)),BE(2),dg("variant",e.enabled?"accent":"outline"),BE(),Fg(e.enabled?"Enabled":"Disabled"),BE(3),Bw(i.deletion.confirmingId()!==e.id?12:-1),BE(),Bw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=eC();BE(14),$w(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,U,2,1,"p",3),jw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};
1
+ import {c}from'./chunk-C9uCCw8u.js';import {z as k,O as O$1,i as at,h as hn,I as Io,l as ko,P,B as P$1}from'./chunk-Ncao0R2n.js';import {g,q as F,I as we,$ as $i,K as U$1,ai as Ne,al as De,v as vw,E as Es,Q as vg,a as hl,x as xC,j as jw,b as BE,P as dg,c as Bw,t as eC,F as Fg,U as Uw,k as $w,Y as Yw,u as pf,w as hf,l as lg}from'./main-6MVJZWGK.js';var M=(n,t)=>t.id??t.name;function U(n,t){if(n&1&&(Es(0,"p",3),xC(1),hl()),n&2){let e=eC();BE(),Fg(e.deletion.error());}}function B(n,t){n&1&&(Es(0,"p",4),xC(1,"Loading scheduled prompts\u2026"),hl());}function j(n,t){n&1&&(Es(0,"p",5),xC(1,"No platform scheduled prompts defined yet."),hl());}function W(n,t){n&1&&(Es(0,"p",4),xC(1,"No scheduled prompts match the current filter."),hl());}function H(n,t){if(n&1&&(Es(0,"span",14),xC(1),hl()),n&2){let e=eC().$implicit;BE(),Fg(e.description);}}function O(n,t){if(n&1){let e=Yw();Es(0,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.toggle(s))}),xC(1),hl(),Es(2,"button",21),vg("click",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.edit(s))}),xC(3,"Edit"),hl();}if(n&2){let e=eC().$implicit;BE(),Fg(e.enabled?"Disable":"Enable"),BE(),lg("aria-label","Edit "+e.name);}}function Y(n,t){if(n&1){let e=Yw();Es(0,"agentos-row-delete-action",22),vg("deleteRequested",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.deletion.request(s.id))})("deleteConfirmed",function(){pf(e);let s=eC().$implicit,c=eC(2);return hf(c.confirmDelete(s))})("deleteCancelled",function(){pf(e);let s=eC(3);return hf(s.deletion.cancel())}),hl();}if(n&2){let e=eC().$implicit,i=eC(2);dg("rowKey",e.id)("rowLabel",e.name)("state",i.deletion);}}function z(n,t){if(n&1&&(Es(0,"tr",9)(1,"td",12)(2,"span",13),xC(3),hl(),jw(4,H,2,1,"span",14),hl(),Es(5,"td",15),xC(6),hl(),Es(7,"td",16)(8,"ds-tag",17),xC(9),hl()(),Es(10,"td",18)(11,"div",19),jw(12,O,4,2),jw(13,Y,1,3,"agentos-row-delete-action",20),hl()()()),n&2){let e=t.$implicit,i=eC(2);BE(3),Fg(e.name),BE(),Bw(e.description?4:-1),BE(2),Fg(i.scheduleLabel(e)),BE(2),dg("variant",e.enabled?"accent":"outline"),BE(),Fg(e.enabled?"Enabled":"Disabled"),BE(3),Bw(i.deletion.confirmingId()!==e.id?12:-1),BE(),Bw(e.id?13:-1);}}function G(n,t){if(n&1&&(Es(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),xC(5,"Name"),hl(),Es(6,"th",10),xC(7,"Schedule"),hl(),Es(8,"th",10),xC(9,"Status"),hl(),Es(10,"th",10)(11,"span",11),xC(12,"Actions"),hl()()()(),Es(13,"tbody",8),Uw(14,z,14,7,"tr",9,M),hl()()()),n&2){let e=eC();BE(14),$w(e.rowFilter.filteredRows());}}var A=class n{router=g(F);destroyRef=g(we);state=g(c);prompts=$i([]);isLoading=$i(true);deletion=k();rowFilter=O$1(this.prompts,t=>[t.name,t.description,this.scheduleLabel(t),t.enabled?"Enabled":"Disabled"].filter(Boolean).join(" "));constructor(){this.state.listPlatform().pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.prompts.set(t),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}scheduleLabel(t){let{recurrence:e}=t,i=e.unit===Ne.WEEK?"week":"month",s=e.unit===Ne.WEEK&&e.days?.length?` (${e.days.map(c=>De[c]??c).join(", ")})`:"";return `Every ${i}${s} at ${e.timeUtc} UTC`}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}edit(t){t.id&&this.router.navigate(["/agentos","admin","scheduled-prompts",t.id,"edit"]);}toggle(t){(t.enabled?this.state.disable(t.id??""):this.state.enable(t.id??"")).pipe(U$1(this.destroyRef)).subscribe(i=>this.patchPrompt(i));}confirmDelete(t){if(!t.id)return;let e=t.id;this.deletion.execute(e,{request$:this.state.delete(e).pipe(U$1(this.destroyRef)),onSuccess:()=>this.prompts.update(i=>i.filter(s=>s.id!==e)),errorMessage:`Deleting "${t.name}" failed. Try again.`});}patchPrompt(t){this.prompts.update(e=>e.map(i=>i.id===t.id?t:i));}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=vw({type:n,selectors:[["agentos-platform-scheduled-prompts"]],decls:9,vars:3,consts:[["title","Platform scheduled prompts","description","Scheduled prompts shared across every namespace."],["label","Filter scheduled prompts","placeholder","Filter scheduled prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform scheduled prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title",""],[1,"settings-table__name","settings-table__stacked"],[1,"settings-table__secondary","settings-table__stacked"],["role","cell","data-label","Schedule"],["role","cell","data-label","Status"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(e,i){e&1&&(Es(0,"ds-section-header",0)(1,"agentos-table-filter",1),vg("queryChange",function(c){return i.rowFilter.query.set(c)}),hl(),Es(2,"button",2),vg("click",function(){return i.openCreateForm()}),xC(3,"New scheduled prompt"),hl()(),jw(4,U,2,1,"p",3),jw(5,B,2,0,"p",4)(6,j,2,0,"p",5)(7,W,2,0,"p",4)(8,G,16,0,"div",6)),e&2&&(BE(),dg("query",i.rowFilter.query()),BE(3),Bw(i.deletion.error()?4:-1),BE(),Bw(i.isLoading()?5:i.prompts().length===0?6:i.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,hn,Io,ko,P,P$1],encapsulation:2})};export{A as PlatformScheduledPromptsComponent};