@whoz-oss/coday-client 0.213.0 → 0.214.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-A34IERCN.js → chunk-277IC2QE.js} +1 -1
- package/browser/{chunk-JIPJ76UT.js → chunk-2PRKBGAK.js} +1 -1
- package/browser/{chunk-TUARXNRR.js → chunk-34VSHF53.js} +1 -1
- package/browser/{chunk-2HEJ7K6I.js → chunk-42PHOVHW.js} +1 -1
- package/browser/{chunk-ZPHUI4F6.js → chunk-7CZDTFEW.js} +1 -1
- package/browser/{chunk-MSMRBM6R.js → chunk-7JNEJMOU.js} +1 -1
- package/browser/{chunk-3FFHE56W.js → chunk-BPJO7AWC.js} +1 -1
- package/browser/{chunk-GVYMNRD4.js → chunk-C2K3CJDB.js} +1 -1
- package/browser/{chunk-3F2YMBKP.js → chunk-CPH6KZS7.js} +1 -1
- package/browser/{chunk-5GF6TTRK.js → chunk-D4HRVNXF.js} +1 -1
- package/browser/{chunk-KWBMAZB4.js → chunk-DRZNSAVZ.js} +1 -1
- package/browser/{chunk-GCJZKHAW.js → chunk-E6H3OGX4.js} +1 -1
- package/browser/{chunk-C47ZCNLR.js → chunk-EAYCLP6Q.js} +1 -1
- package/browser/chunk-EEXBA3SZ.js +1 -0
- package/browser/{chunk-TEJQAOQQ.js → chunk-EYIALH4L.js} +1 -1
- package/browser/{chunk-6MPSH5Y7.js → chunk-FBB7REI2.js} +1 -1
- package/browser/{chunk-KP4KMDLX.js → chunk-GN5OSMEB.js} +1 -1
- package/browser/{chunk-J7IFGV56.js → chunk-HGBGIBBE.js} +1 -1
- package/browser/{chunk-MVRV42NP.js → chunk-L5WQCZRE.js} +1 -1
- package/browser/{chunk-O37JOBGG.js → chunk-LS4KFB4C.js} +1 -1
- package/browser/{chunk-SDINNYUR.js → chunk-MRSRN4TG.js} +1 -1
- package/browser/{chunk-ONZHMPPP.js → chunk-N2EM2OHG.js} +1 -1
- package/browser/{chunk-7RVP2EHC.js → chunk-OUMQX2CT.js} +1 -1
- package/browser/{chunk-EFCODPLG.js → chunk-OUSIG6VB.js} +1 -1
- package/browser/{chunk-XEZKOM4R.js → chunk-PO5YVRVZ.js} +1 -1
- package/browser/{chunk-DEXRATBM.js → chunk-PVRZ743D.js} +1 -1
- package/browser/chunk-QVQF6CQG.js +1 -0
- package/browser/{chunk-2BN4B3OL.js → chunk-R6R7XD7M.js} +1 -1
- package/browser/{chunk-VPYY4J2W.js → chunk-SQLOY43N.js} +1 -1
- package/browser/{chunk-GPZP3WYQ.js → chunk-TPQSKNWC.js} +1 -1
- package/browser/{chunk-QCUONBHJ.js → chunk-WQU7BC4Q.js} +1 -1
- package/browser/chunk-XS2UZDZH.js +1 -0
- package/browser/{chunk-V3HCXJKS.js → chunk-XYSPIFZC.js} +1 -1
- package/browser/{chunk-W7YYBRGC.js → chunk-ZET4SKHG.js} +1 -1
- package/browser/chunk-ZR5OMYGQ.js +1 -0
- package/browser/{chunk-F4BSKSY7.js → chunk-ZWM3VY6S.js} +1 -1
- package/browser/index.html +1 -1
- package/browser/{main-JYYTUNUG.js → main-VMGRWPKV.js} +1 -1
- package/package.json +1 -1
- package/browser/chunk-4CDCFIEK.js +0 -1
- package/browser/chunk-7FTSWXXP.js +0 -1
- package/browser/chunk-RTAXT4D4.js +0 -1
- package/browser/chunk-W7ZS65Y4.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as p}from"./chunk-
|
|
1
|
+
import{m as p}from"./chunk-QVQF6CQG.js";import{V as s,Z as d,a as n,ca as u,ta as a}from"./chunk-5NLXR4MK.js";var c=class o{userController=u(p);users=a([]);isLoading=a(!1);loadAll(){return this.isLoading.set(!0),this.userController.listAllUser().pipe(s({next:e=>{this.users.set(e),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)}))}createUser(e){return this.userController.createUser(e).pipe(s(()=>{this.loadAll().subscribe()}))}updateUser(e,r){let t=this.users().find(i=>i.id===e);if(!t)throw new Error(`Cannot update: user ${e} not found in state`);let U=n(n({},t),r);return this.userController.updateUser(e,U).pipe(s(i=>{this.users.update(b=>b.map(l=>l.id===i.id?i:l))}))}deleteUser(e){return this.userController.deleteUser(e).pipe(s(()=>{this.users.update(r=>r.filter(t=>t.id!==e))}))}static \u0275fac=function(r){return new(r||o)};static \u0275prov=d({token:o,factory:o.\u0275fac,providedIn:"root"})};export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-DB2U5ZVV.js";import{c as q,d as O}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-DB2U5ZVV.js";import{c as q,d as O}from"./chunk-QVQF6CQG.js";import{a as E,c as $}from"./chunk-P4GNUQZT.js";import{r as D,x as S}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as M}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as R,D as g,Db as l,Fb as s,Jc as L,Pb as N,S as A,Wa as h,ab as I,bc as w,ca as r,ec as x,fc as B,ga as p,ha as m,i as u,ic as T,lb as b,m as f,ma as C,mb as P,rb as c,sb as d,t as y,tb as _,z as v}from"./chunk-5NLXR4MK.js";var V=()=>[];function K(n,t){if(n&1){let i=R();d(0,"agentos-ai-model-item",4),l("deleteRequested",function(a){p(i);let e=s(2);return m(e.deleteModel(a))})("editRequested",function(a){p(i);let e=s(2);return m(e.editModel(a))}),_()}if(n&2){let i=s().$implicit,o=s();c("model",t)("namespaceId",o.namespaceId)("readOnly",o.isPlatformModel(i.id))}}function U(n,t){if(n&1&&b(0,K,1,3,"agentos-ai-model-item",3),n&2){let i,o=t.$implicit,a=s();P((i=a.resolveModel(o.id))?0:-1,i)}}var j="__platform__",G="Platform (read-only)",F=class n{route=r(E);router=r($);destroyRef=r(C);aiModelController=r(q);aiProviderController=r(O);namespaceId=this.route.snapshot.params.namespaceId;refresh$=new u(void 0);data$=this.refresh$.pipe(A(()=>v({namespace:this.aiModelController.listByNamespaceIdAiModel(this.namespaceId),platform:this.aiModelController.listPlatformLevelAiModel().pipe(g(()=>f([]))),providers:this.aiProviderController.listAiProvider(this.namespaceId)})));modelItems$=this.data$.pipe(y(({namespace:t,platform:i,providers:o})=>{let a=new Map(o.map(e=>[e.id??"",e.name]));return[...i.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:j,groupLabel:G})),...t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:a.get(e.aiProviderId)??e.aiProviderId}))]}));namespaceModelsById=new Map;platformModelsById=new Map;constructor(){this.data$.pipe(M(this.destroyRef)).subscribe(({namespace:t,platform:i})=>{this.namespaceModelsById=new Map(t.map(o=>[o.id??"",o])),this.platformModelsById=new Map(i.map(o=>[o.id??"",o]))})}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-models","new"])}editModel(t){this.router.navigate(["/agentos",this.namespaceId,"ai-models",t.id,"edit"])}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(M(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveModel(t){return this.namespaceModelsById.get(t)??this.platformModelsById.get(t)??null}isPlatformModel(t){return this.platformModelsById.has(t)}static \u0275fac=function(i){return new(i||n)};static \u0275cmp=h({type:n,selectors:[["agentos-namespace-ai-models"]],decls:5,vars:6,consts:[["aiModelItemTpl",""],["title","AI models","emptyMessage","No AI models configured yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model","namespaceId","readOnly"],[3,"deleteRequested","editRequested","model","namespaceId","readOnly"]],template:function(i,o){if(i&1&&(d(0,"ds-entity-list",1),x(1,"async"),l("createRequested",function(){return o.openCreateForm()}),d(2,"ds-icon-button",2),l("action",function(){return o.goBack()}),_()(),I(3,U,1,1,"ng-template",null,0,T)),i&2){let a=N(4);c("items",B(1,3,o.modelItems$)??w(5,V))("showCreate",!0)("itemTemplate",a)}},dependencies:[S,k,D,L],encapsulation:2,changeDetection:0})};export{F as NamespaceAiModelsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K}from"./chunk-O37JOBGG.js";import"./chunk-W7ZS65Y4.js";import{a as T,c as G}from"./chunk-P4GNUQZT.js";import{a as w}from"./chunk-SKBT6DBT.js";import{F as J,c as z,e as c,g as $,h as R,i as F,l as v,n as L,r as N,s as B,t as q,u as U,v as j,w as H}from"./chunk-Z6RFJ6L3.js";import{Bb as y,Db as s,Fb as d,Ka as a,Rb as P,Tb as r,Ub as b,Vb as k,Wa as D,a as A,b as V,ca as h,ga as f,ha as _,lb as u,ma as I,mb as g,nb as S,pb as E,qb as O,rb as p,sb as n,ta as C,tb as o,ub as x}from"./chunk-5NLXR4MK.js";function W(m,t){m&1&&(n(0,"p",5),r(1,"Loading\u2026"),o())}function X(m,t){m&1&&(n(0,"span",12),r(1,"Name is required."),o())}function Y(m,t){m&1&&(n(0,"p",19),r(1,"No parameters defined."),o())}function Z(m,t){m&1&&(n(0,"span",12),r(1,"Parameter name is required."),o())}function ee(m,t){if(m&1){let e=y();n(0,"div",20)(1,"div",27)(2,"div",28)(3,"label",29),r(4,"Name "),n(5,"span",10),r(6,"*"),o()(),x(7,"input",30),u(8,Z,2,0,"span",12),o(),n(9,"div",28)(10,"label",29),r(11,"Description"),o(),x(12,"input",31),o(),n(13,"div",28)(14,"label",29),r(15,"Default value"),o(),x(16,"input",32),o()(),n(17,"button",33),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeParameter(l))}),r(18," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index;p("formGroupName",i),a(3),p("for","param-name-"+i),a(4),P("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),p("id","param-name-"+i),a(),g(e.controls.name.invalid&&e.controls.name.touched?8:-1),a(2),p("for","param-desc-"+i),a(2),p("id","param-desc-"+i),a(2),p("for","param-default-"+i),a(2),p("id","param-default-"+i)}}function te(m,t){m&1&&(n(0,"span",12),r(1,"Content entry must not be blank."),o())}function re(m,t){if(m&1){let e=y();n(0,"div",22)(1,"span",34),r(2),o(),n(3,"div",35),x(4,"textarea",36),u(5,te,2,0,"span",12),o(),n(6,"button",37),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeContentEntry(l))}),r(7," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index,l=d(2);a(2),b(i+1),a(2),P("prompt-form__textarea--invalid",e.invalid&&e.touched),p("formControlName",i),a(),g(e.invalid&&e.touched?5:-1),a(),p("disabled",l.contentArray.length===1)}}function oe(m,t){if(m&1&&(n(0,"p",23),r(1),o()),m&2){let e=d(2);a(),b(e.errorMessage())}}function ne(m,t){if(m&1){let e=y();n(0,"form",7),s("ngSubmit",function(){f(e);let l=d();return _(l.submit())}),n(1,"div",8)(2,"label",9),r(3,"Name "),n(4,"span",10),r(5,"*"),o()(),x(6,"input",11),u(7,X,2,0,"span",12),o(),n(8,"div",8)(9,"label",13),r(10,"Description"),o(),x(11,"input",14),o(),n(12,"fieldset",15)(13,"legend",16),r(14," Parameters "),n(15,"span",17),r(16,"Named placeholders used in content"),o()(),n(17,"p",18),r(18," Each parameter must have a name and a default value. Use "),n(19,"code"),r(20),o(),r(21," in content entries to reference them. "),o(),u(22,Y,2,0,"p",19),E(23,ee,19,10,"div",20,S),n(25,"button",21),s("click",function(){f(e);let l=d();return _(l.addParameter())}),r(26,"+ Add parameter"),o()(),n(27,"fieldset",15)(28,"legend",16),r(29," Content "),n(30,"span",10),r(31,"*"),o(),n(32,"span",17),r(33,"Ordered list of text commands"),o()(),n(34,"p",18),r(35," Each content entry is a command. Use "),n(36,"code"),r(37,"@AgentName"),o(),r(38," to target an agent, "),n(39,"code"),r(40,"/promptName param1 param2"),o(),r(41," to call another prompt, and "),n(42,"code"),r(43),o(),r(44," for parameter placeholders. "),o(),E(45,re,8,6,"div",22,S),n(47,"button",21),s("click",function(){f(e);let l=d();return _(l.addContentEntry())}),r(48,"+ Add content entry"),o()(),u(49,oe,2,1,"p",23),n(50,"div",24)(51,"button",25),r(52),o(),n(53,"button",26),s("click",function(){f(e);let l=d();return _(l.cancel())}),r(54,"Cancel"),o()()()}if(m&2){let e=d();p("formGroup",e.form),a(6),P("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),p("formControl",e.nameControl),a(),g(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(4),p("formControl",e.descriptionControl),a(),p("formArrayName","parameters"),a(8),b(e.paramPlaceholderSyntax),a(2),g(e.parametersArray.length===0?22:-1),a(),O(e.parametersArray.controls),a(4),p("formArrayName","content"),a(16),b(e.paramPlaceholderSyntax),a(2),O(e.contentArray.controls),a(4),g(e.errorMessage()?49:-1),a(2),p("disabled",e.form.invalid||e.isSubmitting()),a(),k(" ",e.isEditMode()?"Save changes":"Create"," ")}}var Q=class m{route=h(T);router=h(G);destroyRef=h(I);promptState=h(K);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new F({name:new v("",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(null),content:new N([this.createContentControl()],{validators:[c.required]}),parameters:new N([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=C(!1);isSubmitting=C(!1);isLoading=C(!1);errorMessage=C(null);paramPlaceholderSyntax="{{paramName}}";existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(!0),this.loadPrompt(t))}loadPrompt(t){this.isLoading.set(!0),this.promptState.getById(t).pipe(w(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(i=>this.contentArray.push(this.createContentControl(i))),this.parametersArray.clear(),(t.parameters??[]).forEach(i=>this.parametersArray.push(this.createParameterGroup(i)))}createContentControl(t=""){return new v(t,{nonNullable:!0,validators:[c.required,c.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl())}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t)}createParameterGroup(t){return new F({name:new v(t?.name??"",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(t?.description??null),defaultValue:new v(t?.defaultValue??"",{nonNullable:!0,validators:[c.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup())}removeParameter(t){this.parametersArray.removeAt(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=V(A({},this.existingPrompt??{}),{namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(i=>i.value.trim()),parameters:this.parametersArray.controls.map(i=>({name:i.controls.name.value.trim(),description:i.controls.description.value?.trim()||void 0,defaultValue:i.controls.defaultValue.value.trim()}))}),e=this.isEditMode()&&this.existingPrompt?.id?this.promptState.update(this.existingPrompt.id,t):this.promptState.create(t);this.errorMessage.set(null),e.pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(!1),i.status===409?this.errorMessage.set(`A prompt named "${t.name}" already exists in this scope.`):i.status===400?this.errorMessage.set(i.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"])}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=D({type:m,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"]],template:function(e,i){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),s("click",function(){return i.cancel()}),n(3,"span",3),r(4,"\u2190"),o(),r(5),o(),n(6,"h1",4),r(7),o()(),u(8,W,2,0,"p",5)(9,ne,55,14,"form",6),o()),e&2&&(a(5),k(" ",i.isPlatformMode?"Platform prompts":"Prompts"," "),a(2),b(i.isEditMode()?"Edit prompt":"New prompt"),a(),g(i.isLoading()?8:9))},dependencies:[J,L,z,$,R,B,H,j,q,U],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-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-primary, #007aff);font-family:inherit}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);margin-left:.375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary, #6e6e73);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:6px;background:var(--color-surface-hover, rgba(0, 0, 0, .03))}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:6px;border:1px dashed var(--color-border, rgba(0, 0, 0, .15));background:transparent;color:var(--color-primary, #007aff);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:50%;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-error-light, rgba(255, 59, 48, .08));color:var(--color-error, #ff3b30);border-color:var(--color-error, #ff3b30)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:8px;background:var(--color-error-light, rgba(255, 59, 48, .08));border:1px solid var(--color-error, #ff3b30);color:var(--color-error, #ff3b30);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--color-error, #ff3b30)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{Q as PromptFormComponent};
|
|
1
|
+
import{a as K}from"./chunk-LS4KFB4C.js";import"./chunk-QVQF6CQG.js";import{a as T,c as G}from"./chunk-P4GNUQZT.js";import{a as w}from"./chunk-SKBT6DBT.js";import{F as J,c as z,e as c,g as $,h as R,i as F,l as v,n as L,r as N,s as B,t as q,u as U,v as j,w as H}from"./chunk-Z6RFJ6L3.js";import{Bb as y,Db as s,Fb as d,Ka as a,Rb as P,Tb as r,Ub as b,Vb as k,Wa as D,a as A,b as V,ca as h,ga as f,ha as _,lb as u,ma as I,mb as g,nb as S,pb as E,qb as O,rb as p,sb as n,ta as C,tb as o,ub as x}from"./chunk-5NLXR4MK.js";function W(m,t){m&1&&(n(0,"p",5),r(1,"Loading\u2026"),o())}function X(m,t){m&1&&(n(0,"span",12),r(1,"Name is required."),o())}function Y(m,t){m&1&&(n(0,"p",19),r(1,"No parameters defined."),o())}function Z(m,t){m&1&&(n(0,"span",12),r(1,"Parameter name is required."),o())}function ee(m,t){if(m&1){let e=y();n(0,"div",20)(1,"div",27)(2,"div",28)(3,"label",29),r(4,"Name "),n(5,"span",10),r(6,"*"),o()(),x(7,"input",30),u(8,Z,2,0,"span",12),o(),n(9,"div",28)(10,"label",29),r(11,"Description"),o(),x(12,"input",31),o(),n(13,"div",28)(14,"label",29),r(15,"Default value"),o(),x(16,"input",32),o()(),n(17,"button",33),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeParameter(l))}),r(18," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index;p("formGroupName",i),a(3),p("for","param-name-"+i),a(4),P("prompt-form__input--invalid",e.controls.name.invalid&&e.controls.name.touched),p("id","param-name-"+i),a(),g(e.controls.name.invalid&&e.controls.name.touched?8:-1),a(2),p("for","param-desc-"+i),a(2),p("id","param-desc-"+i),a(2),p("for","param-default-"+i),a(2),p("id","param-default-"+i)}}function te(m,t){m&1&&(n(0,"span",12),r(1,"Content entry must not be blank."),o())}function re(m,t){if(m&1){let e=y();n(0,"div",22)(1,"span",34),r(2),o(),n(3,"div",35),x(4,"textarea",36),u(5,te,2,0,"span",12),o(),n(6,"button",37),s("click",function(){let l=f(e).$index,M=d(2);return _(M.removeContentEntry(l))}),r(7," \xD7 "),o()()}if(m&2){let e=t.$implicit,i=t.$index,l=d(2);a(2),b(i+1),a(2),P("prompt-form__textarea--invalid",e.invalid&&e.touched),p("formControlName",i),a(),g(e.invalid&&e.touched?5:-1),a(),p("disabled",l.contentArray.length===1)}}function oe(m,t){if(m&1&&(n(0,"p",23),r(1),o()),m&2){let e=d(2);a(),b(e.errorMessage())}}function ne(m,t){if(m&1){let e=y();n(0,"form",7),s("ngSubmit",function(){f(e);let l=d();return _(l.submit())}),n(1,"div",8)(2,"label",9),r(3,"Name "),n(4,"span",10),r(5,"*"),o()(),x(6,"input",11),u(7,X,2,0,"span",12),o(),n(8,"div",8)(9,"label",13),r(10,"Description"),o(),x(11,"input",14),o(),n(12,"fieldset",15)(13,"legend",16),r(14," Parameters "),n(15,"span",17),r(16,"Named placeholders used in content"),o()(),n(17,"p",18),r(18," Each parameter must have a name and a default value. Use "),n(19,"code"),r(20),o(),r(21," in content entries to reference them. "),o(),u(22,Y,2,0,"p",19),E(23,ee,19,10,"div",20,S),n(25,"button",21),s("click",function(){f(e);let l=d();return _(l.addParameter())}),r(26,"+ Add parameter"),o()(),n(27,"fieldset",15)(28,"legend",16),r(29," Content "),n(30,"span",10),r(31,"*"),o(),n(32,"span",17),r(33,"Ordered list of text commands"),o()(),n(34,"p",18),r(35," Each content entry is a command. Use "),n(36,"code"),r(37,"@AgentName"),o(),r(38," to target an agent, "),n(39,"code"),r(40,"/promptName param1 param2"),o(),r(41," to call another prompt, and "),n(42,"code"),r(43),o(),r(44," for parameter placeholders. "),o(),E(45,re,8,6,"div",22,S),n(47,"button",21),s("click",function(){f(e);let l=d();return _(l.addContentEntry())}),r(48,"+ Add content entry"),o()(),u(49,oe,2,1,"p",23),n(50,"div",24)(51,"button",25),r(52),o(),n(53,"button",26),s("click",function(){f(e);let l=d();return _(l.cancel())}),r(54,"Cancel"),o()()()}if(m&2){let e=d();p("formGroup",e.form),a(6),P("prompt-form__input--invalid",e.nameControl.invalid&&e.nameControl.touched),p("formControl",e.nameControl),a(),g(e.nameControl.invalid&&e.nameControl.touched?7:-1),a(4),p("formControl",e.descriptionControl),a(),p("formArrayName","parameters"),a(8),b(e.paramPlaceholderSyntax),a(2),g(e.parametersArray.length===0?22:-1),a(),O(e.parametersArray.controls),a(4),p("formArrayName","content"),a(16),b(e.paramPlaceholderSyntax),a(2),O(e.contentArray.controls),a(4),g(e.errorMessage()?49:-1),a(2),p("disabled",e.form.invalid||e.isSubmitting()),a(),k(" ",e.isEditMode()?"Save changes":"Create"," ")}}var Q=class m{route=h(T);router=h(G);destroyRef=h(I);promptState=h(K);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new F({name:new v("",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(null),content:new N([this.createContentControl()],{validators:[c.required]}),parameters:new N([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=C(!1);isSubmitting=C(!1);isLoading=C(!1);errorMessage=C(null);paramPlaceholderSyntax="{{paramName}}";existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(!0),this.loadPrompt(t))}loadPrompt(t){this.isLoading.set(!0),this.promptState.getById(t).pipe(w(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(i=>this.contentArray.push(this.createContentControl(i))),this.parametersArray.clear(),(t.parameters??[]).forEach(i=>this.parametersArray.push(this.createParameterGroup(i)))}createContentControl(t=""){return new v(t,{nonNullable:!0,validators:[c.required,c.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl())}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t)}createParameterGroup(t){return new F({name:new v(t?.name??"",{nonNullable:!0,validators:[c.required,c.minLength(1)]}),description:new v(t?.description??null),defaultValue:new v(t?.defaultValue??"",{nonNullable:!0,validators:[c.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup())}removeParameter(t){this.parametersArray.removeAt(t)}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let t=V(A({},this.existingPrompt??{}),{namespaceId:this.namespaceId,name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(i=>i.value.trim()),parameters:this.parametersArray.controls.map(i=>({name:i.controls.name.value.trim(),description:i.controls.description.value?.trim()||void 0,defaultValue:i.controls.defaultValue.value.trim()}))}),e=this.isEditMode()&&this.existingPrompt?.id?this.promptState.update(this.existingPrompt.id,t):this.promptState.create(t);this.errorMessage.set(null),e.pipe(w(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:i=>{this.isSubmitting.set(!1),i.status===409?this.errorMessage.set(`A prompt named "${t.name}" already exists in this scope.`):i.status===400?this.errorMessage.set(i.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.")}})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"])}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=D({type:m,selectors:[["agentos-prompt-form"]],decls:10,vars:3,consts:[[1,"prompt-form"],[1,"prompt-form__header"],["type","button","title","Back to prompts",1,"prompt-form__back",3,"click"],[1,"prompt-form__back-icon"],[1,"prompt-form__title"],[1,"prompt-form__loading"],[1,"prompt-form__form",3,"formGroup"],[1,"prompt-form__form",3,"ngSubmit","formGroup"],[1,"prompt-form__field"],["for","prompt-name",1,"prompt-form__label"],["aria-hidden","true"],["id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__field-error"],["for","prompt-description",1,"prompt-form__label"],["id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",1,"prompt-form__input",3,"formControl"],[1,"prompt-form__section",3,"formArrayName"],[1,"prompt-form__label"],[1,"prompt-form__label-hint"],[1,"prompt-form__section-hint"],[1,"prompt-form__empty-hint"],[1,"prompt-form__param-row",3,"formGroupName"],["type","button",1,"prompt-form__add-btn",3,"click"],[1,"prompt-form__content-row"],[1,"prompt-form__error"],[1,"prompt-form__actions"],["type","submit",1,"prompt-form__btn","prompt-form__btn--primary",3,"disabled"],["type","button",1,"prompt-form__btn",3,"click"],[1,"prompt-form__param-fields"],[1,"prompt-form__field","prompt-form__field--inline"],[1,"prompt-form__label",3,"for"],["type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","Optional","formControlName","description","autocomplete","off",1,"prompt-form__input",3,"id"],["type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",1,"prompt-form__input",3,"id"],["type","button","title","Remove this parameter",1,"prompt-form__remove-btn",3,"click"],[1,"prompt-form__content-index"],[1,"prompt-form__content-field"],["rows","4","placeholder","Enter a command\u2026",1,"prompt-form__textarea",3,"formControlName"],["type","button","title","Remove this entry",1,"prompt-form__remove-btn",3,"click","disabled"]],template:function(e,i){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),s("click",function(){return i.cancel()}),n(3,"span",3),r(4,"\u2190"),o(),r(5),o(),n(6,"h1",4),r(7),o()(),u(8,W,2,0,"p",5)(9,ne,55,14,"form",6),o()),e&2&&(a(5),k(" ",i.isPlatformMode?"Platform prompts":"Prompts"," "),a(2),b(i.isEditMode()?"Edit prompt":"New prompt"),a(),g(i.isLoading()?8:9))},dependencies:[J,L,z,$,R,B,H,j,q,U],styles:[".prompt-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.prompt-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.prompt-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-primary, #007aff);font-family:inherit}.prompt-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.prompt-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.prompt-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.prompt-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.prompt-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.prompt-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.prompt-form__field--inline[_ngcontent-%COMP%]{flex:1}.prompt-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.prompt-form__label-hint[_ngcontent-%COMP%]{font-weight:400;color:var(--color-text-secondary, #6e6e73);margin-left:.375rem}.prompt-form__input[_ngcontent-%COMP%], .prompt-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.prompt-form__input[_ngcontent-%COMP%]:focus, .prompt-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.prompt-form__input[_ngcontent-%COMP%]::placeholder, .prompt-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.prompt-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:100px;line-height:1.5}.prompt-form__section[_ngcontent-%COMP%]{border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:8px;padding:1rem;margin:0;display:flex;flex-direction:column;gap:.75rem}.prompt-form__section-hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:var(--color-text-secondary, #6e6e73);line-height:1.4}.prompt-form__empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73);font-style:italic}.prompt-form__content-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-start}.prompt-form__content-field[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.25rem}.prompt-form__content-index[_ngcontent-%COMP%]{flex-shrink:0;width:1.5rem;padding-top:.6rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary, #6e6e73);text-align:right;-webkit-user-select:none;user-select:none}.prompt-form__param-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:flex-end;padding:.75rem;border-radius:6px;background:var(--color-surface-hover, rgba(0, 0, 0, .03))}.prompt-form__param-fields[_ngcontent-%COMP%]{flex:1;display:flex;gap:.75rem;flex-wrap:wrap}.prompt-form__add-btn[_ngcontent-%COMP%]{align-self:flex-start;padding:.4rem .875rem;border-radius:6px;border:1px dashed var(--color-border, rgba(0, 0, 0, .15));background:transparent;color:var(--color-primary, #007aff);font-size:.875rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__add-btn[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.prompt-form__remove-btn[_ngcontent-%COMP%]{flex-shrink:0;width:1.75rem;height:1.75rem;display:flex;align-items:center;justify-content:center;border-radius:50%;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text-secondary, #6e6e73);font-size:1rem;line-height:1;cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease}.prompt-form__remove-btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-error-light, rgba(255, 59, 48, .08));color:var(--color-error, #ff3b30);border-color:var(--color-error, #ff3b30)}.prompt-form__remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.prompt-form__error[_ngcontent-%COMP%]{margin:0;padding:.625rem .875rem;border-radius:8px;background:var(--color-error-light, rgba(255, 59, 48, .08));border:1px solid var(--color-error, #ff3b30);color:var(--color-error, #ff3b30);font-size:.875rem;line-height:1.4}.prompt-form__field-error[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-error, #ff3b30);line-height:1.3}.prompt-form__input--invalid[_ngcontent-%COMP%], .prompt-form__textarea--invalid[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.prompt-form__input--invalid[_ngcontent-%COMP%]:focus, .prompt-form__textarea--invalid[_ngcontent-%COMP%]:focus{border-color:var(--color-error, #ff3b30)}.prompt-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.prompt-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.prompt-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.prompt-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.prompt-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.prompt-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{Q as PromptFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Y}from"./chunk-KP4KMDLX.js";import{a as Z}from"./chunk-GPZP3WYQ.js";import"./chunk-U5L2OULZ.js";import"./chunk-2BN4B3OL.js";import{h as B}from"./chunk-W7ZS65Y4.js";import{a as R,c as L}from"./chunk-P4GNUQZT.js";import{t as X}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as v,c as y}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import{F as W,c as z,e as x,g as A,h as G,i as q,l as u,n as j,p as $,s as J,w as U,x as H,y as K,z as Q}from"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as T,Db as g,Fb as p,Ka as a,Tb as l,Ub as b,Vb as N,Wa as w,ca as m,ga as _,ha as h,kb as I,lb as M,lc as D,m as E,ma as F,mb as P,pb as O,qb as k,rb as s,sb as i,ta as d,tb as o,ua as V,ub as C}from"./chunk-5NLXR4MK.js";function te(r,e){r&1&&(i(0,"p",5),l(1,"Loading\u2026"),o())}function ne(r,e){if(r&1&&(i(0,"label",10),C(1,"input",25),i(2,"span"),l(3),o()()),r&2){let t=e.$implicit,n=p(2);a(),s("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),a(2),b(t.label)}}function oe(r,e){if(r&1&&(i(0,"option",16),l(1),o()),r&2){let t=e.$implicit;s("value",t.type),a(),b(t.displayName)}}function ie(r,e){if(r&1){let t=T();i(0,"div",21)(1,"ds-json-schema-form",26),g("valueChange",function(c){_(t);let f=p(2);return h(f.onParamsChange(c))}),o()()}if(r&2){let t=p(2);a(),s("schema",e)("value",t.initialParams())}}function re(r,e){if(r&1){let t=T();i(0,"form",7),g("ngSubmit",function(){_(t);let c=p();return h(c.submit())}),i(1,"fieldset",8)(2,"legend",9),l(3,"Scope"),o(),O(4,ne,4,4,"label",10,I().trackByScope,!0),o(),i(6,"div",11)(7,"label",12),l(8,"Type "),i(9,"span",13),l(10,"*"),o()(),i(11,"select",14)(12,"option",15),l(13,"Select type"),o(),O(14,oe,2,2,"option",16,I().trackByType,!0),o()(),i(16,"div",11)(17,"label",17),l(18,"Name "),i(19,"span",13),l(20,"*"),o()(),C(21,"input",18),o(),i(22,"div",11)(23,"label",19),l(24,"Description"),o(),C(25,"textarea",20),o(),M(26,ie,2,2,"div",21),i(27,"div",22)(28,"button",23),l(29),o(),i(30,"button",24),g("click",function(){_(t);let c=p();return h(c.cancel())}),l(31,"Cancel"),o()()()}if(r&2){let t,n=p();s("formGroup",n.form),a(),s("disabled",n.isEditMode()),a(3),k(n.scopeOptions),a(7),s("formControl",n.typeControl),a(3),k(n.integrationTypes()),a(7),s("formControl",n.nameControl),a(4),s("formControl",n.descriptionControl),a(),P((t=n.schema())?26:-1,t),a(2),s("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),a(),N(" ",n.isEditMode()?"Save changes":"Create"," ")}}var ae=new Set(["platform","namespace","userOnNs","userGlobal"]),S=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ee=class r{route=m(R);router=m(L);destroyRef=m(F);state=m(Y);integrationTypeController=m(B);namespaceRole=m(Z);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=y(this.isPlatformMode?E(!0):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new q({name:new u("",{nonNullable:!0,validators:[x.required,x.minLength(1)]}),description:new u(null),type:new u("",{nonNullable:!0,validators:[x.required]}),scope:new u("namespace",{nonNullable:!0})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}isEditMode=d(!1);isSubmitting=d(!1);isLoading=d(!1);scopeOptions=[{value:"platform",label:S.platform},{value:"namespace",label:S.namespace},{value:"userOnNs",label:S.userOnNs},{value:"userGlobal",label:S.userGlobal}];paramsValue=d(null);initialParams=d(null);integrationTypes=y(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=y(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});schema=D(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});existingConfig=null;constructor(){V(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(!0),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let c=this.parseScope(t.get("scope"));this.scopeControl.setValue(c);let f=t.get("template");f&&this.hydrateFromTemplate(f)}parseScope(e){return e&&ae.has(e)?e:"namespace"}deriveScopeFromConfig(e){return!e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(!0),this.state.getById(e).pipe(v(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t,this.scopeControl.setValue(this.deriveScopeFromConfig(t)),this.applyConfigToForm(t),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(e){this.isLoading.set(!0),this.state.getById(e).pipe(v(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters)}onParamsChange(e){this.paramsValue.set(e)}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue()},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(v(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"])}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=w({type:r,selectors:[["agentos-integration-form"]],decls:10,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],["type","button","title","Back to integrations",1,"integration-form__back",3,"click"],[1,"integration-form__back-icon"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[3,"valueChange","schema","value"]],template:function(t,n){t&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),g("click",function(){return n.cancel()}),i(3,"span",3),l(4,"\u2190"),o(),l(5," Integrations "),o(),i(6,"h1",4),l(7),o()(),M(8,te,2,0,"p",5)(9,re,32,8,"form",6),o()),t&2&&(a(7),b(n.isEditMode()?"Edit integration":"New integration"),a(),P(n.isLoading()?8:9))},dependencies:[W,j,K,Q,z,H,$,A,G,J,U,X],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-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-primary, #007aff);font-family:inherit}.integration-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.integration-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));border-radius:10px;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text, #1d1d1f);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:10px;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));background:var(--glass-bg, rgba(255, 255, 255, .5));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px))}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{ee as IntegrationFormComponent};
|
|
1
|
+
import{a as Y}from"./chunk-GN5OSMEB.js";import{a as Z}from"./chunk-TPQSKNWC.js";import"./chunk-U5L2OULZ.js";import"./chunk-R6R7XD7M.js";import{h as B}from"./chunk-QVQF6CQG.js";import{a as R,c as L}from"./chunk-P4GNUQZT.js";import{t as X}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as v,c as y}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import{F as W,c as z,e as x,g as A,h as G,i as q,l as u,n as j,p as $,s as J,w as U,x as H,y as K,z as Q}from"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as T,Db as g,Fb as p,Ka as a,Tb as l,Ub as b,Vb as N,Wa as w,ca as m,ga as _,ha as h,kb as I,lb as M,lc as D,m as E,ma as F,mb as P,pb as O,qb as k,rb as s,sb as i,ta as d,tb as o,ua as V,ub as C}from"./chunk-5NLXR4MK.js";function te(r,e){r&1&&(i(0,"p",5),l(1,"Loading\u2026"),o())}function ne(r,e){if(r&1&&(i(0,"label",10),C(1,"input",25),i(2,"span"),l(3),o()()),r&2){let t=e.$implicit,n=p(2);a(),s("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),a(2),b(t.label)}}function oe(r,e){if(r&1&&(i(0,"option",16),l(1),o()),r&2){let t=e.$implicit;s("value",t.type),a(),b(t.displayName)}}function ie(r,e){if(r&1){let t=T();i(0,"div",21)(1,"ds-json-schema-form",26),g("valueChange",function(c){_(t);let f=p(2);return h(f.onParamsChange(c))}),o()()}if(r&2){let t=p(2);a(),s("schema",e)("value",t.initialParams())}}function re(r,e){if(r&1){let t=T();i(0,"form",7),g("ngSubmit",function(){_(t);let c=p();return h(c.submit())}),i(1,"fieldset",8)(2,"legend",9),l(3,"Scope"),o(),O(4,ne,4,4,"label",10,I().trackByScope,!0),o(),i(6,"div",11)(7,"label",12),l(8,"Type "),i(9,"span",13),l(10,"*"),o()(),i(11,"select",14)(12,"option",15),l(13,"Select type"),o(),O(14,oe,2,2,"option",16,I().trackByType,!0),o()(),i(16,"div",11)(17,"label",17),l(18,"Name "),i(19,"span",13),l(20,"*"),o()(),C(21,"input",18),o(),i(22,"div",11)(23,"label",19),l(24,"Description"),o(),C(25,"textarea",20),o(),M(26,ie,2,2,"div",21),i(27,"div",22)(28,"button",23),l(29),o(),i(30,"button",24),g("click",function(){_(t);let c=p();return h(c.cancel())}),l(31,"Cancel"),o()()()}if(r&2){let t,n=p();s("formGroup",n.form),a(),s("disabled",n.isEditMode()),a(3),k(n.scopeOptions),a(7),s("formControl",n.typeControl),a(3),k(n.integrationTypes()),a(7),s("formControl",n.nameControl),a(4),s("formControl",n.descriptionControl),a(),P((t=n.schema())?26:-1,t),a(2),s("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),a(),N(" ",n.isEditMode()?"Save changes":"Create"," ")}}var ae=new Set(["platform","namespace","userOnNs","userGlobal"]),S=Object.freeze({platform:"Configuration plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ee=class r{route=m(R);router=m(L);destroyRef=m(F);state=m(Y);integrationTypeController=m(B);namespaceRole=m(Z);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;isAdmin=y(this.isPlatformMode?E(!0):this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:this.isPlatformMode});form=new q({name:new u("",{nonNullable:!0,validators:[x.required,x.minLength(1)]}),description:new u(null),type:new u("",{nonNullable:!0,validators:[x.required]}),scope:new u("namespace",{nonNullable:!0})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}isEditMode=d(!1);isSubmitting=d(!1);isLoading=d(!1);scopeOptions=[{value:"platform",label:S.platform},{value:"namespace",label:S.namespace},{value:"userOnNs",label:S.userOnNs},{value:"userGlobal",label:S.userGlobal}];paramsValue=d(null);initialParams=d(null);integrationTypes=y(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=y(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});schema=D(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});existingConfig=null;constructor(){V(()=>{if(this.isAdmin()||this.isEditMode())return;["platform","namespace"].includes(this.scopeControl.value)&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId");if(n){this.isEditMode.set(!0),this.scopeControl.disable(),this.loadConfig(n);return}if(this.isPlatformMode){this.scopeControl.setValue("platform"),this.scopeControl.disable();return}let c=this.parseScope(t.get("scope"));this.scopeControl.setValue(c);let f=t.get("template");f&&this.hydrateFromTemplate(f)}parseScope(e){return e&&ae.has(e)?e:"namespace"}deriveScopeFromConfig(e){return!e.userId&&!e.namespaceId?"platform":e.userId?e.namespaceId?"userOnNs":"userGlobal":"namespace"}loadConfig(e){this.isLoading.set(!0),this.state.getById(e).pipe(v(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t,this.scopeControl.setValue(this.deriveScopeFromConfig(t)),this.applyConfigToForm(t),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(e){this.isLoading.set(!0),this.state.getById(e).pipe(v(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters)}onParamsChange(e){this.paramsValue.set(e)}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let e=this.descriptionControl.value?.trim(),t={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:this.paramsValue()},n=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,t,n,this.existingConfig):this.state.create(t,n,this.namespaceId??null)).pipe(v(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","integration-configs"]):this.router.navigate(["/agentos",this.namespaceId,"integrations"])}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=w({type:r,selectors:[["agentos-integration-form"]],decls:10,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],["type","button","title","Back to integrations",1,"integration-form__back",3,"click"],[1,"integration-form__back-icon"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[3,"valueChange","schema","value"]],template:function(t,n){t&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),g("click",function(){return n.cancel()}),i(3,"span",3),l(4,"\u2190"),o(),l(5," Integrations "),o(),i(6,"h1",4),l(7),o()(),M(8,te,2,0,"p",5)(9,re,32,8,"form",6),o()),t&2&&(a(7),b(n.isEditMode()?"Edit integration":"New integration"),a(),P(n.isLoading()?8:9))},dependencies:[W,j,K,Q,z,H,$,A,G,J,U,X],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-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-primary, #007aff);font-family:inherit}.integration-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.integration-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));border-radius:10px;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text, #1d1d1f);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:10px;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));background:var(--glass-bg, rgba(255, 255, 255, .5));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px))}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{ee as IntegrationFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-IDD4RLL7.js";import{a as S}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-IDD4RLL7.js";import{a as S}from"./chunk-R6R7XD7M.js";import{c as M}from"./chunk-7EHCV7WH.js";import{b as C,c as x}from"./chunk-P4GNUQZT.js";import{Db as c,Fb as v,Ka as _,Tb as u,Vb as T,Wa as m,ca as p,lb as b,lc as d,mb as f,rb as y,sb as r,ta as h,tb as a,ub as s}from"./chunk-5NLXR4MK.js";function w(o,e){if(o&1&&u(0),o&2){let t=v();T(" ",t.userInitials()," ")}}function N(o,e){o&1&&u(0," \u2022\u2022\u2022 ")}var g=class o{router=p(x);userState=p(S);themePort=p(M);menuOpen=h(!1);isAdmin=d(()=>this.userState.currentUser()?.isAdmin===!0);isDark=d(()=>{let e=this.themePort.theme();return e==="dark"?!0:e==="light"?!1:typeof document<"u"&&document.documentElement.hasAttribute("data-theme")});userInitials=d(()=>{let e=this.userState.currentUser();if(!e)return"";let t=e.firstname?.[0]??"",n=e.lastname?.[0]??"";return(t+n).toUpperCase()||e.email?.[0]?.toUpperCase()||""});showTechnical=h(!1);navigateHome(){this.router.navigate(["/agentos/home"])}toggleMenu(e){e.stopPropagation(),this.menuOpen.update(t=>!t)}closeMenu(e){e.stopPropagation(),this.menuOpen.set(!1)}onNavigate(e){this.menuOpen.set(!1),this.router.navigate([e])}onThemeToggle(){this.menuOpen.set(!1);let e=this.isDark()?"light":"dark";this.themePort.setTheme(e)}onLogsToggle(){this.menuOpen.set(!1)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=m({type:o,selectors:[["agentos-shell-topbar"]],decls:10,vars:5,consts:[[1,"shell-topbar"],["type","button","title","Home",1,"shell-topbar__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"shell-topbar__logo-img"],[1,"shell-topbar__logo-text"],[1,"shell-topbar__user-menu"],["type","button","title","Menu",1,"shell-topbar__user-btn",3,"click"],["variant","desktop",3,"navigateTo","themeToggled","logsToggled","closed","open","isAdmin","isDark","showTechnical"]],template:function(t,n){t&1&&(r(0,"div",0)(1,"button",1),c("click",function(){return n.navigateHome()}),s(2,"img",2),r(3,"span",3),u(4,"Coday"),a()(),r(5,"div",4)(6,"button",5),c("click",function(l){return n.toggleMenu(l)}),b(7,w,1,1)(8,N,1,0),a(),r(9,"agentos-shell-user-menu",6),c("navigateTo",function(l){return n.onNavigate(l)})("themeToggled",function(){return n.onThemeToggle()})("logsToggled",function(){return n.onLogsToggle()})("closed",function(l){return n.closeMenu(l)}),a()()()),t&2&&(_(7),f(n.userInitials()?7:8),_(2),y("open",n.menuOpen())("isAdmin",n.isAdmin())("isDark",n.isDark())("showTechnical",n.showTechnical()))},dependencies:[k],styles:[".shell-topbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 12px;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .09));background:var(--color-bg-secondary, rgba(255, 255, 255, .7));flex-shrink:0}.shell-topbar__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:8px;border:none;background:transparent;cursor:pointer;transition:background .14s}.shell-topbar__brand[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .05))}.shell-topbar__logo-img[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:6px;object-fit:contain}.shell-topbar__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;color:var(--color-text);white-space:nowrap;letter-spacing:-.01em}.shell-topbar__user-menu[_ngcontent-%COMP%]{position:relative;flex-shrink:0}.shell-topbar__user-btn[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:8px;border:none;background:var(--color-primary, #016b71);color:#fff;cursor:pointer;display:grid;place-items:center;font-size:.7rem;font-weight:700;letter-spacing:.02em;transition:background .14s}.shell-topbar__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover, #015a5f)}"],changeDetection:0})};var O=class o{static \u0275fac=function(t){return new(t||o)};static \u0275cmp=m({type:o,selectors:[["agentos-layout"]],decls:4,vars:0,consts:[[1,"layout"],[1,"layout__content"]],template:function(t,n){t&1&&(r(0,"div",0),s(1,"agentos-shell-topbar"),r(2,"main",1),s(3,"router-outlet"),a()())},dependencies:[C,g],styles:[".layout[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-height:100vh}.layout__content[_ngcontent-%COMP%]{flex:1;overflow-y:auto}"]})};export{O as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-OUMQX2CT.js";import"./chunk-277IC2QE.js";import"./chunk-QVQF6CQG.js";import"./chunk-P4GNUQZT.js";import"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import"./chunk-5NLXR4MK.js";export{a as UserListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-277IC2QE.js";import{a as T}from"./chunk-R6R7XD7M.js";import{a as I,c as w}from"./chunk-P4GNUQZT.js";import{a as _}from"./chunk-SKBT6DBT.js";import{F as R,b as A,c as N,e as C,g as F,h as U,i as z,l as d,n as D,v as V,w as L}from"./chunk-Z6RFJ6L3.js";import{Bb as P,Db as f,Fb as c,Ka as l,Tb as n,Ub as y,Vb as k,Wa as O,ca as u,ga as p,ha as g,lb as x,ma as E,mb as v,rb as h,sb as r,ta as b,tb as e,ub as m}from"./chunk-5NLXR4MK.js";function q(a,i){a&1&&(r(0,"p",5),n(1,"Loading\u2026"),e())}function $(a,i){if(a&1&&(r(0,"span",13),n(1),e()),a&2){let t=c(2);l(),y(t.form.controls.email.value)}}function j(a,i){a&1&&m(0,"input",14)}function H(a,i){if(a&1){let t=P();r(0,"form",7),f("ngSubmit",function(){p(t);let s=c();return g(s.save())}),r(1,"div",8)(2,"h2",9),n(3,"Identity"),e(),r(4,"div",10)(5,"label",11),n(6,"Email "),r(7,"span",12),n(8,"*"),e()(),x(9,$,2,1,"span",13)(10,j,1,0,"input",14),e(),r(11,"div",10)(12,"label",15),n(13,"External ID"),e(),m(14,"input",16),e()(),r(15,"div",8)(16,"h2",9),n(17,"Profile"),e(),r(18,"div",10)(19,"label",17),n(20,"First name"),e(),m(21,"input",18),e(),r(22,"div",10)(23,"label",19),n(24,"Last name"),e(),m(25,"input",20),e(),r(26,"div",21)(27,"label",22),n(28,"Bio"),e(),m(29,"textarea",23),e()(),r(30,"div",8)(31,"h2",9),n(32,"Permissions"),e(),r(33,"div",24),m(34,"input",25),r(35,"label",26),n(36," Super admin (full access to AgentOS) "),e()()(),r(37,"div",27)(38,"button",28),n(39),e(),r(40,"button",29),f("click",function(){p(t);let s=c();return g(s.cancel())}),n(41,"Cancel"),e()()()}if(a&2){let t=c();h("formGroup",t.form),l(9),v(t.isEditMode?9:10),l(29),h("disabled",t.form.invalid||t.isSaving()),l(),k(" ",t.isSaving()?"Saving\u2026":t.isEditMode?"Save changes":"Create user"," ")}}var B=class a{route=u(I);router=u(w);destroyRef=u(E);userAdminState=u(G);userState=u(T);userId=this.route.snapshot.params.userId;isEditMode=!!this.userId;isSaving=b(!1);isLoading=b(!1);form=new z({email:new d("",{nonNullable:!0,validators:[C.required,C.email]}),externalId:new d("",{nonNullable:!0}),firstname:new d("",{nonNullable:!0}),lastname:new d("",{nonNullable:!0}),bio:new d("",{nonNullable:!0}),isAdmin:new d(!1,{nonNullable:!0})});ngOnInit(){if(!this.isEditMode)return;let i=()=>{this.userState.currentUser()?.id===this.userId&&this.form.controls.isAdmin.disable()};this.userState.currentUser()?i():this.userState.loadMe().pipe(_(this.destroyRef)).subscribe({next:()=>i(),error:()=>this.form.controls.isAdmin.disable()});let t=this.userAdminState.users().find(o=>o.id===this.userId);if(t){this.syncForm(t),this.form.controls.email.disable();return}this.isLoading.set(!0),this.userAdminState.loadAll().pipe(_(this.destroyRef)).subscribe({next:()=>{let o=this.userAdminState.users().find(s=>s.id===this.userId);o&&(this.syncForm(o),this.form.controls.email.disable()),this.isLoading.set(!1)},error:()=>this.isLoading.set(!1)})}get title(){return this.isEditMode?"Edit user":"New user"}save(){if(this.form.invalid||this.isSaving())return;this.isSaving.set(!0);let{email:i,externalId:t,firstname:o,lastname:s,bio:S,isAdmin:M}=this.form.getRawValue();(this.isEditMode?this.userAdminState.updateUser(this.userId,{externalId:t||void 0,firstname:o||void 0,lastname:s||void 0,bio:S||void 0,isAdmin:M}):this.userAdminState.createUser({email:i||void 0,externalId:t||void 0,firstname:o||void 0,lastname:s||void 0,bio:S||void 0,isAdmin:M})).pipe(_(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSaving.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.router.navigate(["/agentos/admin/users"])}syncForm(i){this.form.setValue({email:i.email??"",externalId:i.externalId??"",firstname:i.firstname??"",lastname:i.lastname??"",bio:i.bio??"",isAdmin:i.isAdmin??!1})}static \u0275fac=function(t){return new(t||a)};static \u0275cmp=O({type:a,selectors:[["agentos-user-form"]],decls:10,vars:2,consts:[[1,"user-form"],[1,"user-form__header"],["type","button","title","Back to users",1,"user-form__back",3,"click"],[1,"user-form__back-icon"],[1,"user-form__title"],[1,"user-form__loading"],[1,"user-form__body",3,"formGroup"],[1,"user-form__body",3,"ngSubmit","formGroup"],[1,"user-form__section"],[1,"user-form__section-title"],[1,"user-form__field"],["for","uf-email",1,"user-form__label"],[1,"user-form__required"],[1,"user-form__value","user-form__value--readonly"],["id","uf-email","type","email","placeholder","user@example.com","formControlName","email","autocomplete","email",1,"user-form__input"],["for","uf-externalId",1,"user-form__label"],["id","uf-externalId","type","text","placeholder","External identifier","formControlName","externalId",1,"user-form__input"],["for","uf-firstname",1,"user-form__label"],["id","uf-firstname","type","text","placeholder","First name","formControlName","firstname","autocomplete","given-name",1,"user-form__input"],["for","uf-lastname",1,"user-form__label"],["id","uf-lastname","type","text","placeholder","Last name","formControlName","lastname","autocomplete","family-name",1,"user-form__input"],[1,"user-form__field","user-form__field--bio"],["for","uf-bio",1,"user-form__label"],["id","uf-bio","placeholder","A short description","formControlName","bio","rows","4",1,"user-form__input","user-form__input--textarea"],[1,"user-form__field","user-form__field--checkbox"],["id","uf-isAdmin","type","checkbox","formControlName","isAdmin",1,"user-form__checkbox"],["for","uf-isAdmin",1,"user-form__label","user-form__label--checkbox"],[1,"user-form__actions"],["type","submit",1,"user-form__btn","user-form__btn--primary",3,"disabled"],["type","button",1,"user-form__btn",3,"click"]],template:function(t,o){t&1&&(r(0,"div",0)(1,"header",1)(2,"button",2),f("click",function(){return o.cancel()}),r(3,"span",3),n(4,"\u2190"),e(),n(5," Users "),e(),r(6,"h1",4),n(7),e()(),x(8,q,2,0,"p",5)(9,H,42,4,"form",6),e()),t&2&&(l(7),y(o.title),l(),v(o.isLoading()?8:9))},dependencies:[R,D,N,A,F,U,L,V],styles:[".user-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.user-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.user-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-primary, #007aff);font-family:inherit}.user-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.user-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.user-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.user-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.user-form__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem}.user-form__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.user-form__section-title[_ngcontent-%COMP%]{margin:0;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--color-text-secondary, #6e6e73);border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .06));padding-bottom:.5rem}.user-form__field[_ngcontent-%COMP%]{display:grid;grid-template-columns:140px 1fr;align-items:baseline;gap:.75rem}.user-form__field--bio[_ngcontent-%COMP%]{align-items:start}.user-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary, #6e6e73);white-space:nowrap}.user-form__required[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.user-form__value[_ngcontent-%COMP%]{font-size:.9375rem;color:var(--color-text, #1d1d1f)}.user-form__value--readonly[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.875rem}.user-form__input[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease;resize:none}.user-form__input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.user-form__input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.user-form__input--textarea[_ngcontent-%COMP%]{line-height:1.5;resize:vertical}.user-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.user-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.user-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.user-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.user-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.user-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{B as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-OVCLHAFH.js";import{d as D}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-OVCLHAFH.js";import{d as D}from"./chunk-QVQF6CQG.js";import{c as q}from"./chunk-P4GNUQZT.js";import{r as M,x as $}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as _}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as b,Db as s,Fb as d,Jc as T,Pb as w,S as P,Wa as y,ab as C,bc as R,ca as n,ec as I,fc as x,ga as m,ha as l,i as f,ic as B,lb as h,ma as g,mb as A,rb as c,sb as a,t as u,tb as v}from"./chunk-5NLXR4MK.js";var S=()=>[];function V(r,e){if(r&1){let t=b();a(0,"agentos-ai-provider-item",4),s("editRequested",function(i){m(t);let p=d(2);return l(p.onEdit(i))})("deleteRequested",function(i){m(t);let p=d(2);return l(p.onDelete(i))}),v()}r&2&&c("config",e)("showBadge",!1)}function F(r,e){if(r&1&&h(0,V,1,2,"agentos-ai-provider-item",3),r&2){let t,o=e.$implicit,i=d();A((t=i.resolveProvider(o.id))?0:-1,t)}}var E=class r{router=n(q);destroyRef=n(g);aiProviderController=n(D);refresh$=new f(void 0);providers$=this.refresh$.pipe(P(()=>this.aiProviderController.listAiProvider("none")));providerItems$=this.providers$.pipe(u(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.apiType}))));providersById=new Map;constructor(){this.providers$.pipe(_(this.destroyRef)).subscribe(e=>{this.providersById=new Map(e.map(t=>[t.id??"",t]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"])}onEdit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"])}onDelete(e){e.id&&this.aiProviderController.deleteAiProvider(e.id).pipe(_(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveProvider(e){return this.providersById.get(e)??null}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=y({type:r,selectors:[["agentos-platform-ai-providers"]],decls:5,vars:6,consts:[["aiProviderItemTpl",""],["title","Platform AI Providers","emptyMessage","No platform AI providers defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(t,o){if(t&1&&(a(0,"ds-entity-list",1),I(1,"async"),s("createRequested",function(){return o.openCreateForm()}),a(2,"ds-icon-button",2),s("action",function(){return o.goBack()}),v()(),C(3,F,1,1,"ng-template",null,0,B)),t&2){let i=w(4);c("items",x(1,3,o.providerItems$)??R(5,S))("showCreate",!0)("itemTemplate",i)}},dependencies:[$,k,M,T],styles:[".platform-ai-providers__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-providers__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"],changeDetection:0})};export{E as PlatformAiProvidersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as I}from"./chunk-
|
|
1
|
+
import{i as I}from"./chunk-QVQF6CQG.js";import{a as k,c as w}from"./chunk-P4GNUQZT.js";import{a as h}from"./chunk-SKBT6DBT.js";import{F as B,c as D,e as C,g as F,h as V,i as A,l as s,n as z,s as L,w as R}from"./chunk-Z6RFJ6L3.js";import{Bb as O,Db as u,Fb as g,Ka as r,Tb as o,Ub as S,Vb as E,Wa as N,a as x,b as v,ca as p,ga as _,ha as b,lb as M,ma as y,mb as P,rb as i,sb as n,ta as f,tb as t,ub as l}from"./chunk-5NLXR4MK.js";function T(m,a){m&1&&(n(0,"p",5),o(1,"Loading\u2026"),t())}function $(m,a){if(m&1){let e=O();n(0,"form",7),u("ngSubmit",function(){_(e);let d=g();return b(d.submit())}),n(1,"div",8)(2,"label",9),o(3,"Name "),n(4,"span",10),o(5,"*"),t()(),l(6,"input",11),t(),n(7,"div",8)(8,"label",12),o(9,"Description"),t(),l(10,"textarea",13),t(),n(11,"div",8)(12,"label",14),o(13,"External ID"),t(),l(14,"input",15),t(),n(15,"div",8)(16,"label",16),o(17,"Default agent"),t(),l(18,"input",17),t(),n(19,"div",8)(20,"label",18),o(21,"Config path"),t(),l(22,"input",19),t(),n(23,"div",20)(24,"button",21),o(25),t(),n(26,"button",22),u("click",function(){_(e);let d=g();return b(d.cancel())}),o(27,"Cancel"),t()()()}if(m&2){let e=g();i("formGroup",e.form),r(6),i("formControl",e.nameControl),r(4),i("formControl",e.descriptionControl),r(4),i("formControl",e.externalIdControl),r(4),i("formControl",e.defaultAgentNameControl),r(4),i("formControl",e.configPathControl),r(2),i("disabled",e.nameControl.invalid||e.isSubmitting()),r(),E(" ",e.isEditMode()?"Save changes":"Create"," ")}}var G=class m{route=p(k);router=p(w);namespaceController=p(I);destroyRef=p(y);form=new A({name:new s("",{nonNullable:!0,validators:[C.required,C.minLength(1)]}),description:new s("",{nonNullable:!0}),configPath:new s("",{nonNullable:!0}),externalId:new s("",{nonNullable:!0}),defaultAgentName:new s("",{nonNullable:!0})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}isEditMode=f(!1);isSubmitting=f(!1);isLoading=f(!1);existingNamespace=null;ngOnInit(){let a=this.route.snapshot.paramMap.get("namespaceId");a&&(this.isEditMode.set(!0),this.loadNamespace(a))}loadNamespace(a){this.isLoading.set(!0),this.namespaceController.getByIdNamespace(a).pipe(h(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),this.navigateBack()}})}submit(){if(this.nameControl.invalid||this.isSubmitting())return;this.isSubmitting.set(!0);let a=v(x({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",a):this.namespaceController.createNamespace(a)).pipe(h(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.router.navigate(["/agentos/namespaces"])}static \u0275fac=function(e){return new(e||m)};static \u0275cmp=N({type:m,selectors:[["agentos-namespace-form"]],decls:10,vars:2,consts:[[1,"namespace-form"],[1,"namespace-form__header"],["type","button","title","Back to namespaces",1,"namespace-form__back",3,"click"],[1,"namespace-form__back-icon"],[1,"namespace-form__title"],[1,"namespace-form__loading"],[1,"namespace-form__form",3,"formGroup"],[1,"namespace-form__form",3,"ngSubmit","formGroup"],[1,"namespace-form__field"],["for","ns-name",1,"namespace-form__label"],["aria-hidden","true"],["id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-description",1,"namespace-form__label"],["id","ns-description","rows","4","placeholder","Optional description",1,"namespace-form__textarea",3,"formControl"],["for","ns-external-id",1,"namespace-form__label"],["id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-default-agent",1,"namespace-form__label"],["id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",1,"namespace-form__input",3,"formControl"],["for","ns-config-path",1,"namespace-form__label"],["id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",1,"namespace-form__input",3,"formControl"],[1,"namespace-form__actions"],["type","submit",1,"namespace-form__btn","namespace-form__btn--primary",3,"disabled"],["type","button",1,"namespace-form__btn",3,"click"]],template:function(e,c){e&1&&(n(0,"div",0)(1,"header",1)(2,"button",2),u("click",function(){return c.cancel()}),n(3,"span",3),o(4,"\u2190"),t(),o(5," Namespaces "),t(),n(6,"h1",4),o(7),t()(),M(8,T,2,0,"p",5)(9,$,28,8,"form",6),t()),e&2&&(r(7),S(c.isEditMode()?"Edit namespace":"New namespace"),r(),P(c.isLoading()?8:9))},dependencies:[B,z,D,F,V,L,R],styles:[".namespace-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.namespace-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.namespace-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-primary, #007aff);font-family:inherit}.namespace-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.namespace-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.namespace-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.namespace-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.namespace-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.namespace-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.namespace-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.namespace-form__input[_ngcontent-%COMP%], .namespace-form__textarea[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.namespace-form__input[_ngcontent-%COMP%]:focus, .namespace-form__textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.namespace-form__input[_ngcontent-%COMP%]::placeholder, .namespace-form__textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.namespace-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:96px;line-height:1.5}.namespace-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.namespace-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.namespace-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.namespace-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.namespace-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.namespace-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{G as NamespaceFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-AIC4U2MU.js";import{a as V}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-AIC4U2MU.js";import{a as V}from"./chunk-GN5OSMEB.js";import{a as B}from"./chunk-7FKWFZ3A.js";import{a as K}from"./chunk-TPQSKNWC.js";import"./chunk-U5L2OULZ.js";import"./chunk-R6R7XD7M.js";import"./chunk-QVQF6CQG.js";import{a as D,c as $}from"./chunk-P4GNUQZT.js";import{r as P,x as L}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as c}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as A,Db as g,Fb as s,Jc as N,Ka as C,Pb as x,S as y,Tb as E,Ub as w,Wa as v,ab as R,bc as O,ca as r,ec as M,fc as T,ga as l,ha as m,ic as q,lb as b,m as _,ma as I,mb as S,rb as f,sb as p,t as u,ta as h,tb as d}from"./chunk-5NLXR4MK.js";var z=()=>[];function W(o,e){if(o&1&&(p(0,"p",3),E(1),d()),o&2){let t=s().$implicit;C(),w(t.name)}}function U(o,e){if(o&1){let t=A();p(0,"agentos-integration-config-item",5),g("editRequested",function(){let i=l(t),a=s(2);return m(a.onEdit(i))})("deleteRequested",function(){let i=l(t),a=s(2);return m(a.onDelete(i))})("duplicateRequested",function(){let i=l(t),a=s(2);return m(a.onDuplicate(i))}),d()}if(o&2){let t=e,n=s(2);f("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin())}}function X(o,e){if(o&1&&b(0,W,2,1,"p",3)(1,U,1,3,"agentos-integration-config-item",4),o&2){let t,n=e.$implicit,i=s();S(i.isEmptyPlaceholder(n.id)?0:(t=i.resolve(n.id))?1:-1,t)}}var k=Object.freeze({platform:"Configurations plateforme",namespace:"Configurations du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class o{route=r(D);router=r($);destroyRef=r(I);state=r(V);namespaceRole=r(K);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=h(!1);listItems$=this.state.vm$.pipe(u(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(c(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(u(e=>e.get("namespaceId")??""),y(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_(!1)),c(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(c(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(n=>{n.id&&t.set(this.itemKey("platform",n.id),{config:n,scope:"platform"})}),e.namespace.forEach(n=>{n.id&&t.set(this.itemKey("namespace",n.id),{config:n,scope:"namespace"})}),e.userOnNs.forEach(n=>{n.id&&t.set(this.itemKey("userOnNs",n.id),{config:n,scope:"userOnNs"})}),e.userGlobal.forEach(n=>{n.id&&t.set(this.itemKey("userGlobal",n.id),{config:n,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id??"";this.router.navigate(["/agentos",this.namespaceId,"integrations",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(c(this.destroyRef)).subscribe({error:n=>{console.error(`[IntegrationsAllScopes] Delete failed for ${e.scope}:${t}:`,n)}})}onDuplicate(e){if(!e.config.id)return;let n=(e.scope==="namespace"||e.scope==="platform")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucune configuration",groupKey:e,groupLabel:k[e]}]:t.filter(n=>!!n.id).map(n=>({id:this.itemKey(e,n.id),name:n.name,description:n.integrationType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["agentos-integrations-all-scopes"]],decls:5,vars:6,consts:[["integrationItemTpl",""],["title","Integrations","emptyMessage","No integrations available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"integrations-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,n){if(t&1&&(p(0,"ds-entity-list",1),M(1,"async"),g("createRequested",function(){return n.openCreateForm()}),p(2,"ds-icon-button",2),g("action",function(){return n.goBack()}),d()(),R(3,X,2,1,"ng-template",null,0,q)),t&2){let i=x(4);f("items",T(1,3,n.listItems$)??O(5,z))("showCreate",!0)("itemTemplate",i)}},dependencies:[L,B,P,N],styles:[".integrations-all-scopes__empty[_ngcontent-%COMP%]{margin:0;padding:.65rem 1rem;font-size:.85rem;font-style:italic;color:var(--color-text-secondary)}"],changeDetection:0})};export{j as IntegrationsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y}from"./chunk-U5L2OULZ.js";import{a as f}from"./chunk-
|
|
1
|
+
import{a as y}from"./chunk-U5L2OULZ.js";import{a as f}from"./chunk-R6R7XD7M.js";import{d as m}from"./chunk-QVQF6CQG.js";import{D as a,P as h,S as A,V as d,Z as b,a as P,ca as c,i as v,m as o,t as u,u as l}from"./chunk-5NLXR4MK.js";var g="none",N="me",O=class p{nsController=c(m);userState=c(f);refresh$=new v(void 0);namespaceId$=new v(null);vm$=l([this.namespaceId$,this.refresh$]).pipe(A(([e])=>{let r=this.loadPlatformProviders().pipe(a(()=>o([])));return e?l([r,this.loadNamespaceProviders(e).pipe(a(()=>o([]))),this.loadUserProviders(e).pipe(a(()=>o([]))),this.loadUserProviders("global").pipe(a(()=>o([])))]).pipe(u(([i,n,s,t])=>({platform:i,namespace:n,userOnNs:s,userGlobal:t}))):l([r,this.loadNamespaceProviders("").pipe(a(()=>o([]))),this.loadUserProviders("global").pipe(a(()=>o([])))]).pipe(u(([i,n,s])=>({platform:i,namespace:n,userOnNs:[],userGlobal:s})))}),h({bufferSize:1,refCount:!0}));setNamespace(e){this.namespaceId$.value!==e&&this.namespaceId$.next(e)}refresh(){this.refresh$.next()}loadUserProviders(e){let r=e==="global"?g:e;return this.nsController.listAiProvider(r,N)}userGlobal$=y(this.refresh$,()=>this.loadUserProviders("global"),[]);loadPlatformProviders(){return this.nsController.listAiProvider(g)}loadNamespaceProviders(e){return e?this.nsController.listAiProvider(e):o([])}getById(e,r){return this.nsController.getByIdAiProvider(e)}create(e,r,i){let s=this.userState.currentUser()?.id;if((r==="userOnNs"||r==="userGlobal")&&!s)throw new Error(`Cannot create ${r} provider before UserStateService.loadMe() resolves \u2014 call loadMe() at app init`);if(r==="namespace"){if(i===void 0||i==="")throw new Error("Cannot create namespace-scoped provider without a namespaceId");let S={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,namespaceId:i??void 0};return this.nsController.createAiProvider(S).pipe(d(()=>this.refresh()))}if(r==="userOnNs"&&!i)throw new Error("Cannot create userOnNs provider without a namespaceId");let t={name:e.name,apiType:e.apiType,description:e.description,baseUrl:e.baseUrl,apiKey:e.apiKey,headers:e.headers??void 0,userId:s,namespaceId:r==="userOnNs"?i:void 0};return this.nsController.createAiProvider(t).pipe(d(()=>this.refresh()))}update(e,r,i,n){let s=r.apiKey===null?{}:{apiKey:r.apiKey},t=P({name:r.name,apiType:r.apiType,description:r.description,baseUrl:r.baseUrl,headers:r.headers??void 0,namespaceId:n.namespaceId,userId:n.userId},s);return this.nsController.updateAiProvider(e,t).pipe(d(()=>this.refresh()))}delete(e,r){return this.nsController.deleteAiProvider(e).pipe(d(()=>this.refresh()))}static \u0275fac=function(r){return new(r||p)};static \u0275prov=b({token:p,factory:p.\u0275fac,providedIn:"root"})};export{O as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ne}from"./chunk-KWBMAZB4.js";import{a as ie}from"./chunk-GPZP3WYQ.js";import"./chunk-U5L2OULZ.js";import"./chunk-2BN4B3OL.js";import{n as L}from"./chunk-W7ZS65Y4.js";import{a as K,c as G}from"./chunk-P4GNUQZT.js";import{a as A,c as B}from"./chunk-SKBT6DBT.js";import{F as oe,c as z,e as _,g as $,h as q,i as S,l as p,n as j,p as H,r as J,s as Q,t as W,u as X,v as Y,w as Z,x as ee,y as re,z as te}from"./chunk-Z6RFJ6L3.js";import{Bb as k,Db as v,Fb as m,Ka as l,Tb as i,Ub as P,Vb as U,Wa as I,ca as f,ga as g,ha as h,kb as V,lb as M,ma as N,mb as O,nb as R,ob as D,pb as C,qb as x,rb as d,sb as o,ta as y,tb as t,ua as T,ub as u}from"./chunk-5NLXR4MK.js";function de(n,r){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),t())}function pe(n,r){if(n&1&&(o(0,"label",30),u(1,"input",31),o(2,"span"),i(3),t()()),n&2){let e=r.$implicit,a=m(3);l(),d("formControl",a.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!a.isAdmin()),l(2),P(e.label)}}function me(n,r){if(n&1&&(o(0,"fieldset",8)(1,"legend",24),i(2,"Port\xE9e de la configuration"),t(),C(3,pe,4,4,"label",30,V().trackByScope,!0),t()),n&2){let e=m(2);d("disabled",e.isEditMode()),l(3),x(e.scopeOptions)}}function ce(n,r){if(n&1&&(o(0,"option",13),i(1),t()),n&2){let e=r.$implicit;d("value",e),l(),P(e)}}function ue(n,r){if(n&1){let e=k();o(0,"div",26),u(1,"input",32)(2,"input",33),o(3,"button",34),v("click",function(){let s=g(e).$index,c=m(2);return h(c.removeHeader(s))}),i(4," \xD7 "),t()()}if(n&2){let e=r.$index;d("formGroupName",e)}}function fe(n,r){if(n&1){let e=k();o(0,"form",7),v("ngSubmit",function(){g(e);let s=m();return h(s.submit())}),M(1,me,5,1,"fieldset",8),o(2,"div",9)(3,"label",10),i(4,"API type "),o(5,"span",11),i(6,"*"),t()(),o(7,"select",12),C(8,ce,2,2,"option",13,D),t()(),o(10,"div",9)(11,"label",14),i(12,"Name "),o(13,"span",11),i(14,"*"),t()(),u(15,"input",15),t(),o(16,"div",9)(17,"label",16),i(18,"Description"),t(),u(19,"input",17),t(),o(20,"div",9)(21,"label",18),i(22,"Base URL"),t(),u(23,"input",19),t(),o(24,"div",9)(25,"label",20),i(26,"API key"),t(),u(27,"input",21),t(),o(28,"div",22)(29,"div",23)(30,"span",24),i(31,"Custom headers"),t(),o(32,"button",25),v("click",function(){g(e);let s=m();return h(s.addHeader())}),i(33,"+ Add header"),t()(),C(34,ue,5,1,"div",26,R),t(),o(36,"div",27)(37,"button",28),i(38),t(),o(39,"button",29),v("click",function(){g(e);let s=m();return h(s.cancel())}),i(40,"Cancel"),t()()()}if(n&2){let e=m();d("formGroup",e.form),l(),O(e.isPlatformMode?-1:1),l(6),d("formControl",e.apiTypeControl),l(),x(e.apiTypeOptions),l(7),d("formControl",e.nameControl),l(4),d("formControl",e.descriptionControl),l(4),d("formControl",e.baseUrlControl),l(4),d("formControl",e.apiKeyControl),l(),d("formArrayName","headers"),l(6),x(e.headersArray.controls),l(3),d("disabled",e.form.invalid||e.isSubmitting()),l(),U(" ",e.isEditMode()?"Save changes":"Create"," ")}}var ve=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ae=class n{route=f(K);router=f(G);destroyRef=f(N);state=f(ne);namespaceRole=f(ie);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?y(!0):B(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});apiTypeOptions=Object.values(L);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new S({name:new p("",{nonNullable:!0,validators:[_.required,_.minLength(1)]}),description:new p(null),apiType:new p("OpenAI",{nonNullable:!0,validators:[_.required]}),baseUrl:new p("",{nonNullable:!0}),apiKey:new p("",{nonNullable:!0}),scope:new p("namespace",{nonNullable:!0}),headers:new J([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new S({key:new p("",{nonNullable:!0,validators:[_.required]}),value:new p("",{nonNullable:!0})}))}removeHeader(r){this.headersArray.removeAt(r)}isEditMode=y(!1);isSubmitting=y(!1);isLoading=y(!1);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||T(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,a=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(a){this.isEditMode.set(!0),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(a);return}this.scopeControl.setValue(s);let c=e.get("template");c&&this.hydrateFromTemplate(c)}parseScope(r){return r&&ve.has(r)?r:"namespace"}deriveScopeFromConfig(r){return!r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[a,s]of Object.entries(r.headers??{}))this.headersArray.push(new S({key:new p(a,{nonNullable:!0,validators:[_.required]}),value:new p(s,{nonNullable:!0})}))}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),a=this.apiKeyControl.value,s=this.isEditMode()&&a===this.initialApiKey?null:a,c=this.headersArray.controls.filter(b=>b.controls.key.value.trim()).map(b=>[b.controls.key.value.trim(),b.controls.value.value]),le=c.length>0?Object.fromEntries(c):null,w={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:le},F=this.form.getRawValue().scope,se=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,F,this.existingConfig):this.state.create(w,F,se)).pipe(A(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"])}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,a){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),v("click",function(){return a.cancel()}),o(3,"span",3),i(4,"\u2190"),t(),i(5," AI Providers "),t(),o(6,"h1",4),i(7),t()(),M(8,de,2,0,"p",5)(9,fe,41,10,"form",6),t()),e&2&&(l(7),P(a.isEditMode()?"Edit AI provider":"New AI provider"),l(),O(a.isLoading()?8:9))},dependencies:[oe,j,re,te,z,ee,H,$,q,Q,Z,Y,W,X],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-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-primary, #007aff);font-family:inherit}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;font-family:inherit;color:var(--color-primary, #007aff)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:6px;cursor:pointer;font-size:1rem;color:var(--color-text-secondary, #6e6e73);transition:background .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{ae as AiProviderFormComponent};
|
|
1
|
+
import{a as ne}from"./chunk-DRZNSAVZ.js";import{a as ie}from"./chunk-TPQSKNWC.js";import"./chunk-U5L2OULZ.js";import"./chunk-R6R7XD7M.js";import{n as L}from"./chunk-QVQF6CQG.js";import{a as K,c as G}from"./chunk-P4GNUQZT.js";import{a as A,c as B}from"./chunk-SKBT6DBT.js";import{F as oe,c as z,e as _,g as $,h as q,i as S,l as p,n as j,p as H,r as J,s as Q,t as W,u as X,v as Y,w as Z,x as ee,y as re,z as te}from"./chunk-Z6RFJ6L3.js";import{Bb as k,Db as v,Fb as m,Ka as l,Tb as i,Ub as P,Vb as U,Wa as I,ca as f,ga as g,ha as h,kb as V,lb as M,ma as N,mb as O,nb as R,ob as D,pb as C,qb as x,rb as d,sb as o,ta as y,tb as t,ua as T,ub as u}from"./chunk-5NLXR4MK.js";function de(n,r){n&1&&(o(0,"p",5),i(1,"Loading\u2026"),t())}function pe(n,r){if(n&1&&(o(0,"label",30),u(1,"input",31),o(2,"span"),i(3),t()()),n&2){let e=r.$implicit,a=m(3);l(),d("formControl",a.scopeControl)("value",e.value)("disabled",e.value==="namespace"&&!a.isAdmin()),l(2),P(e.label)}}function me(n,r){if(n&1&&(o(0,"fieldset",8)(1,"legend",24),i(2,"Port\xE9e de la configuration"),t(),C(3,pe,4,4,"label",30,V().trackByScope,!0),t()),n&2){let e=m(2);d("disabled",e.isEditMode()),l(3),x(e.scopeOptions)}}function ce(n,r){if(n&1&&(o(0,"option",13),i(1),t()),n&2){let e=r.$implicit;d("value",e),l(),P(e)}}function ue(n,r){if(n&1){let e=k();o(0,"div",26),u(1,"input",32)(2,"input",33),o(3,"button",34),v("click",function(){let s=g(e).$index,c=m(2);return h(c.removeHeader(s))}),i(4," \xD7 "),t()()}if(n&2){let e=r.$index;d("formGroupName",e)}}function fe(n,r){if(n&1){let e=k();o(0,"form",7),v("ngSubmit",function(){g(e);let s=m();return h(s.submit())}),M(1,me,5,1,"fieldset",8),o(2,"div",9)(3,"label",10),i(4,"API type "),o(5,"span",11),i(6,"*"),t()(),o(7,"select",12),C(8,ce,2,2,"option",13,D),t()(),o(10,"div",9)(11,"label",14),i(12,"Name "),o(13,"span",11),i(14,"*"),t()(),u(15,"input",15),t(),o(16,"div",9)(17,"label",16),i(18,"Description"),t(),u(19,"input",17),t(),o(20,"div",9)(21,"label",18),i(22,"Base URL"),t(),u(23,"input",19),t(),o(24,"div",9)(25,"label",20),i(26,"API key"),t(),u(27,"input",21),t(),o(28,"div",22)(29,"div",23)(30,"span",24),i(31,"Custom headers"),t(),o(32,"button",25),v("click",function(){g(e);let s=m();return h(s.addHeader())}),i(33,"+ Add header"),t()(),C(34,ue,5,1,"div",26,R),t(),o(36,"div",27)(37,"button",28),i(38),t(),o(39,"button",29),v("click",function(){g(e);let s=m();return h(s.cancel())}),i(40,"Cancel"),t()()()}if(n&2){let e=m();d("formGroup",e.form),l(),O(e.isPlatformMode?-1:1),l(6),d("formControl",e.apiTypeControl),l(),x(e.apiTypeOptions),l(7),d("formControl",e.nameControl),l(4),d("formControl",e.descriptionControl),l(4),d("formControl",e.baseUrlControl),l(4),d("formControl",e.apiKeyControl),l(),d("formArrayName","headers"),l(6),x(e.headersArray.controls),l(3),d("disabled",e.form.invalid||e.isSubmitting()),l(),U(" ",e.isEditMode()?"Save changes":"Create"," ")}}var ve=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({platform:"Configuration de niveau plateforme",namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),ae=class n{route=f(K);router=f(G);destroyRef=f(N);state=f(ne);namespaceRole=f(ie);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;isAdmin=this.isPlatformMode?y(!0):B(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});apiTypeOptions=Object.values(L);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];form=new S({name:new p("",{nonNullable:!0,validators:[_.required,_.minLength(1)]}),description:new p(null),apiType:new p("OpenAI",{nonNullable:!0,validators:[_.required]}),baseUrl:new p("",{nonNullable:!0}),apiKey:new p("",{nonNullable:!0}),scope:new p("namespace",{nonNullable:!0}),headers:new J([],{validators:[]})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get apiTypeControl(){return this.form.controls.apiType}get baseUrlControl(){return this.form.controls.baseUrl}get apiKeyControl(){return this.form.controls.apiKey}get scopeControl(){return this.form.controls.scope}get headersArray(){return this.form.controls.headers}addHeader(){this.headersArray.push(new S({key:new p("",{nonNullable:!0,validators:[_.required]}),value:new p("",{nonNullable:!0})}))}removeHeader(r){this.headersArray.removeAt(r)}isEditMode=y(!1);isSubmitting=y(!1);isLoading=y(!1);existingConfig=null;initialApiKey="";constructor(){this.isPlatformMode||T(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.namespaceId&&this.state.setNamespace(this.namespaceId);let r=this.route.snapshot.paramMap,e=this.route.snapshot.queryParamMap,a=r.get("aiProviderId"),s=this.isPlatformMode?"namespace":this.parseScope(e.get("scope"));if(a){this.isEditMode.set(!0),this.scopeControl.disable(),this.apiTypeControl.disable(),this.loadConfig(a);return}this.scopeControl.setValue(s);let c=e.get("template");c&&this.hydrateFromTemplate(c)}parseScope(r){return r&&ve.has(r)?r:"namespace"}deriveScopeFromConfig(r){return!r.userId?"namespace":r.namespaceId?"userOnNs":"userGlobal"}loadConfig(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(this.destroyRef)).subscribe({next:e=>{this.existingConfig=e,this.scopeControl.setValue(this.deriveScopeFromConfig(e)),this.applyConfigToForm(e),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[AiProviderForm] Could not load provider '${r}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(r){this.isLoading.set(!0),this.state.getById(r).pipe(A(this.destroyRef)).subscribe({next:e=>{this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.apiTypeControl.setValue(e.apiType),this.baseUrlControl.setValue(e.baseUrl??""),this.apiKeyControl.setValue(""),this.initialApiKey="",this.apiKeyControl.markAsTouched(),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:e=>{console.warn(`[AiProviderForm] Could not hydrate from template ${r}:`,e),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(r){this.nameControl.setValue(r.name),this.descriptionControl.setValue(r.description??null),this.apiTypeControl.setValue(r.apiType),this.baseUrlControl.setValue(r.baseUrl??"");let e=r.apiKey??"";this.apiKeyControl.setValue(e),this.initialApiKey=e,this.headersArray.clear();for(let[a,s]of Object.entries(r.headers??{}))this.headersArray.push(new S({key:new p(a,{nonNullable:!0,validators:[_.required]}),value:new p(s,{nonNullable:!0})}))}submit(){if(this.form.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let r=this.descriptionControl.value?.trim(),e=this.baseUrlControl.value.trim(),a=this.apiKeyControl.value,s=this.isEditMode()&&a===this.initialApiKey?null:a,c=this.headersArray.controls.filter(b=>b.controls.key.value.trim()).map(b=>[b.controls.key.value.trim(),b.controls.value.value]),le=c.length>0?Object.fromEntries(c):null,w={name:this.nameControl.value.trim(),apiType:this.apiTypeControl.value,description:r||null,baseUrl:e||null,apiKey:s,headers:le},F=this.form.getRawValue().scope,se=this.isPlatformMode?null:this.namespaceId??null;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,w,F,this.existingConfig):this.state.create(w,F,se)).pipe(A(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-providers"]):this.router.navigate(["/agentos",this.namespaceId,"ai-providers"])}trackByScope(r,e){return e.value}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=I({type:n,selectors:[["agentos-ai-provider-form"]],decls:10,vars:2,consts:[[1,"ai-provider-form"],[1,"ai-provider-form__header"],["type","button","title","Back to AI providers",1,"ai-provider-form__back",3,"click"],[1,"ai-provider-form__back-icon"],[1,"ai-provider-form__title"],[1,"ai-provider-form__loading"],[1,"ai-provider-form__form",3,"formGroup"],[1,"ai-provider-form__form",3,"ngSubmit","formGroup"],[1,"ai-provider-form__scope",3,"disabled"],[1,"ai-provider-form__field"],["for","llm-api-type",1,"ai-provider-form__label"],["aria-hidden","true"],["id","llm-api-type",1,"ai-provider-form__select",3,"formControl"],[3,"value"],["for","llm-name",1,"ai-provider-form__label"],["id","llm-name","type","text","placeholder","e.g. OpenAI prod","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-description",1,"ai-provider-form__label"],["id","llm-description","type","text","placeholder","Optional \u2014 short description of this provider","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-base-url",1,"ai-provider-form__label"],["id","llm-base-url","type","url","placeholder","Optional \u2014 leave empty for default endpoint","autocomplete","off",1,"ai-provider-form__input",3,"formControl"],["for","llm-api-key",1,"ai-provider-form__label"],["id","llm-api-key","type","password","placeholder","sk-\u2026","autocomplete","new-password",1,"ai-provider-form__input","ai-provider-form__input--secret",3,"formControl"],[1,"ai-provider-form__headers",3,"formArrayName"],[1,"ai-provider-form__headers-title"],[1,"ai-provider-form__label"],["type","button",1,"ai-provider-form__headers-add",3,"click"],[1,"ai-provider-form__header-row",3,"formGroupName"],[1,"ai-provider-form__actions"],["type","submit",1,"ai-provider-form__btn","ai-provider-form__btn--primary",3,"disabled"],["type","button",1,"ai-provider-form__btn",3,"click"],[1,"ai-provider-form__scope-option"],["type","radio",3,"formControl","value","disabled"],["type","text","placeholder","Header name","formControlName","key","autocomplete","off",1,"ai-provider-form__input"],["type","text","placeholder","Value","formControlName","value","autocomplete","off",1,"ai-provider-form__input"],["type","button","title","Remove header","aria-label","Remove header",1,"ai-provider-form__header-remove",3,"click"]],template:function(e,a){e&1&&(o(0,"div",0)(1,"header",1)(2,"button",2),v("click",function(){return a.cancel()}),o(3,"span",3),i(4,"\u2190"),t(),i(5," AI Providers "),t(),o(6,"h1",4),i(7),t()(),M(8,de,2,0,"p",5)(9,fe,41,10,"form",6),t()),e&2&&(l(7),P(a.isEditMode()?"Edit AI provider":"New AI provider"),l(),O(a.isLoading()?8:9))},dependencies:[oe,j,re,te,z,ee,H,$,q,Q,Z,Y,W,X],styles:[".ai-provider-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:480px;margin:0 auto;padding:2rem 1rem}.ai-provider-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-border);border-radius:8px;padding:.75rem 1rem;margin:0}.ai-provider-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.ai-provider-form__scope-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:.85rem;color:var(--color-text);cursor:pointer}.ai-provider-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-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-primary, #007aff);font-family:inherit}.ai-provider-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.ai-provider-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.ai-provider-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.ai-provider-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.ai-provider-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.ai-provider-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.ai-provider-form__input[_ngcontent-%COMP%], .ai-provider-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.ai-provider-form__input[_ngcontent-%COMP%]:focus, .ai-provider-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.ai-provider-form__input[_ngcontent-%COMP%]::placeholder, .ai-provider-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.ai-provider-form__input--secret[_ngcontent-%COMP%]{font-family:monospace;letter-spacing:.05em}.ai-provider-form__headers[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.ai-provider-form__headers-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.ai-provider-form__headers-add[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.8125rem;font-family:inherit;color:var(--color-primary, #007aff)}.ai-provider-form__headers-add[_ngcontent-%COMP%]:hover{text-decoration:underline}.ai-provider-form__header-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}.ai-provider-form__header-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;background:none;border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:6px;cursor:pointer;font-size:1rem;color:var(--color-text-secondary, #6e6e73);transition:background .15s ease;flex-shrink:0}.ai-provider-form__header-remove[_ngcontent-%COMP%]:hover{background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.ai-provider-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.ai-provider-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.ai-provider-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.ai-provider-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.ai-provider-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.ai-provider-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{ae as AiProviderFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as S}from"./chunk-DB2U5ZVV.js";import{c as $,d as k}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-DB2U5ZVV.js";import{c as $,d as k}from"./chunk-QVQF6CQG.js";import{c as B}from"./chunk-P4GNUQZT.js";import{r as E,x as D}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as f}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as P,Db as l,Fb as d,Jc as q,Pb as I,S as y,Wa as C,ab as A,bc as w,ca as n,ec as R,fc as x,ga as m,ha as p,i as u,ic as T,lb as b,ma as g,mb as h,rb as c,sb as a,t as M,tb as _,u as v}from"./chunk-5NLXR4MK.js";var N=()=>[];function V(r,t){if(r&1){let o=P();a(0,"agentos-ai-model-item",4),l("editRequested",function(e){m(o);let s=d(2);return p(s.onEdit(e))})("deleteRequested",function(e){m(o);let s=d(2);return p(s.deleteModel(e))}),_()}r&2&&c("model",t)}function F(r,t){if(r&1&&b(0,V,1,1,"agentos-ai-model-item",3),r&2){let o,i=t.$implicit,e=d();h((o=e.resolveModel(i.id))?0:-1,o)}}var L=class r{router=n(B);destroyRef=n(g);aiModelController=n($);aiProviderController=n(k);refresh$=new u(void 0);data$=this.refresh$.pipe(y(()=>v([this.aiModelController.listPlatformLevelAiModel(),this.aiProviderController.listAiProvider("none")])));modelItems$=this.data$.pipe(M(([t,o])=>{let i=new Map(o.map(e=>[e.id??"",e.name]));return t.map(e=>({id:e.id??"",name:e.alias??e.apiModelName,description:e.apiModelName,groupKey:e.aiProviderId,groupLabel:i.get(e.aiProviderId)??e.aiProviderId}))}));modelsById=new Map;constructor(){this.data$.pipe(f(this.destroyRef)).subscribe(([t])=>{this.modelsById=new Map(t.map(o=>[o.id??"",o]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","ai-models","new"])}deleteModel(t){this.aiModelController.deleteAiModel(t.id??"").pipe(f(this.destroyRef)).subscribe(()=>this.refresh$.next())}onEdit(t){t.id&&this.router.navigate(["/agentos","admin","ai-models",t.id,"edit"])}resolveModel(t){return this.modelsById.get(t)??null}static \u0275fac=function(o){return new(o||r)};static \u0275cmp=C({type:r,selectors:[["agentos-platform-ai-models"]],decls:5,vars:6,consts:[["aiModelItemTpl",""],["title","Platform AI Models","emptyMessage","No platform AI models defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[3,"model"],[3,"editRequested","deleteRequested","model"]],template:function(o,i){if(o&1&&(a(0,"ds-entity-list",1),R(1,"async"),l("createRequested",function(){return i.openCreateForm()}),a(2,"ds-icon-button",2),l("action",function(){return i.goBack()}),_()(),A(3,F,1,1,"ng-template",null,0,T)),o&2){let e=I(4);c("items",x(1,3,i.modelItems$)??w(5,N))("showCreate",!0)("itemTemplate",e)}},dependencies:[D,S,E,q],styles:[".platform-ai-models__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-models__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"],changeDetection:0})};export{L as PlatformAiModelsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Oe}from"./chunk-BPJO7AWC.js";import{a as Se,b as Ie}from"./chunk-OUMQX2CT.js";import{a as ke}from"./chunk-277IC2QE.js";import{a as K}from"./chunk-J5W3AZMJ.js";import{a as $,b as ee,c as te,d as ne,e as oe,f as ae,g as re,h as ie,i as me,j as de,k as ce,l as se,m as le,n as ge,o as fe,p as he,q as ue,r as Ce,s as be,t as _e,u as ve}from"./chunk-XS2UZDZH.js";import{a as pe}from"./chunk-XC3I4AWV.js";import{a as Q,b as X,c as Z}from"./chunk-NCFBQG5D.js";import"./chunk-LS4KFB4C.js";import{a as xe}from"./chunk-7CZDTFEW.js";import"./chunk-IDD4RLL7.js";import{a as H}from"./chunk-R6R7XD7M.js";import{a as Y,b as q,c as J}from"./chunk-7EHCV7WH.js";import{a as Pe,b as Me}from"./chunk-EYIALH4L.js";import{a as Ae,b as ye}from"./chunk-UFZICL7S.js";import{k as F}from"./chunk-QVQF6CQG.js";import"./chunk-WIYSZEOD.js";import{c as w}from"./chunk-P4GNUQZT.js";import{r as T}from"./chunk-K7JRH3HO.js";import"./chunk-EBAEYY2S.js";import"./chunk-BZ7URUNM.js";import{a as E}from"./chunk-SKBT6DBT.js";import"./chunk-GF3EMWCA.js";import"./chunk-Z6RFJ6L3.js";import"./chunk-OPSHMM4H.js";import{Bb as O,Db as p,Fb as C,Ka as d,Rb as S,Tb as r,Ub as x,Wa as f,ca as g,ga as A,ha as y,lb as s,lc as I,ma as P,mb as l,rb as _,sb as n,ta as b,tb as o,ub as u,vb as M,wb as k,xb as v}from"./chunk-5NLXR4MK.js";var t=()=>!0;var Ee=[{path:"",loadComponent:()=>import("./chunk-GDWZ2TMN.js").then(e=>e.AgentosShellComponent),children:[{path:"home",canActivate:[t],loadComponent:()=>import("./chunk-SQLOY43N.js").then(e=>e.CaseShellComponent)},{path:"",loadComponent:()=>import("./chunk-ZR5OMYGQ.js").then(e=>e.LayoutComponent),children:[{path:"namespaces/new",canActivate:[t],loadComponent:()=>import("./chunk-CPH6KZS7.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces/:namespaceId/edit",canActivate:[t],loadComponent:()=>import("./chunk-CPH6KZS7.js").then(e=>e.NamespaceFormComponent)},{path:"namespaces",canActivate:[t],loadComponent:()=>import("./chunk-N2EM2OHG.js").then(e=>e.NamespaceListComponent)},{path:"admin",canActivate:[t],loadComponent:()=>import("./chunk-JCMCMBHO.js").then(e=>e.AdminHomeComponent)},{path:"admin/users/new",canActivate:[t],loadComponent:()=>import("./chunk-MRSRN4TG.js").then(e=>e.UserFormComponent)},{path:"admin/users/:userId/edit",canActivate:[t],loadComponent:()=>import("./chunk-MRSRN4TG.js").then(e=>e.UserFormComponent)},{path:"admin/users",canActivate:[t],loadComponent:()=>import("./chunk-7JNEJMOU.js").then(e=>e.UserListComponent)},{path:"admin/integration-configs/new",canActivate:[t],loadComponent:()=>import("./chunk-42PHOVHW.js").then(e=>e.IntegrationFormComponent)},{path:"admin/integration-configs/:integrationId/edit",canActivate:[t],loadComponent:()=>import("./chunk-42PHOVHW.js").then(e=>e.IntegrationFormComponent)},{path:"admin/integration-configs",canActivate:[t],loadComponent:()=>import("./chunk-PO5YVRVZ.js").then(e=>e.PlatformIntegrationConfigsComponent)},{path:"admin/prompts/new",canActivate:[t],loadComponent:()=>import("./chunk-34VSHF53.js").then(e=>e.PromptFormComponent)},{path:"admin/prompts/:promptId/edit",canActivate:[t],loadComponent:()=>import("./chunk-34VSHF53.js").then(e=>e.PromptFormComponent)},{path:"admin/prompts",canActivate:[t],loadComponent:()=>import("./chunk-ZET4SKHG.js").then(e=>e.PlatformPromptsComponent)},{path:"admin/ai-providers/new",canActivate:[t],loadComponent:()=>import("./chunk-E6H3OGX4.js").then(e=>e.AiProviderFormComponent)},{path:"admin/ai-providers/:aiProviderId/edit",canActivate:[t],loadComponent:()=>import("./chunk-E6H3OGX4.js").then(e=>e.AiProviderFormComponent)},{path:"admin/ai-providers",canActivate:[t],loadComponent:()=>import("./chunk-C2K3CJDB.js").then(e=>e.PlatformAiProvidersComponent)},{path:"admin/ai-models/new",canActivate:[t],loadComponent:()=>import("./chunk-XYSPIFZC.js").then(e=>e.AiModelFormComponent)},{path:"admin/ai-models/:modelId/edit",canActivate:[t],loadComponent:()=>import("./chunk-XYSPIFZC.js").then(e=>e.AiModelFormComponent)},{path:"admin/ai-models",canActivate:[t],loadComponent:()=>import("./chunk-EAYCLP6Q.js").then(e=>e.PlatformAiModelsComponent)},{path:"admin/agent-configs/new",canActivate:[t],loadComponent:()=>import("./chunk-ZWM3VY6S.js").then(e=>e.AgentConfigFormComponent)},{path:"admin/agent-configs/:agentConfigId/edit",canActivate:[t],loadComponent:()=>import("./chunk-ZWM3VY6S.js").then(e=>e.AgentConfigFormComponent)},{path:"admin/agent-configs/:agentConfigId/inspect",canActivate:[t],loadComponent:()=>import("./chunk-OUSIG6VB.js").then(e=>e.AgentConfigInspectComponent)},{path:"admin/agent-configs",canActivate:[t],loadComponent:()=>import("./chunk-PVRZ743D.js").then(e=>e.PlatformAgentConfigsComponent)},{path:"me",canActivate:[t],loadComponent:()=>import("./chunk-WQU7BC4Q.js").then(e=>e.UserProfileComponent)},{path:"user",canActivate:[t],loadComponent:()=>import("./chunk-WQU7BC4Q.js").then(e=>e.UserProfileComponent)},{path:":namespaceId/integrations/new",canActivate:[t],loadComponent:()=>import("./chunk-42PHOVHW.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations/:integrationId/edit",canActivate:[t],loadComponent:()=>import("./chunk-42PHOVHW.js").then(e=>e.IntegrationFormComponent)},{path:":namespaceId/integrations",canActivate:[t],loadComponent:()=>import("./chunk-D4HRVNXF.js").then(e=>e.IntegrationsAllScopesComponent)},{path:":namespaceId/ai-providers/new",canActivate:[t],loadComponent:()=>import("./chunk-E6H3OGX4.js").then(e=>e.AiProviderFormComponent)},{path:":namespaceId/ai-providers/:aiProviderId/edit",canActivate:[t],loadComponent:()=>import("./chunk-E6H3OGX4.js").then(e=>e.AiProviderFormComponent)},{path:":namespaceId/ai-providers",canActivate:[t],loadComponent:()=>import("./chunk-HGBGIBBE.js").then(e=>e.AiProvidersAllScopesComponent)},{path:":namespaceId/ai-models/new",canActivate:[t],loadComponent:()=>import("./chunk-XYSPIFZC.js").then(e=>e.AiModelFormComponent)},{path:":namespaceId/ai-models/:modelId/edit",canActivate:[t],loadComponent:()=>import("./chunk-XYSPIFZC.js").then(e=>e.AiModelFormComponent)},{path:":namespaceId/ai-models",canActivate:[t],loadComponent:()=>import("./chunk-2PRKBGAK.js").then(e=>e.NamespaceAiModelsComponent)},{path:":namespaceId/prompts/new",canActivate:[t],loadComponent:()=>import("./chunk-34VSHF53.js").then(e=>e.PromptFormComponent)},{path:":namespaceId/prompts/:promptId/edit",canActivate:[t],loadComponent:()=>import("./chunk-34VSHF53.js").then(e=>e.PromptFormComponent)},{path:":namespaceId/prompts",canActivate:[t],loadComponent:()=>import("./chunk-FBB7REI2.js").then(e=>e.NamespacePromptsComponent)},{path:":namespaceId/agent-configs/new",canActivate:[t],loadComponent:()=>import("./chunk-ZWM3VY6S.js").then(e=>e.AgentConfigFormComponent)},{path:":namespaceId/agent-configs/:agentConfigId/edit",canActivate:[t],loadComponent:()=>import("./chunk-ZWM3VY6S.js").then(e=>e.AgentConfigFormComponent)},{path:":namespaceId/agent-configs/:agentConfigId/inspect",canActivate:[t],loadComponent:()=>import("./chunk-OUSIG6VB.js").then(e=>e.AgentConfigInspectComponent)},{path:":namespaceId/agent-configs",canActivate:[t],loadComponent:()=>import("./chunk-L5WQCZRE.js").then(e=>e.NamespaceAgentConfigsComponent)},{path:"",redirectTo:"namespaces",pathMatch:"full"}]}]}];function B(e,i){e&1&&v(0,"span",1)}function R(e,i){e&1&&v(0,"span",2)}function j(e,i){e&1&&v(0,"span",3)}var h=class e{pluginService=g(F);online=b(null);ngOnInit(){this.pluginService.getAllPlugins().subscribe({next:()=>this.online.set(!0),error:()=>this.online.set(!1)})}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=f({type:e,selectors:[["agentos-backend-status"]],decls:4,vars:1,consts:[[1,"backend-status"],["title","AgentOS online",1,"dot","dot--online"],["title","AgentOS offline",1,"dot","dot--offline"],["title","Checking\u2026",1,"dot","dot--checking"]],template:function(a,m){if(a&1&&(M(0,"div",0),s(1,B,1,0,"span",1)(2,R,1,0,"span",2)(3,j,1,0,"span",3),k()),a&2){let c;d(),l((c=m.online())===!0?1:c===!1?2:3)}},styles:[".backend-status[_ngcontent-%COMP%]{display:flex;align-items:center}.dot[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;flex-shrink:0}.dot--online[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.dot--offline[_ngcontent-%COMP%]{background:var(--color-error, #ff3b30)}.dot--checking[_ngcontent-%COMP%]{background:var(--color-text-secondary, #6e6e73);opacity:.5;animation:_ngcontent-%COMP%_pulse 1.2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:.5}50%{opacity:1}}"]})};function L(e,i){if(e&1){let a=O();n(0,"button",9),p("click",function(){A(a);let c=C();return y(c.navigateToAdmin())}),n(1,"span",10),r(2,"\u2699\uFE0F"),o()()}}function G(e,i){if(e&1&&(n(0,"span",7),r(1),o()),e&2){let a=C();d(),x(a.userInitials)}}function V(e,i){e&1&&(n(0,"span",8),r(1,"\u25EF"),o())}var z=class e{router=g(w);userState=g(H);destroyRef=g(P);currentUser=this.userState.currentUser;navigateHome(){this.router.navigate(["/agentos/home"])}isAdmin=I(()=>this.userState.currentUser()?.isAdmin===!0);navigateToAdmin(){this.router.navigate(["/agentos/admin"])}ngOnInit(){this.currentUser()||this.userState.loadMe().pipe(E(this.destroyRef)).subscribe()}get userInitials(){let i=this.currentUser();if(!i)return"";let a=i.firstname?.[0]??"",m=i.lastname?.[0]??"";return(a+m).toUpperCase()||i.email?.[0]?.toUpperCase()||"?"}get isOnProfilePage(){return this.router.url.startsWith("/agentos/me")}toggleProfile(){this.isOnProfilePage?window.history.length>1?window.history.back():this.router.navigate(["/agentos"]):this.router.navigate(["/agentos/me"])}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=f({type:e,selectors:[["agentos-header"]],decls:11,vars:5,consts:[[1,"header"],["type","button","title","Home",1,"header__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"header__logo-img"],[1,"header__logo-text"],[1,"header__nav"],["type","button","title","Admin",1,"header__admin-btn"],["type","button",1,"header__user-btn",3,"click","title"],[1,"header__user-initials"],[1,"header__user-icon"],["type","button","title","Admin",1,"header__admin-btn",3,"click"],[1,"header__admin-icon"]],template:function(a,m){a&1&&(n(0,"header",0)(1,"button",1),p("click",function(){return m.navigateHome()}),u(2,"img",2),n(3,"span",3),r(4,"Coday"),o()(),n(5,"nav",4),u(6,"agentos-backend-status"),s(7,L,3,0,"button",5),n(8,"button",6),p("click",function(){return m.toggleProfile()}),s(9,G,2,1,"span",7)(10,V,2,0,"span",8),o()()()),a&2&&(d(7),l(m.isAdmin()?7:-1),d(),S("header__user-btn--active",m.isOnProfilePage),_("title",m.isOnProfilePage?"Back":"My profile"),d(),l(m.userInitials?9:10))},dependencies:[h],styles:[".header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:0 1.5rem;height:56px;background:var(--glass-bg, rgba(255, 255, 255, .72));border-bottom:1px solid var(--glass-border, rgba(255, 255, 255, .18));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));position:sticky;top:0;z-index:100}.header__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;background:none;border:none;padding:0;cursor:pointer;border-radius:6px;transition:opacity .15s ease}.header__brand[_ngcontent-%COMP%]:hover{opacity:.7}.header__logo-img[_ngcontent-%COMP%]{width:32px;height:32px;object-fit:contain}.header__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;letter-spacing:-.01em;color:var(--color-text, #1d1d1f)}.header__nav[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.header__admin-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit;font-size:1rem;line-height:1}.header__admin-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__admin-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.header__user-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit}.header__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%] .header__user-initials[_ngcontent-%COMP%], .header__user-btn--active[_ngcontent-%COMP%] .header__user-icon[_ngcontent-%COMP%]{color:#fff}.header__user-initials[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;color:var(--color-text, #1d1d1f);line-height:1;letter-spacing:.02em}.header__user-icon[_ngcontent-%COMP%]{font-size:1rem;color:var(--color-text-secondary, #6e6e73);line-height:1}"]})};function W(e,i){if(e&1&&(n(0,"p",11),r(1," Last action: "),n(2,"strong"),r(3),o()()),e&2){let a=C();d(3),x(a.lastAction())}}var D=class e{lastAction=b(null);onSend(){this.lastAction.set("send")}onStop(){this.lastAction.set("stop")}onAttach(){this.lastAction.set("attach")}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=f({type:e,selectors:[["agentos-hello"]],decls:35,vars:2,consts:[[1,"hello-agentos"],[1,"card"],[1,"badge"],[1,"principles"],[1,"demo"],[1,"demo-label"],[1,"demo-buttons"],["icon","send","variant","primary","title","Send",3,"action"],["icon","stop","variant","danger","title","Stop",3,"action"],["icon","attach_file","variant","default","title","Attach",3,"action"],["icon","mic","variant","default","title","Record",3,"action","disabled"],[1,"demo-feedback"]],template:function(a,m){a&1&&(n(0,"div",0)(1,"div",1)(2,"div",2),r(3,"AgentOS UI"),o(),n(4,"h1"),r(5,"Hello AgentOS"),o(),n(6,"p"),r(7," This component lives in "),n(8,"code"),r(9,"libs/agentos-ui"),o(),r(10," \u2014 isolated from Coday internals, ready to be published as "),n(11,"code"),r(12,"@whoz-oss/agentos-ui"),o(),r(13,". "),o(),u(14,"agentos-backend-status"),n(15,"ul",3)(16,"li"),r(17,"\u2726 No imports from Coday app"),o(),n(18,"li"),r(19,"\u2726 CSS custom properties as host contract"),o(),n(20,"li"),r(21,"\u2726 Standalone Angular components"),o(),n(22,"li"),r(23,"\u2726 Signals-first reactive state"),o()(),n(24,"div",4)(25,"p",5),r(26,"ds-icon-button from "),n(27,"code"),r(28,"@whoz-oss/design-system"),o()(),n(29,"div",6)(30,"ds-icon-button",7),p("action",function(){return m.onSend()}),o(),n(31,"ds-icon-button",8),p("action",function(){return m.onStop()}),o(),n(32,"ds-icon-button",9),p("action",function(){return m.onAttach()}),o(),n(33,"ds-icon-button",10),p("action",function(){return m.onAttach()}),o()(),s(34,W,4,1,"p",11),o()()()),a&2&&(d(33),_("disabled",!0),d(),l(m.lastAction()?34:-1))},dependencies:[T,h],styles:['@charset "UTF-8";.hello-agentos[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-height:100vh;padding:2rem}.card[_ngcontent-%COMP%]{background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 32px 0 rgba(31, 38, 135, .15));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));border-radius:20px;padding:3rem;max-width:480px;width:100%;text-align:center}.badge[_ngcontent-%COMP%]{display:inline-block;background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff);font-size:.75rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;padding:.25rem .75rem;border-radius:100px;margin-bottom:1.5rem}h1[_ngcontent-%COMP%]{color:var(--color-text, #1d1d1f);font-size:2rem;font-weight:700;margin:0 0 1rem;letter-spacing:-.02em}p[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);line-height:1.6;margin:0 0 1.5rem}p[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.principles[_ngcontent-%COMP%]{list-style:none;margin:0 0 1.5rem;padding:0;text-align:left;display:flex;flex-direction:column;gap:.5rem}.principles[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;padding:.5rem .75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:8px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%]{border-top:1px solid var(--color-border-light, rgba(40, 40, 40, .08));padding-top:1.25rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.8rem;margin:0 0 .75rem}.demo[_ngcontent-%COMP%] .demo-label[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(142, 142, 147, .12));color:var(--color-code-text, #ff375f);padding:.125rem .375rem;border-radius:6px;font-size:.875em;border:1px solid var(--color-border, rgba(0, 0, 0, .1))}.demo[_ngcontent-%COMP%] .demo-buttons[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center;justify-content:center;padding:.75rem;background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-radius:12px;border:1px solid var(--color-border-light, rgba(40, 40, 40, .08))}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%]{margin:.75rem 0 0;font-size:.85rem;color:var(--color-text-secondary, #6e6e73)}.demo[_ngcontent-%COMP%] .demo-feedback[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{color:var(--color-primary, #007aff)}']})};export{Ee as AGENTOS_ROUTES,Ae as ActionCardChipsDirective,ye as ActionCardComponent,K as AgentosShellComponent,q as AgentosThemeService,X as AgentosUserPreferencesService,h as BackendStatusComponent,ue as CaseChatComponent,_e as CaseDrawerComponent,Ce as CaseHomeComponent,be as CaseItemComponent,ve as CaseShellComponent,Q as ENTER_KEY_BEHAVIORS,se as ExchangeContentViewerComponent,fe as ExchangeDrawerComponent,ge as ExchangeFileListComponent,le as ExchangeItemComponent,he as ExchangeShellComponent,$ as ExchangeStateService,z as HeaderComponent,D as HelloAgentosComponent,xe as LayoutComponent,ee as MAX_VIEWABLE_SIZE,pe as MarkdownPipe,Pe as NamespaceItemComponent,Me as NamespaceListComponent,Y as THEME_MODES,J as THEME_PORT,Z as USER_PREFERENCES_PORT,ke as UserAdminStateService,Oe as UserFormComponent,Se as UserItemComponent,Ie as UserListComponent,H as UserStateService,t as agentosReadyGuard,me as canViewFile,ae as detectFormat,ce as exchangeMutationScope,oe as formatDate,ne as formatSize,te as getFileIcon,re as isFormatViewable,ie as isViewable,de as reindentJson};
|