@whoz-oss/coday-client 3.29.0 → 3.31.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-C3cvHmBJ.js → chunk--r2IPkvN.js} +1 -1
- package/browser/chunk-1mA1C1Ia.js +1 -0
- package/browser/{chunk-D5UGtM5T.js → chunk-4NMdLPHF.js} +1 -1
- package/browser/chunk-4QqbIPaR.js +1 -0
- package/browser/{chunk-C6x9SBjG.js → chunk-AB2V4DzP.js} +1 -1
- package/browser/{chunk-D-vld_6F.js → chunk-B-Ejl4sU.js} +1 -1
- package/browser/{chunk-CrYRdxC9.js → chunk-B3KKH9dW.js} +1 -1
- package/browser/{chunk-Ov4I3GYD.js → chunk-B4hQ_D8H.js} +1 -1
- package/browser/{chunk-Bo1DjeiW.js → chunk-BFY0pXEf.js} +1 -1
- package/browser/{chunk-Bbb2Oy9I.js → chunk-BPkyqr-f.js} +1 -1
- package/browser/chunk-BWcVMw4T.js +1 -0
- package/browser/{chunk-sqjr_Ky0.js → chunk-BXZoje_o.js} +1 -1
- package/browser/{chunk-Cmp8otOQ.js → chunk-B_-1xOxe.js} +1 -1
- package/browser/{chunk-CCQAu0MS.js → chunk-B_gHVcU6.js} +1 -1
- package/browser/{chunk-CG4buEjj.js → chunk-BhXLqAug.js} +1 -1
- package/browser/{chunk-CHSLALZZ.js → chunk-BjFLkaZE.js} +1 -1
- package/browser/{chunk-DOV6c8DN.js → chunk-Bk2EXxig.js} +2 -2
- package/browser/{chunk-DpKLsgM9.js → chunk-BopMYlkE.js} +1 -1
- package/browser/{chunk-ChTqQ8HQ.js → chunk-BpSHA6TV.js} +1 -1
- package/browser/{chunk-B1gTtKFG.js → chunk-BrUYkz33.js} +1 -1
- package/browser/{chunk-BjBW1d-u.js → chunk-Bx_FH6m3.js} +1 -1
- package/browser/{chunk-1xKCP6gl.js → chunk-C0KRHI6e.js} +1 -1
- package/browser/{chunk-DG8M0PqZ.js → chunk-C2Inb2UP.js} +1 -1
- package/browser/{chunk-D2pgQ9ii.js → chunk-CEQ5C5Tx.js} +1 -1
- package/browser/{chunk-CdkqXKu3.js → chunk-CG3MF0H4.js} +1 -1
- package/browser/{chunk-BtBbv-Bf.js → chunk-CGn0orvL.js} +1 -1
- package/browser/chunk-CJGzYd_S.js +1 -0
- package/browser/{chunk-Bv_n_Pea.js → chunk-CJIgE5YB.js} +3 -3
- package/browser/{chunk-cNEt2yX6.js → chunk-CJxkwaxD.js} +1 -1
- package/browser/{chunk-CFfiJ53b.js → chunk-CK18gZ63.js} +1 -1
- package/browser/{chunk-BloWX02p.js → chunk-CNmZmLwF.js} +1 -1
- package/browser/{chunk-CxozF4Vf.js → chunk-COD2O4SF.js} +1 -1
- package/browser/{chunk-D_aTK145.js → chunk-CZmNdEYy.js} +1 -1
- package/browser/{chunk-CE5rgBGE.js → chunk-C_J2R_PK.js} +1 -1
- package/browser/{chunk-BlUiCEeR.js → chunk-CglVp4ZH.js} +1 -1
- package/browser/{chunk-DZe-m4Sd.js → chunk-CkBh9-Fw.js} +1 -1
- package/browser/{chunk-CRrjfkUg.js → chunk-CnEa9fH2.js} +2 -2
- package/browser/{chunk-CGL1Leue.js → chunk-CniyJRG1.js} +1 -1
- package/browser/{chunk-cg5smJeu.js → chunk-Cq3KqN1m.js} +1 -1
- package/browser/{chunk-q9uyoVUw.js → chunk-CtHF-uul.js} +1 -1
- package/browser/chunk-D-QPhn7p.js +1 -0
- package/browser/{chunk-bIJnspzL.js → chunk-D-l2ORqm.js} +1 -1
- package/browser/chunk-D3BAOO_0.js +1 -0
- package/browser/{chunk-Boc0RvBR.js → chunk-D3fatnCm.js} +1 -1
- package/browser/{chunk-Ddpg0y75.js → chunk-D3gurhpR.js} +1 -1
- package/browser/{chunk-CCEiNYBj.js → chunk-D6BBuWSd.js} +1 -1
- package/browser/{chunk-CFY3CFkD.js → chunk-D8sYWCcr.js} +1 -1
- package/browser/{chunk-Bol7PdRu.js → chunk-DAk8SIkq.js} +1 -1
- package/browser/{chunk-BIdH1XJF.js → chunk-DFLL0Odh.js} +1 -1
- package/browser/{chunk-RUBMO7Yb.js → chunk-DR5zNU0n.js} +1 -1
- package/browser/{chunk-u3jxNXQ8.js → chunk-DVrM3JI8.js} +1 -1
- package/browser/{chunk-BmHNWYuZ.js → chunk-DWSvE7KY.js} +1 -1
- package/browser/{chunk-DX05HUs9.js → chunk-DZUhjamf.js} +1 -1
- package/browser/{chunk-Cw62GRPX.js → chunk-DZuvl0-q.js} +1 -1
- package/browser/{chunk-DKg7p59a.js → chunk-DmNKvrHl.js} +1 -1
- package/browser/chunk-DnMJl9Ao.js +1 -0
- package/browser/{chunk-G_l8BMaJ.js → chunk-DqzTsn7a.js} +1 -1
- package/browser/{chunk-CjKxvXTd.js → chunk-DsFEZkSl.js} +1 -1
- package/browser/{chunk-BSAXfS2x.js → chunk-DstI03OT.js} +1 -1
- package/browser/{chunk-CERsD1uZ.js → chunk-DzWQQKpk.js} +1 -1
- package/browser/{chunk-BvO---8Y.js → chunk-F5WjZgr6.js} +1 -1
- package/browser/{chunk-DuNMllH-.js → chunk-KIJUJ9nq.js} +1 -1
- package/browser/chunk-Mxaxers6.js +1 -0
- package/browser/{chunk-CGlvdEI7.js → chunk-O4nbXJCv.js} +1 -1
- package/browser/{chunk-vQXZQsZC.js → chunk-P6Fi8ohd.js} +1 -1
- package/browser/{chunk-DgmZwFcU.js → chunk-QcmfFN_C.js} +1 -1
- package/browser/{chunk-DczzZnS1.js → chunk-S9BROQKc.js} +1 -1
- package/browser/{chunk-_2qKLbuS.js → chunk-VE530Qd2.js} +1 -1
- package/browser/{chunk-CBwpP2V0.js → chunk-bgvmHk7z.js} +1 -1
- package/browser/chunk-kFOHrPbJ.js +10 -0
- package/browser/chunk-lU3996br.js +1 -0
- package/browser/index.html +1 -1
- package/browser/{main-2GG5NZ4C.js → main-2EYBZUJC.js} +9 -9
- package/package.json +1 -1
- package/browser/chunk-C-VoWDOg.js +0 -10
- package/browser/chunk-C0DMx9CU.js +0 -1
- package/browser/chunk-C5mPb_F4.js +0 -1
- package/browser/chunk-CpGwP-5T.js +0 -1
- package/browser/chunk-CrZEE1qa.js +0 -1
- package/browser/chunk-Dz1wgxrF.js +0 -1
- package/browser/chunk-Fh0Lvh-K.js +0 -1
- package/browser/chunk-WuZ8xi__.js +0 -1
- package/browser/chunk-a4RWgm8g.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f}from'./chunk-Bol7PdRu.js';import {g,bm as Mm,R as Re,a as Gi,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,n as GC,o as pl,J as Jw,af as Eg,ag as fT,u as CC,X as XE,v as bg,y as eC,H as py,P,aF as R,Y as x,Z as z,_ as Ue,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,i as pr,bn as Xt,ai as tm,aj as KC,a3 as VI,t as rC,bo as tC,a8 as Yg,ak as em,a6 as UI,z as oC,a5 as vl,ac as gC,a9 as lC,aa as If,ab as wf,bp as ml,bq as yl,ah as rT,b4 as oT,A as Ug,b0 as Qg,a4 as nC,T as Tg,S as Sg}from'./main-2GG5NZ4C.js';import {P as Pt}from'./chunk-Bo1DjeiW.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-RUBMO7Yb.js';import {W as Wn,o as ot$1,i as it$1,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-BjBW1d-u.js';import'./chunk-Bbb2Oy9I.js';import {y as yt,w as wt,t as ti,Q as Qn,e as ei,Y as Ye$1,f as fn,m as mn,Z as Zn,g as gt,$ as $t,W as Wt,c as cn}from'./chunk-D_aTK145.js';var w=class s{http=g(py);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new R(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n);},a.onerror=()=>n.error(a.error),a.readAsDataURL(e);})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};function ze(s,t){s&1&&(ws(0,"p",15),GC(1,"No integrations defined \u2014 agent will have access to all tools."),pl());}function qe(s,t){if(s&1){let e=lC();ws(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),GC(3,"Integration"),pl(),ws(4,"input",23),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.integration,a)||(r.integration=a),wf(a)}),pl(),VI(),pl(),ws(5,"mat-form-field",24)(6,"mat-label"),GC(7,"Tools (comma-separated)"),pl(),ws(8,"input",25),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.tools,a)||(r.tools=a),wf(a)}),pl(),VI(),pl(),ws(9,"button",26),Rg("click",function(){let a=If(e).$index,r=gC();return wf(r.removeIntegrationRow(a))}),ws(10,"mat-icon"),GC(11,"delete"),pl()()();}if(s&2){let e=t.$implicit;XE(4),em("ngModel",e.integration),UI(),XE(4),em("ngModel",e.tools),UI();}}function He(s,t){if(s&1&&(ws(0,"p",30),GC(1),pl()),s&2){let e=gC(2);XE(),Yg(e.docUploadError);}}function Ge(s,t){s&1&&(ws(0,"p",15),GC(1,"No mandatory documents defined."),pl());}function Ze(s,t){if(s&1&&Sg(0,"option",35),s&2){let e=t.$implicit;bg("value","documents/"+e);}}function Ke(s,t){if(s&1){let e=lC();ws(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),GC(3,"Document path"),pl(),ws(4,"input",33),tm("ngModelChange",function(a){let r=If(e).$index,j=gC(2);return KC(j.mandatoryDocs[r],a)||(j.mandatoryDocs[r]=a),wf(a)}),pl(),VI(),ws(5,"datalist",34),rC(6,Ze,1,1,"option",35,nC),pl()(),ws(8,"button",26),Rg("click",function(){let a=If(e).$index,r=gC(2);return wf(r.removeDocRow(a))}),ws(9,"mat-icon"),GC(10,"delete"),pl()()();}if(s&2){let e=t.$index,n=gC(2);XE(4),em("ngModel",n.mandatoryDocs[e]),Tg("list","docs-list-"+e),UI(),XE(),bg("id","docs-list-"+e),XE(),oC(n.availableDocuments);}}function Je(s,t){if(s&1){let e=lC();ws(0,"div",6)(1,"span"),GC(2,"Mandatory Documents"),pl(),ws(3,"button",27),Rg("click",function(){If(e);let a=gC();return wf(a.addDocRow())}),ws(4,"mat-icon"),GC(5,"add"),pl()(),ws(6,"label",28)(7,"mat-icon"),GC(8,"upload_file"),pl(),ws(9,"input",29),Rg("change",function(a){If(e);let r=gC();return wf(r.onDocFileSelected(a))}),pl()()(),Jw(10,He,2,1,"p",30),Jw(11,Ge,2,0,"p",15),rC(12,Ke,11,3,"div",31,tC);}if(s&2){let e=gC();XE(6),Ug("uploading",e.isUploadingDoc),XE(3),bg("disabled",e.isUploadingDoc),XE(),eC(e.docUploadError?10:-1),XE(),eC(e.mandatoryDocs.length===0?11:-1),XE(),oC(e.mandatoryDocs);}}function Qe(s,t){s&1&&(ws(0,"p",15),GC(1,"\u{1F4A1} Documents can be added after the agent is created."),pl());}function Xe(s,t){if(s&1){let e=lC();ws(0,"div",6),GC(1,"Save to"),pl(),ws(2,"div",36)(3,"label",37)(4,"input",38),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(5,"div",39)(6,"div",40)(7,"span",41),GC(8,"\u{1F464}"),pl(),ws(9,"span",42),GC(10,"Project config"),pl()(),ws(11,"p",43),GC(12),pl()()(),ws(13,"label",37)(14,"input",44),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(15,"div",39)(16,"div",40)(17,"span",41),GC(18,"\u{1F4E6}"),pl(),ws(19,"span",42),GC(20,"Colocated"),pl()(),ws(21,"p",43),GC(22,"Next to coday.yaml in ./agents/ (committable)"),pl()()()(),ws(23,"p",15),GC(24,"Storage location is permanent and cannot be changed after creation."),pl();}if(s&2){let e=gC();XE(3),Ug("selected",e.location==="project"),XE(),em("ngModel",e.location),UI(),XE(8),Qg("~/.coday/projects/","{","name","}","/agents/ (not committed)"),XE(),Ug("selected",e.location==="colocated"),XE(),em("ngModel",e.location),UI();}}function Ye(s,t){if(s&1&&(ws(0,"div",17)(1,"span",6),GC(2,"Storage Location"),pl(),ws(3,"span",45),GC(4),pl(),ws(5,"p",15),GC(6,"Cannot be changed after creation."),pl()()),s&2){let e=gC();XE(3),Ug("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),XE(),vl(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ");}}function $e(s,t){if(s&1&&(ws(0,"div",18)(1,"mat-icon"),GC(2,"error"),pl(),ws(3,"span"),GC(4),pl()()),s&2){let e=gC();XE(4),Yg(e.errorMessage);}}var E=class s{agentCrudApi=g(w);agentApi=g(f);dialogRef=g(z);data=g(Ue);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=false;docUploadError="";location="project";isSaving=false;errorMessage="";isEditMode=false;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments();}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]});}addDocRow(){this.mandatoryDocs.push("");}removeDocRow(t){this.mandatoryDocs.splice(t,1);}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=true,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=false,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value="";},error:a=>{this.isUploadingDoc=false,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value="";}}));}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""});}removeIntegrationRow(t){this.integrationRows.splice(t,1);}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",false;if(!this.description.trim())return this.errorMessage="Description is required",false;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",false;return true}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return {name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=true,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=false,this.agentApi.clearAllCache(),this.dialogRef.close(true);},error:n=>{this.isSaving=false,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent";}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(ws(0,"h2",0),GC(1),pl(),ws(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),GC(6,"Name"),pl(),ws(7,"input",3),tm("ngModelChange",function(r){return KC(n.name,r)||(n.name=r),r}),pl(),VI(),ws(8,"mat-hint"),GC(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),pl()(),ws(10,"mat-form-field",2)(11,"mat-label"),GC(12,"Description"),pl(),ws(13,"textarea",4),tm("ngModelChange",function(r){return KC(n.description,r)||(n.description=r),r}),pl(),VI(),pl(),ws(14,"mat-form-field",2)(15,"mat-label"),GC(16,"Instructions"),pl(),ws(17,"textarea",5),tm("ngModelChange",function(r){return KC(n.instructions,r)||(n.instructions=r),r}),pl(),VI(),ws(18,"mat-hint"),GC(19,"System prompt / instructions sent to the AI model"),pl()(),ws(20,"div",6),GC(21,"AI Configuration"),pl(),ws(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),GC(25,"AI Provider"),pl(),ws(26,"input",9),tm("ngModelChange",function(r){return KC(n.aiProvider,r)||(n.aiProvider=r),r}),pl(),VI(),pl(),ws(27,"mat-form-field",8)(28,"mat-label"),GC(29,"Model Name"),pl(),ws(30,"input",10),tm("ngModelChange",function(r){return KC(n.modelName,r)||(n.modelName=r),r}),pl(),VI(),pl()(),ws(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),GC(34,"Temperature"),pl(),ws(35,"input",11),tm("ngModelChange",function(r){return KC(n.temperature,r)||(n.temperature=r),r}),pl(),VI(),ws(36,"mat-hint"),GC(37,"Leave empty for model default"),pl()(),ws(38,"mat-form-field",8)(39,"mat-label"),GC(40,"Max Output Tokens"),pl(),ws(41,"input",12),tm("ngModelChange",function(r){return KC(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),pl(),VI(),ws(42,"mat-hint"),GC(43,"Leave empty for model default"),pl()()(),ws(44,"mat-form-field",2)(45,"mat-label"),GC(46,"OpenAI Assistant ID"),pl(),ws(47,"input",13),tm("ngModelChange",function(r){return KC(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),pl(),VI(),ws(48,"mat-hint"),GC(49,"If set, forces aiProvider to openai"),pl()(),ws(50,"div",6)(51,"span"),GC(52,"Integrations"),pl(),ws(53,"button",14),Rg("click",function(){return n.addIntegrationRow()}),ws(54,"mat-icon"),GC(55,"add"),pl()()(),Jw(56,ze,2,0,"p",15),rC(57,qe,12,2,"div",16,tC),Jw(59,Je,14,5)(60,Qe,2,0,"p",15),Jw(61,Xe,25,8),Jw(62,Ye,7,5,"div",17),Jw(63,$e,5,1,"div",18),pl()(),ws(64,"mat-dialog-actions",19)(65,"button",20),Rg("click",function(){return n.cancel()}),GC(66,"Cancel"),pl(),ws(67,"button",21),Rg("click",function(){return n.save()}),GC(68),pl()()),e&2&&(XE(),Yg(n.isEditMode?"Edit Agent":"Create Agent"),XE(6),em("ngModel",n.name),bg("readonly",n.isEditMode),UI(),XE(6),em("ngModel",n.description),UI(),XE(4),em("ngModel",n.instructions),UI(),XE(9),em("ngModel",n.aiProvider),UI(),XE(4),em("ngModel",n.modelName),UI(),XE(5),em("ngModel",n.temperature),UI(),XE(6),em("ngModel",n.maxOutputTokens),UI(),XE(6),em("ngModel",n.openaiAssistantId),UI(),XE(9),eC(n.integrationRows.length===0?56:-1),XE(),oC(n.integrationRows),XE(2),eC(n.isEditMode?59:60),XE(2),eC(n.isEditMode?-1:61),XE(),eC(n.isEditMode?62:-1),XE(),eC(n.errorMessage?63:-1),XE(2),bg("disabled",n.isSaving),XE(2),bg("disabled",n.isSaving),XE(),vl(" ",n.isSaving?"Saving...":"Save"," "));},dependencies:[ti,Qn,ei,Ye$1,fn,mn,Zn,gt,$t,Wt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Pt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.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-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.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-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.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}"],changeDetection:1})};var et=()=>[],tt=s=>({id:s});function nt(s,t){if(s&1&&(ws(0,"div",5),GC(1),pl()),s&2){let e=gC();XE(),Yg(e.errorMessage());}}function it(s,t){if(s&1){let e=lC();ws(0,"ds-entity-card",7),Rg("selected",function(a){If(e);let r=gC();return wf(r.onEdit(a))}),ml(1,8),ws(2,"button",9),Rg("click",function(a){return a.stopPropagation()}),ws(3,"mat-icon"),GC(4,"more_vert"),pl()(),yl(),pl();}if(s&2){let e=t.$implicit;gC();let n=CC(9);bg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,et)),XE(2),bg("matMenuTriggerFor",n)("matMenuTriggerData",oT(7,tt,e.id));}}function ot(s,t){if(s&1){let e=lC();ws(0,"button",10),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onEdit(a))}),ws(1,"mat-icon"),GC(2,"edit"),pl(),GC(3," Edit "),pl(),ws(4,"button",11),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onDelete(a))}),ws(5,"mat-icon"),GC(6,"delete"),pl(),GC(7," Delete "),pl();}}var Ve=class s{agentCrudApi=g(w);location=g(Mm);dialog=g(Re);agents=Gi([]);isLoading=Gi(false);errorMessage=Gi(null);agentItems=mT(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents();}loadAgents(){this.isLoading.set(true),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(false);},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents();});}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")});}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")});}buildBadges(t){return [t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-list"]],decls:11,vars:5,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-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","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(ws(0,"div",2)(1,"ds-entity-list",3),Rg("createRequested",function(){return n.onCreate()}),ws(2,"button",4),Rg("click",function(){return n.onBack()}),ws(3,"mat-icon"),GC(4,"chevron_left"),pl()()(),Jw(5,nt,2,1,"div",5),pl(),Eg(6,it,5,9,"ng-template",null,0,fT),ws(8,"mat-menu",null,1),Eg(10,ot,8,0,"ng-template",6),pl()),e&2){let a=CC(7);XE(),bg("items",n.agentItems())("loading",n.isLoading())("showCreate",true)("itemTemplate",a),XE(4),eC(n.errorMessage()?5:-1);}},dependencies:[Wn,ot$1,it$1,hr,Gn,yt,wt,In,De,Be,ya,En],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-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{Ve as AgentListComponent};
|
|
1
|
+
import {f}from'./chunk-DAk8SIkq.js';import {g,bm as Mm,R as Re,a as Gi,m as mT,e as xw,h as hr,j as Gn,k as ws,q as Rg,n as GC,o as pl,J as Jw,af as Eg,ag as fT,u as CC,X as XE,v as bg,y as eC,H as py,P,aF as R,Y as x,Z as z,_ as Ue,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,i as pr,bn as Xt,ai as tm,aj as KC,a3 as VI,t as rC,bo as tC,a8 as Yg,ak as em,a6 as UI,z as oC,a5 as vl,ac as gC,a9 as lC,aa as If,ab as wf,bp as ml,bq as yl,ah as rT,b4 as oT,A as Ug,b0 as Qg,a4 as nC,T as Tg,S as Sg}from'./main-2EYBZUJC.js';import {P as Pt}from'./chunk-BFY0pXEf.js';import {T as Tn,S as Sn,n as nt$1,a as ae,l as le,c as ce}from'./chunk-DR5zNU0n.js';import {W as Wn,o as ot$1,i as it$1,I as In,D as De,B as Be,y as ya,E as En}from'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';import {y as yt,w as wt,t as ti,Q as Qn,e as ei,Y as Ye$1,f as fn,m as mn,Z as Zn,g as gt,$ as $t,W as Wt,c as cn}from'./chunk-CZmNdEYy.js';var w=class s{http=g(py);projectState=g(P);getBaseUrl(){return `/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new R(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n);},a.onerror=()=>n.error(a.error),a.readAsDataURL(e);})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=x({token:s,factory:s.\u0275fac,providedIn:"root"})};function ze(s,t){s&1&&(ws(0,"p",15),GC(1,"No integrations defined \u2014 agent will have access to all tools."),pl());}function qe(s,t){if(s&1){let e=lC();ws(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),GC(3,"Integration"),pl(),ws(4,"input",23),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.integration,a)||(r.integration=a),wf(a)}),pl(),VI(),pl(),ws(5,"mat-form-field",24)(6,"mat-label"),GC(7,"Tools (comma-separated)"),pl(),ws(8,"input",25),tm("ngModelChange",function(a){let r=If(e).$implicit;return KC(r.tools,a)||(r.tools=a),wf(a)}),pl(),VI(),pl(),ws(9,"button",26),Rg("click",function(){let a=If(e).$index,r=gC();return wf(r.removeIntegrationRow(a))}),ws(10,"mat-icon"),GC(11,"delete"),pl()()();}if(s&2){let e=t.$implicit;XE(4),em("ngModel",e.integration),UI(),XE(4),em("ngModel",e.tools),UI();}}function He(s,t){if(s&1&&(ws(0,"p",30),GC(1),pl()),s&2){let e=gC(2);XE(),Yg(e.docUploadError);}}function Ge(s,t){s&1&&(ws(0,"p",15),GC(1,"No mandatory documents defined."),pl());}function Ze(s,t){if(s&1&&Sg(0,"option",35),s&2){let e=t.$implicit;bg("value","documents/"+e);}}function Ke(s,t){if(s&1){let e=lC();ws(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),GC(3,"Document path"),pl(),ws(4,"input",33),tm("ngModelChange",function(a){let r=If(e).$index,j=gC(2);return KC(j.mandatoryDocs[r],a)||(j.mandatoryDocs[r]=a),wf(a)}),pl(),VI(),ws(5,"datalist",34),rC(6,Ze,1,1,"option",35,nC),pl()(),ws(8,"button",26),Rg("click",function(){let a=If(e).$index,r=gC(2);return wf(r.removeDocRow(a))}),ws(9,"mat-icon"),GC(10,"delete"),pl()()();}if(s&2){let e=t.$index,n=gC(2);XE(4),em("ngModel",n.mandatoryDocs[e]),Tg("list","docs-list-"+e),UI(),XE(),bg("id","docs-list-"+e),XE(),oC(n.availableDocuments);}}function Je(s,t){if(s&1){let e=lC();ws(0,"div",6)(1,"span"),GC(2,"Mandatory Documents"),pl(),ws(3,"button",27),Rg("click",function(){If(e);let a=gC();return wf(a.addDocRow())}),ws(4,"mat-icon"),GC(5,"add"),pl()(),ws(6,"label",28)(7,"mat-icon"),GC(8,"upload_file"),pl(),ws(9,"input",29),Rg("change",function(a){If(e);let r=gC();return wf(r.onDocFileSelected(a))}),pl()()(),Jw(10,He,2,1,"p",30),Jw(11,Ge,2,0,"p",15),rC(12,Ke,11,3,"div",31,tC);}if(s&2){let e=gC();XE(6),Ug("uploading",e.isUploadingDoc),XE(3),bg("disabled",e.isUploadingDoc),XE(),eC(e.docUploadError?10:-1),XE(),eC(e.mandatoryDocs.length===0?11:-1),XE(),oC(e.mandatoryDocs);}}function Qe(s,t){s&1&&(ws(0,"p",15),GC(1,"\u{1F4A1} Documents can be added after the agent is created."),pl());}function Xe(s,t){if(s&1){let e=lC();ws(0,"div",6),GC(1,"Save to"),pl(),ws(2,"div",36)(3,"label",37)(4,"input",38),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(5,"div",39)(6,"div",40)(7,"span",41),GC(8,"\u{1F464}"),pl(),ws(9,"span",42),GC(10,"Project config"),pl()(),ws(11,"p",43),GC(12),pl()()(),ws(13,"label",37)(14,"input",44),tm("ngModelChange",function(a){If(e);let r=gC();return KC(r.location,a)||(r.location=a),wf(a)}),pl(),VI(),ws(15,"div",39)(16,"div",40)(17,"span",41),GC(18,"\u{1F4E6}"),pl(),ws(19,"span",42),GC(20,"Colocated"),pl()(),ws(21,"p",43),GC(22,"Next to coday.yaml in ./agents/ (committable)"),pl()()()(),ws(23,"p",15),GC(24,"Storage location is permanent and cannot be changed after creation."),pl();}if(s&2){let e=gC();XE(3),Ug("selected",e.location==="project"),XE(),em("ngModel",e.location),UI(),XE(8),Qg("~/.coday/projects/","{","name","}","/agents/ (not committed)"),XE(),Ug("selected",e.location==="colocated"),XE(),em("ngModel",e.location),UI();}}function Ye(s,t){if(s&1&&(ws(0,"div",17)(1,"span",6),GC(2,"Storage Location"),pl(),ws(3,"span",45),GC(4),pl(),ws(5,"p",15),GC(6,"Cannot be changed after creation."),pl()()),s&2){let e=gC();XE(3),Ug("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),XE(),vl(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ");}}function $e(s,t){if(s&1&&(ws(0,"div",18)(1,"mat-icon"),GC(2,"error"),pl(),ws(3,"span"),GC(4),pl()()),s&2){let e=gC();XE(4),Yg(e.errorMessage);}}var E=class s{agentCrudApi=g(w);agentApi=g(f);dialogRef=g(z);data=g(Ue);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=false;docUploadError="";location="project";isSaving=false;errorMessage="";isEditMode=false;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments();}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]});}addDocRow(){this.mandatoryDocs.push("");}removeDocRow(t){this.mandatoryDocs.splice(t,1);}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=true,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=false,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value="";},error:a=>{this.isUploadingDoc=false,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value="";}}));}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""});}removeIntegrationRow(t){this.integrationRows.splice(t,1);}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",false;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",false;if(!this.description.trim())return this.errorMessage="Description is required",false;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",false;return true}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return {name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=true,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=false,this.agentApi.clearAllCache(),this.dialogRef.close(true);},error:n=>{this.isSaving=false,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent";}});}cancel(){this.dialogRef.close(false);}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(ws(0,"h2",0),GC(1),pl(),ws(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),GC(6,"Name"),pl(),ws(7,"input",3),tm("ngModelChange",function(r){return KC(n.name,r)||(n.name=r),r}),pl(),VI(),ws(8,"mat-hint"),GC(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),pl()(),ws(10,"mat-form-field",2)(11,"mat-label"),GC(12,"Description"),pl(),ws(13,"textarea",4),tm("ngModelChange",function(r){return KC(n.description,r)||(n.description=r),r}),pl(),VI(),pl(),ws(14,"mat-form-field",2)(15,"mat-label"),GC(16,"Instructions"),pl(),ws(17,"textarea",5),tm("ngModelChange",function(r){return KC(n.instructions,r)||(n.instructions=r),r}),pl(),VI(),ws(18,"mat-hint"),GC(19,"System prompt / instructions sent to the AI model"),pl()(),ws(20,"div",6),GC(21,"AI Configuration"),pl(),ws(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),GC(25,"AI Provider"),pl(),ws(26,"input",9),tm("ngModelChange",function(r){return KC(n.aiProvider,r)||(n.aiProvider=r),r}),pl(),VI(),pl(),ws(27,"mat-form-field",8)(28,"mat-label"),GC(29,"Model Name"),pl(),ws(30,"input",10),tm("ngModelChange",function(r){return KC(n.modelName,r)||(n.modelName=r),r}),pl(),VI(),pl()(),ws(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),GC(34,"Temperature"),pl(),ws(35,"input",11),tm("ngModelChange",function(r){return KC(n.temperature,r)||(n.temperature=r),r}),pl(),VI(),ws(36,"mat-hint"),GC(37,"Leave empty for model default"),pl()(),ws(38,"mat-form-field",8)(39,"mat-label"),GC(40,"Max Output Tokens"),pl(),ws(41,"input",12),tm("ngModelChange",function(r){return KC(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),pl(),VI(),ws(42,"mat-hint"),GC(43,"Leave empty for model default"),pl()()(),ws(44,"mat-form-field",2)(45,"mat-label"),GC(46,"OpenAI Assistant ID"),pl(),ws(47,"input",13),tm("ngModelChange",function(r){return KC(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),pl(),VI(),ws(48,"mat-hint"),GC(49,"If set, forces aiProvider to openai"),pl()(),ws(50,"div",6)(51,"span"),GC(52,"Integrations"),pl(),ws(53,"button",14),Rg("click",function(){return n.addIntegrationRow()}),ws(54,"mat-icon"),GC(55,"add"),pl()()(),Jw(56,ze,2,0,"p",15),rC(57,qe,12,2,"div",16,tC),Jw(59,Je,14,5)(60,Qe,2,0,"p",15),Jw(61,Xe,25,8),Jw(62,Ye,7,5,"div",17),Jw(63,$e,5,1,"div",18),pl()(),ws(64,"mat-dialog-actions",19)(65,"button",20),Rg("click",function(){return n.cancel()}),GC(66,"Cancel"),pl(),ws(67,"button",21),Rg("click",function(){return n.save()}),GC(68),pl()()),e&2&&(XE(),Yg(n.isEditMode?"Edit Agent":"Create Agent"),XE(6),em("ngModel",n.name),bg("readonly",n.isEditMode),UI(),XE(6),em("ngModel",n.description),UI(),XE(4),em("ngModel",n.instructions),UI(),XE(9),em("ngModel",n.aiProvider),UI(),XE(4),em("ngModel",n.modelName),UI(),XE(5),em("ngModel",n.temperature),UI(),XE(6),em("ngModel",n.maxOutputTokens),UI(),XE(6),em("ngModel",n.openaiAssistantId),UI(),XE(9),eC(n.integrationRows.length===0?56:-1),XE(),oC(n.integrationRows),XE(2),eC(n.isEditMode?59:60),XE(2),eC(n.isEditMode?-1:61),XE(),eC(n.isEditMode?62:-1),XE(),eC(n.errorMessage?63:-1),XE(2),bg("disabled",n.isSaving),XE(2),bg("disabled",n.isSaving),XE(),vl(" ",n.isSaving?"Saving...":"Save"," "));},dependencies:[ti,Qn,ei,Ye$1,fn,mn,Zn,gt,$t,Wt,cn,zt,jt,Vt,Nt,hr,pr,Gn,Tn,Sn,nt$1,ae,le,ce,yt,wt,Pt,Xt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.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-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.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-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.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}"],changeDetection:1})};var et=()=>[],tt=s=>({id:s});function nt(s,t){if(s&1&&(ws(0,"div",5),GC(1),pl()),s&2){let e=gC();XE(),Yg(e.errorMessage());}}function it(s,t){if(s&1){let e=lC();ws(0,"ds-entity-card",7),Rg("selected",function(a){If(e);let r=gC();return wf(r.onEdit(a))}),ml(1,8),ws(2,"button",9),Rg("click",function(a){return a.stopPropagation()}),ws(3,"mat-icon"),GC(4,"more_vert"),pl()(),yl(),pl();}if(s&2){let e=t.$implicit;gC();let n=CC(9);bg("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??rT(6,et)),XE(2),bg("matMenuTriggerFor",n)("matMenuTriggerData",oT(7,tt,e.id));}}function ot(s,t){if(s&1){let e=lC();ws(0,"button",10),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onEdit(a))}),ws(1,"mat-icon"),GC(2,"edit"),pl(),GC(3," Edit "),pl(),ws(4,"button",11),Rg("click",function(){let a=If(e).id,r=gC();return wf(r.onDelete(a))}),ws(5,"mat-icon"),GC(6,"delete"),pl(),GC(7," Delete "),pl();}}var Ve=class s{agentCrudApi=g(w);location=g(Mm);dialog=g(Re);agents=Gi([]);isLoading=Gi(false);errorMessage=Gi(null);agentItems=mT(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents();}loadAgents(){this.isLoading.set(true),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(false);},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(false);}});}onBack(){this.location.back();}onCreate(){this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents();});}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(E,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents();});},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")});}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")});}buildBadges(t){return [t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=xw({type:s,selectors:[["app-agent-list"]],decls:11,vars:5,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","loading","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-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","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(ws(0,"div",2)(1,"ds-entity-list",3),Rg("createRequested",function(){return n.onCreate()}),ws(2,"button",4),Rg("click",function(){return n.onBack()}),ws(3,"mat-icon"),GC(4,"chevron_left"),pl()()(),Jw(5,nt,2,1,"div",5),pl(),Eg(6,it,5,9,"ng-template",null,0,fT),ws(8,"mat-menu",null,1),Eg(10,ot,8,0,"ng-template",6),pl()),e&2){let a=CC(7);XE(),bg("items",n.agentItems())("loading",n.isLoading())("showCreate",true)("itemTemplate",a),XE(4),eC(n.errorMessage()?5:-1);}},dependencies:[Wn,ot$1,it$1,hr,Gn,yt,wt,In,De,Be,ya,En],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-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{Ve as AgentListComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as Qe}from'./chunk-
|
|
1
|
+
import {b as Qe}from'./chunk-BPkyqr-f.js';import {D as D$1,i as y}from'./chunk-CZmNdEYy.js';import {g,H as py,bU as Od,Y as x,aL as wo,aM as Zn,aO as wt,az as Xt,bw as St,bs as Tl,aW as C,aS as K,al as vt,aX as D,bx as on,by as um,aT as Ut,e as xw,bz as Oi,aC as Tu,a_ as QT,bA as yC,k as ws,q as Rg,S as Sg,o as pl,J as Jw,bB as vC,u as CC,v as bg,X as XE,A as Ug,T as Tg,y as eC,b5 as nT,bC as Si,c8 as KT,c0 as xg,b$ as kC,D as Pg,E as EC,I as IC,c9 as kf}from'./main-2EYBZUJC.js';var ae=["switch"],ie=["*"];function ne(a,s){a&1&&(ws(0,"span",11),kf(),ws(1,"svg",13),Sg(2,"path",14),pl(),ws(3,"svg",15),Sg(4,"path",16),pl()());}var ce=new C("mat-slide-toggle-default-options",{providedIn:"root",factory:()=>({disableToggleValue:false,hideIcon:false,disabledInteractive:false})}),b=class{source;checked;constructor(s,e){this.source=s,this.checked=e;}},se=(()=>{class a{_elementRef=g(Xt);_focusMonitor=g(St);_changeDetectorRef=g(Tl);defaults=g(ce);_onChange=e=>{};_onTouched=()=>{};_validatorOnChange=()=>{};_uniqueId;_checked=false;_createChangeEvent(e){return new b(this,e)}_labelId;get buttonId(){return `${this.id||this._uniqueId}-button`}_switchElement;focus(){this._switchElement.nativeElement.focus();}_noopAnimations=K();_focused=false;name=null;id;labelPosition="after";ariaLabel=null;ariaLabelledby=null;ariaDescribedby;required=false;color;disabled=false;disableRipple=false;tabIndex=0;get checked(){return this._checked}set checked(e){this._checked=e,this._changeDetectorRef.markForCheck();}hideIcon;disabledInteractive;change=new vt;toggleChange=new vt;get inputId(){return `${this.id||this._uniqueId}-input`}constructor(){g(D).load(on);let e=g(new um("tabindex"),{optional:true}),i=this.defaults;this.tabIndex=e==null?0:parseInt(e)||0,this.color=i.color||"accent",this.id=this._uniqueId=g(Ut).getId("mat-mdc-slide-toggle-"),this.hideIcon=i.hideIcon??false,this.disabledInteractive=i.disabledInteractive??false,this._labelId=this._uniqueId+"-label";}ngAfterContentInit(){this._focusMonitor.monitor(this._elementRef,true).subscribe(e=>{e==="keyboard"||e==="program"?(this._focused=true,this._changeDetectorRef.markForCheck()):e||Promise.resolve().then(()=>{this._focused=false,this._onTouched(),this._changeDetectorRef.markForCheck();});});}ngOnChanges(e){e.required&&this._validatorOnChange();}ngOnDestroy(){this._focusMonitor.stopMonitoring(this._elementRef);}writeValue(e){this.checked=!!e;}registerOnChange(e){this._onChange=e;}registerOnTouched(e){this._onTouched=e;}validate(e){return this.required&&e.value!==true?{required:true}:null}registerOnValidatorChange(e){this._validatorOnChange=e;}setDisabledState(e){this.disabled=e,this._changeDetectorRef.markForCheck();}toggle(){this.checked=!this.checked,this._onChange(this.checked);}_emitChangeEvent(){this._onChange(this.checked),this.change.emit(this._createChangeEvent(this.checked));}_handleClick(){this.disabled||(this.toggleChange.emit(),this.defaults.disableToggleValue||(this.checked=!this.checked,this._onChange(this.checked),this.change.emit(new b(this,this.checked))));}_getAriaLabelledBy(){return this.ariaLabelledby?this.ariaLabelledby:this.ariaLabel?null:this._labelId}static \u0275fac=function(i){return new(i||a)};static \u0275cmp=xw({type:a,selectors:[["mat-slide-toggle"]],viewQuery:function(i,t){if(i&1&&Pg(ae,5),i&2){let r;EC(r=IC())&&(t._switchElement=r.first);}},hostAttrs:[1,"mat-mdc-slide-toggle"],hostVars:13,hostBindings:function(i,t){i&2&&(xg("id",t.id),Tg("tabindex",null)("aria-label",null)("name",null)("aria-labelledby",null),kC(t.color?"mat-"+t.color:""),Ug("mat-mdc-slide-toggle-focused",t._focused)("mat-mdc-slide-toggle-checked",t.checked)("_mat-animation-noopable",t._noopAnimations));},inputs:{name:"name",id:"id",labelPosition:"labelPosition",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],required:[2,"required","required",QT],color:"color",disabled:[2,"disabled","disabled",QT],disableRipple:[2,"disableRipple","disableRipple",QT],tabIndex:[2,"tabIndex","tabIndex",e=>e==null?0:KT(e)],checked:[2,"checked","checked",QT],hideIcon:[2,"hideIcon","hideIcon",QT],disabledInteractive:[2,"disabledInteractive","disabledInteractive",QT]},outputs:{change:"change",toggleChange:"toggleChange"},exportAs:["matSlideToggle"],features:[nT([{provide:D$1,useExisting:Si(()=>a),multi:true},{provide:y,useExisting:a,multi:true}]),Tu],ngContentSelectors:ie,decls:14,vars:27,consts:[["switch",""],["mat-internal-form-field","",3,"labelPosition"],["role","switch","type","button",1,"mdc-switch",3,"click","tabIndex","disabled"],[1,"mat-mdc-slide-toggle-touch-target"],[1,"mdc-switch__track"],[1,"mdc-switch__handle-track"],[1,"mdc-switch__handle"],[1,"mdc-switch__shadow"],[1,"mdc-elevation-overlay"],[1,"mdc-switch__ripple"],["mat-ripple","",1,"mat-mdc-slide-toggle-ripple","mat-focus-indicator",3,"matRippleTrigger","matRippleDisabled","matRippleCentered"],[1,"mdc-switch__icons"],[1,"mdc-label",3,"click","for"],["viewBox","0 0 24 24","aria-hidden","true",1,"mdc-switch__icon","mdc-switch__icon--on"],["d","M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z"],["viewBox","0 0 24 24","aria-hidden","true",1,"mdc-switch__icon","mdc-switch__icon--off"],["d","M20 13H4v-2h16v2z"]],template:function(i,t){if(i&1&&(yC(),ws(0,"div",1)(1,"button",2,0),Rg("click",function(){return t._handleClick()}),Sg(3,"div",3)(4,"span",4),ws(5,"span",5)(6,"span",6)(7,"span",7),Sg(8,"span",8),pl(),ws(9,"span",9),Sg(10,"span",10),pl(),Jw(11,ne,5,0,"span",11),pl()()(),ws(12,"label",12),Rg("click",function(ee){return ee.stopPropagation()}),vC(13),pl()()),i&2){let r=CC(2);bg("labelPosition",t.labelPosition),XE(),Ug("mdc-switch--selected",t.checked)("mdc-switch--unselected",!t.checked)("mdc-switch--checked",t.checked)("mdc-switch--disabled",t.disabled)("mat-mdc-slide-toggle-disabled-interactive",t.disabledInteractive),bg("tabIndex",t.disabled&&!t.disabledInteractive?-1:t.tabIndex)("disabled",t.disabled&&!t.disabledInteractive),Tg("id",t.buttonId)("name",t.name)("aria-label",t.ariaLabel)("aria-labelledby",t._getAriaLabelledBy())("aria-describedby",t.ariaDescribedby)("aria-required",t.required||null)("aria-checked",t.checked)("aria-disabled",t.disabled&&t.disabledInteractive?"true":null),XE(9),bg("matRippleTrigger",r)("matRippleDisabled",t.disableRipple||t.disabled)("matRippleCentered",true),XE(),eC(t.hideIcon?-1:11),XE(),bg("for",t.buttonId),Tg("id",t._labelId);}},dependencies:[Oi,Qe],styles:[`.mdc-switch {
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: none;
|
|
4
4
|
border: none;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {v}from'./chunk-C6x9SBjG.js';import {R,q,J}from'./chunk-CCQAu0MS.js';import {g,ao as V,G,C as Ce$1,a as Gi,F,m as mT,cd as Hf,b as U,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,a9 as lC,t as rC,a4 as nC,a3 as VI,S as Sg,ac as gC,v as bg,a6 as UI,z as oC,a5 as vl,cH as Kw,aa as If,ab as wf,b$ as kC,T as Tg}from'./main-2GG5NZ4C.js';import'./chunk-C-VoWDOg.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-D_aTK145.js';import'./chunk-C0DMx9CU.js';import'./chunk-G_l8BMaJ.js';import'./chunk-BjBW1d-u.js';import'./chunk-Bbb2Oy9I.js';function se(i,t){i&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ce(i,t){if(i&1&&(ws(0,"label",23),Sg(1,"input",24),VI(),ws(2,"span"),GC(3),pl()()),i&2){let e=t.$implicit,o=gC(3);XE(),bg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),UI(),XE(2),Yg(e.label);}}function de(i,t){if(i&1&&(ws(0,"fieldset",8)(1,"legend",22),GC(2,"Configuration scope"),pl(),rC(3,ce,4,4,"label",23,Kw().trackByScope,true),pl()),i&2){let e=gC(2);bg("disabled",e.isEditMode()),XE(3),oC(e.scopeOptions);}}function ue(i,t){if(i&1&&(ws(0,"option",13),GC(1),pl()),i&2){let e=t.$implicit,o=gC(2);bg("value",e),XE(),Yg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&GC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(ws(0,"span",11),GC(1,"*"),pl());}function me(i,t){if(i&1&&(ws(0,"p",28),GC(1),pl()),i&2){let e=gC(2).$implicit;bg("id","as-hint-"+e.key),XE(),Yg(e.hint);}}function ge(i,t){if(i&1&&(Sg(0,"input",27),VI(),Jw(1,me,2,2,"p",28)),i&2){let e=gC().$implicit;kC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),bg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Tg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI(),XE(),eC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(ws(0,"div",9)(1,"label",26),GC(2),Jw(3,he,2,0,"span",11),pl(),Jw(4,ge,2,9),pl()),i&2){let e,o=t.$implicit,l=gC(3);XE(),bg("for","as-cred-"+o.key),XE(),vl(" ",o.label," "),XE(),eC(o.required?3:-1),XE(),eC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(ws(0,"fieldset",18)(1,"legend",22),GC(2,"Credentials"),pl(),ws(3,"p",25),GC(4," Values are stored encrypted and masked on read. "),Jw(5,pe,1,0),pl(),rC(6,Ce,5,4,"div",9,Kw().trackByField,true),pl()),i&2){let e=gC(2);XE(5),eC(e.isEditMode()?5:-1),XE(),oC(e.credentialFields());}}function ye(i,t){if(i&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let l=gC();return wf(l.submit())}),Jw(1,de,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),GC(4,"Auth type "),ws(5,"span",11),GC(6,"*"),pl()(),ws(7,"select",12),rC(8,ue,2,2,"option",13,nC),pl(),VI(),pl(),ws(10,"div",9)(11,"label",14),GC(12,"Name "),ws(13,"span",11),GC(14,"*"),pl()(),Sg(15,"input",15),VI(),pl(),ws(16,"div",9)(17,"label",16),GC(18,"Description"),pl(),Sg(19,"input",17),VI(),pl(),Jw(20,fe,8,1,"fieldset",18),ws(21,"div",19)(22,"button",20),GC(23),pl(),ws(24,"button",21),Rg("click",function(){If(e);let l=gC();return wf(l.cancel())}),GC(25,"Cancel"),pl()()();}if(i&2){let e=gC();bg("formGroup",e.form),XE(),eC(e.isPlatformMode?-1:1),XE(6),bg("formControl",e.authTypeControl),UI(),XE(),oC(e.authTypeOptions),XE(7),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(),eC(e.credentialFields().length>0?20:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(V);router=g(G);destroyRef=g(Ce$1);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return o.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Auth Settings "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,se,2,0,"p",5)(9,ye,26,8,"form",6),pl()),e&2&&(XE(7),Yg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),eC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
1
|
+
import {v}from'./chunk-AB2V4DzP.js';import {R,q,J}from'./chunk-B_gHVcU6.js';import {g,ao as V,G,C as Ce$1,a as Gi,F,m as mT,cd as Hf,b as U,x,w,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,a9 as lC,t as rC,a4 as nC,a3 as VI,S as Sg,ac as gC,v as bg,a6 as UI,z as oC,a5 as vl,cH as Kw,aa as If,ab as wf,b$ as kC,T as Tg}from'./main-2EYBZUJC.js';import'./chunk-kFOHrPbJ.js';import {k as _t,b as _e$1,o as z,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,A as At,m as mn,Z as Zn,l as Xn,C as Cn,E as En}from'./chunk-CZmNdEYy.js';import'./chunk-BWcVMw4T.js';import'./chunk-DqzTsn7a.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';function se(i,t){i&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function ce(i,t){if(i&1&&(ws(0,"label",23),Sg(1,"input",24),VI(),ws(2,"span"),GC(3),pl()()),i&2){let e=t.$implicit,o=gC(3);XE(),bg("formControl",o.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!o.isAdmin()),UI(),XE(2),Yg(e.label);}}function de(i,t){if(i&1&&(ws(0,"fieldset",8)(1,"legend",22),GC(2,"Configuration scope"),pl(),rC(3,ce,4,4,"label",23,Kw().trackByScope,true),pl()),i&2){let e=gC(2);bg("disabled",e.isEditMode()),XE(3),oC(e.scopeOptions);}}function ue(i,t){if(i&1&&(ws(0,"option",13),GC(1),pl()),i&2){let e=t.$implicit,o=gC(2);bg("value",e),XE(),Yg(o.authTypeLabel[e]);}}function pe(i,t){i&1&&GC(0," Leave a field unchanged to keep the stored credential. ");}function he(i,t){i&1&&(ws(0,"span",11),GC(1,"*"),pl());}function me(i,t){if(i&1&&(ws(0,"p",28),GC(1),pl()),i&2){let e=gC(2).$implicit;bg("id","as-hint-"+e.key),XE(),Yg(e.hint);}}function ge(i,t){if(i&1&&(Sg(0,"input",27),VI(),Jw(1,me,2,2,"p",28)),i&2){let e=gC().$implicit;kC("auth-setting-form__input"+(e.secret?" auth-setting-form__input--secret":"")),bg("id","as-cred-"+e.key)("type",e.secret?"password":"text")("placeholder",e.placeholder)("formControl",t)("autocomplete",e.secret?"new-password":"off"),Tg("aria-describedby",e.hint?"as-hint-"+e.key:null),UI(),XE(),eC(e.hint?1:-1);}}function Ce(i,t){if(i&1&&(ws(0,"div",9)(1,"label",26),GC(2),Jw(3,he,2,0,"span",11),pl(),Jw(4,ge,2,9),pl()),i&2){let e,o=t.$implicit,l=gC(3);XE(),bg("for","as-cred-"+o.key),XE(),vl(" ",o.label," "),XE(),eC(o.required?3:-1),XE(),eC((e=l.controlForField(o.key))?4:-1,e);}}function fe(i,t){if(i&1&&(ws(0,"fieldset",18)(1,"legend",22),GC(2,"Credentials"),pl(),ws(3,"p",25),GC(4," Values are stored encrypted and masked on read. "),Jw(5,pe,1,0),pl(),rC(6,Ce,5,4,"div",9,Kw().trackByField,true),pl()),i&2){let e=gC(2);XE(5),eC(e.isEditMode()?5:-1),XE(),oC(e.credentialFields());}}function ye(i,t){if(i&1){let e=lC();ws(0,"form",7),Rg("ngSubmit",function(){If(e);let l=gC();return wf(l.submit())}),Jw(1,de,5,1,"fieldset",8),ws(2,"div",9)(3,"label",10),GC(4,"Auth type "),ws(5,"span",11),GC(6,"*"),pl()(),ws(7,"select",12),rC(8,ue,2,2,"option",13,nC),pl(),VI(),pl(),ws(10,"div",9)(11,"label",14),GC(12,"Name "),ws(13,"span",11),GC(14,"*"),pl()(),Sg(15,"input",15),VI(),pl(),ws(16,"div",9)(17,"label",16),GC(18,"Description"),pl(),Sg(19,"input",17),VI(),pl(),Jw(20,fe,8,1,"fieldset",18),ws(21,"div",19)(22,"button",20),GC(23),pl(),ws(24,"button",21),Rg("click",function(){If(e);let l=gC();return wf(l.cancel())}),GC(25,"Cancel"),pl()()();}if(i&2){let e=gC();bg("formGroup",e.form),XE(),eC(e.isPlatformMode?-1:1),XE(6),bg("formControl",e.authTypeControl),UI(),XE(),oC(e.authTypeOptions),XE(7),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(),eC(e.credentialFields().length>0?20:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," ");}}var _e=new Set(["namespace","userOnNs","userGlobal"]),P=Object.freeze({platform:"Platform (read-only)",namespace:"Namespace configuration",userOnNs:"Personal \u2014 this namespace only",userGlobal:"Personal \u2014 all namespaces"}),Se={ApiKeyAuthSetting:[{key:"apiKey",label:"API Key",placeholder:"sk-\u2026",secret:true,required:false}],BasicAuthAuthSetting:[{key:"username",label:"Username",placeholder:"user@example.com",secret:false,required:false},{key:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",secret:true,required:false}],BearerTokenAuthSetting:[{key:"token",label:"Bearer token",placeholder:"eyJ\u2026",secret:true,required:false}],OAuthDiscoverableAuthSetting:[{key:"discoveryUrl",label:"Discovery URL",placeholder:"https://\u2026/.well-known/openid-configuration",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthCustomAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthRegisteredAuthSetting:[{key:"authorizationUrl",label:"Authorization URL",placeholder:"https://\u2026/authorize",secret:false,required:false},{key:"tokenUrl",label:"Token URL",placeholder:"https://\u2026/token",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Space-separated OAuth scopes to request (e.g. openid profile email). Check your provider's documentation for the exact values.",secret:false,required:false}],OAuthMcpDiscoverableAuthSetting:[{key:"resourceUrl",label:"Resource URL",placeholder:"https://mcp.example.com",hint:"Use the base URL exactly as documented by your provider \u2014 do not append a path suffix. Examples: https://mcp.hubspot.com (HubSpot), https://mcp.atlassian.com/v1/mcp (Atlassian).",secret:false,required:false},{key:"clientId",label:"Client ID",placeholder:"",hint:"Leave empty to let the server register an OAuth client automatically (RFC 7591 dynamic registration). Fill in only if you have a pre-registered client ID from your provider.",secret:false,required:false},{key:"clientSecret",label:"Client secret",placeholder:"",secret:true,required:false},{key:"scopes",label:"Scopes",placeholder:"",hint:"Leave empty in most cases \u2014 the MCP server declares the required scopes itself. Fill in only if your provider explicitly requires client-declared scopes.",secret:false,required:false}]},le=class i{route=g(V);router=g(G);destroyRef=g(Ce$1);state=g(R);namespaceRole=g(v);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?Gi(true):F(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:false});authTypeOptions=q;authTypeLabel=J;scopeOptions=[{value:"namespace",label:P.namespace},{value:"userOnNs",label:P.userOnNs},{value:"userGlobal",label:P.userGlobal}];nameControl=new _t("",{nonNullable:true,validators:[_e$1.required,_e$1.minLength(1)]});descriptionControl=new _t(null);authTypeControl=new _t("ApiKeyAuthSetting",{nonNullable:true,validators:[_e$1.required]});scopeControl=new _t("namespace",{nonNullable:true});form=new z({name:this.nameControl,description:this.descriptionControl,authType:this.authTypeControl,scope:this.scopeControl});apiKeyControl=new _t("",{nonNullable:true});usernameControl=new _t("",{nonNullable:true});passwordControl=new _t("",{nonNullable:true});tokenControl=new _t("",{nonNullable:true});discoveryUrlControl=new _t("",{nonNullable:true});authorizationUrlControl=new _t("",{nonNullable:true});tokenUrlControl=new _t("",{nonNullable:true});clientIdControl=new _t("",{nonNullable:true});clientSecretControl=new _t("",{nonNullable:true});scopesControl=new _t("",{nonNullable:true});resourceUrlControl=new _t("",{nonNullable:true});selectedAuthType=F(this.authTypeControl.valueChanges,{initialValue:this.authTypeControl.value});credentialFields=mT(()=>Se[this.selectedAuthType()]);isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);existingConfig=null;initialCredentials={};constructor(){this.isPlatformMode||Hf(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs");});}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let t=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,o=t.get("authSettingId");if(o){this.isEditMode.set(true),this.scopeControl.disable(),this.authTypeControl.disable(),this.loadConfig(o);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let l=this.parseScope(e.get("scope"));this.scopeControl.setValue(l);let v=e.get("template");v&&this.hydrateFromTemplate(v);}parseScope(t){return t&&_e.has(t)?t:"namespace"}deriveScopeFromConfig(t){return !t.userId&&!t.namespaceId?"platform":t.userId?t.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),console.warn(`[AuthSettingForm] Could not load auth setting '${t}' \u2014 navigating back`),this.navigateBack();}});}hydrateFromTemplate(t){this.isLoading.set(true),this.state.getById(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.authTypeControl.setValue(e.authType),this.clearCredentialControls(),this.initialCredentials={},this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});},error:e=>{console.warn(`[AuthSettingForm] Could not hydrate from template ${t}:`,e),this.isLoading.set(false),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:true});}});}applyConfigToForm(t){switch(this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.authTypeControl.setValue(t.authType),this.clearCredentialControls(),this.initialCredentials={},t.authType){case "ApiKeyAuthSetting":{let e=t.apiKey??"";this.apiKeyControl.setValue(e),this.initialCredentials.apiKey=e;break}case "BasicAuthAuthSetting":{let e=t,o=e.username??"",l=e.password??"";this.usernameControl.setValue(o),this.passwordControl.setValue(l),this.initialCredentials.username=o,this.initialCredentials.password=l;break}case "BearerTokenAuthSetting":{let e=t.token??"";this.tokenControl.setValue(e),this.initialCredentials.token=e;break}case "OAuthDiscoverableAuthSetting":{let e=t;this.discoveryUrlControl.setValue(e.discoveryUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.discoveryUrl=e.discoveryUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthCustomAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthRegisteredAuthSetting":{let e=t;this.authorizationUrlControl.setValue(e.authorizationUrl??""),this.tokenUrlControl.setValue(e.tokenUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.authorizationUrl=e.authorizationUrl??"",this.initialCredentials.tokenUrl=e.tokenUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}case "OAuthMcpDiscoverableAuthSetting":{let e=t;this.resourceUrlControl.setValue(e.resourceUrl??""),this.clientIdControl.setValue(e.clientId??""),this.clientSecretControl.setValue(e.clientSecret??""),this.scopesControl.setValue(e.scopes??""),this.initialCredentials.resourceUrl=e.resourceUrl??"",this.initialCredentials.clientId=e.clientId??"",this.initialCredentials.clientSecret=e.clientSecret??"",this.initialCredentials.scopes=e.scopes??"";break}}}clearCredentialControls(){this.apiKeyControl.setValue(""),this.usernameControl.setValue(""),this.passwordControl.setValue(""),this.tokenControl.setValue(""),this.discoveryUrlControl.setValue(""),this.authorizationUrlControl.setValue(""),this.tokenUrlControl.setValue(""),this.clientIdControl.setValue(""),this.clientSecretControl.setValue(""),this.scopesControl.setValue(""),this.resourceUrlControl.setValue("");}credentialValue(t,e){if(!(this.isEditMode()&&e===this.initialCredentials[t]))return e||void 0}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(true);let t=this.nameControl.value.trim(),e=this.descriptionControl.value?.trim()||void 0,o=this.authTypeControl.value,l=this.form.getRawValue().scope,v=this.isPlatformMode?null:this.namespaceId??null,w=this.buildTypedPayload(o,t,e);(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,this.existingConfig):this.state.create(w,l,v)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}buildTypedPayload(t,e,o){let l={name:e,description:o};switch(t){case "ApiKeyAuthSetting":return x(w({},l),{authType:"ApiKeyAuthSetting",apiKey:this.credentialValue("apiKey",this.apiKeyControl.value)});case "BasicAuthAuthSetting":return x(w({},l),{authType:"BasicAuthAuthSetting",username:this.credentialValue("username",this.usernameControl.value),password:this.credentialValue("password",this.passwordControl.value)});case "BearerTokenAuthSetting":return x(w({},l),{authType:"BearerTokenAuthSetting",token:this.credentialValue("token",this.tokenControl.value)});case "OAuthDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthDiscoverableAuthSetting",discoveryUrl:this.credentialValue("discoveryUrl",this.discoveryUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthCustomAuthSetting":return x(w({},l),{authType:"OAuthCustomAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthRegisteredAuthSetting":return x(w({},l),{authType:"OAuthRegisteredAuthSetting",authorizationUrl:this.credentialValue("authorizationUrl",this.authorizationUrlControl.value),tokenUrl:this.credentialValue("tokenUrl",this.tokenUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)});case "OAuthMcpDiscoverableAuthSetting":return x(w({},l),{authType:"OAuthMcpDiscoverableAuthSetting",resourceUrl:this.credentialValue("resourceUrl",this.resourceUrlControl.value),clientId:this.credentialValue("clientId",this.clientIdControl.value),clientSecret:this.credentialValue("clientSecret",this.clientSecretControl.value),scopes:this.credentialValue("scopes",this.scopesControl.value)})}}controlForField(t){return {apiKey:this.apiKeyControl,username:this.usernameControl,password:this.passwordControl,token:this.tokenControl,discoveryUrl:this.discoveryUrlControl,authorizationUrl:this.authorizationUrlControl,tokenUrl:this.tokenUrlControl,clientId:this.clientIdControl,clientSecret:this.clientSecretControl,scopes:this.scopesControl,resourceUrl:this.resourceUrlControl}[t]}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","auth-settings"]):this.router.navigate(["/agentos",this.namespaceId,"auth-settings"]);}trackByScope(t,e){return e.value}trackByField(t,e){return e.key}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=xw({type:i,selectors:[["agentos-auth-setting-form"]],decls:10,vars:2,consts:[[1,"auth-setting-form"],[1,"auth-setting-form__header"],["type","button","title","Back to auth settings",1,"auth-setting-form__back",3,"click"],[1,"auth-setting-form__back-icon"],[1,"auth-setting-form__title"],[1,"auth-setting-form__loading"],[1,"auth-setting-form__form",3,"formGroup"],[1,"auth-setting-form__form",3,"ngSubmit","formGroup"],[1,"auth-setting-form__scope",3,"disabled"],[1,"auth-setting-form__field"],["for","as-auth-type",1,"auth-setting-form__label"],["aria-hidden","true"],["id","as-auth-type",1,"auth-setting-form__select",3,"formControl"],[3,"value"],["for","as-name",1,"auth-setting-form__label"],["id","as-name","type","text","placeholder","e.g. GitHub OAuth App","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],["for","as-description",1,"auth-setting-form__label"],["id","as-description","type","text","placeholder","Optional \u2014 short description of this auth setting","autocomplete","off",1,"auth-setting-form__input",3,"formControl"],[1,"auth-setting-form__credentials"],[1,"auth-setting-form__actions"],["type","submit",1,"auth-setting-form__btn","auth-setting-form__btn--primary",3,"disabled"],["type","button",1,"auth-setting-form__btn",3,"click"],[1,"auth-setting-form__label"],[1,"auth-setting-form__scope-option"],["type","radio",3,"formControl","value","disabled"],[1,"auth-setting-form__credentials-hint"],[1,"auth-setting-form__label",3,"for"],[3,"id","type","placeholder","formControl","autocomplete"],[1,"auth-setting-form__field-hint",3,"id"]],template:function(e,o){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return o.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Auth Settings "),pl(),ws(6,"h1",4),GC(7),pl()(),Jw(8,se,2,0,"p",5)(9,ye,26,8,"form",6),pl()),e&2&&(XE(7),Yg(o.isEditMode()?"Edit auth setting":"New auth setting"),XE(),eC(o.isLoading()?8:9));},dependencies:[ni,Jn,Qn,ei,Ye,At,mn,Zn,Xn,Cn,En],styles:[".auth-setting-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem;padding:1.5rem;max-width:640px}.auth-setting-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;background:none;border:none;cursor:pointer;color:var(--color-text-secondary);font-size:.85rem;padding:0}.auth-setting-form__back[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.auth-setting-form__back-icon[_ngcontent-%COMP%]{font-size:1rem}.auth-setting-form__title[_ngcontent-%COMP%]{font-size:1.4rem;font-weight:600;color:var(--color-text);margin:0}.auth-setting-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem}.auth-setting-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.auth-setting-form__scope[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;display:flex;flex-direction:column;gap:.5rem}.auth-setting-form__scope[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;font-size:.9rem;color:var(--color-text)}.auth-setting-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.auth-setting-form__field-hint[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);margin:0;line-height:1.4}.auth-setting-form__label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:500;color:var(--color-text-secondary)}.auth-setting-form__input[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;transition:border-color .15s ease;width:100%;box-sizing:border-box}.auth-setting-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.auth-setting-form__select[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem .75rem;background:var(--color-bg-secondary);color:var(--color-text);font-size:.9rem;outline:none;cursor:pointer;transition:border-color .15s ease}.auth-setting-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.auth-setting-form__credentials[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem 1rem;display:flex;flex-direction:column;gap:.75rem;margin:0}.auth-setting-form__credentials[_ngcontent-%COMP%] legend[_ngcontent-%COMP%]{padding:0 .25rem}.auth-setting-form__credentials-hint[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);margin:0}.auth-setting-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center;padding-top:.5rem}.auth-setting-form__btn[_ngcontent-%COMP%]{border:1px solid var(--color-border);border-radius:6px;padding:.5rem 1.25rem;cursor:pointer;font-size:.9rem;font-weight:500;background:var(--color-bg-secondary);color:var(--color-text);transition:background .15s ease}.auth-setting-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover)}.auth-setting-form__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.auth-setting-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-on-primary, #fff);border-color:var(--color-primary)}.auth-setting-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, var(--color-primary))}"]})};
|
|
2
2
|
export{le as AuthSettingFormComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {N}from'./chunk-DnMJl9Ao.js';import {g,ao as V,G,C as Ce$1,da as M,dn as B,a as Gi,dp as J,d8 as F,F as F$1,m as mT,dq as Ae$1,b as U,a7 as ya,W as br,Q as By,r as re,x,w,e as xw,s as si,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,a8 as Yg,y as eC,ac as gC,v as bg,a9 as lC,S as Sg,a3 as VI,a6 as UI,T as Tg,a5 as vl,t as rC,z as oC,bo as tC,aa as If,ab as wf,b0 as Qg}from'./main-2EYBZUJC.js';import'./chunk-kFOHrPbJ.js';import {o as z,k as _t,b as _e,n as ni,J as Jn,Q as Qn,e as ei,Y as Ye,f as fn,a as wt,A as At,Z as Zn,l as Xn,$ as $t,W as Wt,C as Cn,E as En}from'./chunk-CZmNdEYy.js';import'./chunk-BWcVMw4T.js';import'./chunk-DqzTsn7a.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';var Ce=(o,t)=>t.config.id,be=(o,t)=>t.type;function xe(o,t){if(o&1&&(ws(0,"a",5),GC(1,"View resolved definition \u2192"),pl()),o&2){let e=gC();bg("routerLink",e.inspectRoute());}}function he(o,t){o&1&&(ws(0,"span",6),GC(1,"Platform level"),pl());}function ve(o,t){o&1&&(ws(0,"p",7),GC(1,"Loading\u2026"),pl());}function ye(o,t){if(o&1&&(ws(0,"span",49),GC(1),pl()),o&2){let e=gC().$implicit;XE(),Yg(e.config.integrationType);}}function we(o,t){if(o&1&&(Sg(0,"input",50),VI()),o&2){let e=gC().$implicit;bg("formControl",e.toolsControl),UI();}}function Se(o,t){if(o&1){let e=lC();ws(0,"div",45)(1,"label",46)(2,"input",47),Rg("change",function(){let c=If(e).$implicit,g=gC(3);return wf(g.toggleIntegration(c))}),pl(),ws(3,"span",48),GC(4),pl(),Jw(5,ye,2,1,"span",49),pl(),Jw(6,we,1,1,"input",50),pl();}if(o&2){let e=t.$implicit;XE(2),bg("checked",e.enabled()),XE(2),Yg(e.config.name),XE(),eC(e.config.integrationType?5:-1),XE(),eC(e.enabled()?6:-1);}}function Me(o,t){if(o&1&&(ws(0,"p",56),GC(1),pl()),o&2){let e=gC().$implicit;XE(),vl(" Restricted to: ",e.restrictedTools.join(", ")," (set outside this form, preserved on save) ");}}function Ee(o,t){if(o&1){let e=lC();ws(0,"div",45)(1,"label",46)(2,"span",48),GC(3),pl(),ws(4,"span",49),GC(5,"built-in"),pl()(),ws(6,"select",52),Rg("change",function(c){let g=If(e).$implicit,C=gC(4);return wf(C.setBuiltInState(g,c.target.value))}),ws(7,"option",53),GC(8),pl(),ws(9,"option",54),GC(10,"Enabled"),pl(),ws(11,"option",55),GC(12,"Disabled"),pl()(),Jw(13,Me,2,1,"p",56),ws(14,"p",57),GC(15),pl()();}if(o&2){let e=t.$implicit,a=gC(4);XE(),Tg("for","built-in-"+e.type),XE(2),Yg(e.displayName),XE(3),bg("id","built-in-"+e.type)("value",e.state()),XE(2),Yg(a.builtInDefaultLabel(e)),XE(5),eC(e.state()==="on"&&e.restrictedTools?13:-1),XE(2),Yg(e.description);}}function Ae(o,t){if(o&1&&(ws(0,"p",51),GC(1,"Built-in integrations"),pl(),rC(2,Ee,16,7,"div",45,be)),o&2){let e=gC(3);XE(2),oC(e.builtInRows());}}function Ie(o,t){if(o&1&&(ws(0,"fieldset",20)(1,"legend",29),GC(2,"Integrations"),pl(),ws(3,"p",44),GC(4," Select which integrations this agent can use. Leave tool names empty to allow all tools from an integration. "),pl(),rC(5,Se,7,4,"div",45,Ce),Jw(7,Ae,4,0),pl()),o&2){let e=gC(2);XE(5),oC(e.integrationRows()),XE(2),eC(e.builtInRows().length>0?7:-1);}}function Oe(o,t){o&1&&(ws(0,"p",60),GC(1,"Invalid JSON \u2014 please fix the syntax."),pl());}function Pe(o,t){if(o&1&&(ws(0,"div",10)(1,"label",58),GC(2,"Loop configuration (JSON)"),pl(),Sg(3,"textarea",59),VI(),Jw(4,Oe,2,0,"p",60),ws(5,"p",24),GC(6," Default payload for this loop agent. Overridden at launch time if the first message contains a valid "),ws(7,"code",30),GC(8,"AgentLoopPayload"),pl(),GC(9,". Leave empty if you always provide the payload at launch. "),pl()()),o&2){let e=gC(2);XE(3),bg("placeholder",e.loopConfigPlaceholder)("formControl",e.loopConfigControl),UI(),XE(),eC(e.loopConfigControl.invalid&&e.loopConfigControl.touched?4:-1);}}function ke(o,t){if(o&1){let e=lC();ws(0,"li",61),Sg(1,"input",62),VI(),ws(2,"button",63),Rg("click",function(){let c=If(e).$implicit,g=gC(3);return wf(g.removeSubAgent(c))}),GC(3," \u{1F5D1} "),pl()();}if(o&2){let e=t.$implicit;XE(),bg("formControl",e.control),UI();}}function Te(o,t){if(o&1&&(ws(0,"ul",31),rC(1,ke,4,1,"li",61,tC),pl()),o&2){let e=gC(2);XE(),oC(e.subAgentRows());}}function Re(o,t){if(o&1&&GC(0),o&2){let e=gC(2);Qg(" : ",e.defaultDelegationTimeoutSeconds()," s (",e.defaultDelegationTimeoutSeconds()/60," min) ");}}function De(o,t){o&1&&(ws(0,"p",38),GC(1," Enter a valid positive whole number of seconds, or leave empty to inherit the server default. "),pl());}function Ve(o,t){if(o&1){let e=lC();ws(0,"button",64),Rg("click",function(){If(e);let c=gC(2);return wf(c.useDefaultDelegationTimeout())}),GC(1," Use server default "),pl();}}function Ne(o,t){if(o&1){let e=lC();ws(0,"button",65),Rg("click",function(){If(e);let c=gC(2);return wf(c.exportYaml())}),GC(1),pl();}if(o&2){let e=gC(2);bg("disabled",e.isExporting()),XE(),vl(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Fe(o,t){if(o&1){let e=lC();ws(0,"form",9),Rg("ngSubmit",function(){If(e);let c=gC();return wf(c.submit())}),ws(1,"div",10)(2,"label",11),GC(3,"Name "),ws(4,"span",12),GC(5,"*"),pl()(),Sg(6,"input",13),VI(),pl(),ws(7,"div",10)(8,"label",14),GC(9,"Description"),pl(),Sg(10,"input",15),VI(),pl(),ws(11,"div",10)(12,"label",16),GC(13,"Model name"),pl(),Sg(14,"input",17),VI(),pl(),ws(15,"div",10)(16,"label",18),GC(17,"Instructions"),pl(),Sg(18,"textarea",19),VI(),pl(),Jw(19,Ie,8,1,"fieldset",20),ws(20,"div",10)(21,"label",21),GC(22,"Execution mode"),pl(),ws(23,"select",22)(24,"option",23),GC(25,"SIMPLE \u2014 Standard agent (single LLM call)"),pl(),ws(26,"option",23),GC(27,"ADVANCED \u2014 Multi-step reasoning loop"),pl(),ws(28,"option",23),GC(29,"LOOP \u2014 Bulk loop agent (no LLM, experimental)"),pl()(),VI(),ws(30,"p",24),GC(31,' SIMPLE runs a single LLM pass. ADVANCED uses an intention loop for complex tasks. LOOP (experimental) starts one case per result of a tool, without an LLM \u2014 run it with "Launch loop" in the agent list menu. '),pl()(),Jw(32,Pe,10,3,"div",10),ws(33,"div",10)(34,"label",25),Sg(35,"input",26),VI(),ws(36,"span",27),GC(37,"Enabled"),pl()(),ws(38,"p",28),GC(39,"Disabled agents are excluded from namespace resolution."),pl()(),ws(40,"div",10)(41,"span",29),GC(42,"Sub-agents"),pl(),ws(43,"p",24),GC(44," Glob patterns for agents this agent may delegate to. "),ws(45,"code",30),GC(46,"*"),pl(),GC(47," matches any sequence of characters (e.g. "),ws(48,"code",30),GC(49,"*Fixer"),pl(),GC(50,", "),ws(51,"code",30),GC(52,"*"),pl(),GC(53," for all). Leave empty to disable delegation. "),pl(),Jw(54,Te,3,0,"ul",31),ws(55,"div",32)(56,"input",33),Rg("keydown.enter",function(){If(e);let c=gC();return wf(c.addSubAgent())}),pl(),VI(),ws(57,"button",34),Rg("click",function(){If(e);let c=gC();return wf(c.addSubAgent())}),GC(58," + "),pl()()(),ws(59,"div",10)(60,"label",35),GC(61,"Delegation timeout (seconds)"),pl(),ws(62,"p",36),GC(63," Maximum time for each delegation launched by this agent, including nested delegations. On timeout, the sub-agent and its active descendants are stopped. Leave empty to use the server default "),Jw(64,Re,1,2),GC(65," . "),pl(),Sg(66,"input",37),VI(),Jw(67,De,2,0,"p",38),Jw(68,Ve,2,0,"button",39),pl(),ws(69,"div",40)(70,"button",41),GC(71),pl(),Jw(72,Ne,2,2,"button",42),ws(73,"button",43),Rg("click",function(){If(e);let c=gC();return wf(c.cancel())}),GC(74,"Cancel"),pl()()();}if(o&2){let e=gC();bg("formGroup",e.form),XE(6),bg("formControl",e.nameControl),UI(),XE(4),bg("formControl",e.descriptionControl),UI(),XE(4),bg("formControl",e.modelNameControl),UI(),XE(4),bg("formControl",e.instructionsControl),UI(),XE(),eC(e.integrationRows().length>0||e.builtInRows().length>0?19:-1),XE(4),bg("formControl",e.executionModeControl),UI(),XE(),bg("value",e.ExecutionMode.SIMPLE),XE(2),bg("value",e.ExecutionMode.ADVANCED),XE(2),bg("value",e.ExecutionMode.LOOP),XE(4),eC(e.isLoopMode()?32:-1),XE(3),bg("formControl",e.enabledControl),UI(),XE(19),eC(e.subAgentRows().length>0?54:-1),XE(2),bg("formControl",e.newSubAgentControl),UI(),XE(),bg("disabled",!e.newSubAgentControl.value.trim()),XE(7),eC(e.defaultDelegationTimeoutSeconds()!==null?64:-1),XE(2),bg("formControl",e.delegationTimeoutControl),Tg("aria-invalid",e.delegationTimeoutControl.invalid),UI(),XE(),eC(e.delegationTimeoutControl.invalid?67:-1),XE(),eC(e.delegationTimeoutControl.value!==null?68:-1),XE(2),bg("disabled",e.form.invalid||e.isSubmitting()),XE(),vl(" ",e.isEditMode()?"Save changes":"Create"," "),XE(),eC(e.isEditMode()?72:-1);}}var pe=class o{route=g(V);router=g(G);destroyRef=g(Ce$1);agentConfigController=g(M);defaultsController=g(B);defaultDelegationTimeoutSeconds=Gi(null);exportService=g(J);integrationConfigState=g(N);integrationTypeController=g(F);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new z({name:new _t("",{nonNullable:true,validators:[_e.required,_e.minLength(1)]}),description:new _t(null),modelName:new _t(null),instructions:new _t(null),executionMode:new _t("SIMPLE",{nonNullable:true}),delegationTimeoutSeconds:new _t(null,{validators:[_e.min(1),_e.max(2147483647),_e.pattern(/^\d+$/)]}),enabled:new _t(false,{nonNullable:true}),loopConfig:new _t(null,{validators:[o.jsonValidator]})});static jsonValidator(t){let e=t.value?.trim();if(!e)return null;try{return JSON.parse(e),null}catch(a){return {invalidJson:true}}}get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get modelNameControl(){return this.form.controls.modelName}get instructionsControl(){return this.form.controls.instructions}get executionModeControl(){return this.form.controls.executionMode}get delegationTimeoutControl(){return this.form.controls.delegationTimeoutSeconds}useDefaultDelegationTimeout(){this.delegationTimeoutControl.setValue(null),this.delegationTimeoutControl.markAsDirty();}get enabledControl(){return this.form.controls.enabled}get loopConfigControl(){return this.form.controls.loopConfig}executionModeValue=F$1(this.form.controls.executionMode.valueChanges,{initialValue:this.form.controls.executionMode.value});isLoopMode=mT(()=>this.executionModeValue()==="LOOP");subAgentRows=Gi([]);newSubAgentControl=new _t("",{nonNullable:true});isEditMode=Gi(false);isSubmitting=Gi(false);isLoading=Gi(false);isExporting=Gi(false);ExecutionMode=Ae$1;loopConfigPlaceholder=JSON.stringify({search:{tool:"SearchTalents",params:{talentId:["6ac76692a909eaaae0b078d6"],resolveTargets:["MANAGER"],next:null}},act:{agentName:"ProfileCaretaker",promptTemplate:"This talent has not completed their profile. As their manager, I need you to help me review and improve it."}},null,2);builtInRows=Gi([]);inspectRoute(){let t=this.route.snapshot.paramMap.get("agentConfigId")??"";return this.isPlatformMode?["/agentos","admin","agent-configs",t,"inspect"]:["/agentos",this.namespaceId,"agent-configs",t,"inspect"]}integrationRows=Gi([]);existingConfig=null;ngOnInit(){this.defaultsController.getAgentConfigDefaults().pipe(U(this.destroyRef),ya(()=>br(null))).subscribe(e=>this.defaultDelegationTimeoutSeconds.set(e?.delegationTimeoutSeconds??null));let t=this.route.snapshot.paramMap.get("agentConfigId");t?(this.isEditMode.set(true),this.loadConfigAndIntegrations(t)):this.loadIntegrations(void 0);}loadConfigAndIntegrations(t){this.isLoading.set(true),By({config:this.agentConfigController.getByIdAgentConfig(t),namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({config:e,namespaceIntegrations:a,platformIntegrations:c,builtInTypes:g})=>{this.existingConfig=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.modelNameControl.setValue(e.modelName??null),this.instructionsControl.setValue(e.instructions??null);let C=e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE");this.executionModeControl.setValue(C),this.delegationTimeoutControl.setValue(e.delegationTimeoutSeconds??null),this.enabledControl.setValue(e.enabled??true),this.loopConfigControl.setValue(e.loopConfig!=null?JSON.stringify(e.loopConfig,null,2):null);let T=[...c,...a];this.integrationRows.set(this.buildIntegrationRows(T,e.integrations??void 0)),this.builtInRows.set(this.buildBuiltInRows(g,e.integrations??void 0)),this.subAgentRows.set((e.subAgents??[]).map(_e=>({control:new _t(_e,{nonNullable:true})}))),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadIntegrations(t){By({namespaceIntegrations:this.namespaceId?this.integrationConfigState.loadNamespaceConfigs(this.namespaceId):br([]),platformIntegrations:this.integrationConfigState.loadPlatformConfigs(),builtInTypes:this.loadBuiltInTypes()}).pipe(U(this.destroyRef)).subscribe({next:({namespaceIntegrations:e,platformIntegrations:a,builtInTypes:c})=>{let g=[...a,...e];this.integrationRows.set(this.buildIntegrationRows(g,t??void 0)),this.builtInRows.set(this.buildBuiltInRows(c,t??void 0));}});}loadBuiltInTypes(){return this.integrationTypeController.listTypesIntegrationType().pipe(re(t=>t.filter(e=>!e.configSchema)),ya(t=>(console.error("[agent-config-form] failed to load integration types",t),br([]))))}buildIntegrationRows(t,e){return t.map(a=>{let c=a.name??"",g=e?.[c],C=e!=null&&c in e,T=Array.isArray(g)?g.join(", "):"";return {config:a,enabled:Gi(C),toolsControl:new _t(T,{nonNullable:true})}})}buildBuiltInRows(t,e){return t.map(a=>{let c=e!=null&&a.type in e,g=e?.[a.type],C=c?Array.isArray(g)&&g.length===0?"off":"on":"default";return {type:a.type,displayName:a.displayName,description:a.description,enabledByDefault:a.enabledByDefault===true,state:Gi(C),restrictedTools:Array.isArray(g)&&g.length>0?g:null}})}toggleIntegration(t){t.enabled.update(e=>!e);}setBuiltInState(t,e){t.state.set(e);}builtInDefaultLabel(t){return t.enabledByDefault?"Platform default (enabled)":"Platform default (disabled)"}addSubAgent(){let t=this.newSubAgentControl.value.trim();t&&(this.subAgentRows.update(e=>[...e,{control:new _t(t,{nonNullable:true})}]),this.newSubAgentControl.reset(""));}removeSubAgent(t){this.subAgentRows.update(e=>e.filter(a=>a!==t));}buildSubAgentsPayload(){let t=this.subAgentRows().map(e=>e.control.value.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}buildIntegrationsPayload(){let t={};for(let a of this.integrationRows().filter(c=>c.enabled())){let c=a.config.name??"",g=a.toolsControl.value.trim();t[c]=g===""?null:g.split(",").map(C=>C.trim()).filter(C=>C.length>0);}for(let a of this.builtInRows()){let c=a.state();c==="on"?t[a.type]=a.restrictedTools??null:c==="off"&&(t[a.type]=[]);}let e=new Set([...this.integrationRows().map(a=>a.config.name??""),...this.builtInRows().map(a=>a.type)]);for(let[a,c]of Object.entries(this.existingConfig?.integrations??{}))e.has(a)||(t[a]=c);return Object.keys(t).length>0?t:void 0}submit(){if(this.form.invalid||this.isSubmitting())return;this.addSubAgent(),this.isSubmitting.set(true);let t=x(w({},this.existingConfig??{}),{createdOn:this.existingConfig?.createdOn,updatedOn:this.existingConfig?.updatedOn,namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,modelName:this.modelNameControl.value?.trim()||void 0,instructions:this.instructionsControl.value?.trim()||void 0,integrations:this.buildIntegrationsPayload(),executionMode:this.executionModeControl.value,advancedExecution:this.executionModeControl.value==="ADVANCED",enabled:this.enabledControl.value,subAgents:this.buildSubAgentsPayload(),delegationTimeoutSeconds:this.delegationTimeoutControl.value,loopConfig:this.buildLoopConfigPayload()});(this.isEditMode()?this.agentConfigController.updateAgentConfig(this.existingConfig.id??"",t):this.agentConfigController.createAgentConfig(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}exportYaml(){let t=this.existingConfig?.id;!t||this.isExporting()||(this.isExporting.set(true),this.exportService.exportAsYaml(t).pipe(U(this.destroyRef)).subscribe({next:e=>{let a=new Blob([e],{type:"application/yaml"}),c=URL.createObjectURL(a),g=document.createElement("a");g.href=c,g.download=`${this.existingConfig?.name??"agent"}.yaml`,g.click(),URL.revokeObjectURL(c),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}buildLoopConfigPayload(){let t=this.loopConfigControl.value?.trim();if(!t)return this.existingConfig?.loopConfig!=null?null:void 0;try{return JSON.parse(t)}catch(e){return}}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","agent-configs"]):this.router.navigate(["/agentos",this.namespaceId,"agent-configs"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-agent-config-form"]],decls:12,vars:4,consts:[[1,"agent-config-form"],[1,"agent-config-form__header"],["type","button","title","Back to agent configs",1,"agent-config-form__back",3,"click"],[1,"agent-config-form__back-icon"],[1,"agent-config-form__title"],[1,"agent-config-form__sibling-link",3,"routerLink"],[1,"agent-config-form__platform-badge"],[1,"agent-config-form__loading"],[1,"agent-config-form__form",3,"formGroup"],[1,"agent-config-form__form",3,"ngSubmit","formGroup"],[1,"agent-config-form__field"],["for","agent-config-name",1,"agent-config-form__label"],["aria-hidden","true"],["id","agent-config-name","type","text","placeholder","e.g. Support agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-description",1,"agent-config-form__label"],["id","agent-config-description","type","text","placeholder","Optional \u2014 short description of this agent","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-model-name",1,"agent-config-form__label"],["id","agent-config-model-name","type","text","placeholder","Optional \u2014 model alias or name to use","autocomplete","off",1,"agent-config-form__input",3,"formControl"],["for","agent-config-instructions",1,"agent-config-form__label"],["id","agent-config-instructions","rows","6","placeholder","Optional \u2014 system instructions for this agent",1,"agent-config-form__textarea",3,"formControl"],[1,"agent-config-form__integrations"],["for","agent-config-execution-mode",1,"agent-config-form__label"],["id","agent-config-execution-mode",1,"agent-config-form__select",3,"formControl"],[3,"value"],[1,"agent-config-form__field-hint"],[1,"agent-config-form__toggle-label"],["type","checkbox",1,"agent-config-form__toggle-checkbox",3,"formControl"],[1,"agent-config-form__toggle-text"],[1,"agent-config-form__toggle-hint"],[1,"agent-config-form__label"],[1,"agent-config-form__code"],[1,"agent-config-form__sub-agent-list"],[1,"agent-config-form__sub-agent-add"],["type","text","placeholder","e.g. *Fixer or *","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"keydown.enter","formControl"],["type","button","title","Add pattern",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--add",3,"click","disabled"],["for","delegation-timeout",1,"agent-config-form__label"],["id","delegation-timeout-hint",1,"agent-config-form__field-hint"],["id","delegation-timeout","type","number","min","1","max","2147483647","step","1","placeholder","Server default","aria-describedby","delegation-timeout-hint delegation-timeout-error",1,"agent-config-form__input",3,"formControl"],["id","delegation-timeout-error","role","alert",1,"agent-config-form__field-hint"],["type","button",1,"agent-config-form__sub-agent-btn"],[1,"agent-config-form__actions"],["type","submit",1,"agent-config-form__btn","agent-config-form__btn--primary",3,"disabled"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"disabled"],["type","button",1,"agent-config-form__btn",3,"click"],[1,"agent-config-form__integrations-hint"],[1,"agent-config-form__integration-row"],[1,"agent-config-form__integration-toggle"],["type","checkbox",1,"agent-config-form__integration-checkbox",3,"change","checked"],[1,"agent-config-form__integration-name"],[1,"agent-config-form__integration-type"],["type","text","placeholder","Tool names, comma-separated (empty = all tools)","autocomplete","off",1,"agent-config-form__input","agent-config-form__integration-tools",3,"formControl"],[1,"agent-config-form__integrations-separator"],[1,"agent-config-form__integration-state",3,"change","id","value"],["value","default"],["value","on"],["value","off"],[1,"agent-config-form__integration-restriction"],[1,"agent-config-form__integration-builtin-desc"],["for","agent-config-loop-config",1,"agent-config-form__label"],["id","agent-config-loop-config","rows","10","spellcheck","false","autocomplete","off",1,"agent-config-form__textarea","agent-config-form__textarea--mono",3,"placeholder","formControl"],["role","alert",1,"agent-config-form__field-error"],[1,"agent-config-form__sub-agent-row"],["type","text","autocomplete","off",1,"agent-config-form__input","agent-config-form__sub-agent-input",3,"formControl"],["type","button","title","Remove",1,"agent-config-form__sub-agent-btn","agent-config-form__sub-agent-btn--danger",3,"click"],["type","button",1,"agent-config-form__sub-agent-btn",3,"click"],["type","button",1,"agent-config-form__btn","agent-config-form__btn--export",3,"click","disabled"]],template:function(e,a){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return a.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Agent Configs "),pl(),ws(6,"h1",4),GC(7),pl(),Jw(8,xe,2,1,"a",5),Jw(9,he,2,0,"span",6),pl(),Jw(10,ve,2,0,"p",7)(11,Fe,75,23,"form",8),pl()),e&2&&(XE(7),Yg(a.isEditMode()?"Edit agent config":"New agent config"),XE(),eC(a.isEditMode()?8:-1),XE(),eC(a.isPlatformMode?9:-1),XE(),eC(a.isLoading()?10:11));},dependencies:[ni,Jn,Qn,ei,Ye,fn,wt,At,Zn,Xn,$t,Wt,Cn,En,si],styles:[".agent-config-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.agent-config-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.agent-config-form__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)}.agent-config-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.agent-config-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;color:var(--color-text);letter-spacing:-.02em}.agent-config-form__sibling-link[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-accent);text-decoration:none}.agent-config-form__sibling-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-config-form__platform-badge[_ngcontent-%COMP%]{display:inline-block;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:var(--color-surface);border:1px solid var(--color-divider);border-radius:0;padding:.125rem .5rem;letter-spacing:.02em;align-self:flex-start}.agent-config-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-size:.9rem;margin:0}.agent-config-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.agent-config-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.agent-config-form__input[_ngcontent-%COMP%], .agent-config-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;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;transition:border-color .15s ease}.agent-config-form__input[_ngcontent-%COMP%]:focus, .agent-config-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__input[_ngcontent-%COMP%]::placeholder, .agent-config-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-neutral-500)}.agent-config-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:120px;line-height:1.5}.agent-config-form__textarea--mono[_ngcontent-%COMP%]{font-family:monospace;font-size:.8125rem}.agent-config-form__field-error[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-error, var(--red, #dc2626));line-height:1.4}.agent-config-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:0;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;cursor:pointer;transition:border-color .15s ease;appearance:auto}.agent-config-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-accent)}.agent-config-form__integrations[_ngcontent-%COMP%]{border:1px solid var(--color-divider);border-radius:0;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.agent-config-form__integrations-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__integration-row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.agent-config-form__integration-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__integration-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__integration-name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__integration-type[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);font-family:monospace}.agent-config-form__integration-tools[_ngcontent-%COMP%]{margin-left:1.5rem;font-size:.875rem}.agent-config-form__integrations-separator[_ngcontent-%COMP%]{margin:.25rem 0 0;padding-top:.5rem;border-top:1px solid var(--color-divider);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);font-family:var(--font-heading)}.agent-config-form__integration-state[_ngcontent-%COMP%]{margin-left:1.5rem;padding:.375rem .625rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s ease}.agent-config-form__integration-state[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.agent-config-form__integration-restriction[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;font-style:italic;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.agent-config-form__integration-builtin-desc[_ngcontent-%COMP%]{margin:0 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__field-hint[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__code[_ngcontent-%COMP%]{font-family:monospace;font-size:.85em;background:var(--color-surface-muted, rgba(0, 0, 0, .06));padding:.1em .3em;border-radius:0}.agent-config-form__sub-agent-list[_ngcontent-%COMP%]{list-style:none;margin:.5rem 0 0;padding:0;display:flex;flex-direction:column;gap:.375rem}.agent-config-form__sub-agent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem}.agent-config-form__sub-agent-input[_ngcontent-%COMP%]{flex:1;min-width:0}.agent-config-form__sub-agent-add[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;margin-top:.5rem}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]{flex-shrink:0;width:2rem;height:2rem;padding:0;border-radius:0;border:1px solid var(--color-divider);background:transparent;color:var(--color-text-secondary);font-size:.9rem;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s ease,border-color .15s ease,color .15s ease}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500);color:var(--color-text)}.agent-config-form__sub-agent-btn[_ngcontent-%COMP%]:disabled{opacity:.35;cursor:not-allowed}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]{width:2rem;height:2rem;font-size:1.25rem;font-weight:300;border-color:var(--color-accent);color:var(--color-accent)}.agent-config-form__sub-agent-btn--add[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent);color:#fff}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]{border:1px solid transparent;color:var(--color-neutral-500)}.agent-config-form__sub-agent-btn--danger[_ngcontent-%COMP%]:hover:not(:disabled){border-color:var(--red);color:var(--red);background:color-mix(in srgb,var(--red) 10%,transparent)}.agent-config-form__toggle-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer;-webkit-user-select:none;user-select:none}.agent-config-form__toggle-checkbox[_ngcontent-%COMP%]{width:1rem;height:1rem;flex-shrink:0;accent-color:var(--color-accent);cursor:pointer}.agent-config-form__toggle-text[_ngcontent-%COMP%]{font-size:.9rem;font-weight:500;color:var(--color-text)}.agent-config-form__toggle-hint[_ngcontent-%COMP%]{margin:.25rem 0 0 1.5rem;font-size:.8rem;color:var(--color-text-secondary);line-height:1.4}.agent-config-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.agent-config-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:0;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;transition:background .15s ease,border-color .15s ease}.agent-config-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-config-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.agent-config-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-accent);border-color:var(--color-accent);color:#fff}.agent-config-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-accent-700);border-color:var(--color-accent-700)}"]})};export{pe as AgentConfigFormComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {R}from'./chunk-CCQAu0MS.js';import {g,ao as V,G,dr as D,C as Ce,a as Gi,m as mT,ds as Ae,Q as jy,b as U,a7 as ya,W as br,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,y as eC,a9 as lC,a3 as VI,t as rC,ac as gC,v as bg,a6 as UI,z as oC,a5 as vl,a8 as Yg,A as Ug,b0 as Qg,aa as If,ab as wf}from'./main-2GG5NZ4C.js';import'./chunk-C-VoWDOg.js';import {t as ti,Q as Qn,e as ei,Y as Ye,a as wt,A as At,Z as Zn,c as cn}from'./chunk-D_aTK145.js';import'./chunk-C0DMx9CU.js';import'./chunk-G_l8BMaJ.js';import'./chunk-BjBW1d-u.js';import'./chunk-Bbb2Oy9I.js';var $=(o,t)=>t.id;function J(o,t){o&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function Q(o,t){if(o&1&&(ws(0,"p",8),GC(1),pl()),o&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function X(o,t){if(o&1){let e=lC();ws(0,"button",29),Rg("click",function(){If(e);let s=gC(2);return wf(s.retryLoad())}),GC(1,"Retry loading"),pl();}}function Z(o,t){if(o&1&&(ws(0,"span",31),GC(1),pl()),o&2){let e=gC(3);XE(),Yg(e.association()?.checkoutFailureReason);}}function ee(o,t){if(o&1&&(ws(0,"p",30),GC(1),Jw(2,Z,2,1,"span",31),pl()),o&2){let e=gC(2);Ug("namespace-git__status--failed",e.checkoutStatus()===e.CheckoutStatus.FAILED)("namespace-git__status--ready",e.checkoutStatus()===e.CheckoutStatus.READY),XE(),vl(" Repository: ",e.checkoutStatus()," "),XE(),eC(e.association()?.checkoutFailureReason?2:-1);}}function te(o,t){if(o&1&&(ws(0,"option",20),GC(1),pl()),o&2){let e=t.$implicit,l=gC(2);bg("value",e.id),XE(),Qg("",e.name," (",l.authTypeLabel(e.authType),")");}}function ne(o,t){o&1&&(ws(0,"span",21),GC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function ie(o,t){if(o&1){let e=lC();ws(0,"button",32),Rg("click",function(){If(e);let s=gC(2);return wf(s.remove())}),GC(1," Remove association "),pl();}if(o&2){let e=gC(2);bg("disabled",!e.associationLoaded()||e.isSaving());}}function ae(o,t){if(o&1){let e=lC();ws(0,"div",6)(1,"p",7),GC(2," Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, every new top-level case gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows. "),pl(),Jw(3,Q,2,1,"p",8),Jw(4,X,2,0,"button",9),Jw(5,ee,3,6,"p",10),ws(6,"fieldset",11)(7,"legend",12),GC(8,"Repository"),pl(),ws(9,"label",13)(10,"span",14),GC(11,"Repository URL"),pl(),ws(12,"input",15),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.repositoryUrl.set(s))}),pl(),VI(),ws(13,"span",16),GC(14,"HTTPS only, without credentials in the URL."),pl()(),ws(15,"label",13)(16,"span",14),GC(17,"Main branch"),pl(),ws(18,"input",17),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.mainBranch.set(s))}),pl(),VI(),ws(19,"span",16),GC(20,"New worktrees start at this branch\u2019s commit, without creating a branch."),pl()(),ws(21,"label",13)(22,"span",14),GC(23,"Service account"),pl(),ws(24,"select",18),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.serviceAuthSettingId.set(s))}),ws(25,"option",19),GC(26,"Select an auth setting\u2026"),pl(),rC(27,te,2,3,"option",20,$),pl(),VI(),ws(29,"span",16),GC(30," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),pl(),Jw(31,ne,2,0,"span",21),pl()(),ws(32,"fieldset",11)(33,"legend",12),GC(34,"Automation"),pl(),ws(35,"label",22)(36,"input",23),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.autoWorktree.set(s))}),pl(),VI(),ws(37,"span"),GC(38,"Create a worktree for every new top-level case"),pl()(),ws(39,"span",16),GC(40," Applies to cases created from now on. Turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),pl(),ws(41,"label",13)(42,"span",14),GC(43,"Setup command (optional)"),pl(),ws(44,"input",24),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.setupCommand.set(s))}),pl(),VI(),ws(45,"span",21),GC(46," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),pl()()(),ws(47,"div",25)(48,"button",26),Rg("click",function(){If(e);let s=gC();return wf(s.save())}),GC(49),pl(),Jw(50,ie,2,1,"button",27),ws(51,"button",28),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(52,"Cancel"),pl()()();}if(o&2){let e=gC();XE(3),eC(e.errorMessage()?3:-1),XE(),eC(e.associationLoaded()?-1:4),XE(),eC(e.isAssociated()&&e.checkoutStatus()?5:-1),XE(),bg("disabled",!e.associationLoaded()||e.isSaving()),XE(6),bg("ngModel",e.repositoryUrl()),UI(),XE(6),bg("ngModel",e.mainBranch()),UI(),XE(6),bg("ngModel",e.serviceAuthSettingId()),UI(),XE(3),oC(e.eligibleAuthSettings()),XE(4),eC(e.eligibleAuthSettings().length===0?31:-1),XE(),bg("disabled",!e.associationLoaded()||e.isSaving()),XE(4),bg("ngModel",e.autoWorktree()),UI(),XE(8),bg("ngModel",e.setupCommand()),UI(),XE(4),bg("disabled",!e.canSave()),XE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),XE(),eC(e.isAssociated()?50:-1);}}var oe=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],re={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},q=class o{route=g(V);router=g(G);gitApi=g(D);authSettingState=g(R);destroyRef=g(Ce);isLoading=Gi(true);isSaving=Gi(false);associationLoaded=Gi(false);errorMessage=Gi(null);association=Gi(null);authSettings=Gi([]);repositoryUrl=Gi("");mainBranch=Gi("main");serviceAuthSettingId=Gi("");autoWorktree=Gi(false);setupCommand=Gi("");namespaceId="";isAssociated=mT(()=>this.association()?.associated===true);eligibleAuthSettings=mT(()=>this.authSettings().filter(t=>oe.includes(t.authType)));authTypeLabel(t){return re[t??""]??t??"unknown"}canSave=mT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=mT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Ae;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),jy({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ya(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||confirm("Remove the repository association? Existing workspaces keep their worktree.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ya(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}cancel(){this.router.navigate(["/agentos/namespaces"]);}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-namespace-git"]],decls:10,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],["type","button","title","Back to namespaces",1,"namespace-git__back",3,"click"],[1,"namespace-git__back-icon"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],["type","button",1,"namespace-git__retry"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section",3,"disabled"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__checkbox"],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],["type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__cancel",3,"click"],["type","button",1,"namespace-git__retry",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(e,l){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Namespaces "),pl(),ws(6,"h1",4),GC(7,"Git repository"),pl()(),Jw(8,J,2,0,"p",5)(9,ae,53,14,"div",6),pl()),e&2&&(XE(8),eC(l.isLoading()?8:9));},dependencies:[ti,Qn,ei,Ye,wt,At,Zn,cn],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__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-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__checkbox[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;cursor:pointer}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__retry[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
|
|
1
|
+
import {R}from'./chunk-B_gHVcU6.js';import {g,ao as V,G,du as W,C as Ce,a as Gi,m as mT,dv as Pe,Q as By,b as U,a7 as ya,W as br,e as xw,k as ws,q as Rg,n as GC,o as pl,J as Jw,X as XE,y as eC,a9 as lC,a3 as VI,t as rC,ac as gC,v as bg,a6 as UI,z as oC,a5 as vl,a8 as Yg,A as Ug,b0 as Qg,aa as If,ab as wf}from'./main-2EYBZUJC.js';import'./chunk-kFOHrPbJ.js';import {t as ti,Q as Qn,e as ei,Y as Ye,a as wt,A as At,Z as Zn,c as cn}from'./chunk-CZmNdEYy.js';import'./chunk-BWcVMw4T.js';import'./chunk-DqzTsn7a.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';var $=(o,t)=>t.id;function J(o,t){o&1&&(ws(0,"p",5),GC(1,"Loading\u2026"),pl());}function Q(o,t){if(o&1&&(ws(0,"p",8),GC(1),pl()),o&2){let e=gC(2);XE(),Yg(e.errorMessage());}}function X(o,t){if(o&1){let e=lC();ws(0,"button",29),Rg("click",function(){If(e);let s=gC(2);return wf(s.retryLoad())}),GC(1,"Retry loading"),pl();}}function Z(o,t){if(o&1&&(ws(0,"span",31),GC(1),pl()),o&2){let e=gC(3);XE(),Yg(e.association()?.checkoutFailureReason);}}function ee(o,t){if(o&1&&(ws(0,"p",30),GC(1),Jw(2,Z,2,1,"span",31),pl()),o&2){let e=gC(2);Ug("namespace-git__status--failed",e.checkoutStatus()===e.CheckoutStatus.FAILED)("namespace-git__status--ready",e.checkoutStatus()===e.CheckoutStatus.READY),XE(),vl(" Repository: ",e.checkoutStatus()," "),XE(),eC(e.association()?.checkoutFailureReason?2:-1);}}function te(o,t){if(o&1&&(ws(0,"option",20),GC(1),pl()),o&2){let e=t.$implicit,l=gC(2);bg("value",e.id),XE(),Qg("",e.name," (",l.authTypeLabel(e.authType),")");}}function ne(o,t){o&1&&(ws(0,"span",21),GC(1," No usable auth setting in this namespace. Create a BEARER_TOKEN one first. "),pl());}function ie(o,t){if(o&1){let e=lC();ws(0,"button",32),Rg("click",function(){If(e);let s=gC(2);return wf(s.remove())}),GC(1," Remove association "),pl();}if(o&2){let e=gC(2);bg("disabled",!e.associationLoaded()||e.isSaving());}}function ae(o,t){if(o&1){let e=lC();ws(0,"div",6)(1,"p",7),GC(2," Associating a repository enables Git workspaces for this namespace. When worktree creation is enabled, every new top-level case gets a repo/ directory shared by its sub-cases. Namespace files remain shared documents outside Git. Agents create branches and pull requests in their workflows. "),pl(),Jw(3,Q,2,1,"p",8),Jw(4,X,2,0,"button",9),Jw(5,ee,3,6,"p",10),ws(6,"fieldset",11)(7,"legend",12),GC(8,"Repository"),pl(),ws(9,"label",13)(10,"span",14),GC(11,"Repository URL"),pl(),ws(12,"input",15),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.repositoryUrl.set(s))}),pl(),VI(),ws(13,"span",16),GC(14,"HTTPS only, without credentials in the URL."),pl()(),ws(15,"label",13)(16,"span",14),GC(17,"Main branch"),pl(),ws(18,"input",17),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.mainBranch.set(s))}),pl(),VI(),ws(19,"span",16),GC(20,"New worktrees start at this branch\u2019s commit, without creating a branch."),pl()(),ws(21,"label",13)(22,"span",14),GC(23,"Service account"),pl(),ws(24,"select",18),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.serviceAuthSettingId.set(s))}),ws(25,"option",19),GC(26,"Select an auth setting\u2026"),pl(),rC(27,te,2,3,"option",20,$),pl(),VI(),ws(29,"span",16),GC(30," Shared by the namespace. Every Git operation uses this identity, never the identity of whoever opened the case. "),pl(),Jw(31,ne,2,0,"span",21),pl()(),ws(32,"fieldset",11)(33,"legend",12),GC(34,"Automation"),pl(),ws(35,"label",22)(36,"input",23),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.autoWorktree.set(s))}),pl(),VI(),ws(37,"span"),GC(38,"Create a worktree for every new top-level case"),pl()(),ws(39,"span",16),GC(40," Applies to cases created from now on. Turning this on later never equips existing cases, and turning it off never removes a worktree already created. "),pl(),ws(41,"label",13)(42,"span",14),GC(43,"Setup command (optional)"),pl(),ws(44,"input",24),Rg("ngModelChange",function(s){If(e);let u=gC();return wf(u.setupCommand.set(s))}),pl(),VI(),ws(45,"span",21),GC(46," Runs on the server, as the service user, in each new worktree. It executes code from the branch \u2014 prefer a command that disables lifecycle scripts. "),pl()()(),ws(47,"div",25)(48,"button",26),Rg("click",function(){If(e);let s=gC();return wf(s.save())}),GC(49),pl(),Jw(50,ie,2,1,"button",27),ws(51,"button",28),Rg("click",function(){If(e);let s=gC();return wf(s.cancel())}),GC(52,"Cancel"),pl()()();}if(o&2){let e=gC();XE(3),eC(e.errorMessage()?3:-1),XE(),eC(e.associationLoaded()?-1:4),XE(),eC(e.isAssociated()&&e.checkoutStatus()?5:-1),XE(),bg("disabled",!e.associationLoaded()||e.isSaving()),XE(6),bg("ngModel",e.repositoryUrl()),UI(),XE(6),bg("ngModel",e.mainBranch()),UI(),XE(6),bg("ngModel",e.serviceAuthSettingId()),UI(),XE(3),oC(e.eligibleAuthSettings()),XE(4),eC(e.eligibleAuthSettings().length===0?31:-1),XE(),bg("disabled",!e.associationLoaded()||e.isSaving()),XE(4),bg("ngModel",e.autoWorktree()),UI(),XE(8),bg("ngModel",e.setupCommand()),UI(),XE(4),bg("disabled",!e.canSave()),XE(),vl(" ",e.isSaving()?"Saving\u2026":e.isAssociated()?"Update":"Associate"," "),XE(),eC(e.isAssociated()?50:-1);}}var oe=["BearerTokenAuthSetting","BasicAuthAuthSetting","ApiKeyAuthSetting"],re={BearerTokenAuthSetting:"token",BasicAuthAuthSetting:"basic auth",ApiKeyAuthSetting:"API key"},q=class o{route=g(V);router=g(G);gitApi=g(W);authSettingState=g(R);destroyRef=g(Ce);isLoading=Gi(true);isSaving=Gi(false);associationLoaded=Gi(false);errorMessage=Gi(null);association=Gi(null);authSettings=Gi([]);repositoryUrl=Gi("");mainBranch=Gi("main");serviceAuthSettingId=Gi("");autoWorktree=Gi(false);setupCommand=Gi("");namespaceId="";isAssociated=mT(()=>this.association()?.associated===true);eligibleAuthSettings=mT(()=>this.authSettings().filter(t=>oe.includes(t.authType)));authTypeLabel(t){return re[t??""]??t??"unknown"}canSave=mT(()=>this.associationLoaded()&&!this.isLoading()&&!this.isSaving()&&this.repositoryUrl().trim().length>0&&this.serviceAuthSettingId().length>0);checkoutStatus=mT(()=>this.association()?.checkoutStatus??null);CheckoutStatus=Pe;ngOnInit(){this.namespaceId=this.route.snapshot.paramMap.get("namespaceId")??"",this.load();}retryLoad(){this.isLoading()||this.isSaving()||this.load();}load(){this.isLoading.set(true),this.associationLoaded.set(false),this.errorMessage.set(null),By({association:this.gitApi.getAssociationNamespaceGit(this.namespaceId),authSettings:this.authSettingState.loadNamespaceSettings(this.namespaceId)}).pipe(U(this.destroyRef)).subscribe({next:({association:t,authSettings:e})=>{this.authSettings.set(e??[]),this.acceptAssociation(t),this.isLoading.set(false);},error:t=>{console.error("Failed to load the Git repository settings",t),this.errorMessage.set(this.messageOf(t)),this.isLoading.set(false);}});}acceptAssociation(t){this.association.set(t);let e=t?.associated===false||t?.associated===true&&typeof t.repositoryUrl=="string"&&typeof t.mainBranch=="string"&&typeof t.serviceAuthSettingId=="string"&&typeof t.autoWorktreeForRootCases=="boolean"&&(t.setupCommand==null||typeof t.setupCommand=="string");this.associationLoaded.set(e),e?this.applyToForm(t):this.errorMessage.set("The repository settings could not be loaded completely. Retry before making changes.");}applyToForm(t){this.repositoryUrl.set(t.repositoryUrl??""),this.mainBranch.set(t.mainBranch??"main"),this.serviceAuthSettingId.set(t.serviceAuthSettingId??""),this.autoWorktree.set(t.autoWorktreeForRootCases??false),this.setupCommand.set(t.setupCommand??"");}save(){this.canSave()&&(this.isSaving.set(true),this.errorMessage.set(null),this.gitApi.setAssociationNamespaceGit(this.namespaceId,{repositoryUrl:this.repositoryUrl().trim(),mainBranch:this.mainBranch().trim()||void 0,serviceAuthSettingId:this.serviceAuthSettingId(),autoWorktreeForRootCases:this.autoWorktree(),setupCommand:this.setupCommand().trim()||void 0}).pipe(U(this.destroyRef),ya(t=>(console.error("Failed to save the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}remove(){!this.associationLoaded()||this.isLoading()||this.isSaving()||!this.isAssociated()||confirm("Remove the repository association? Existing workspaces keep their worktree.")&&(this.isSaving.set(true),this.gitApi.removeAssociationNamespaceGit(this.namespaceId).pipe(U(this.destroyRef),ya(t=>(console.error("Failed to remove the Git association",t),this.errorMessage.set(this.messageOf(t)),this.isSaving.set(false),br(null)))).subscribe(t=>{t&&this.acceptAssociation(t),this.isSaving.set(false);}));}cancel(){this.router.navigate(["/agentos/namespaces"]);}messageOf(t){return t.error?.message??t.message??"Unexpected error"}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=xw({type:o,selectors:[["agentos-namespace-git"]],decls:10,vars:1,consts:[[1,"namespace-git"],[1,"namespace-git__header"],["type","button","title","Back to namespaces",1,"namespace-git__back",3,"click"],[1,"namespace-git__back-icon"],[1,"namespace-git__title"],[1,"namespace-git__loading"],[1,"namespace-git__body"],[1,"namespace-git__hint"],["role","alert",1,"namespace-git__error"],["type","button",1,"namespace-git__retry"],[1,"namespace-git__status",3,"namespace-git__status--failed","namespace-git__status--ready"],[1,"namespace-git__section",3,"disabled"],[1,"namespace-git__label"],[1,"namespace-git__field"],[1,"namespace-git__field-label"],["type","url","placeholder","https://forge.example/org/project.git","name","repositoryUrl",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__field-hint"],["type","text","placeholder","main","name","mainBranch",1,"namespace-git__input",3,"ngModelChange","ngModel"],["name","serviceAuthSettingId",1,"namespace-git__input",3,"ngModelChange","ngModel"],["value",""],[3,"value"],[1,"namespace-git__field-hint","namespace-git__field-hint--warn"],[1,"namespace-git__checkbox"],["type","checkbox","name","autoWorktree",3,"ngModelChange","ngModel"],["type","text","placeholder","pnpm install --ignore-scripts","name","setupCommand",1,"namespace-git__input",3,"ngModelChange","ngModel"],[1,"namespace-git__actions"],["type","button",1,"namespace-git__save",3,"click","disabled"],["type","button",1,"namespace-git__remove",3,"disabled"],["type","button",1,"namespace-git__cancel",3,"click"],["type","button",1,"namespace-git__retry",3,"click"],[1,"namespace-git__status"],[1,"namespace-git__status-reason"],["type","button",1,"namespace-git__remove",3,"click","disabled"]],template:function(e,l){e&1&&(ws(0,"div",0)(1,"header",1)(2,"button",2),Rg("click",function(){return l.cancel()}),ws(3,"span",3),GC(4,"\u2190"),pl(),GC(5," Namespaces "),pl(),ws(6,"h1",4),GC(7,"Git repository"),pl()(),Jw(8,J,2,0,"p",5)(9,ae,53,14,"div",6),pl()),e&2&&(XE(8),eC(l.isLoading()?8:9));},dependencies:[ti,Qn,ei,Ye,wt,At,Zn,cn],styles:[".namespace-git[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.namespace-git__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-git__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-primary, #007aff);font-family:inherit}.namespace-git__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-git__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem}.namespace-git__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.5rem}.namespace-git__hint[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__error[_ngcontent-%COMP%]{margin:0;padding:.75rem;border-radius:.375rem;background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c);font-size:.875rem}.namespace-git__status[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;border-radius:.375rem;background:var(--color-surface-secondary, #f3f4f6);font-size:.875rem;display:flex;flex-direction:column;gap:.25rem}.namespace-git__status--ready[_ngcontent-%COMP%]{background:var(--color-success-bg, #ecfdf5);color:var(--color-success, #047857)}.namespace-git__status--failed[_ngcontent-%COMP%]{background:var(--red-bg, #fef2f2);color:var(--color-error, #b91c1c)}.namespace-git__status-reason[_ngcontent-%COMP%]{font-size:.8125rem;opacity:.9}.namespace-git__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.5rem;padding:1rem;margin:0}.namespace-git__label[_ngcontent-%COMP%]{font-weight:600;font-size:.9375rem;padding:0 .25rem}.namespace-git__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-git__field-label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500}.namespace-git__field-hint[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text-secondary, #6b7280)}.namespace-git__field-hint--warn[_ngcontent-%COMP%]{color:var(--color-warning, #b45309)}.namespace-git__input[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem .625rem;border:1px solid var(--color-border, #e5e7eb);border-radius:.375rem;background:var(--color-surface, #fff);color:inherit}.namespace-git__checkbox[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;cursor:pointer}.namespace-git__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.namespace-git__save[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%], .namespace-git__remove[_ngcontent-%COMP%], .namespace-git__cancel[_ngcontent-%COMP%]{font-family:inherit;font-size:.875rem;padding:.5rem 1rem;border-radius:.375rem;cursor:pointer;border:1px solid transparent}.namespace-git__save[_ngcontent-%COMP%]:disabled, .namespace-git__retry[_ngcontent-%COMP%]:disabled, .namespace-git__remove[_ngcontent-%COMP%]:disabled, .namespace-git__cancel[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.namespace-git__save[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);color:var(--color-text-on-accent, #fff)}.namespace-git__remove[_ngcontent-%COMP%]{background:none;border-color:var(--color-error, #b91c1c);color:var(--color-error, #b91c1c)}.namespace-git__cancel[_ngcontent-%COMP%], .namespace-git__retry[_ngcontent-%COMP%]{background:none;border-color:var(--color-border, #e5e7eb);color:inherit}"]})};
|
|
2
2
|
export{q as NamespaceGitComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-kFOHrPbJ.js';import {g,ao as V,dr as G,a as Gi,an as ue$1,cd as Hf,e as xw,s as si,cF as Pb,k as ws,n as GC,o as pl,J as Jw,X as XE,y as eC,bR as Id,bS as va,cB as on,Q as By,a7 as ya,a9 as lC,q as Rg,ai as tm,a3 as VI,ac as gC,ak as em,a6 as UI,a8 as Yg,t as rC,z as oC,cg as iT,b4 as oT,bf as aT,bg as uT,b0 as Qg,bi as lT,aa as If,ab as wf,aj as KC,a5 as vl}from'./main-2EYBZUJC.js';import {t as ti,J as Jn,Y as Ye,Z as Zn,l as Xn,g as gt,c as cn,d as an}from'./chunk-CZmNdEYy.js';import'./chunk-DqzTsn7a.js';import'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';var ne=e=>({title:"By agent",rows:e}),ie=e=>({title:"By model",rows:e}),ae=(e,o)=>[e,o],oe=(e,o)=>o.title,re=(e,o)=>o.key;function se(e,o){e&1&&(ws(0,"p",2),GC(1,"Loading usage settings\u2026"),pl());}function le(e,o){if(e&1){let t=lC();ws(0,"p",3),GC(1,"Could not load usage settings. Please try again."),pl(),ws(2,"button",4),Rg("click",function(){If(t);let s=gC();return wf(s.configuration.retry())}),GC(3,"Retry usage settings"),pl();}}function me(e,o){e&1&&(ws(0,"p",2),GC(1,"Usage tracking is disabled."),pl());}function de(e,o){e&1&&(ws(0,"p",3),GC(1),pl()),e&2&&(XE(),Yg(o));}function ce(e,o){e&1&&(ws(0,"p",2),GC(1,"Loading usage\u2026"),pl());}function pe(e,o){e&1&&(ws(0,"p"),GC(1,"No recorded usage for this period."),pl());}function ge(e,o){if(e&1&&(ws(0,"small"),GC(1),pl()),e&2){let t=gC().$implicit;XE(),vl("",t.aggregate.unknownCostCount," record(s) with unknown cost");}}function ue(e,o){if(e&1&&(ws(0,"tr")(1,"th",11),GC(2),pl(),ws(3,"td"),GC(4),aT(5,"number"),pl(),ws(6,"td"),GC(7),aT(8,"number"),aT(9,"number"),pl(),ws(10,"td"),GC(11),aT(12,"number"),aT(13,"number"),pl(),ws(14,"td"),GC(15),aT(16,"number"),Jw(17,ge,2,1,"small"),pl()()),e&2){let t=o.$implicit;XE(2),Yg(t.key),XE(2),Yg(uT(5,9,t.aggregate.totalTokens)),XE(3),Qg("",uT(8,11,t.aggregate.inputTokens)," / ",uT(9,13,t.aggregate.outputTokens)),XE(4),Qg(" ",uT(12,15,t.aggregate.cacheReadTokens)," / ",uT(13,17,t.aggregate.cacheWriteTokens)," "),XE(4),Qg(" ",t.aggregate.unknownCostCount>0?"At least ":"","",lT(16,19,t.aggregate.cost,"1.2-6")," "),XE(2),eC(t.aggregate.unknownCostCount>0?17:-1);}}function _e(e,o){if(e&1&&(ws(0,"div",9)(1,"table")(2,"thead")(3,"tr")(4,"th",10),GC(5,"Name"),pl(),ws(6,"th",10),GC(7,"Tokens"),pl(),ws(8,"th",10),GC(9,"Input / output"),pl(),ws(10,"th",10),GC(11,"Cache read / write"),pl(),ws(12,"th",10),GC(13,"Estimated cost"),pl()()(),ws(14,"tbody"),rC(15,ue,18,22,"tr",null,re),pl()()()),e&2){let t=gC().$implicit;XE(15),oC(t.rows);}}function Ce(e,o){if(e&1&&(ws(0,"h2"),GC(1),pl(),Jw(2,pe,2,0,"p")(3,_e,17,0,"div",9)),e&2){let t=o.$implicit;XE(),Yg(t.title),XE(),eC(t.rows.length===0?2:3);}}function fe(e,o){if(e&1&&(rC(0,Ce,4,2,null,null,oe),ws(2,"p"),GC(3,"Unpriced usage is kept separate from known costs. Active agent runs appear here after they finish."),pl()),e&2){let t=gC(2);oC(iT(4,ae,oT(0,ne,t.agents()),oT(2,ie,t.models())));}}function ye(e,o){if(e&1){let t=lC();ws(0,"p"),GC(1,"Recorded LLM usage across this namespace. Costs are estimates in the platform currency."),pl(),ws(2,"form",5),Rg("ngSubmit",function(){If(t);let s=gC();return wf(s.load())}),ws(3,"label"),GC(4,"From (UTC)"),ws(5,"input",6),tm("ngModelChange",function(s){If(t);let d=gC();return KC(d.from,s)||(d.from=s),wf(s)}),pl(),VI(),pl(),ws(6,"label"),GC(7,"To (UTC)"),ws(8,"input",7),tm("ngModelChange",function(s){If(t);let d=gC();return KC(d.to,s)||(d.to=s),wf(s)}),pl(),VI(),pl(),ws(9,"button",8),GC(10,"Refresh"),pl()(),Jw(11,de,2,1,"p",3),Jw(12,ce,2,0,"p",2)(13,fe,4,7);}if(e&2){let t,r=gC();XE(5),em("ngModel",r.from),UI(),XE(3),em("ngModel",r.to),UI(),XE(3),eC((t=r.error())?11:-1,t),XE(),eC(r.loading()?12:r.error()?-1:13);}}var te=class e{route=g(V);api=g(G);configuration=g(c);namespaceId=this.route.snapshot.params.namespaceId;agents=Gi([]);models=Gi([]);error=Gi(null);loading=Gi(false);from=new Date(Date.now()-30*864e5).toISOString().slice(0,10);to=new Date().toISOString().slice(0,10);refresh=new ue$1;constructor(){Hf(o=>{if(!this.configuration.enabled())return;let t=this.refresh.pipe(Id(void 0),va(()=>{this.error.set(null),this.agents.set([]),this.models.set([]);let r=new Date(`${this.from}T00:00:00.000Z`),s=new Date(`${this.to}T23:59:59.999Z`);return !Number.isFinite(r.getTime())||!Number.isFinite(s.getTime())||r>s?(this.error.set("Select a valid date range."),this.loading.set(false),on):(this.loading.set(true),By({agents:this.api.aggregateByAgentUsageRecord(this.namespaceId,r.toISOString(),s.toISOString()),models:this.api.aggregateByModelUsageRecord(this.namespaceId,r.toISOString(),s.toISOString())}).pipe(ya(d=>(this.loading.set(false),this.error.set(d.status===403?"Namespace admin permission is required to view this report.":"Could not load usage. Please try again."),on))))})).subscribe(({agents:r,models:s})=>{this.agents.set(r),this.models.set(s),this.loading.set(false);});o(()=>t.unsubscribe());});}load(){this.configuration.enabled()&&this.refresh.next();}static \u0275fac=function(t){return new(t||e)};static \u0275cmp=xw({type:e,selectors:[["agentos-namespace-usage"]],decls:9,vars:1,consts:[[1,"report"],["routerLink","/agentos/namespaces"],["role","status"],["role","alert"],["type","button",3,"click"],[1,"filters",3,"ngSubmit"],["type","date","name","from","required","",3,"ngModelChange","ngModel"],["type","date","name","to","required","",3,"ngModelChange","ngModel"],["type","submit"],[1,"table-wrap"],["scope","col"],["scope","row"]],template:function(t,r){t&1&&(ws(0,"section",0)(1,"a",1),GC(2,"\u2190 Namespaces"),pl(),ws(3,"h1"),GC(4,"Usage and costs"),pl(),Jw(5,se,2,0,"p",2)(6,le,4,0)(7,me,2,0,"p",2)(8,ye,14,4),pl()),t&2&&(XE(5),eC(r.configuration.state()==="loading"?5:r.configuration.state()==="error"?6:r.configuration.state()==="disabled"?7:8));},dependencies:[ti,Jn,Ye,Zn,Xn,gt,cn,an,si,Pb],styles:["[_nghost-%COMP%]{display:block}.report[_ngcontent-%COMP%]{max-width:1100px;margin:auto;padding:1.5rem;color:var(--color-text, inherit)}a[_ngcontent-%COMP%]{color:inherit}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:1rem;align-items:end;margin:1.5rem 0}label[_ngcontent-%COMP%]{display:grid;gap:.4rem}input[_ngcontent-%COMP%], button[_ngcontent-%COMP%]{font:inherit;color:inherit;background:transparent;border:1px solid var(--color-border, rgba(136, 136, 136, .5333333333));border-radius:.4rem;padding:.5rem .75rem}button[_ngcontent-%COMP%]{cursor:pointer}.table-wrap[_ngcontent-%COMP%]{overflow-x:auto}table[_ngcontent-%COMP%]{border-collapse:collapse;width:100%}th[_ngcontent-%COMP%], td[_ngcontent-%COMP%]{text-align:left;padding:.75rem;border-bottom:1px solid var(--color-border, rgba(136, 136, 136, .3333333333))}small[_ngcontent-%COMP%]{display:block;margin-top:.3rem}h2[_ngcontent-%COMP%]{margin-top:2rem}"]})};export{te as NamespaceUsageComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {n as ne}from'./chunk-
|
|
1
|
+
import {n as ne}from'./chunk-CK18gZ63.js';import {g,Z as z$1,_ as Ue,e as xw,$ as zt,a0 as jt,a1 as Vt,a2 as Nt,h as hr,i as pr,k as ws,n as GC,o as pl,J as Jw,q as Rg,X as XE,A as Ug,a5 as vl,a8 as Yg,y as eC,v as bg,a9 as lC,ai as tm,aa as If,ac as gC,aj as KC,ab as wf,a3 as VI,ak as em,a6 as UI}from'./main-2EYBZUJC.js';import {y as yt,w as wt,t as ti,Z as Zn,c as cn}from'./chunk-CZmNdEYy.js';function G(c,p){if(c&1){let t=lC();ws(0,"mat-checkbox",5),tm("ngModelChange",function(l){If(t);let f=gC();return KC(f.checkboxChecked,l)||(f.checkboxChecked=l),wf(l)}),GC(1),pl(),VI();}if(c&2){let t=gC();em("ngModel",t.checkboxChecked),UI(),XE(),Yg(t.data.checkboxLabel);}}var z=class c{dialogRef=g(z$1);data=g(Ue);checkboxChecked=false;confirm(){this.dialogRef.close({confirmed:true,checkboxChecked:this.checkboxChecked});}cancel(){this.dialogRef.close({confirmed:false});}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=xw({type:c,selectors:[["app-confirm-dialog"]],decls:13,vars:8,consts:[["mat-dialog-title",""],[3,"ngModel"],["align","end"],["mat-button","",3,"click"],["mat-flat-button","",3,"click","color"],[3,"ngModelChange","ngModel"]],template:function(t,e){t&1&&(ws(0,"h2",0)(1,"mat-icon"),GC(2,"warning"),pl(),GC(3),pl(),ws(4,"mat-dialog-content")(5,"p"),GC(6),pl(),Jw(7,G,2,2,"mat-checkbox",1),pl(),ws(8,"mat-dialog-actions",2)(9,"button",3),Rg("click",function(){return e.cancel()}),GC(10),pl(),ws(11,"button",4),Rg("click",function(){return e.confirm()}),GC(12),pl()()),t&2&&(XE(),Ug("destructive",!!e.data.isDestructive),XE(2),vl(" ",e.data.title,`
|
|
2
2
|
`),XE(3),Yg(e.data.message),XE(),eC(e.data.checkboxLabel?7:-1),XE(3),Yg(e.data.cancelLabel??"Cancel"),XE(),bg("color",e.data.isDestructive?"warn":"primary"),XE(),vl(" ",e.data.confirmLabel??"Confirm"," "));},dependencies:[zt,jt,Vt,Nt,hr,pr,yt,wt,ne,ti,Zn,cn],styles:["h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}h2[mat-dialog-title][_ngcontent-%COMP%] mat-icon.destructive[_ngcontent-%COMP%]{color:var(--color-error, #f44336)}mat-dialog-content[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:var(--color-text-secondary);line-height:1.5}mat-dialog-content[_ngcontent-%COMP%] mat-checkbox[_ngcontent-%COMP%]{display:block;margin-top:8px;font-size:.875rem}"]})};export{z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {O}from'./chunk-
|
|
1
|
+
import {O}from'./chunk-D3gurhpR.js';import {R}from'./chunk-B_gHVcU6.js';import {g,G,C as Ce,aJ as Tr,a as Gi,bS as va,r as re,b as U,e as xw,aK as xb,k as ws,bf as aT,q as Rg,n as GC,o as pl,af as Eg,u as CC,v as bg,bg as uT,ah as rT,J as Jw,ac as gC,y as eC,a9 as lC,aa as If,ab as wf,ag as fT}from'./main-2EYBZUJC.js';import'./chunk-kFOHrPbJ.js';import {W as Wn}from'./chunk-Bx_FH6m3.js';import'./chunk-BPkyqr-f.js';import'./chunk-CZmNdEYy.js';import'./chunk-BWcVMw4T.js';import'./chunk-DqzTsn7a.js';var k=()=>[];function V(i,t){if(i&1){let e=lC();ws(0,"agentos-auth-setting-item",4),Rg("editRequested",function(n){If(e);let p=gC(2);return wf(p.onEdit(n))})("deleteRequested",function(n){If(e);let p=gC(2);return wf(p.onDelete(n))}),pl();}i&2&&bg("config",t)("showBadge",false);}function F(i,t){if(i&1&&Jw(0,V,1,2,"agentos-auth-setting-item",3),i&2){let e,o=t.$implicit,n=gC();eC((e=n.resolveSetting(o.id))?0:-1,e);}}var M=class i{router=g(G);destroyRef=g(Ce);state=g(R);refresh$=new Tr(void 0);isLoading=Gi(true);settings$=this.refresh$.pipe(va(()=>(this.isLoading.set(true),this.state.loadPlatformSettings())));settingItems$=this.settings$.pipe(re(t=>t.map(e=>({id:e.id??"",name:e.name,description:e.authType}))));settingsById=new Map;constructor(){this.settings$.pipe(U(this.destroyRef)).subscribe({next:t=>{this.settingsById=new Map(t.map(e=>[e.id??"",e])),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}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=xw({type:i,selectors:[["agentos-platform-auth-settings"]],decls:6,vars:7,consts:[["authSettingItemTpl",""],["title","Platform Auth Settings","emptyMessage","No platform auth settings defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","loading","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&&(ws(0,"ds-entity-list",1),aT(1,"async"),Rg("createRequested",function(){return o.openCreateForm()}),ws(2,"button",2),Rg("click",function(){return o.goBack()}),GC(3,"\u2190 Admin"),pl()(),Eg(4,F,1,1,"ng-template",null,0,fT)),e&2){let n=CC(5);bg("items",uT(1,4,o.settingItems$)??rT(6,k))("loading",o.isLoading())("showCreate",true)("itemTemplate",n);}},dependencies:[Wn,O,xb],encapsulation:2})};export{M as PlatformAuthSettingsComponent};
|