@whoz-oss/coday-client 1.1.4 → 1.2.0
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.
- package/browser/{chunk-BOyQUmLL.js → chunk-8pAL3TTw.js} +1 -1
- package/browser/{chunk-BOODo6vl.js → chunk-B7cU3-SJ.js} +1 -1
- package/browser/{chunk-BZpeyGNo.js → chunk-BHIMjX2L.js} +1 -1
- package/browser/{chunk-Cl3ZRrfW.js → chunk-BIOUDJ0F.js} +1 -1
- package/browser/{chunk-M3D83Zfi.js → chunk-BJZWmRHp.js} +1 -1
- package/browser/{chunk-trVB7xYc.js → chunk-BLyTJSkT.js} +1 -1
- package/browser/{chunk-BialWP1H.js → chunk-BN30pivM.js} +1 -1
- package/browser/{chunk-C4OduJsK.js → chunk-BPZiEPAR.js} +1 -1
- package/browser/{chunk-0cPoBixl.js → chunk-BQlMqtrZ.js} +1 -1
- package/browser/{chunk-crDngsGJ.js → chunk-BT1y4-QA.js} +1 -1
- package/browser/{chunk-BvZq_CjM.js → chunk-B_IHIoXy.js} +1 -1
- package/browser/{chunk-kkUZnzqV.js → chunk-BaG8ayeQ.js} +1 -1
- package/browser/{chunk-aMSzn2bp.js → chunk-Bc_IY1Pz.js} +1 -1
- package/browser/{chunk-Cgy8z0ce.js → chunk-BqpYQimE.js} +1 -1
- package/browser/{chunk-Cz_UfOLH.js → chunk-Bt9wZSAw.js} +1 -1
- package/browser/{chunk-CfDM-x08.js → chunk-BvkvQ5HD.js} +1 -1
- package/browser/{chunk-D6rN_3EL.js → chunk-BwAT4jgv.js} +1 -1
- package/browser/{chunk-CE25GJ46.js → chunk-C3d0WplP.js} +1 -1
- package/browser/{chunk-DOyeSBTP.js → chunk-CLjMzM1F.js} +1 -1
- package/browser/{chunk-BedM_GSi.js → chunk-COuPnuWl.js} +1 -1
- package/browser/{chunk-CTGx3Jge.js → chunk-CThawlq-.js} +1 -1
- package/browser/{chunk-D4Dqx_ip.js → chunk-CWywI4c2.js} +1 -1
- package/browser/chunk-CWzYMkED.js +1 -0
- package/browser/{chunk-CHog9WTC.js → chunk-CXrwBUrc.js} +1 -1
- package/browser/{chunk-BSSTOY6w.js → chunk-CY_VVARD.js} +1 -1
- package/browser/{chunk-CaKQArNh.js → chunk-CYotDxgg.js} +1 -1
- package/browser/{chunk-CyYtRijQ.js → chunk-CbeOpZJP.js} +1 -1
- package/browser/{chunk-DxUTvYzz.js → chunk-ChVyBWZx.js} +1 -1
- package/browser/{chunk-BBc1zBIH.js → chunk-Cr3JLHIQ.js} +1 -1
- package/browser/{chunk-Dk-65uxm.js → chunk-CwcjLl23.js} +1 -1
- package/browser/{chunk-ljtSZRGe.js → chunk-CzQWzZ8j.js} +1 -1
- package/browser/{chunk-eerFYirH.js → chunk-D0hisJ4J.js} +1 -1
- package/browser/{chunk-NESmEqs9.js → chunk-D5Wauxj3.js} +1 -1
- package/browser/{chunk-BGjYQHAv.js → chunk-D5yEKva-.js} +1 -1
- package/browser/{chunk-C-OixNz-.js → chunk-D8NRH963.js} +1 -1
- package/browser/{chunk-COPfOpTU.js → chunk-D8t3UIqI.js} +1 -1
- package/browser/{chunk-ChNa-tu7.js → chunk-DDAJWWdu.js} +1 -1
- package/browser/{chunk-D0E73LzT.js → chunk-DNuI5ZLP.js} +1 -1
- package/browser/{chunk-C6SAWsWh.js → chunk-DQd46-bX.js} +1 -1
- package/browser/{chunk-BaYBlYlb.js → chunk-DQkoGfMI.js} +1 -1
- package/browser/{chunk-D79S__pD.js → chunk-DXCUsjC1.js} +1 -1
- package/browser/{chunk-B9o2w3JI.js → chunk-DeUJR8VL.js} +1 -1
- package/browser/{chunk-QeHqMQf7.js → chunk-DfY4WxHh.js} +1 -1
- package/browser/{chunk-CFPAGufF.js → chunk-Di7fNC0o.js} +1 -1
- package/browser/{chunk-BIRDz36R.js → chunk-DmT3W6Cu.js} +1 -1
- package/browser/{chunk-O8HRrO0s.js → chunk-Dnh87Bnp.js} +1 -1
- package/browser/{chunk-5NfwAOdQ.js → chunk-Dp9-5_qE.js} +1 -1
- package/browser/{chunk-B9tiwcGd.js → chunk-Dt8jPmaF.js} +1 -1
- package/browser/{chunk-Dv0QDJkQ.js → chunk-EV20uCJe.js} +1 -1
- package/browser/{chunk-DhG6eqs5.js → chunk-FwtCmWET.js} +1 -1
- package/browser/{chunk-DXX7sA5a.js → chunk-Li4hBsDL.js} +1 -1
- package/browser/{chunk-DEhiJkrz.js → chunk-R3xzoDPf.js} +1 -1
- package/browser/{chunk-B1e87EHV.js → chunk-SRb3rnAs.js} +1 -1
- package/browser/{chunk-2wm-ymQ7.js → chunk-SZxCBMtv.js} +1 -1
- package/browser/{chunk-DxeVm4Qs.js → chunk-UcdLpjjz.js} +1 -1
- package/browser/{chunk-DNUCFrvl.js → chunk-WLJnnpyn.js} +1 -1
- package/browser/{chunk-B5KeDUKO.js → chunk-_c2NJLKH.js} +1 -1
- package/browser/{chunk-DzuBpjGU.js → chunk-_mwMNDBZ.js} +1 -1
- package/browser/{chunk-CZrVPAwS.js → chunk-iBjrbq39.js} +4 -4
- package/browser/{chunk-BGG_4ZYf.js → chunk-irfXtcc2.js} +1 -1
- package/browser/{chunk-E7Qgx1Py.js → chunk-kVgSKSo7.js} +1 -1
- package/browser/{chunk-DqYAhU-z.js → chunk-oqnP7rKK.js} +1 -1
- package/browser/{chunk-PIndlztw.js → chunk-pPKjcmZw.js} +1 -1
- package/browser/{chunk-Clsi5w7v.js → chunk-r9UpFUCU.js} +1 -1
- package/browser/{chunk-DWQMxRwt.js → chunk-tdsKNlom.js} +1 -1
- package/browser/{chunk-Du2WwKpL.js → chunk-wt1fF7Ba.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-XRUWKAYH.js → main-SESULK5A.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-f78wUAk6.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bl as Sm,R as Re,H as Hi,m as mT,A as Aw,i as hr,j as Gn,v as vs,l as Ag,W as WC,k as fl,a3 as HI,n as eC,af as Dg,ag as fT,T as TC,X as XE,r as Tg,a6 as $I,t as tC,Z as z,bk as Mt,_ as Ue$1,am as Gm,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,p as pr,bm as Xt,ai as Jg,aj as KC,q as oC,bn as nC,a8 as Zg,ak as Xg,x as iC,a5 as yl,ac as mC,a9 as dC,aa as If,ab as wf,bo as gl,bp as ml,ah as rT,b3 as oT,y as Hg}from'./main-XRUWKAYH.js';import {d}from'./chunk-CTGx3Jge.js';import {W,k as ke,s as se}from'./chunk-BialWP1H.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-M3D83Zfi.js';import {W as Wn,i as it,n as nt,I as In,D as De,B as Be,_ as _a,E as En}from'./chunk-Du2WwKpL.js';import'./chunk-Cl3ZRrfW.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn,Y as Ye$1,a as wt$1,m as mn,g as gt}from'./chunk-B9o2w3JI.js';function Ue(s,i){if(s&1){let e=dC();vs(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),WC(3),fl(),vs(4,"textarea",19),Jg("ngModelChange",function(r){let m=If(e).$index,D=mC();return KC(D.commands[m],r)||(D.commands[m]=r),wf(r)}),fl(),HI(),vs(5,"mat-hint"),WC(6,"Use placeholder for dynamic values"),fl()(),vs(7,"button",20),Ag("click",function(){let r=If(e).$index,m=mC();return wf(m.removeCommand(r))}),vs(8,"mat-icon"),WC(9,"delete"),fl()()();}if(s&2){let e=i.$index,t=mC();XE(3),yl("Prompt ",e+1),XE(),Xg("ngModel",t.commands[e]),$I(),XE(3),Tg("disabled",t.commands.length===1);}}function Ne(s,i){if(s&1){let e=dC();vs(0,"div",10)(1,"h3"),WC(2,"Save to"),fl(),vs(3,"div",21)(4,"label",22)(5,"input",23),Jg("ngModelChange",function(r){If(e);let m=mC();return KC(m.source,r)||(m.source=r),wf(r)}),fl(),HI(),vs(6,"div",24)(7,"div",25)(8,"span",26),WC(9,"\u{1F464}"),fl(),vs(10,"span",27),WC(11,"Local"),fl()(),vs(12,"p",28),WC(13,"Personal prompt in ~/.coday/... (not committed)"),fl()()(),vs(14,"label",22)(15,"input",29),Jg("ngModelChange",function(r){If(e);let m=mC();return KC(m.source,r)||(m.source=r),wf(r)}),fl(),HI(),vs(16,"div",24)(17,"div",25)(18,"span",26),WC(19,"\u{1F4E6}"),fl(),vs(20,"span",27),WC(21,"Project"),fl()(),vs(22,"p",28),WC(23,"Shared prompt in ./prompts/ (committable)"),fl()()()(),vs(24,"p",30),WC(25,"Storage location is permanent and cannot be changed after creation"),fl()();}if(s&2){let e=mC();XE(4),Hg("selected",e.source==="local"),XE(),Xg("ngModel",e.source),$I(),XE(9),Hg("selected",e.source==="project"),XE(),Xg("ngModel",e.source),$I();}}function je(s,i){if(s&1&&(vs(0,"div",11)(1,"h3"),WC(2,"Storage Location"),fl(),vs(3,"div",31)(4,"span",26),WC(5),fl(),vs(6,"span",27),WC(7),fl()(),vs(8,"p",30),WC(9,"Cannot be changed after creation"),fl()()),s&2){let e=mC();XE(3),Hg("badge-local",e.source==="local")("badge-project",e.source==="project"),XE(2),Zg(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),XE(2),Zg(e.source==="local"?"Local":"Project");}}function qe(s,i){if(s&1){let e=dC();vs(0,"div",12)(1,"label",32)(2,"input",33),Jg("ngModelChange",function(r){If(e);let m=mC();return KC(m.webhookEnabled,r)||(m.webhookEnabled=r),wf(r)}),fl(),HI(),vs(3,"span"),WC(4,"Enable webhook"),fl()(),vs(5,"p",30),WC(6,"Enable webhook to trigger this prompt via HTTP POST"),fl()();}if(s&2){let e=mC();XE(2),Xg("ngModel",e.webhookEnabled),$I();}}function He(s,i){if(s&1){let e=dC();vs(0,"div",13)(1,"div",34)(2,"mat-icon",35),WC(3,"link"),fl(),vs(4,"h4"),WC(5,"Webhook URL"),fl()(),vs(6,"div",36)(7,"p",37),WC(8),fl(),vs(9,"button",38),Ag("click",function(){If(e);let r=mC();return wf(r.copyWebhookUrl())}),vs(10,"mat-icon"),WC(11,"content_copy"),fl(),vs(12,"span"),WC(13,"Copy URL"),fl()()(),vs(14,"p",30),WC(15,"Use this URL to trigger the prompt via HTTP POST"),fl()();}if(s&2){let e=mC();XE(8),Zg(e.getWebhookUrl());}}function Ye(s,i){if(s&1&&(vs(0,"div",14)(1,"mat-icon"),WC(2,"error"),fl(),vs(3,"span"),WC(4),fl()()),s&2){let e=mC();XE(4),Zg(e.errorMessage);}}var S=class s{promptApi=g(d);dialogRef=g(z);configApi=g(W);snackBar=g(Mt);name="";description="";commands=[""];webhookEnabled=false;threadLifetime="";source="local";isSaving=false;errorMessage="";isAdmin=false;isEditMode=false;promptId="";data=g(Ue$1);constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false;},error:i=>{console.error("[PROMPT_FORM] Error loading user config:",i),this.isAdmin=false;}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source);}addCommand(){this.commands.push("");}removeCommand(i){this.commands.length>1&&this.commands.splice(i,1);}trackByIndex(i){return i}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase();}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",false):true:(this.errorMessage="Description is required",false):(this.errorMessage="Name is required",false)}save(){if(this.errorMessage="",!this.validateForm())return;let i=this.commands.filter(e=>e.trim());if(this.isSaving=true,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=false;}});}else {let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=false;}});}}cancel(){this.dialogRef.close(false);}getWebhookUrl(){return `${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let i=this.getWebhookUrl();navigator.clipboard.writeText(i).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3});}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3});});}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Aw({type:s,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(vs(0,"h2",0),WC(1),fl(),vs(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),WC(6,"Name"),fl(),vs(7,"input",3),Jg("ngModelChange",function(m){return KC(t.name,m)||(t.name=m),m}),Ag("blur",function(){return t.normalizeName()}),fl(),HI(),vs(8,"mat-hint"),WC(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),fl()(),vs(10,"mat-form-field",2)(11,"mat-label"),WC(12,"Description"),fl(),vs(13,"textarea",4),Jg("ngModelChange",function(m){return KC(t.description,m)||(t.description=m),m}),fl(),HI(),vs(14,"mat-hint"),WC(15,"Explain the purpose of this prompt, helps for searchability"),fl()(),vs(16,"div",5)(17,"div",6)(18,"h3"),WC(19,"Prompts"),fl(),vs(20,"button",7),Ag("click",function(){return t.addCommand()}),vs(21,"mat-icon"),WC(22,"add"),fl()()(),vs(23,"div",8),oC(24,Ue,10,3,"div",9,nC),fl()(),eC(26,Ne,26,6,"div",10),eC(27,je,10,6,"div",11),eC(28,qe,7,1,"div",12),eC(29,He,16,1,"div",13),eC(30,Ye,5,1,"div",14),fl()(),vs(31,"mat-dialog-actions",15)(32,"button",16),Ag("click",function(){return t.cancel()}),WC(33,"Cancel"),fl(),vs(34,"button",17),Ag("click",function(){return t.save()}),WC(35),fl()()),e&2&&(XE(),Zg(t.isEditMode?"Edit Prompt":"Create Prompt"),XE(6),Xg("ngModel",t.name),$I(),XE(6),Xg("ngModel",t.description),$I(),XE(11),iC(t.commands),XE(2),tC(t.isEditMode?-1:26),XE(),tC(t.isEditMode?27:-1),XE(),tC(t.isAdmin?28:-1),XE(),tC(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),XE(),tC(t.errorMessage?30:-1),XE(2),Tg("disabled",t.isSaving),XE(2),Tg("disabled",t.isSaving),XE(),yl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Gm,ti,Ye$1,wt$1,mn,Zn,gt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media(max-width:768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"],changeDetection:1})};var Ge=()=>[],Ke=s=>({id:s});function Je(s,i){if(s&1&&(vs(0,"div",6),WC(1),fl()),s&2){let e=mC();XE(),Zg(e.errorMessage());}}function Qe(s,i){if(s&1){let e=dC();vs(0,"ds-entity-card",8),Ag("selected",function(r){If(e);let m=mC();return wf(m.onEdit(r))}),gl(1,9),vs(2,"button",10),Ag("click",function(r){return r.stopPropagation()}),vs(3,"mat-icon"),WC(4,"more_vert"),fl()(),ml(),fl();}if(s&2){let e=i.$implicit;mC();let t=TC(11);Tg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,Ge)),XE(2),Tg("matMenuTriggerFor",t)("matMenuTriggerData",oT(7,Ke,e.id));}}function Xe(s,i){if(s&1){let e=dC();vs(0,"button",11),Ag("click",function(){If(e);let r=mC().id,m=mC();return wf(m.onToggleWebhook(r))}),vs(1,"mat-icon"),WC(2),fl(),WC(3),fl();}if(s&2){let e=mC().id,t=mC();XE(2),Zg(t.isWebhookEnabled(e)?"link_off":"link"),XE(),yl(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ");}}function Ze(s,i){if(s&1){let e=dC();vs(0,"button",11),Ag("click",function(){let r=If(e).id,m=mC();return wf(m.onEdit(r))}),vs(1,"mat-icon"),WC(2,"edit"),fl(),WC(3," Edit "),fl(),eC(4,Xe,4,2,"button",12),vs(5,"button",13),Ag("click",function(){let r=If(e).id,m=mC();return wf(m.onDelete(r))}),vs(6,"mat-icon"),WC(7,"delete"),fl(),WC(8," Delete "),fl();}if(s&2){let e=mC();XE(4),tC(e.isAdmin()?4:-1);}}var Ie="system",Le=class s{promptApi=g(d);configApi=g(W);location=g(Sm);dialog=g(Re);prompts=Hi([]);isLoading=Hi(false);errorMessage=Hi(null);showOnlyMine=Hi(true);isAdmin=Hi(false);currentUsername=Hi("");promptItems=mT(()=>{let i=this.prompts(),e=this.currentUsername(),r=this.showOnlyMine()&&e?i.filter(p=>this.isMyPrompt(p)):i,D=[...new Set(r.map(p=>p.createdBy))].sort((p,k)=>p===e&&k!==e?-1:k===e&&p!==e||p===Ie?1:k===Ie?-1:p.localeCompare(k)),H=[];for(let p of D){let k=p===e?`${p} (you)`:p;for(let F of r.filter(Ae=>Ae.createdBy===p))H.push({id:F.id,name:F.name,description:F.description,badges:this.buildBadges(F),groupKey:p,groupLabel:k});}return H});ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin.set(i.groups?.includes("CODAY_ADMIN")??false),this.currentUsername.set(i.username??"");},error:()=>this.isAdmin.set(false)}),this.loadPrompts();}loadPrompts(){this.isLoading.set(true),this.promptApi.listPrompts().subscribe({next:i=>{this.prompts.set(i.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(false);},error:i=>{this.errorMessage.set(i?.error?.error??"Failed to load prompts"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts();});}onEdit(i){this.promptApi.getPrompt(i).subscribe({next:e=>{this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(r=>{r&&this.loadPrompts();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")});}onDelete(i){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(i).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")});}onToggleWebhook(i){let e=this.prompts().find(r=>r.id===i);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(i):this.promptApi.enableWebhook(i)).subscribe({next:()=>this.loadPrompts(),error:r=>this.errorMessage.set(r?.error?.error??"Failed to toggle webhook")});}isWebhookEnabled(i){return this.prompts().find(e=>e.id===i)?.webhookEnabled??false}isMyPrompt(i){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(i.createdBy)===e(this.currentUsername())}buildBadges(i){let e=[];return i.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),i.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Aw({type:s,selectors:[["app-prompt-list"]],decls:13,vars:5,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(vs(0,"div",2)(1,"ds-entity-list",3),Ag("createRequested",function(){return t.onCreate()}),vs(2,"button",4),Ag("click",function(){return t.onBack()}),vs(3,"mat-icon"),WC(4,"chevron_left"),fl()(),vs(5,"mat-slide-toggle",5),Ag("ngModelChange",function(m){return t.showOnlyMine.set(m)}),WC(6," Mine "),fl(),HI(),fl(),eC(7,Je,2,1,"div",6),fl(),Dg(8,Qe,5,9,"ng-template",null,0,fT),vs(10,"mat-menu",null,1),Dg(12,Ze,9,1,"ng-template",7),fl()),e&2){let r=TC(9);XE(),Tg("items",t.promptItems())("showCreate",true)("itemTemplate",r),XE(4),Tg("ngModel",t.showOnlyMine()),$I(),XE(2),tC(t.errorMessage()?7:-1);}},dependencies:[Wn,it,nt,hr,Gn,yt,wt,ke,se,In,De,Be,_a,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Le as PromptListComponent};
|
|
1
|
+
import {g,bl as Sm,R as Re,H as Hi,m as mT,A as Aw,i as hr,j as Gn,v as vs,l as Ag,W as WC,k as fl,a3 as HI,n as eC,af as Dg,ag as fT,T as TC,X as XE,r as Tg,a6 as $I,t as tC,Z as z,bk as Mt,_ as Ue$1,am as Gm,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,p as pr,bm as Xt,ai as Jg,aj as KC,q as oC,bn as nC,a8 as Zg,ak as Xg,x as iC,a5 as yl,ac as mC,a9 as dC,aa as If,ab as wf,bo as gl,bp as ml,ah as rT,b3 as oT,y as Hg}from'./main-SESULK5A.js';import {d}from'./chunk-CThawlq-.js';import {W,k as ke,s as se}from'./chunk-BN30pivM.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-BJZWmRHp.js';import {W as Wn,i as it,n as nt,I as In,D as De,B as Be,_ as _a,E as En}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn,Y as Ye$1,a as wt$1,m as mn,g as gt}from'./chunk-DeUJR8VL.js';function Ue(s,i){if(s&1){let e=dC();vs(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),WC(3),fl(),vs(4,"textarea",19),Jg("ngModelChange",function(r){let m=If(e).$index,D=mC();return KC(D.commands[m],r)||(D.commands[m]=r),wf(r)}),fl(),HI(),vs(5,"mat-hint"),WC(6,"Use placeholder for dynamic values"),fl()(),vs(7,"button",20),Ag("click",function(){let r=If(e).$index,m=mC();return wf(m.removeCommand(r))}),vs(8,"mat-icon"),WC(9,"delete"),fl()()();}if(s&2){let e=i.$index,t=mC();XE(3),yl("Prompt ",e+1),XE(),Xg("ngModel",t.commands[e]),$I(),XE(3),Tg("disabled",t.commands.length===1);}}function Ne(s,i){if(s&1){let e=dC();vs(0,"div",10)(1,"h3"),WC(2,"Save to"),fl(),vs(3,"div",21)(4,"label",22)(5,"input",23),Jg("ngModelChange",function(r){If(e);let m=mC();return KC(m.source,r)||(m.source=r),wf(r)}),fl(),HI(),vs(6,"div",24)(7,"div",25)(8,"span",26),WC(9,"\u{1F464}"),fl(),vs(10,"span",27),WC(11,"Local"),fl()(),vs(12,"p",28),WC(13,"Personal prompt in ~/.coday/... (not committed)"),fl()()(),vs(14,"label",22)(15,"input",29),Jg("ngModelChange",function(r){If(e);let m=mC();return KC(m.source,r)||(m.source=r),wf(r)}),fl(),HI(),vs(16,"div",24)(17,"div",25)(18,"span",26),WC(19,"\u{1F4E6}"),fl(),vs(20,"span",27),WC(21,"Project"),fl()(),vs(22,"p",28),WC(23,"Shared prompt in ./prompts/ (committable)"),fl()()()(),vs(24,"p",30),WC(25,"Storage location is permanent and cannot be changed after creation"),fl()();}if(s&2){let e=mC();XE(4),Hg("selected",e.source==="local"),XE(),Xg("ngModel",e.source),$I(),XE(9),Hg("selected",e.source==="project"),XE(),Xg("ngModel",e.source),$I();}}function je(s,i){if(s&1&&(vs(0,"div",11)(1,"h3"),WC(2,"Storage Location"),fl(),vs(3,"div",31)(4,"span",26),WC(5),fl(),vs(6,"span",27),WC(7),fl()(),vs(8,"p",30),WC(9,"Cannot be changed after creation"),fl()()),s&2){let e=mC();XE(3),Hg("badge-local",e.source==="local")("badge-project",e.source==="project"),XE(2),Zg(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),XE(2),Zg(e.source==="local"?"Local":"Project");}}function qe(s,i){if(s&1){let e=dC();vs(0,"div",12)(1,"label",32)(2,"input",33),Jg("ngModelChange",function(r){If(e);let m=mC();return KC(m.webhookEnabled,r)||(m.webhookEnabled=r),wf(r)}),fl(),HI(),vs(3,"span"),WC(4,"Enable webhook"),fl()(),vs(5,"p",30),WC(6,"Enable webhook to trigger this prompt via HTTP POST"),fl()();}if(s&2){let e=mC();XE(2),Xg("ngModel",e.webhookEnabled),$I();}}function He(s,i){if(s&1){let e=dC();vs(0,"div",13)(1,"div",34)(2,"mat-icon",35),WC(3,"link"),fl(),vs(4,"h4"),WC(5,"Webhook URL"),fl()(),vs(6,"div",36)(7,"p",37),WC(8),fl(),vs(9,"button",38),Ag("click",function(){If(e);let r=mC();return wf(r.copyWebhookUrl())}),vs(10,"mat-icon"),WC(11,"content_copy"),fl(),vs(12,"span"),WC(13,"Copy URL"),fl()()(),vs(14,"p",30),WC(15,"Use this URL to trigger the prompt via HTTP POST"),fl()();}if(s&2){let e=mC();XE(8),Zg(e.getWebhookUrl());}}function Ye(s,i){if(s&1&&(vs(0,"div",14)(1,"mat-icon"),WC(2,"error"),fl(),vs(3,"span"),WC(4),fl()()),s&2){let e=mC();XE(4),Zg(e.errorMessage);}}var S=class s{promptApi=g(d);dialogRef=g(z);configApi=g(W);snackBar=g(Mt);name="";description="";commands=[""];webhookEnabled=false;threadLifetime="";source="local";isSaving=false;errorMessage="";isAdmin=false;isEditMode=false;promptId="";data=g(Ue$1);constructor(){this.isEditMode=this.data.mode==="edit";}ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin=i.groups?.includes("CODAY_ADMIN")??false;},error:i=>{console.error("[PROMPT_FORM] Error loading user config:",i),this.isAdmin=false;}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source);}addCommand(){this.commands.push("");}removeCommand(i){this.commands.length>1&&this.commands.splice(i,1);}trackByIndex(i){return i}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase();}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",false):true:(this.errorMessage="Description is required",false):(this.errorMessage="Name is required",false)}save(){if(this.errorMessage="",!this.validateForm())return;let i=this.commands.filter(e=>e.trim());if(this.isSaving=true,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=false;}});}else {let e={name:this.name.trim(),description:this.description.trim(),commands:i,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=false,this.dialogRef.close(true);},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=false;}});}}cancel(){this.dialogRef.close(false);}getWebhookUrl(){return `${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let i=this.getWebhookUrl();navigator.clipboard.writeText(i).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3});}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3});});}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Aw({type:s,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(vs(0,"h2",0),WC(1),fl(),vs(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),WC(6,"Name"),fl(),vs(7,"input",3),Jg("ngModelChange",function(m){return KC(t.name,m)||(t.name=m),m}),Ag("blur",function(){return t.normalizeName()}),fl(),HI(),vs(8,"mat-hint"),WC(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),fl()(),vs(10,"mat-form-field",2)(11,"mat-label"),WC(12,"Description"),fl(),vs(13,"textarea",4),Jg("ngModelChange",function(m){return KC(t.description,m)||(t.description=m),m}),fl(),HI(),vs(14,"mat-hint"),WC(15,"Explain the purpose of this prompt, helps for searchability"),fl()(),vs(16,"div",5)(17,"div",6)(18,"h3"),WC(19,"Prompts"),fl(),vs(20,"button",7),Ag("click",function(){return t.addCommand()}),vs(21,"mat-icon"),WC(22,"add"),fl()()(),vs(23,"div",8),oC(24,Ue,10,3,"div",9,nC),fl()(),eC(26,Ne,26,6,"div",10),eC(27,je,10,6,"div",11),eC(28,qe,7,1,"div",12),eC(29,He,16,1,"div",13),eC(30,Ye,5,1,"div",14),fl()(),vs(31,"mat-dialog-actions",15)(32,"button",16),Ag("click",function(){return t.cancel()}),WC(33,"Cancel"),fl(),vs(34,"button",17),Ag("click",function(){return t.save()}),WC(35),fl()()),e&2&&(XE(),Zg(t.isEditMode?"Edit Prompt":"Create Prompt"),XE(6),Xg("ngModel",t.name),$I(),XE(6),Xg("ngModel",t.description),$I(),XE(11),iC(t.commands),XE(2),tC(t.isEditMode?-1:26),XE(),tC(t.isEditMode?27:-1),XE(),tC(t.isAdmin?28:-1),XE(),tC(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),XE(),tC(t.errorMessage?30:-1),XE(2),Tg("disabled",t.isSaving),XE(2),Tg("disabled",t.isSaving),XE(),yl(" ",t.isSaving?"Saving...":"Save"," "));},dependencies:[Gm,ti,Ye$1,wt$1,mn,Zn,gt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media(max-width:768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"],changeDetection:1})};var Ge=()=>[],Ke=s=>({id:s});function Je(s,i){if(s&1&&(vs(0,"div",6),WC(1),fl()),s&2){let e=mC();XE(),Zg(e.errorMessage());}}function Qe(s,i){if(s&1){let e=dC();vs(0,"ds-entity-card",8),Ag("selected",function(r){If(e);let m=mC();return wf(m.onEdit(r))}),gl(1,9),vs(2,"button",10),Ag("click",function(r){return r.stopPropagation()}),vs(3,"mat-icon"),WC(4,"more_vert"),fl()(),ml(),fl();}if(s&2){let e=i.$implicit;mC();let t=TC(11);Tg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,Ge)),XE(2),Tg("matMenuTriggerFor",t)("matMenuTriggerData",oT(7,Ke,e.id));}}function Xe(s,i){if(s&1){let e=dC();vs(0,"button",11),Ag("click",function(){If(e);let r=mC().id,m=mC();return wf(m.onToggleWebhook(r))}),vs(1,"mat-icon"),WC(2),fl(),WC(3),fl();}if(s&2){let e=mC().id,t=mC();XE(2),Zg(t.isWebhookEnabled(e)?"link_off":"link"),XE(),yl(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ");}}function Ze(s,i){if(s&1){let e=dC();vs(0,"button",11),Ag("click",function(){let r=If(e).id,m=mC();return wf(m.onEdit(r))}),vs(1,"mat-icon"),WC(2,"edit"),fl(),WC(3," Edit "),fl(),eC(4,Xe,4,2,"button",12),vs(5,"button",13),Ag("click",function(){let r=If(e).id,m=mC();return wf(m.onDelete(r))}),vs(6,"mat-icon"),WC(7,"delete"),fl(),WC(8," Delete "),fl();}if(s&2){let e=mC();XE(4),tC(e.isAdmin()?4:-1);}}var Ie="system",Le=class s{promptApi=g(d);configApi=g(W);location=g(Sm);dialog=g(Re);prompts=Hi([]);isLoading=Hi(false);errorMessage=Hi(null);showOnlyMine=Hi(true);isAdmin=Hi(false);currentUsername=Hi("");promptItems=mT(()=>{let i=this.prompts(),e=this.currentUsername(),r=this.showOnlyMine()&&e?i.filter(p=>this.isMyPrompt(p)):i,D=[...new Set(r.map(p=>p.createdBy))].sort((p,k)=>p===e&&k!==e?-1:k===e&&p!==e||p===Ie?1:k===Ie?-1:p.localeCompare(k)),H=[];for(let p of D){let k=p===e?`${p} (you)`:p;for(let F of r.filter(Ae=>Ae.createdBy===p))H.push({id:F.id,name:F.name,description:F.description,badges:this.buildBadges(F),groupKey:p,groupLabel:k});}return H});ngOnInit(){this.configApi.getUserConfig().subscribe({next:i=>{this.isAdmin.set(i.groups?.includes("CODAY_ADMIN")??false),this.currentUsername.set(i.username??"");},error:()=>this.isAdmin.set(false)}),this.loadPrompts();}loadPrompts(){this.isLoading.set(true),this.promptApi.listPrompts().subscribe({next:i=>{this.prompts.set(i.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(false);},error:i=>{this.errorMessage.set(i?.error?.error??"Failed to load prompts"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts();});}onEdit(i){this.promptApi.getPrompt(i).subscribe({next:e=>{this.dialog.open(S,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(r=>{r&&this.loadPrompts();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")});}onDelete(i){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(i).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")});}onToggleWebhook(i){let e=this.prompts().find(r=>r.id===i);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(i):this.promptApi.enableWebhook(i)).subscribe({next:()=>this.loadPrompts(),error:r=>this.errorMessage.set(r?.error?.error??"Failed to toggle webhook")});}isWebhookEnabled(i){return this.prompts().find(e=>e.id===i)?.webhookEnabled??false}isMyPrompt(i){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(i.createdBy)===e(this.currentUsername())}buildBadges(i){let e=[];return i.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),i.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=Aw({type:s,selectors:[["app-prompt-list"]],decls:13,vars:5,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1&&(vs(0,"div",2)(1,"ds-entity-list",3),Ag("createRequested",function(){return t.onCreate()}),vs(2,"button",4),Ag("click",function(){return t.onBack()}),vs(3,"mat-icon"),WC(4,"chevron_left"),fl()(),vs(5,"mat-slide-toggle",5),Ag("ngModelChange",function(m){return t.showOnlyMine.set(m)}),WC(6," Mine "),fl(),HI(),fl(),eC(7,Je,2,1,"div",6),fl(),Dg(8,Qe,5,9,"ng-template",null,0,fT),vs(10,"mat-menu",null,1),Dg(12,Ze,9,1,"ng-template",7),fl()),e&2){let r=TC(9);XE(),Tg("items",t.promptItems())("showCreate",true)("itemTemplate",r),XE(4),Tg("ngModel",t.showOnlyMine()),$I(),XE(2),tC(t.errorMessage()?7:-1);}},dependencies:[Wn,it,nt,hr,Gn,yt,wt,ke,se,In,De,Be,_a,En,ti,Zn,cn],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"],changeDetection:1})};export{Le as PromptListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {K as Kn,Z as Zn,S as Se}from'./chunk-
|
|
1
|
+
import {K as Kn,Z as Zn,S as Se}from'./chunk-wt1fF7Ba.js';import {ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,a5 as yl,t as tC,a9 as dC,l as Ag,ac as mC,r as Tg,aa as If,ab as wf}from'./main-SESULK5A.js';function A(o,a){if(o&1){let e=dC();vs(0,"span",7),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",8),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",9),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteCancelled())}),fl();}}function P(o,a){if(o&1){let e=dC();vs(0,"ds-kebab-menu",10),Ag("itemSelected",function(l){If(e);let O=mC();return wf(O.onMenuAction(l))}),fl();}if(o&2){let e=mC();Tg("items",e.menuItems);}}var I=class o{model=mB.required();namespaceId=mB(void 0);readOnly=mB(false);deleteRequested=gB();editRequested=gB();pendingDelete=Hi(false);menuItems=[{key:"edit",label:"Edit model",icon:"edit"},{key:"delete",label:"Delete model",icon:"delete",variant:"danger"}];get displayTitle(){return this.model().alias??this.model().apiModelName}onMenuAction(a){switch(a){case "edit":this.editRequested.emit(this.model());break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.model());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-ai-model-item"]],inputs:{model:[1,"model"],namespaceId:[1,"namespaceId"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested",editRequested:"editRequested"},decls:12,vars:4,consts:[["role","listitem","dsBlueprint","",1,"ai-model-item"],[1,"ai-model-item__body"],[1,"ai-model-item__name"],[1,"ai-model-item__api-name"],[1,"ai-model-item__params"],[1,"ai-model-item__actions"],[3,"items"],[1,"ai-model-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(vs(0,"div",0)(1,"div",1)(2,"span",2),WC(3),fl(),vs(4,"span",3),WC(5),fl(),vs(6,"span",4)(7,"span"),WC(8),fl()()(),vs(9,"div",5),eC(10,A,4,0)(11,P,1,1,"ds-kebab-menu",6),fl()()),e&2&&(XE(3),Zg(i.displayTitle),XE(2),Zg(i.model().apiModelName),XE(3),yl("priority: ",i.model().priority),XE(2),tC(i.pendingDelete()?10:i.readOnly()?-1:11));},dependencies:[Kn,Zn,Se],styles:[".ai-model-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.ai-model-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-model-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__api-name[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__params[_ngcontent-%COMP%]{display:flex;gap:.75rem;font-size:13px;color:var(--color-text-secondary)}.ai-model-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover .ai-model-item__actions[_ngcontent-%COMP%], .ai-model-item[_ngcontent-%COMP%]:focus-within .ai-model-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-model-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,bk as Mt,Y as x}from'./main-
|
|
1
|
+
import {g,bk as Mt,Y as x}from'./main-SESULK5A.js';var s=class n{snackBar=g(Mt);success(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]});}error(t,o=3e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]});}info(t,o=2e3){this.snackBar.open(t,"",{duration:o,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]});}static \u0275fac=function(o){return new(o||n)};static \u0275prov=x({token:n,factory:n.\u0275fac,providedIn:"root"})};export{s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-C6SAWsWh.js';import {v}from'./chunk-2wm-ymQ7.js';import {y}from'./chunk-B5KeDUKO.js';import {g,G,bl as Sm,w as we$1,H as Hi,m as mT,F as F$1,aD as Ly,u as ue$1,b as U,A as Aw,v as vs,l as Ag,k as fl,W as WC,n as eC,X as XE,t as tC,q as oC,ac as mC,x as iC,a9 as dC,y as Hg,C as Cg,a8 as Zg,a5 as yl,o as bg,a3 as HI,r as Tg,a6 as $I,aa as If,ab as wf,cG as Xw}from'./main-XRUWKAYH.js';import {u,I,f}from'./chunk-CZrVPAwS.js';import {S as Se$1}from'./chunk-Du2WwKpL.js';import'./chunk-Cl3ZRrfW.js';import {o as z,k as _t,n as ni,J as Jn,Y as Ye,Z as Zn,l as Xn,E as En,p as An}from'./chunk-B9o2w3JI.js';import'./chunk-f78wUAk6.js';import'./chunk-DhG6eqs5.js';var F=(o,i)=>i.value;function re(o,i){o&1&&(vs(0,"p",4),WC(1,"Loading\u2026"),fl());}function ae(o,i){if(o&1){let e=dC();vs(0,"button",18),Ag("click",function(){let _=If(e).$implicit,d=mC(2);return wf(d.setThemeVariant(_.value))}),vs(1,"span",19),WC(2),fl(),vs(3,"span",20),WC(4),fl()();}if(o&2){let e=i.$implicit,a=mC(2);Hg("user-profile__theme-variant--active",a.themeVariant()===e.value),Cg("aria-pressed",a.themeVariant()===e.value),XE(2),Zg(e.label),XE(2),Zg(e.description);}}function le(o,i){if(o&1){let e=dC();vs(0,"button",21),Ag("click",function(){let _=If(e).$implicit,d=mC(2);return wf(d.setTheme(_.value))}),WC(1),fl();}if(o&2){let e=i.$implicit,a=mC(2);Hg("user-profile__segmented-option--active",a.themeMode()===e.value),Cg("aria-pressed",a.themeMode()===e.value),XE(),yl(" ",e.label," ");}}function se(o,i){if(o&1){let e=dC();vs(0,"button",21),Ag("click",function(){let _=If(e).$implicit,d=mC(2);return wf(d.setEnterKeyBehavior(_.value))}),WC(1),fl();}if(o&2){let e=i.$implicit,a=mC(2);Hg("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),Cg("aria-pressed",a.enterKeyBehavior()===e.value),XE(),yl(" ",e.label," ");}}function _e(o,i){if(o&1){let e=dC();vs(0,"form",22),Ag("ngSubmit",function(){If(e);let _=mC(2);return wf(_.save())}),vs(1,"div",5)(2,"h2",6),WC(3,"Identity"),fl(),vs(4,"div",7)(5,"span",8),WC(6,"Email"),fl(),vs(7,"span",23),WC(8),fl()(),vs(9,"div",7)(10,"span",8),WC(11,"External ID"),fl(),vs(12,"span",23),WC(13),fl()()(),vs(14,"div",5)(15,"h2",6),WC(16,"Profile"),fl(),vs(17,"div",7)(18,"label",24),WC(19,"First name"),fl(),bg(20,"input",25),HI(),fl(),vs(21,"div",7)(22,"label",26),WC(23,"Last name"),fl(),bg(24,"input",27),HI(),fl(),vs(25,"div",7)(26,"label",28),WC(27,"Bio"),fl(),bg(28,"textarea",29),HI(),fl()(),vs(29,"div",30)(30,"button",31),WC(31),fl(),vs(32,"button",32),Ag("click",function(){If(e);let _=mC(2);return wf(_.cancelEditing())}),WC(33,"Cancel"),fl()()();}if(o&2){let e=mC(),a=mC();Tg("formGroup",a.form),XE(8),Zg(e.email),XE(5),Zg(e.externalId),XE(7),$I(),XE(4),$I(),XE(4),$I(),XE(2),Tg("disabled",a.isSaving()),XE(),yl(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function de(o,i){o&1&&(vs(0,"p",40),WC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),fl());}function ce(o,i){if(o&1){let e=dC();vs(0,"span",47),WC(1,"Delete?"),fl(),vs(2,"button",48),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.confirmDelete(_))}),WC(3," Confirm "),fl(),vs(4,"button",49),Ag("click",function(){If(e);let _=mC(7);return wf(_.cancelDelete())}),WC(5," Cancel "),fl();}}function pe(o,i){if(o&1){let e=dC();vs(0,"button",49),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.armDelete(_))}),WC(1," Delete "),fl();}}function me(o,i){if(o&1&&(vs(0,"li",43)(1,"span",44),WC(2),fl(),vs(3,"span",45),WC(4),fl(),eC(5,ce,6,0)(6,pe,2,0,"button",46),fl()),o&2){let e=i.$implicit,a=mC(6);XE(2),Zg(e.name),XE(2),Zg(e.subtitle),XE(),tC(a.isPendingDelete(e)?5:6);}}function ue(o,i){if(o&1&&(vs(0,"h3",41),WC(1,"Integrations"),fl(),vs(2,"ul",42),oC(3,me,7,3,"li",43,Xw().trackEntry,true),fl()),o&2){let e=mC(5);XE(3),iC(e.recap().integrations);}}function fe(o,i){if(o&1){let e=dC();vs(0,"span",47),WC(1,"Delete?"),fl(),vs(2,"button",48),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.confirmDelete(_))}),WC(3," Confirm "),fl(),vs(4,"button",49),Ag("click",function(){If(e);let _=mC(7);return wf(_.cancelDelete())}),WC(5," Cancel "),fl();}}function Ce(o,i){if(o&1){let e=dC();vs(0,"button",49),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.armDelete(_))}),WC(1," Delete "),fl();}}function ge(o,i){if(o&1&&(vs(0,"li",43)(1,"span",44),WC(2),fl(),vs(3,"span",45),WC(4),fl(),eC(5,fe,6,0)(6,Ce,2,0,"button",46),fl()),o&2){let e=i.$implicit,a=mC(6);XE(2),Zg(e.name),XE(2),Zg(e.subtitle),XE(),tC(a.isPendingDelete(e)?5:6);}}function ve(o,i){if(o&1&&(vs(0,"h3",41),WC(1,"AI Providers"),fl(),vs(2,"ul",42),oC(3,ge,7,3,"li",43,Xw().trackEntry,true),fl()),o&2){let e=mC(5);XE(3),iC(e.recap().aiProviders);}}function xe(o,i){if(o&1){let e=dC();vs(0,"span",47),WC(1,"Delete?"),fl(),vs(2,"button",48),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.confirmDelete(_))}),WC(3," Confirm "),fl(),vs(4,"button",49),Ag("click",function(){If(e);let _=mC(7);return wf(_.cancelDelete())}),WC(5," Cancel "),fl();}}function be(o,i){if(o&1){let e=dC();vs(0,"button",49),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.armDelete(_))}),WC(1," Delete "),fl();}}function ye(o,i){if(o&1&&(vs(0,"li",43)(1,"span",44),WC(2),fl(),vs(3,"span",45),WC(4),fl(),eC(5,xe,6,0)(6,be,2,0,"button",46),fl()),o&2){let e=i.$implicit,a=mC(6);XE(2),Zg(e.name),XE(2),Zg(e.subtitle),XE(),tC(a.isPendingDelete(e)?5:6);}}function he(o,i){if(o&1&&(vs(0,"h3",41),WC(1,"My global auth settings"),fl(),vs(2,"ul",42),oC(3,ye,7,3,"li",43,Xw().trackEntry,true),fl()),o&2){let e=mC(5);XE(3),iC(e.recap().authSettings);}}function Pe(o,i){if(o&1&&(eC(0,ue,5,0),eC(1,ve,5,0),eC(2,he,5,0)),o&2){let e=mC(4);tC(e.recap().integrations.length>0?0:-1),XE(),tC(e.recap().aiProviders.length>0?1:-1),XE(),tC(e.recap().authSettings.length>0?2:-1);}}function Ee(o,i){if(o&1&&eC(0,de,2,0,"p",40)(1,Pe,3,3),o&2){let e=mC(3);tC(e.recap().total===0?0:1);}}function Se(o,i){if(o&1){let e=dC();vs(0,"div",17)(1,"div",5)(2,"h2",6),WC(3,"Identity"),fl(),vs(4,"div",7)(5,"span",8),WC(6,"Email"),fl(),vs(7,"span",33),WC(8),fl()(),vs(9,"div",7)(10,"span",8),WC(11,"External ID"),fl(),vs(12,"span",33),WC(13),fl()()(),vs(14,"div",5)(15,"h2",6),WC(16,"Profile"),fl(),vs(17,"div",7)(18,"span",8),WC(19,"First name"),fl(),vs(20,"span",33),WC(21),fl()(),vs(22,"div",7)(23,"span",8),WC(24,"Last name"),fl(),vs(25,"span",33),WC(26),fl()(),vs(27,"div",34)(28,"span",8),WC(29,"Bio"),fl(),vs(30,"span",33),WC(31),fl()()(),vs(32,"div",30)(33,"button",35),Ag("click",function(){If(e);let _=mC(2);return wf(_.startEditing())}),WC(34," Edit profile "),fl()(),vs(35,"div",36)(36,"button",37),Ag("click",function(){If(e);let _=mC(2);return wf(_.toggleOverrides())}),vs(37,"span",38),WC(38,"\u25B6"),fl(),WC(39," My global user configurations "),vs(40,"span",39),WC(41),fl()(),eC(42,Ee,2,1),fl()();}if(o&2){let e=mC(),a=mC();XE(8),Zg(e.email),XE(5),Zg(e.externalId),XE(8),Zg(e.firstname||"\u2014"),XE(5),Zg(e.lastname||"\u2014"),XE(5),Zg(e.bio||"\u2014"),XE(5),Cg("aria-expanded",a.isOverridesExpanded()),XE(),Hg("user-profile__overrides-arrow--open",a.isOverridesExpanded()),XE(4),yl("(",a.recap().total,")"),XE(),tC(a.isOverridesExpanded()?42:-1);}}function we(o,i){if(o&1&&(vs(0,"div",5)(1,"h2",6),WC(2,"Appearance"),fl(),vs(3,"div",7)(4,"span",8),WC(5,"Skin"),fl(),vs(6,"div",9),oC(7,ae,5,5,"button",10,F),fl()(),vs(9,"div",7)(10,"span",8),WC(11,"Mode"),fl(),vs(12,"div",11),oC(13,le,2,4,"button",12,F),fl()()(),vs(15,"div",5)(16,"h2",6),WC(17,"Composer"),fl(),vs(18,"div",7)(19,"span",8),WC(20,"Enter key"),fl(),vs(21,"div",13)(22,"div",14),oC(23,se,2,4,"button",12,F),fl(),vs(25,"p",15),WC(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),fl()()()(),eC(27,_e,34,5,"form",16)(28,Se,43,10,"div",17)),o&2){let e=mC();XE(7),iC(e.themeVariantOptions),XE(6),iC(e.themeOptions),XE(10),iC(e.enterKeyOptions),XE(4),tC(e.isEditing()?27:28);}}function Me(o,i){o&1&&(vs(0,"p",4),WC(1,"Unable to load profile."),fl());}var oe=class o{userState=g(u);router=g(G);location=g(Sm);destroyRef=g(we$1);integrationState=g(y);providerState=g(O);authSettingState=g(v);themePort=g(I);preferencesPort=g(f);isEditing=Hi(false);isLoading=Hi(false);isSaving=Hi(false);isOverridesExpanded=Hi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];form=new z({firstname:new _t("",{nonNullable:true}),lastname:new _t("",{nonNullable:true}),bio:new _t("",{nonNullable:true})});recap=F$1(Ly([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ue$1(([i,e,a])=>{let _=i.map(C=>({category:"integration",id:C.id??"",name:C.name,subtitle:C.integrationType})),d=e.map(C=>({category:"aiProvider",id:C.id??"",name:C.name,subtitle:C.apiType})),I=a.map(C=>({category:"authSetting",id:C.id??"",name:C.name,subtitle:C.authType}));return {integrations:_,aiProviders:d,authSettings:I,total:_.length+d.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){this.isSaving()||(this.isSaving.set(true),this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)}));}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=Hi(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}entryKey(i){return `${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"]);}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??""});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(vs(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),Ag("action",function(){return a.goBack()}),fl(),vs(3,"h1",3),WC(4,"My profile"),fl()(),eC(5,re,2,0,"p",4)(6,we,29,1)(7,Me,2,0,"p",4),fl()),e&2){let _;XE(5),tC(a.isLoading()?5:(_=a.currentUser())?6:7,_);}},dependencies:[ni,Jn,Ye,Zn,Xn,En,An,Se$1],styles:[".user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}"]})};export{oe as UserProfileComponent};
|
|
1
|
+
import {O}from'./chunk-DQd46-bX.js';import {v}from'./chunk-SZxCBMtv.js';import {y}from'./chunk-_c2NJLKH.js';import {g,G,bl as Sm,w as we$1,H as Hi,m as mT,F as F$1,aD as Ly,u as ue$1,b as U,A as Aw,v as vs,l as Ag,k as fl,W as WC,n as eC,X as XE,t as tC,q as oC,ac as mC,x as iC,a9 as dC,y as Hg,C as Cg,a8 as Zg,a5 as yl,o as bg,a3 as HI,r as Tg,a6 as $I,aa as If,ab as wf,cG as Xw}from'./main-SESULK5A.js';import {u,I,f}from'./chunk-iBjrbq39.js';import {S as Se$1}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import {o as z,k as _t,n as ni,J as Jn,Y as Ye,Z as Zn,l as Xn,E as En,p as An}from'./chunk-DeUJR8VL.js';import'./chunk-CWzYMkED.js';import'./chunk-FwtCmWET.js';var F=(o,i)=>i.value;function re(o,i){o&1&&(vs(0,"p",4),WC(1,"Loading\u2026"),fl());}function ae(o,i){if(o&1){let e=dC();vs(0,"button",18),Ag("click",function(){let _=If(e).$implicit,d=mC(2);return wf(d.setThemeVariant(_.value))}),vs(1,"span",19),WC(2),fl(),vs(3,"span",20),WC(4),fl()();}if(o&2){let e=i.$implicit,a=mC(2);Hg("user-profile__theme-variant--active",a.themeVariant()===e.value),Cg("aria-pressed",a.themeVariant()===e.value),XE(2),Zg(e.label),XE(2),Zg(e.description);}}function le(o,i){if(o&1){let e=dC();vs(0,"button",21),Ag("click",function(){let _=If(e).$implicit,d=mC(2);return wf(d.setTheme(_.value))}),WC(1),fl();}if(o&2){let e=i.$implicit,a=mC(2);Hg("user-profile__segmented-option--active",a.themeMode()===e.value),Cg("aria-pressed",a.themeMode()===e.value),XE(),yl(" ",e.label," ");}}function se(o,i){if(o&1){let e=dC();vs(0,"button",21),Ag("click",function(){let _=If(e).$implicit,d=mC(2);return wf(d.setEnterKeyBehavior(_.value))}),WC(1),fl();}if(o&2){let e=i.$implicit,a=mC(2);Hg("user-profile__segmented-option--active",a.enterKeyBehavior()===e.value),Cg("aria-pressed",a.enterKeyBehavior()===e.value),XE(),yl(" ",e.label," ");}}function _e(o,i){if(o&1){let e=dC();vs(0,"form",22),Ag("ngSubmit",function(){If(e);let _=mC(2);return wf(_.save())}),vs(1,"div",5)(2,"h2",6),WC(3,"Identity"),fl(),vs(4,"div",7)(5,"span",8),WC(6,"Email"),fl(),vs(7,"span",23),WC(8),fl()(),vs(9,"div",7)(10,"span",8),WC(11,"External ID"),fl(),vs(12,"span",23),WC(13),fl()()(),vs(14,"div",5)(15,"h2",6),WC(16,"Profile"),fl(),vs(17,"div",7)(18,"label",24),WC(19,"First name"),fl(),bg(20,"input",25),HI(),fl(),vs(21,"div",7)(22,"label",26),WC(23,"Last name"),fl(),bg(24,"input",27),HI(),fl(),vs(25,"div",7)(26,"label",28),WC(27,"Bio"),fl(),bg(28,"textarea",29),HI(),fl()(),vs(29,"div",30)(30,"button",31),WC(31),fl(),vs(32,"button",32),Ag("click",function(){If(e);let _=mC(2);return wf(_.cancelEditing())}),WC(33,"Cancel"),fl()()();}if(o&2){let e=mC(),a=mC();Tg("formGroup",a.form),XE(8),Zg(e.email),XE(5),Zg(e.externalId),XE(7),$I(),XE(4),$I(),XE(4),$I(),XE(2),Tg("disabled",a.isSaving()),XE(),yl(" ",a.isSaving()?"Saving\u2026":"Save changes"," ");}}function de(o,i){o&1&&(vs(0,"p",40),WC(1," No global configuration yet. Create one from the Integrations / AI Providers / Auth Settings pages of your namespaces. "),fl());}function ce(o,i){if(o&1){let e=dC();vs(0,"span",47),WC(1,"Delete?"),fl(),vs(2,"button",48),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.confirmDelete(_))}),WC(3," Confirm "),fl(),vs(4,"button",49),Ag("click",function(){If(e);let _=mC(7);return wf(_.cancelDelete())}),WC(5," Cancel "),fl();}}function pe(o,i){if(o&1){let e=dC();vs(0,"button",49),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.armDelete(_))}),WC(1," Delete "),fl();}}function me(o,i){if(o&1&&(vs(0,"li",43)(1,"span",44),WC(2),fl(),vs(3,"span",45),WC(4),fl(),eC(5,ce,6,0)(6,pe,2,0,"button",46),fl()),o&2){let e=i.$implicit,a=mC(6);XE(2),Zg(e.name),XE(2),Zg(e.subtitle),XE(),tC(a.isPendingDelete(e)?5:6);}}function ue(o,i){if(o&1&&(vs(0,"h3",41),WC(1,"Integrations"),fl(),vs(2,"ul",42),oC(3,me,7,3,"li",43,Xw().trackEntry,true),fl()),o&2){let e=mC(5);XE(3),iC(e.recap().integrations);}}function fe(o,i){if(o&1){let e=dC();vs(0,"span",47),WC(1,"Delete?"),fl(),vs(2,"button",48),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.confirmDelete(_))}),WC(3," Confirm "),fl(),vs(4,"button",49),Ag("click",function(){If(e);let _=mC(7);return wf(_.cancelDelete())}),WC(5," Cancel "),fl();}}function Ce(o,i){if(o&1){let e=dC();vs(0,"button",49),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.armDelete(_))}),WC(1," Delete "),fl();}}function ge(o,i){if(o&1&&(vs(0,"li",43)(1,"span",44),WC(2),fl(),vs(3,"span",45),WC(4),fl(),eC(5,fe,6,0)(6,Ce,2,0,"button",46),fl()),o&2){let e=i.$implicit,a=mC(6);XE(2),Zg(e.name),XE(2),Zg(e.subtitle),XE(),tC(a.isPendingDelete(e)?5:6);}}function ve(o,i){if(o&1&&(vs(0,"h3",41),WC(1,"AI Providers"),fl(),vs(2,"ul",42),oC(3,ge,7,3,"li",43,Xw().trackEntry,true),fl()),o&2){let e=mC(5);XE(3),iC(e.recap().aiProviders);}}function xe(o,i){if(o&1){let e=dC();vs(0,"span",47),WC(1,"Delete?"),fl(),vs(2,"button",48),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.confirmDelete(_))}),WC(3," Confirm "),fl(),vs(4,"button",49),Ag("click",function(){If(e);let _=mC(7);return wf(_.cancelDelete())}),WC(5," Cancel "),fl();}}function be(o,i){if(o&1){let e=dC();vs(0,"button",49),Ag("click",function(){If(e);let _=mC().$implicit,d=mC(6);return wf(d.armDelete(_))}),WC(1," Delete "),fl();}}function ye(o,i){if(o&1&&(vs(0,"li",43)(1,"span",44),WC(2),fl(),vs(3,"span",45),WC(4),fl(),eC(5,xe,6,0)(6,be,2,0,"button",46),fl()),o&2){let e=i.$implicit,a=mC(6);XE(2),Zg(e.name),XE(2),Zg(e.subtitle),XE(),tC(a.isPendingDelete(e)?5:6);}}function he(o,i){if(o&1&&(vs(0,"h3",41),WC(1,"My global auth settings"),fl(),vs(2,"ul",42),oC(3,ye,7,3,"li",43,Xw().trackEntry,true),fl()),o&2){let e=mC(5);XE(3),iC(e.recap().authSettings);}}function Pe(o,i){if(o&1&&(eC(0,ue,5,0),eC(1,ve,5,0),eC(2,he,5,0)),o&2){let e=mC(4);tC(e.recap().integrations.length>0?0:-1),XE(),tC(e.recap().aiProviders.length>0?1:-1),XE(),tC(e.recap().authSettings.length>0?2:-1);}}function Ee(o,i){if(o&1&&eC(0,de,2,0,"p",40)(1,Pe,3,3),o&2){let e=mC(3);tC(e.recap().total===0?0:1);}}function Se(o,i){if(o&1){let e=dC();vs(0,"div",17)(1,"div",5)(2,"h2",6),WC(3,"Identity"),fl(),vs(4,"div",7)(5,"span",8),WC(6,"Email"),fl(),vs(7,"span",33),WC(8),fl()(),vs(9,"div",7)(10,"span",8),WC(11,"External ID"),fl(),vs(12,"span",33),WC(13),fl()()(),vs(14,"div",5)(15,"h2",6),WC(16,"Profile"),fl(),vs(17,"div",7)(18,"span",8),WC(19,"First name"),fl(),vs(20,"span",33),WC(21),fl()(),vs(22,"div",7)(23,"span",8),WC(24,"Last name"),fl(),vs(25,"span",33),WC(26),fl()(),vs(27,"div",34)(28,"span",8),WC(29,"Bio"),fl(),vs(30,"span",33),WC(31),fl()()(),vs(32,"div",30)(33,"button",35),Ag("click",function(){If(e);let _=mC(2);return wf(_.startEditing())}),WC(34," Edit profile "),fl()(),vs(35,"div",36)(36,"button",37),Ag("click",function(){If(e);let _=mC(2);return wf(_.toggleOverrides())}),vs(37,"span",38),WC(38,"\u25B6"),fl(),WC(39," My global user configurations "),vs(40,"span",39),WC(41),fl()(),eC(42,Ee,2,1),fl()();}if(o&2){let e=mC(),a=mC();XE(8),Zg(e.email),XE(5),Zg(e.externalId),XE(8),Zg(e.firstname||"\u2014"),XE(5),Zg(e.lastname||"\u2014"),XE(5),Zg(e.bio||"\u2014"),XE(5),Cg("aria-expanded",a.isOverridesExpanded()),XE(),Hg("user-profile__overrides-arrow--open",a.isOverridesExpanded()),XE(4),yl("(",a.recap().total,")"),XE(),tC(a.isOverridesExpanded()?42:-1);}}function we(o,i){if(o&1&&(vs(0,"div",5)(1,"h2",6),WC(2,"Appearance"),fl(),vs(3,"div",7)(4,"span",8),WC(5,"Skin"),fl(),vs(6,"div",9),oC(7,ae,5,5,"button",10,F),fl()(),vs(9,"div",7)(10,"span",8),WC(11,"Mode"),fl(),vs(12,"div",11),oC(13,le,2,4,"button",12,F),fl()()(),vs(15,"div",5)(16,"h2",6),WC(17,"Composer"),fl(),vs(18,"div",7)(19,"span",8),WC(20,"Enter key"),fl(),vs(21,"div",13)(22,"div",14),oC(23,se,2,4,"button",12,F),fl(),vs(25,"p",15),WC(26,'In "New line" mode, press Ctrl or Cmd + Enter to send.'),fl()()()(),eC(27,_e,34,5,"form",16)(28,Se,43,10,"div",17)),o&2){let e=mC();XE(7),iC(e.themeVariantOptions),XE(6),iC(e.themeOptions),XE(10),iC(e.enterKeyOptions),XE(4),tC(e.isEditing()?27:28);}}function Me(o,i){o&1&&(vs(0,"p",4),WC(1,"Unable to load profile."),fl());}var oe=class o{userState=g(u);router=g(G);location=g(Sm);destroyRef=g(we$1);integrationState=g(y);providerState=g(O);authSettingState=g(v);themePort=g(I);preferencesPort=g(f);isEditing=Hi(false);isLoading=Hi(false);isSaving=Hi(false);isOverridesExpanded=Hi(false);currentUser=this.userState.currentUser;theme=this.themePort.theme;themeMode=mT(()=>this.themePort.theme().mode);themeOptions=[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}];themeVariant=mT(()=>this.themePort.theme().variant);themeVariantOptions=[{value:"industry",label:"Industry",description:"Bleu acier, Barlow"},{value:"terminal",label:"Terminal",description:"Ambre CRT, JetBrains Mono"}];enterKeyBehavior=this.preferencesPort.enterKeyBehavior;enterKeyOptions=[{value:"send",label:"Send"},{value:"newline",label:"New line"}];form=new z({firstname:new _t("",{nonNullable:true}),lastname:new _t("",{nonNullable:true}),bio:new _t("",{nonNullable:true})});recap=F$1(Ly([this.integrationState.userGlobal$,this.providerState.userGlobal$,this.authSettingState.userGlobal$]).pipe(ue$1(([i,e,a])=>{let _=i.map(C=>({category:"integration",id:C.id??"",name:C.name,subtitle:C.integrationType})),d=e.map(C=>({category:"aiProvider",id:C.id??"",name:C.name,subtitle:C.apiType})),I=a.map(C=>({category:"authSetting",id:C.id??"",name:C.name,subtitle:C.authType}));return {integrations:_,aiProviders:d,authSettings:I,total:_.length+d.length+I.length}})),{initialValue:{integrations:[],aiProviders:[],authSettings:[],total:0}});ngOnInit(){if(this.currentUser()){this.syncFormFromState();return}this.isLoading.set(true),this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({next:()=>{this.syncFormFromState(),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}startEditing(){this.syncFormFromState(),this.isEditing.set(true);}cancelEditing(){this.isEditing.set(false);}setTheme(i){this.themePort.setTheme({variant:this.themePort.theme().variant,mode:i});}setThemeVariant(i){this.themePort.setTheme({variant:i,mode:this.themePort.theme().mode});}setEnterKeyBehavior(i){this.preferencesPort.setEnterKeyBehavior(i);}save(){this.isSaving()||(this.isSaving.set(true),this.userState.updateMe({firstname:this.form.controls.firstname.value.trim()||void 0,lastname:this.form.controls.lastname.value.trim()||void 0,bio:this.form.controls.bio.value.trim()||void 0}).pipe(U(this.destroyRef)).subscribe({next:()=>{this.isSaving.set(false),this.isEditing.set(false);},error:()=>this.isSaving.set(false)}));}toggleOverrides(){this.isOverridesExpanded.update(i=>!i),this.pendingDeleteKey.set(null);}pendingDeleteKey=Hi(null);isPendingDelete(i){return this.pendingDeleteKey()===this.entryKey(i)}armDelete(i){i.id&&this.pendingDeleteKey.set(this.entryKey(i));}cancelDelete(){this.pendingDeleteKey.set(null);}confirmDelete(i){if(!i.id)return;this.pendingDeleteKey.set(null),(i.category==="integration"?this.integrationState.delete(i.id,"userGlobal"):i.category==="authSetting"?this.authSettingState.delete(i.id,"userGlobal"):this.providerState.delete(i.id,"userGlobal")).pipe(U(this.destroyRef)).subscribe({error:a=>{console.error(`[UserProfile] Delete failed for ${i.category}:${i.id}:`,a);}});}entryKey(i){return `${i.category}:${i.id}`}goBack(){window.history.length>1?this.location.back():this.router.navigate(["/agentos"]);}trackEntry(i,e){return this.entryKey(e)}syncFormFromState(){let i=this.currentUser();i&&this.form.setValue({firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??""});}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-user-profile"]],decls:8,vars:1,consts:[[1,"user-profile"],[1,"user-profile__header"],["icon","arrow_back","title","Back",3,"action"],[1,"user-profile__title"],[1,"user-profile__loading"],[1,"user-profile__section"],[1,"user-profile__section-title"],[1,"user-profile__field"],[1,"user-profile__label"],[1,"user-profile__theme-variants"],["type","button",1,"user-profile__theme-variant",3,"user-profile__theme-variant--active"],["role","group","aria-label","Color mode",1,"user-profile__segmented"],["type","button",1,"user-profile__segmented-option",3,"user-profile__segmented-option--active"],[1,"user-profile__field-control"],["role","group","aria-label","Enter key behavior",1,"user-profile__segmented"],[1,"user-profile__hint"],[1,"user-profile__form",3,"formGroup"],[1,"user-profile__view"],["type","button",1,"user-profile__theme-variant",3,"click"],[1,"user-profile__theme-variant-name"],[1,"user-profile__theme-variant-desc"],["type","button",1,"user-profile__segmented-option",3,"click"],[1,"user-profile__form",3,"ngSubmit","formGroup"],[1,"user-profile__value","user-profile__value--readonly"],["for","up-firstname",1,"user-profile__label"],["id","up-firstname","type","text","placeholder","Your first name","formControlName","firstname","autocomplete","given-name",1,"user-profile__input"],["for","up-lastname",1,"user-profile__label"],["id","up-lastname","type","text","placeholder","Your last name","formControlName","lastname","autocomplete","family-name",1,"user-profile__input"],["for","up-bio",1,"user-profile__label"],["id","up-bio","placeholder","A short description about yourself","formControlName","bio","rows","4",1,"user-profile__input","user-profile__input--textarea"],[1,"user-profile__actions"],["type","submit",1,"user-profile__btn","user-profile__btn--primary",3,"disabled"],["type","button",1,"user-profile__btn",3,"click"],[1,"user-profile__value"],[1,"user-profile__field","user-profile__field--bio"],["type","button",1,"user-profile__btn","user-profile__btn--primary",3,"click"],[1,"user-profile__overrides"],["type","button",1,"user-profile__overrides-toggle",3,"click"],[1,"user-profile__overrides-arrow"],[1,"user-profile__overrides-count"],[1,"user-profile__overrides-empty"],[1,"user-profile__overrides-subtitle"],[1,"user-profile__overrides-list"],[1,"user-profile__overrides-row"],[1,"user-profile__overrides-name"],[1,"user-profile__overrides-subtitle-text"],["type","button",1,"user-profile__overrides-delete"],[1,"user-profile__overrides-confirm-label"],["type","button",1,"user-profile__overrides-delete","user-profile__overrides-delete--confirm",3,"click"],["type","button",1,"user-profile__overrides-delete",3,"click"]],template:function(e,a){if(e&1&&(vs(0,"div",0)(1,"header",1)(2,"ds-icon-button",2),Ag("action",function(){return a.goBack()}),fl(),vs(3,"h1",3),WC(4,"My profile"),fl()(),eC(5,re,2,0,"p",4)(6,we,29,1)(7,Me,2,0,"p",4),fl()),e&2){let _;XE(5),tC(a.isLoading()?5:(_=a.currentUser())?6:7,_);}},dependencies:[ni,Jn,Ye,Zn,Xn,En,An,Se$1],styles:[".user-profile[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-profile__header[_ngcontent-%COMP%]{display:flex;flex-direction:row;align-items:center;gap:.5rem}.user-profile__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-accent)}.user-profile__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-profile__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-profile__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.user-profile__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.user-profile__view[_ngcontent-%COMP%], .user-profile__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-profile__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-profile__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.user-profile__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-profile__field--bio[_ngcontent-%COMP%]{align-items:start}.user-profile__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary);white-space:nowrap}.user-profile__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text);word-break:break-word;white-space:pre-wrap}.user-profile__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.875rem}.user-profile__segmented[_ngcontent-%COMP%]{display:inline-flex;justify-self:start;border:1px solid var(--color-divider);overflow:hidden}.user-profile__segmented-option[_ngcontent-%COMP%]{padding:.4rem .85rem;background:transparent;border:none;border-right:1px solid var(--color-divider);color:var(--color-text-secondary);font-size:.875rem;cursor:pointer;transition:background .15s ease,color .15s ease}.user-profile__segmented-option[_ngcontent-%COMP%]:last-child{border-right:none}.user-profile__segmented-option[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__segmented-option--active[_ngcontent-%COMP%]{background:var(--color-accent);color:#fff}.user-profile__segmented-option--active[_ngcontent-%COMP%]:hover{background:var(--color-accent-700)}.user-profile__field-control[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.4rem}.user-profile__hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary)}.user-profile__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border:1px solid var(--color-divider);background:var(--color-surface);color:var(--color-text);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;border-radius:0;transition:border-color .15s ease;resize:none}.user-profile__input[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.user-profile__input[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.user-profile__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-profile__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-profile__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border:1px solid var(--color-divider);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;cursor:pointer;border-radius:0;transition:background .15s ease,border-color .15s ease}.user-profile__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-profile__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.user-profile__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}.user-profile__theme-variants[_ngcontent-%COMP%]{display:flex;gap:8px;justify-self:start}.user-profile__theme-variant[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:3px;padding:10px 16px;border:1px solid var(--color-divider);background:transparent;cursor:pointer;min-width:120px;transition:background .12s,border-color .12s}.user-profile__theme-variant[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.user-profile__theme-variant--active[_ngcontent-%COMP%]{border-color:var(--color-accent);background:color-mix(in srgb,var(--color-accent) 8%,transparent)}.user-profile__theme-variant-name[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:13px;font-weight:600;color:var(--color-text)}.user-profile__theme-variant-desc[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-secondary);font-family:var(--font-body)}.user-profile__overrides[_ngcontent-%COMP%]{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--color-divider)}.user-profile__overrides-toggle[_ngcontent-%COMP%]{background:transparent;border:none;padding:.25rem 0;font-size:.85rem;color:var(--color-text-secondary);cursor:pointer;display:flex;align-items:center;gap:.4rem}.user-profile__overrides-toggle[_ngcontent-%COMP%]:hover{color:var(--color-text)}.user-profile__overrides-arrow[_ngcontent-%COMP%]{display:inline-block;font-size:.65rem;transition:transform .15s ease}.user-profile__overrides-arrow--open[_ngcontent-%COMP%]{transform:rotate(90deg)}.user-profile__overrides-count[_ngcontent-%COMP%]{color:var(--color-text-tertiary)}.user-profile__overrides-empty[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary);font-style:italic;padding:.5rem 0 0;margin:0}.user-profile__overrides-subtitle[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);margin:.75rem 0 .25rem}.user-profile__overrides-list[_ngcontent-%COMP%]{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:.25rem}.user-profile__overrides-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.4rem .5rem;font-size:.85rem;border-radius:0}.user-profile__overrides-row[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-profile__overrides-name[_ngcontent-%COMP%]{flex:1;color:var(--color-text);font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-profile__overrides-subtitle-text[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:var(--font-heading)}.user-profile__overrides-confirm-label[_ngcontent-%COMP%]{font-size:11px;font-family:var(--font-heading);font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);white-space:nowrap}.user-profile__overrides-delete[_ngcontent-%COMP%]{background:transparent;border:1px solid transparent;font-size:11px;font-family:var(--font-heading);font-weight:600;color:var(--color-neutral-500);cursor:pointer;padding:3px 8px;border-radius:0;transition:color .12s,background .12s,border-color .12s}.user-profile__overrides-delete[_ngcontent-%COMP%]:hover{color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent);border-color:var(--red)}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]{border-color:var(--red);background:var(--red);color:#fff}.user-profile__overrides-delete--confirm[_ngcontent-%COMP%]:hover{background:var(--red-deep);border-color:var(--red-deep)}"]})};export{oe as UserProfileComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,y as Hg,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,y as Hg,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-SESULK5A.js';import {Z as Zn,S as Se}from'./chunk-wt1fF7Ba.js';function k(t,r){if(t&1&&(vs(0,"span",3),WC(1),fl()),t&2){let e=mC();XE(),Zg(e.prompt().description);}}function S(t,r){if(t&1){let e=dC();vs(0,"span",6),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",7),Ag("action",function(){If(e);let m=mC();return wf(m.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",8),Ag("action",function(){If(e);let m=mC();return wf(m.onDeleteCancelled())}),fl();}}function E(t,r){if(t&1){let e=dC();vs(0,"ds-kebab-menu",9),Ag("itemSelected",function(m){If(e);let O=mC();return wf(O.onMenuAction(m))}),fl();}if(t&2){let e=mC();Tg("items",e.menuItems);}}var I=class t{router=g(G);prompt=mB.required();namespaceId=mB(void 0);platformMode=mB(false);readOnly=mB(false);deleteRequested=gB();pendingDelete=Hi(false);menuItems=[{key:"edit",label:"Edit prompt",icon:"edit"},{key:"delete",label:"Delete prompt",icon:"delete",variant:"danger"}];onMenuAction(r){switch(r){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","prompts",this.prompt().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"prompts",this.prompt().id,"edit"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.prompt());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Aw({type:t,selectors:[["agentos-prompt-item"]],inputs:{prompt:[1,"prompt"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:8,vars:5,consts:[["role","listitem",1,"prompt-item"],[1,"prompt-item__body"],[1,"prompt-item__name"],[1,"prompt-item__description"],[1,"prompt-item__actions"],[3,"items"],[1,"prompt-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(vs(0,"div",0)(1,"div",1)(2,"span",2),WC(3),fl(),eC(4,k,2,1,"span",3),fl(),vs(5,"div",4),eC(6,S,4,0)(7,E,1,1,"ds-kebab-menu",5),fl()()),e&2&&(Hg("prompt-item--pending-delete",o.pendingDelete()),XE(3),Zg(o.prompt().name),XE(),tC(o.prompt().description?4:-1),XE(2),tC(o.pendingDelete()?6:o.readOnly()?-1:7));},dependencies:[Zn,Se],styles:[".prompt-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.prompt-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.prompt-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.prompt-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.prompt-item[_ngcontent-%COMP%]:hover .prompt-item__actions[_ngcontent-%COMP%], .prompt-item[_ngcontent-%COMP%]:focus-within .prompt-item__actions[_ngcontent-%COMP%], .prompt-item--pending-delete[_ngcontent-%COMP%] .prompt-item__actions[_ngcontent-%COMP%]{opacity:1}.prompt-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"]})};export{I};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,J as dy,P,S as ha,u as ue,Y as x}from'./main-
|
|
1
|
+
import {g,J as dy,P,S as ha,u as ue,Y as x}from'./main-SESULK5A.js';var d=class i{http=g(dy);projectState=g(P);promptsCache=new Map;getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/prompts`}listPrompts(){return this.http.get(this.getBaseUrl())}getPromptsAutocomplete(t,e){let r=this.promptsCache.get(t);return r?ha(this.filterPromptsForAutocomplete(r,e)):this.http.get(`/api/projects/${t}/prompts`).pipe(ue(p=>(this.promptsCache.set(t,p),this.filterPromptsForAutocomplete(p,e))))}filterPromptsForAutocomplete(t,e){let r=e.toLowerCase();return t.filter(o=>o.name.toLowerCase().includes(r)||o.description.toLowerCase().includes(r)).map(o=>({name:o.name,description:o.description,parameterFormat:o.parameterFormat}))}clearCache(t){t?this.promptsCache.delete(t):this.promptsCache.clear();}getPrompt(t){return this.http.get(`${this.getBaseUrl()}/${t}`)}createPrompt(t){return this.http.post(this.getBaseUrl(),t).pipe(ue(e=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),e)))}updatePrompt(t,e){return this.http.put(`${this.getBaseUrl()}/${t}`,e).pipe(ue(r=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),r)))}deletePrompt(t){return this.http.delete(`${this.getBaseUrl()}/${t}`).pipe(ue(e=>(this.clearCache(this.projectState.getSelectedProjectId()??void 0),e)))}enableWebhook(t){return this.http.post(`${this.getBaseUrl()}/${t}/webhook`,{})}disableWebhook(t){return this.http.delete(`${this.getBaseUrl()}/${t}/webhook`)}static \u0275fac=function(e){return new(e||i)};static \u0275prov=x({token:i,factory:i.\u0275fac,providedIn:"root"})};export{d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-BwAT4jgv.js';import {g,G,w as we,de as B,dd as $,aI as Tr,bR as ma,aD as Ly,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-SESULK5A.js';import {W as Wn,S as Se}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';var N=()=>[];function V(n,t){if(n&1){let o=dC();vs(0,"agentos-ai-model-item",4),Ag("editRequested",function(e){If(o);let s=mC(2);return wf(s.onEdit(e))})("deleteRequested",function(e){If(o);let s=mC(2);return wf(s.deleteModel(e))}),fl();}n&2&&Tg("model",t);}function F(n,t){if(n&1&&eC(0,V,1,1,"agentos-ai-model-item",3),n&2){let o,i=t.$implicit,e=mC();tC((o=e.resolveModel(i.id))?0:-1,o);}}var L=class n{router=g(G);destroyRef=g(we);aiModelController=g(B);aiProviderController=g($);refresh$=new Tr(void 0);data$=this.refresh$.pipe(ma(()=>Ly([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")])));modelItems$=this.data$.pipe(ue(([t,o])=>{let i=new Map(o.map(e=>[e.id??"",e.name]));return t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:i.get(e.aiProviderId)??e.aiProviderId}))}));modelsById=new Map;constructor(){this.data$.pipe(U(this.destroyRef)).subscribe(([t])=>{this.modelsById=new Map(t.map(o=>[o.id??"",o]));});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"]);}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","ai-models",t.id,"edit"]);}resolveModel(t){return this.modelsById.get(t)??null}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-platform-ai-models"]],decls:5,vars:6,consts:[["aiModelItemTpl",""],["title","Platform AI Models","emptyMessage","No platform AI models defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model"],[3,"editRequested","deleteRequested","model"]],template:function(o,i){if(o&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return i.openCreateForm()}),vs(2,"ds-icon-button",2),Ag("action",function(){return i.goBack()}),fl()(),Dg(3,F,1,1,"ng-template",null,0,fT)),o&2){let e=TC(4);Tg("items",uT(1,3,i.modelItems$)??rT(5,N))("showCreate",true)("itemTemplate",e);}},dependencies:[Wn,I,Se,Nb],styles:[".platform-ai-models__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-models__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"]})};export{L as PlatformAiModelsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {bR as ma,a7 as ga,S as ha,cD as Rd}from'./main-SESULK5A.js';function i(t,o,p){return t.pipe(ma(()=>o().pipe(ga(()=>ha(p)))),Rd({bufferSize:1,refCount:true}))}export{i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-COuPnuWl.js';import {m}from'./chunk-iBjrbq39.js';import {g,G,w as we,aI as Tr,bR as ma,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-SESULK5A.js';import {W as Wn,S as Se}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';import'./chunk-FwtCmWET.js';var F=()=>[];function L(o,e){if(o&1){let t=dC();vs(0,"agentos-prompt-item",4),Ag("deleteRequested",function(r){If(t);let E=mC(2);return wf(E.deletePrompt(r))}),fl();}o&2&&Tg("prompt",e)("platformMode",true);}function N(o,e){if(o&1&&eC(0,L,1,2,"agentos-prompt-item",3),o&2){let t,n=e.$implicit,r=mC();tC((t=r.resolvePrompt(n.id))?0:-1,t);}}var D=class o{router=g(G);destroyRef=g(we);promptState=g(m);refresh$=new Tr(void 0);prompts$=this.refresh$.pipe(ma(()=>this.promptState.listPlatform()));promptItems$=this.prompts$.pipe(ue(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.description}))));promptsById=new Map;constructor(){this.prompts$.pipe(U(this.destroyRef)).subscribe(e=>{this.promptsById=new Map(e.map(t=>[t.id??"",t]));});}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}deletePrompt(e){this.promptState.delete(e.id??"").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(e){return this.promptsById.get(e)??null}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-platform-prompts"]],decls:5,vars:6,consts:[["promptItemTpl",""],["title","Platform Prompts","emptyMessage","No platform prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"prompt","platformMode"],[3,"deleteRequested","prompt","platformMode"]],template:function(t,n){if(t&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return n.openCreateForm()}),vs(2,"ds-icon-button",2),Ag("action",function(){return n.goBack()}),fl()(),Dg(3,N,1,1,"ng-template",null,0,fT)),t&2){let r=TC(4);Tg("items",uT(1,3,n.promptItems$)??rT(5,F))("showCreate",true)("itemTemplate",r);}},dependencies:[Wn,I,Se,Nb],styles:[".platform-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{D as PlatformPromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-R3xzoDPf.js';import {v}from'./chunk-SZxCBMtv.js';import {g,G,w as we,aI as Tr,bR as ma,u as ue,b as U,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,W as WC,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-SESULK5A.js';import'./chunk-iBjrbq39.js';import {W as Wn}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';import'./chunk-CWzYMkED.js';import'./chunk-FwtCmWET.js';var M=()=>[];function V(i,t){if(i&1){let e=dC();vs(0,"agentos-auth-setting-item",4),Ag("editRequested",function(n){If(e);let p=mC(2);return wf(p.onEdit(n))})("deleteRequested",function(n){If(e);let p=mC(2);return wf(p.onDelete(n))}),fl();}i&2&&Tg("config",t)("showBadge",false);}function F(i,t){if(i&1&&eC(0,V,1,2,"agentos-auth-setting-item",3),i&2){let e,o=t.$implicit,n=mC();tC((e=n.resolveSetting(o.id))?0:-1,e);}}var k=class i{router=g(G);destroyRef=g(we);state=g(v);refresh$=new Tr(void 0);settings$=this.refresh$.pipe(ma(()=>this.state.loadPlatformSettings()));settingItems$=this.settings$.pipe(ue(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe(t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","admin"]);}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.state.delete(t.id,"platform").pipe(U(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveSetting(t){return this.settingsById.get(t)??null}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=Aw({type:i,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:6,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"platform-auth-settings__back",3,"click"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(e,o){if(e&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return o.openCreateForm()}),vs(2,"button",2),Ag("click",function(){return o.goBack()}),WC(3,"\u2190 Admin"),fl()(),Dg(4,F,1,1,"ng-template",null,0,fT)),e&2){let n=TC(5);Tg("items",uT(1,3,o.settingItems$)??rT(5,M))("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,O,Nb],encapsulation:2})};export{k as PlatformAuthSettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-CbeOpZJP.js';import {g,ao as V$1,G as G$1,w as we,d8 as M,aI as Tr,bR as ma,Q as By,a7 as ga,S as ha,u as ue,b as U$1,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,W as WC,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-SESULK5A.js';import {W as Wn}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';var F=()=>[];function U(o,t){if(o&1){let n=dC();vs(0,"agentos-agent-config-item",4),Ag("deleteRequested",function(i){If(n);let D=mC(2);return wf(D.deleteConfig(i))}),fl();}if(o&2){let n=mC().$implicit,e=mC();Tg("config",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformConfig(n.id));}}function V(o,t){if(o&1&&eC(0,U,1,3,"agentos-agent-config-item",3),o&2){let n,e=t.$implicit,i=mC();tC((n=i.resolveConfig(e.id))?0:-1,n);}}var j="namespace",G="platform",q=class o{route=g(V$1);router=g(G$1);destroyRef=g(we);agentConfigController=g(M);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);allConfigs$=this.refresh$.pipe(ma(()=>By({namespace:this.agentConfigController.listByParentAgentConfig(this.namespaceId),platform:this.agentConfigController.listPlatformAgentsAgentConfig().pipe(ga(()=>ha([])))})));configItems$=this.allConfigs$.pipe(ue(({namespace:t,platform:n})=>[...n.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Platform (read-only)"})),...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:j,groupLabel:"Namespace"}))]));namespaceConfigsById=new Map;platformConfigsById=new Map;constructor(){this.allConfigs$.pipe(U$1(this.destroyRef)).subscribe(({namespace:t,platform:n})=>{this.namespaceConfigsById=new Map(t.map(e=>[e.id??"",e])),this.platformConfigsById=new Map(n.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs","new"]);}deleteConfig(t){this.agentConfigController.deleteAgentConfig(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolveConfig(t){return this.namespaceConfigsById.get(t)??this.platformConfigsById.get(t)??null}isPlatformConfig(t){return this.platformConfigsById.has(t)}static \u0275fac=function(n){return new(n||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-namespace-agent-configs"]],decls:6,vars:6,consts:[["agentConfigItemTpl",""],["title","Agent Configs","emptyMessage","No agent configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-agent-configs__back",3,"click"],[3,"config","namespaceId","readOnly"],[3,"deleteRequested","config","namespaceId","readOnly"]],template:function(n,e){if(n&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return e.openCreateForm()}),vs(2,"button",2),Ag("click",function(){return e.goBack()}),WC(3," \u2190 Namespaces "),fl()(),Dg(4,V,1,1,"ng-template",null,0,fT)),n&2){let i=TC(5);Tg("items",uT(1,3,e.configItems$)??rT(5,F))("showCreate",true)("itemTemplate",i);}},dependencies:[Wn,O,Nb],styles:[".namespace-agent-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-agent-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{q as NamespaceAgentConfigsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,G,ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-
|
|
1
|
+
import {g,G,ca as mB,cb as gB,H as Hi,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,t as tC,ac as mC,a9 as dC,l as Ag,r as Tg,aa as If,ab as wf}from'./main-SESULK5A.js';import {K as Kn,Z as Zn,S as Se}from'./chunk-wt1fF7Ba.js';function P(n,o){if(n&1&&(vs(0,"span",3),WC(1),fl()),n&2){let e=mC();XE(),Zg(e.config().modelName);}}function k(n,o){if(n&1&&(vs(0,"span",4),WC(1),fl()),n&2){let e=mC();XE(),Zg(e.config().description);}}function S(n,o){if(n&1){let e=dC();vs(0,"span",7),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",8),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",9),Ag("action",function(){If(e);let l=mC();return wf(l.onDeleteCancelled())}),fl();}}function E(n,o){if(n&1){let e=dC();vs(0,"ds-kebab-menu",10),Ag("itemSelected",function(l){If(e);let A=mC();return wf(A.onMenuAction(l))}),fl();}if(n&2){let e=mC();Tg("items",e.readOnly()?e.readOnlyMenuItems:e.menuItems);}}var O=class n{router=g(G);config=mB.required();namespaceId=mB(void 0);platformMode=mB(false);readOnly=mB(false);deleteRequested=gB();pendingDelete=Hi(false);menuItems=[{key:"edit",label:"Edit agent config",icon:"edit"},{key:"inspect",label:"Inspect definition",icon:"search"},{key:"delete",label:"Delete agent config",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"Inspect definition",icon:"search"}];onMenuAction(o){switch(o){case "edit":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"edit"]);break;case "inspect":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"inspect"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"inspect"]);break;case "delete":this.pendingDelete.set(true);break}}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=Aw({type:n,selectors:[["agentos-agent-config-item"]],inputs:{config:[1,"config"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:9,vars:4,consts:[["role","listitem","dsBlueprint","",1,"agent-config-item"],[1,"agent-config-item__body"],[1,"agent-config-item__name"],[1,"agent-config-item__model"],[1,"agent-config-item__description"],[1,"agent-config-item__actions"],[3,"items"],[1,"agent-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,a){e&1&&(vs(0,"div",0)(1,"div",1)(2,"span",2),WC(3),fl(),eC(4,P,2,1,"span",3),eC(5,k,2,1,"span",4),fl(),vs(6,"div",5),eC(7,S,4,0)(8,E,1,1,"ds-kebab-menu",6),fl()()),e&2&&(XE(3),Zg(a.config().name),XE(),tC(a.config().modelName?4:-1),XE(),tC(a.config().description?5:-1),XE(2),tC(a.pendingDelete()?7:8));},dependencies:[Kn,Zn,Se],styles:[".agent-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.agent-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.agent-config-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__model[_ngcontent-%COMP%], .agent-config-item__description[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover .agent-config-item__actions[_ngcontent-%COMP%], .agent-config-item[_ngcontent-%COMP%]:focus-within .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item[_ngcontent-%COMP%]:has(.agent-config-item__confirm-label) .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {p}from'./chunk-
|
|
1
|
+
import {p}from'./chunk-iBjrbq39.js';import {g,ao as V,J as dy,d3 as y,A as Aw,aw as pl,W as WC,ax as hl,X as XE,a8 as Zg}from'./main-SESULK5A.js';import'./chunk-FwtCmWET.js';import'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';var A=class r{route=g(V);http=g(dy);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(p,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(p,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(pl(0,"p",0),WC(1),hl()),t&2&&(XE(),Zg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {g,J as dy,S as ha,bT as Od,u as ue,Y as x}from'./main-
|
|
1
|
+
import {g,J as dy,S as ha,bT as Od,u as ue,Y as x}from'./main-SESULK5A.js';var f=class s{http=g(dy);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?ha(t):this.http.get(`/api/projects/${e}/agents`).pipe(Od(o=>{this.agentsCache.set(e,o);}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(ue(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e);}clearAllCache(){this.agentsCache.clear();}static \u0275fac=function(t){return new(t||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {K as Kn,S as Se}from'./chunk-
|
|
1
|
+
import {K as Kn,S as Se}from'./chunk-wt1fF7Ba.js';import {ca as mB,cb as gB,H as Hi,m as mT,A as Aw,v as vs,W as WC,k as fl,n as eC,X as XE,a8 as Zg,C as Cg,a5 as yl,t as tC,a9 as dC,l as Ag,ac as mC,aa as If,ab as wf}from'./main-SESULK5A.js';function M(o,m){if(o&1){let e=dC();vs(0,"span",7),WC(1,"Delete?"),fl(),vs(2,"ds-icon-button",8),Ag("action",function(){If(e);let a=mC();return wf(a.onDeleteConfirmed())}),fl(),vs(3,"ds-icon-button",9),Ag("action",function(){If(e);let a=mC();return wf(a.onDeleteCancelled())}),fl();}}function S(o,m){if(o&1){let e=dC();vs(0,"ds-icon-button",11),Ag("action",function(){If(e);let a=mC(2);return wf(a.onEdit())}),fl(),vs(1,"ds-icon-button",12),Ag("action",function(){If(e);let a=mC(2);return wf(a.onDeleteArmed())}),fl();}}function P(o,m){if(o&1){let e=dC();vs(0,"ds-icon-button",10),Ag("action",function(){If(e);let a=mC();return wf(a.onDuplicate())}),fl(),eC(1,S,2,0);}if(o&2){let e=mC();XE(),tC(e.readOnly()?-1:1);}}var E=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration partag\xE9e plateforme",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),O=class o{config=mB.required();scope=mB.required();readOnly=mB(false);editRequested=gB();deleteRequested=gB();duplicateRequested=gB();pendingDelete=Hi(false);badge=mT(()=>E[this.scope()]);onEdit(){this.editRequested.emit(this.config());}onDuplicate(){this.duplicateRequested.emit(this.config());}onDeleteArmed(){this.pendingDelete.set(true);}onDeleteConfirmed(){this.pendingDelete.set(false),this.deleteRequested.emit(this.config());}onDeleteCancelled(){this.pendingDelete.set(false);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=Aw({type:o,selectors:[["agentos-integration-config-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:6,consts:[["role","listitem","dsBlueprint","",1,"integration-config-item"],[1,"integration-config-item__body"],[1,"integration-config-item__heading"],[1,"integration-config-item__name"],[1,"integration-config-item__badge"],[1,"integration-config-item__type"],[1,"integration-config-item__actions"],[1,"integration-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this configuration",3,"action"],["icon","edit","title","Edit integration",3,"action"],["icon","delete","variant","danger","title","Delete integration",3,"action"]],template:function(e,t){e&1&&(vs(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),WC(4),fl(),vs(5,"span",4),WC(6),fl()(),vs(7,"span",5),WC(8),fl()(),vs(9,"div",6),eC(10,M,4,0)(11,P,2,1),fl()()),e&2&&(XE(4),Zg(t.config().name),XE(),Cg("data-variant",t.badge().variant)("aria-label",t.badge().ariaLabel),XE(),yl(" ",t.badge().label," "),XE(2),Zg(t.config().integrationType),XE(2),tC(t.pendingDelete()?10:11));},dependencies:[Kn,Se],styles:[".integration-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:14px 16px;position:relative;border-radius:0;border:1px solid var(--color-divider);background:var(--color-bg);box-shadow:var(--shadow-sm);overflow:visible;transition:border-color .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover{border-color:var(--color-accent)}.integration-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.integration-config-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.integration-config-item__name[_ngcontent-%COMP%]{font-size:15px;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.integration-config-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;border-radius:0;padding:.15rem .5rem;white-space:nowrap}.integration-config-item__badge[data-variant=neutral][_ngcontent-%COMP%]{border:1px solid var(--color-divider);color:var(--color-neutral-600);background:transparent}.integration-config-item__badge[data-variant=info][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-info) 40%,transparent);color:var(--color-info);background:color-mix(in srgb,var(--color-info) 10%,transparent)}.integration-config-item__badge[data-variant=warning][_ngcontent-%COMP%]{border:1px solid color-mix(in srgb,var(--color-warning) 40%,transparent);color:var(--color-warning);background:color-mix(in srgb,var(--color-warning) 10%,transparent)}.integration-config-item__type[_ngcontent-%COMP%]{font-size:13px;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.integration-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.integration-config-item[_ngcontent-%COMP%]:hover .integration-config-item__actions[_ngcontent-%COMP%], .integration-config-item[_ngcontent-%COMP%]:focus-within .integration-config-item__actions[_ngcontent-%COMP%]{opacity:1}.integration-config-item__confirm-label[_ngcontent-%COMP%]{font-family:var(--font-heading);font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--red-deep);margin-right:.25rem;white-space:nowrap}"]})};export{O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {I}from'./chunk-
|
|
1
|
+
import {I}from'./chunk-COuPnuWl.js';import {m}from'./chunk-iBjrbq39.js';import {g,ao as V$1,G as G$1,w as we,aI as Tr,bR as ma,Q as By,a7 as ga,S as ha,u as ue,b as U$1,A as Aw,aJ as Nb,v as vs,be as aT,l as Ag,W as WC,k as fl,af as Dg,T as TC,r as Tg,bf as uT,ah as rT,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-SESULK5A.js';import {W as Wn}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';import'./chunk-FwtCmWET.js';var F=()=>[];function U(r,t){if(r&1){let o=dC();vs(0,"agentos-prompt-item",4),Ag("deleteRequested",function(n){If(o);let D=mC(2);return wf(D.deletePrompt(n))}),fl();}if(r&2){let o=mC().$implicit,e=mC();Tg("prompt",t)("namespaceId",e.namespaceId)("readOnly",e.isPlatformPrompt(o.id));}}function V(r,t){if(r&1&&eC(0,U,1,3,"agentos-prompt-item",3),r&2){let o,e=t.$implicit,n=mC();tC((o=n.resolvePrompt(e.id))?0:-1,o);}}var j="platform",G="namespace",A=class r{route=g(V$1);router=g(G$1);destroyRef=g(we);promptState=g(m);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new Tr(void 0);allPrompts$=this.refresh$.pipe(ma(()=>By({platform:this.promptState.listPlatform().pipe(ga(()=>ha([]))),namespace:this.promptState.listByNamespace(this.namespaceId)})));promptItems$=this.allPrompts$.pipe(ue(({platform:t,namespace:o})=>[...t.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:j,groupLabel:"Platform (read-only)"})),...o.map(e=>({id:e.id??"",name:e.name,description:e.description,groupKey:G,groupLabel:"Namespace"}))]));namespacePromptsById=new Map;platformPromptsById=new Map;constructor(){this.allPrompts$.pipe(U$1(this.destroyRef)).subscribe(({platform:t,namespace:o})=>{this.platformPromptsById=new Map(t.map(e=>[e.id??"",e])),this.namespacePromptsById=new Map(o.map(e=>[e.id??"",e]));});}goBack(){this.router.navigate(["/agentos","namespaces"]);}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"prompts","new"]);}deletePrompt(t){this.promptState.delete(t.id??"").pipe(U$1(this.destroyRef)).subscribe(()=>this.refresh$.next());}resolvePrompt(t){return this.platformPromptsById.get(t)??this.namespacePromptsById.get(t)??null}isPlatformPrompt(t){return this.platformPromptsById.has(t)}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-namespace-prompts"]],decls:6,vars:6,consts:[["promptItemTpl",""],["title","Prompts","emptyMessage","No prompts defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","type","button",1,"namespace-prompts__back",3,"click"],[3,"prompt","namespaceId","readOnly"],[3,"deleteRequested","prompt","namespaceId","readOnly"]],template:function(o,e){if(o&1&&(vs(0,"ds-entity-list",1),aT(1,"async"),Ag("createRequested",function(){return e.openCreateForm()}),vs(2,"button",2),Ag("click",function(){return e.goBack()}),WC(3,"\u2190 Namespaces"),fl()(),Dg(4,V,1,1,"ng-template",null,0,fT)),o&2){let n=TC(5);Tg("items",uT(1,3,e.promptItems$)??rT(5,F))("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,I,Nb],styles:[".namespace-prompts__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.namespace-prompts__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"]})};export{A as NamespacePromptsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {R}from'./chunk-
|
|
1
|
+
import {R}from'./chunk-DXCUsjC1.js';import {c}from'./chunk-_mwMNDBZ.js';import {g,G,w as we,H as Hi,m as mT,b as U,A as Aw,v as vs,l as Ag,k as fl,af as Dg,T as TC,r as Tg,n as eC,ac as mC,t as tC,a9 as dC,aa as If,ab as wf,ag as fT}from'./main-SESULK5A.js';import {W as Wn,S as Se}from'./chunk-wt1fF7Ba.js';import'./chunk-BIOUDJ0F.js';import'./chunk-DeUJR8VL.js';function M(r,e){if(r&1){let t=dC();vs(0,"agentos-scheduled-prompt-item",4),Ag("enableRequested",function(n){If(t);let i=mC(2);return wf(i.enablePrompt(n))})("disableRequested",function(n){If(t);let i=mC(2);return wf(i.disablePrompt(n))})("deleteRequested",function(n){If(t);let i=mC(2);return wf(i.deletePrompt(n))}),fl();}r&2&&Tg("definition",e)("platformMode",true);}function E(r,e){if(r&1&&eC(0,M,1,2,"agentos-scheduled-prompt-item",3),r&2){let t,o=e.$implicit,n=mC();tC((t=n.resolvePrompt(o.id))?0:-1,t);}}var D=class r{router=g(G);destroyRef=g(we);state=g(c);prompts=Hi([]);promptItems=mT(()=>this.prompts().map(e=>({id:e.id??"",name:e.name,description:e.description,badges:[{label:e.enabled?"Enabled":"Disabled",variant:e.enabled?"success":"warning"}]})));constructor(){this.state.listPlatform().pipe(U(this.destroyRef)).subscribe(e=>this.prompts.set(e));}goBack(){this.router.navigate(["/agentos","admin"]);}openCreateForm(){this.router.navigate(["/agentos","admin","scheduled-prompts","new"]);}enablePrompt(e){this.state.enable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchPrompt(t));}disablePrompt(e){this.state.disable(e.id??"").pipe(U(this.destroyRef)).subscribe(t=>this.patchPrompt(t));}deletePrompt(e){let t=e.id??"";this.state.delete(t).pipe(U(this.destroyRef)).subscribe(()=>this.prompts.update(o=>o.filter(n=>n.id!==t)));}resolvePrompt(e){return this.prompts().find(t=>t.id===e)??null}patchPrompt(e){this.prompts.update(t=>t.map(o=>o.id===e.id?e:o));}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=Aw({type:r,selectors:[["agentos-platform-scheduled-prompts"]],decls:4,vars:3,consts:[["scheduledPromptItemTpl",""],["title","Platform Scheduled Prompts","emptyMessage","No platform scheduled prompts defined yet. Add one above.","cardMinWidth","420px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"definition","platformMode"],[3,"enableRequested","disableRequested","deleteRequested","definition","platformMode"]],template:function(t,o){if(t&1&&(vs(0,"ds-entity-list",1),Ag("createRequested",function(){return o.openCreateForm()}),vs(1,"ds-icon-button",2),Ag("action",function(){return o.goBack()}),fl()(),Dg(2,E,1,1,"ng-template",null,0,fT)),t&2){let n=TC(3);Tg("items",o.promptItems())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,R,Se],encapsulation:2})};export{D as PlatformScheduledPromptsComponent};
|