@whoz-oss/coday-client 0.0.0-workstream-messaging.6 → 0.0.0-workstream-forge.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/browser/chunk-2rx1a3bg.js +1 -0
  2. package/browser/chunk-44iNe1uu.js +1 -0
  3. package/browser/chunk-6fEcW1af.js +1 -0
  4. package/browser/chunk-BOAakMd1.js +1 -0
  5. package/browser/chunk-BOu7cjfB.js +1 -0
  6. package/browser/chunk-BRf--TAM.js +1 -0
  7. package/browser/chunk-BXEuZdL_.js +1 -0
  8. package/browser/chunk-BXjaHG4X.js +1 -0
  9. package/browser/chunk-BZl7Iiay.js +1 -0
  10. package/browser/chunk-Bb4ZghwW.js +1 -0
  11. package/browser/chunk-BgUbG3v4.js +2 -0
  12. package/browser/{chunk-D0vHzITV.js → chunk-Bjb4ofPZ.js} +1 -1
  13. package/browser/chunk-Blm_gDNW.js +1 -0
  14. package/browser/chunk-Bm9jTMyL.js +1 -0
  15. package/browser/chunk-Boa1rtr3.js +1 -0
  16. package/browser/chunk-BzRZcbeu.js +1 -0
  17. package/browser/{chunk-DmRaBKc6.js → chunk-C1C0RiZa.js} +1 -1
  18. package/browser/chunk-C7-dVBzk.js +1 -0
  19. package/browser/chunk-CIVLU6Kt.js +1 -0
  20. package/browser/chunk-COuqiVBt.js +1 -0
  21. package/browser/chunk-Cbx6LzEu.js +1 -0
  22. package/browser/chunk-CjYCW_MM.js +1 -0
  23. package/browser/chunk-CuO_LCF5.js +1 -0
  24. package/browser/chunk-D-1TnBnZ.js +1 -0
  25. package/browser/chunk-D0tfduku.js +1 -0
  26. package/browser/chunk-DE6sgNNV.js +1 -0
  27. package/browser/chunk-DHe0DwEl.js +1 -0
  28. package/browser/chunk-DO-ovLg3.js +1 -0
  29. package/browser/chunk-DOAcv-0n.js +1 -0
  30. package/browser/chunk-DRRpPNnR.js +1 -0
  31. package/browser/chunk-DT2PdsWA.js +1 -0
  32. package/browser/chunk-DY9-csXz.js +1 -0
  33. package/browser/chunk-DmcssVrC.js +1 -0
  34. package/browser/chunk-Dq6TitFH.js +1 -0
  35. package/browser/chunk-Ds02yuKZ.js +1 -0
  36. package/browser/chunk-Dyr7sRIs.js +1 -0
  37. package/browser/chunk-HBNTqJMB.js +2 -0
  38. package/browser/chunk-HNE4DSTY.js +2 -0
  39. package/browser/chunk-JvVR12Id.js +1 -0
  40. package/browser/chunk-TdvCGQY1.js +674 -0
  41. package/browser/chunk-X1BEhfE5.js +1 -0
  42. package/browser/chunk-eYQBIph9.js +1 -0
  43. package/browser/{chunk-DGEz4p7l.js → chunk-oRtfYKfO.js} +1 -1
  44. package/browser/chunk-s9o_sIbq.js +1 -0
  45. package/browser/chunk-ujBeU4_3.js +1 -0
  46. package/browser/chunk-yXcf610a.js +1 -0
  47. package/browser/index.html +1 -1
  48. package/browser/main-C57PASRG.js +1253 -0
  49. package/package.json +1 -1
  50. package/browser/chunk-5j6qVmNr.js +0 -2
  51. package/browser/chunk-BRlHxogh.js +0 -1
  52. package/browser/chunk-BZzn53bQ.js +0 -1
  53. package/browser/chunk-BeT-E8P2.js +0 -1
  54. package/browser/chunk-Bp_ymzom.js +0 -1
  55. package/browser/chunk-BsJuusWB.js +0 -1
  56. package/browser/chunk-BtrZ-Mv4.js +0 -1
  57. package/browser/chunk-BvPY6zMm.js +0 -1
  58. package/browser/chunk-Bz76f5F9.js +0 -1
  59. package/browser/chunk-C3ILbsIC.js +0 -1
  60. package/browser/chunk-C3IqVFBm.js +0 -1
  61. package/browser/chunk-CH4u_0xa.js +0 -1
  62. package/browser/chunk-CIXkHX9u.js +0 -1
  63. package/browser/chunk-COmLfT0N.js +0 -674
  64. package/browser/chunk-Cc0MCjmC.js +0 -1
  65. package/browser/chunk-CgBP6cXi.js +0 -1
  66. package/browser/chunk-Cmjv1U23.js +0 -1
  67. package/browser/chunk-CoioEeqa.js +0 -1
  68. package/browser/chunk-Cq9jD9x7.js +0 -1
  69. package/browser/chunk-Cs7JPANX.js +0 -1
  70. package/browser/chunk-Ct5SlLjd.js +0 -2
  71. package/browser/chunk-D1kq6J6C.js +0 -1
  72. package/browser/chunk-D2xRGvgz.js +0 -1
  73. package/browser/chunk-DIVQtNVn.js +0 -1
  74. package/browser/chunk-DKL6wv8w.js +0 -1
  75. package/browser/chunk-DSMx6Y5L.js +0 -1
  76. package/browser/chunk-DTS0hzha.js +0 -1
  77. package/browser/chunk-DX8h3arb.js +0 -1
  78. package/browser/chunk-DkBkSmvX.js +0 -1
  79. package/browser/chunk-DnB0tF3N.js +0 -1
  80. package/browser/chunk-DnkCIZhe.js +0 -2
  81. package/browser/chunk-Dx9mLY6-.js +0 -1
  82. package/browser/chunk-DxIOAne_.js +0 -1
  83. package/browser/chunk-Dzy8eQLO.js +0 -1
  84. package/browser/chunk-GF2Xn6bl.js +0 -1
  85. package/browser/chunk-YrkvQ7uA.js +0 -1
  86. package/browser/chunk-ZPs3mDFS.js +0 -1
  87. package/browser/chunk-_RBJYLm-.js +0 -1
  88. package/browser/chunk-_VwpOjoS.js +0 -1
  89. package/browser/chunk-aqEkIRN7.js +0 -1
  90. package/browser/chunk-b_xoWNAu.js +0 -1
  91. package/browser/chunk-m4ODhjhI.js +0 -1
  92. package/browser/chunk-rLH5JBfe.js +0 -1
  93. package/browser/chunk-sEql4aGA.js +0 -1
  94. package/browser/chunk-vEjTDtHB.js +0 -1
  95. package/browser/chunk-v_8QrHNJ.js +0 -1
  96. package/browser/main-B6UJJXO7.js +0 -1254
@@ -1 +0,0 @@
1
- import {g as g$1}from'./chunk-D1kq6J6C.js';import {v}from'./chunk-aqEkIRN7.js';import {V as M,X as a,j as e}from'./chunk-COmLfT0N.js';import {g,w as we,aD as aB,aE as ze,M as Mi,aF as Qs,x as U,aG as oy,K as x,C as w,J as JI,_ as Qb,G as Gu,f as fC,b as Wu,i as bw,as as Cw,E as Ew,a as EE,T as Tw,I as Iw,P as Pw,l as lg,Y as Yu,a0 as AC,c as Gh,a1 as kC,n as Aw,Z as Zh,q as Pd,L as Ld,O as Op,t as tC,U as Uh}from'./main-B6UJJXO7.js';function J(i,t){i&1&&(Gu(0,"span",6),fC(1,"created by AgentOS"),Wu());}function H(i,t){if(i&1){let e=Aw();Gu(0,"span",6),fC(1,"Remove the bot and its users' links?"),Wu(),Gu(2,"button",14),Zh("click",function(){Pd(e);let o=Pw(2),d=Pw(2);return Ld(d.remove(o))}),fC(3," Remove "),Wu(),Gu(4,"button",15),Zh("click",function(){Pd(e);let o=Pw(4);return Ld(o.confirmingRemoveId.set(null))}),fC(5,"Cancel"),Wu();}if(i&2){let e=Pw(4);EE(2),Gh("disabled",e.busy());}}function Y(i,t){if(i&1){let e=Aw();Gu(0,"button",15),Zh("click",function(){Pd(e);let o=Pw(2),d=Pw(2);return Ld(d.confirmingRemoveId.set(o.id))}),fC(1," Remove "),Wu();}}function Q(i,t){if(i&1){let e=Aw();Uh(0,"span",11),Gu(1,"button",12),Zh("click",function(){Pd(e);let o=Pw(),d=Pw(2);return Ld(d.toggle(o))}),fC(2),Wu(),Ew(3,H,6,1)(4,Y,2,0,"button",13);}if(i&2){let e=Pw(),n=Pw(2);EE(),Gh("disabled",n.busy()),EE(),Yu(" ",e.enabled?"Turn off":"Turn on"," "),EE(),Iw(n.confirmingRemoveId()===e.id?3:4);}}function W(i,t){if(i&1&&(Gu(0,"p",10),fC(1),Wu()),i&2){let e=Pw(2).$implicit,n=Pw();EE(),Yu(" ",n.platformName(e)," refuses this bot's token: it was revoked or replaced. Remove the bot and give the agent a new one. ");}}function X(i,t){i&1&&(Gu(0,"p",10),fC(1," Another program receives this bot's messages, such as another AgentOS instance: give each instance its own bot. "),Wu());}function Z(i,t){if(i&1&&(Gu(0,"p",2),fC(1),Wu()),i&2){let e=Pw(2).$implicit,n=Pw();EE(),Yu("Your ",n.platformName(e)," account is connected to this bot.");}}function ee(i,t){if(i&1){let e=Aw();Gu(0,"span",6),fC(1,"then send it this message:"),Wu(),Gu(2,"code",17),fC(3),Wu(),Gu(4,"button",15),Zh("click",function(){let o=Pd(e),d=Pw(4);return Ld(d.copy(o))}),fC(5,"Copy"),Wu();}i&2&&(EE(3),lg(t));}function te(i,t){i&1&&(Gu(0,"span",6),fC(1,"Press Start, then come back here."),Wu());}function ne(i,t){if(i&1&&(Gu(0,"div",7)(1,"a",16),fC(2),Wu(),Ew(3,ee,6,1)(4,te,2,0,"span",6),Gu(5,"span",6),fC(6),AC(7,"date"),Wu()()),i&2){let e,n=t,o=Pw();EE(),Gh("href",n.url,Op),EE(),Yu(" Open @",o.username," "),EE(),Iw((e=n.code)?3:4,e),EE(3),Yu("Valid until ",kC(7,4,n.expiresAt,"shortTime"),".");}}function ie(i,t){if(i&1){let e=Aw();Gu(0,"div",7)(1,"button",12),Zh("click",function(){Pd(e);let o=Pw(),d=Pw(2);return Ld(d.connect(o))}),fC(2," Connect my account "),Wu()();}if(i&2){let e=Pw(3);EE(),Gh("disabled",e.busy());}}function oe(i,t){if(i&1&&(Gu(0,"div",7)(1,"a",8),fC(2),Wu(),Gu(3,"span",9),fC(4),Wu(),Ew(5,J,2,0,"span",6),Ew(6,Q,5,3),Wu(),Ew(7,W,2,1,"p",10)(8,X,2,0,"p",10),Ew(9,Z,2,1,"p",2)(10,ne,8,7,"div",7)(11,ie,3,1,"div",7)),i&2){let e,n=t,o=Pw(2);EE(),Gh("href",n.url,Op),EE(),Yu("@",n.username),EE(),tC("agent-messaging__status--"+o.statusTone(n.status)),EE(),Yu(" ",o.statusLabel(n.status)," "),EE(),Iw(n.managed?5:-1),EE(),Iw(o.canAdminister()?6:-1),EE(),Iw(n.status==="TOKEN_REJECTED"?7:n.status==="CONFLICT"?8:-1),EE(2),Iw(n.linked?9:(e=o.connectLinkOf(n))?10:n.enabled?11:-1,e);}}function ae(i,t){if(i&1&&(Gu(0,"div",7)(1,"a",16),fC(2," Open Telegram "),Wu(),Gu(3,"span",6),fC(4),AC(5,"date"),Wu()()),i&2){let e=t;EE(),Gh("href",e.url,Op),EE(3),Yu(" Press Start, then Create, and confirm the bot's name: this page shows the bot as soon as it exists. Valid until ",kC(5,2,e.expiresAt,"shortTime"),". ");}}function re(i,t){if(i&1){let e=Aw();Gu(0,"button",20),Zh("click",function(){Pd(e);let o=Pw(3).$implicit,d=Pw();return Ld(d.createBot(o))}),fC(1),Wu();}if(i&2){let e=Pw(3).$implicit,n=Pw();Gh("disabled",n.busy()),EE(),Yu(" Create a ",n.platformName(e)," bot ");}}function se(i,t){i&1&&(Gu(0,"p",6),fC(1," Creating a bot without copying a token needs the instance's bot manager: a super-admin sets it in Settings, Messaging. "),Wu());}function le(i,t){if(i&1){let e=Aw();Gu(0,"div",7),Ew(1,re,2,2,"button",19),Gu(2,"button",15),Zh("click",function(){Pd(e);let o=Pw(2).$implicit,d=Pw();return Ld(d.openForm(o))}),fC(3),Wu()(),Ew(4,se,2,0,"p",6);}if(i&2){let e=Pw(2).$implicit,n=Pw();EE(),Iw(n.canCreate(e)?1:-1),EE(2),Yu(" ",e===n.Platform.SLACK?"Connect a Slack app":"Use an existing bot"," "),EE(),Iw(e===n.Platform.TELEGRAM&&!n.canCreate(e)?4:-1);}}function me(i,t){if(i&1){let e=Aw();Gu(0,"a",27),fC(1,"open Slack's apps"),Wu(),fC(2,", choose From a manifest, pick the workspace and paste it. "),Gu(3,"pre",28),fC(4),Wu(),Gu(5,"button",15),Zh("click",function(){let o=Pd(e),d=Pw(5);return Ld(d.copy(o.manifest))}),fC(6),Wu();}if(i&2){let e=t,n=Pw(5);Gh("href",e.createUrl,Op),EE(4),lg(e.manifest),EE(2),Yu(" ",n.copied()?"Copied":"Copy the manifest"," ");}}function de(i,t){if(i&1&&(Gu(0,"ol",22)(1,"li"),fC(2," Create a Slack app from this manifest: "),Ew(3,me,7,3),Wu(),Gu(4,"li"),fC(5,"Install the app in the workspace, then copy its Bot User OAuth Token (OAuth & Permissions)."),Wu(),Gu(6,"li"),fC(7," In Basic Information, App-Level Tokens, generate a token with the connections:write scope, and copy it. "),Wu()()),i&2){let e,n=Pw(4);EE(3),Iw((e=n.manifest())?3:-1,e);}}function ge(i,t){if(i&1){let e=Aw();Gu(0,"label",29),fC(1,"App-level token"),Wu(),Gu(2,"input",30),Zh("input",function(o){Pd(e);let d=Pw(4);return Ld(d.appToken.set(o.target.value))}),Wu();}if(i&2){let e=Pw(4);EE(2),Gh("value",e.appToken());}}function ce(i,t){i&1&&fC(0," Create a bot with @BotFather in Telegram (/newbot) and paste its token. ");}function _e(i,t){if(i&1){let e=Aw();Gu(0,"form",21),Zh("submit",function(o){Pd(e);let d=Pw(2).$implicit,M=Pw();return o.preventDefault(),Ld(M.attach(d))}),Ew(1,de,8,1,"ol",22),Gu(2,"div",23)(3,"label",24),fC(4),Wu(),Gu(5,"input",25),Zh("input",function(o){Pd(e);let d=Pw(3);return Ld(d.token.set(o.target.value))}),Wu(),Ew(6,ge,3,1),Gu(7,"button",26),fC(8," Attach "),Wu()(),Gu(9,"p",6),Ew(10,ce,1,0),fC(11," The tokens are stored encrypted and never shown again. "),Wu()();}if(i&2){let e=Pw(2).$implicit,n=Pw();EE(),Iw(e===n.Platform.SLACK?1:-1),EE(2),Gh("htmlFor","agent-messaging-token-"+e),EE(),Yu(" ",e===n.Platform.SLACK?"Bot User OAuth Token":"Bot token"," "),EE(),Gh("id","agent-messaging-token-"+e)("placeholder",e===n.Platform.SLACK?"xoxb-\u2026":"123456789:AA\u2026")("value",n.token()),EE(),Iw(e===n.Platform.SLACK?6:-1),EE(),Gh("disabled",n.busy()||!n.token().trim()||e===n.Platform.SLACK&&!n.appToken().trim()),EE(3),Iw(e===n.Platform.TELEGRAM?10:-1);}}function pe(i,t){if(i&1&&(Ew(0,ae,6,5,"div",7)(1,le,5,3),Ew(2,_e,12,9,"form",18)),i&2){let e,n=Pw().$implicit,o=Pw();Iw((e=n===o.Platform.TELEGRAM&&o.creationLink())?0:1,e),EE(2),Iw(o.formPlatform()===n?2:-1);}}function ue(i,t){if(i&1&&(Gu(0,"p",6),fC(1),Wu()),i&2){let e=Pw().$implicit,n=Pw();EE(),Yu(" No bot yet. An admin of the namespace can give this agent a ",n.platformName(e)," bot. ");}}function fe(i,t){if(i&1&&(Gu(0,"div",3)(1,"h3",5),fC(2),Wu(),Ew(3,oe,12,9)(4,pe,3,2)(5,ue,2,1,"p",6),Wu()),i&2){let e,n=t.$implicit,o=Pw();EE(2),lg(o.platformName(n)),EE(),Iw((e=o.botOf(n))?3:o.canAdminister()?4:5,e);}}function Ce(i,t){i&1&&(Gu(0,"p",4),fC(1),Wu()),i&2&&(EE(),lg(t));}var q=class i{botConfig=g(g$1);messagingState=g(M);namespaceRole=g(v);destroyRef=g(we);namespaceId=aB.required();agentId=aB.required();platforms=a;platformName=e;Platform=ze;bots=Mi([]);canAdminister=Mi(false);creatable=Mi([]);creationLink=Mi(null);connectLinks=Mi({});formPlatform=Mi(null);token=Mi("");appToken=Mi("");manifest=Mi(null);copied=Mi(false);busy=Mi(false);confirmingRemoveId=Mi(null);error=Mi(null);constructor(){Qs(window,"focus").pipe(U()).subscribe(()=>{(this.creationLink()||Object.keys(this.connectLinks()).length>0)&&this.refresh();}),oy(be).pipe(U()).subscribe(()=>{let t=this.creationLink();t&&(Date.parse(t.expiresAt)<Date.now()?this.creationLink.set(null):this.refresh());});}ngOnInit(){this.namespaceRole.isAdminOfNamespace$(this.namespaceId()).pipe(U(this.destroyRef)).subscribe(t=>this.canAdminister.set(t)),this.messagingState.capabilities().pipe(U(this.destroyRef)).subscribe({next:t=>this.creatable.set(t.botCreation),error:t=>console.error("[AgentMessaging] Could not read the messaging capabilities:",t)}),this.refresh();}botOf(t){return this.bots().find(e=>e.platform===t)??null}canCreate(t){return this.creatable().includes(t)}connectLinkOf(t){return this.connectLinks()[t.id]}statusLabel(t){return xe[t]??t}statusTone(t){switch(t){case "RUNNING":return "ok";case "DISABLED":return "off";default:return "warn"}}openForm(t){if(this.formPlatform()===t){this.formPlatform.set(null);return}this.formPlatform.set(t),this.token.set(""),this.appToken.set(""),this.manifest.set(null),this.copied.set(false),t==="SLACK"&&this.run(this.botConfig.manifest(this.namespaceId(),this.agentId(),t),e=>this.manifest.set(e),"Could not get the manifest of the Slack app.");}copy(t){navigator.clipboard?.writeText(t).then(()=>this.copied.set(true),()=>this.copied.set(false));}createBot(t){this.run(this.botConfig.requestCreation(this.namespaceId(),this.agentId(),t),e=>this.creationLink.set(e),"Could not start the creation of the bot.");}attach(t){let e$1=this.token().trim(),n=this.appToken().trim();!e$1||t==="SLACK"&&!n||this.run(this.botConfig.attach(this.namespaceId(),this.agentId(),t,e$1,n||void 0),o=>{this.token.set(""),this.appToken.set(""),this.formPlatform.set(null),this.replace(o);},`${e(t)} refused these tokens, or the bot already serves another agent.`);}toggle(t){this.run(this.botConfig.setEnabled(t.id,!t.enabled),e=>this.replace(e),"Could not change the bot.");}remove(t){this.confirmingRemoveId.set(null),this.run(this.botConfig.remove(t.id),()=>{this.bots.update(e=>e.filter(n=>n.id!==t.id)),this.reloadMessagingState();},"Could not remove the bot.");}connect(t){this.run(this.messagingState.createLink(t.id),e=>this.connectLinks.update(n=>x(w({},n),{[t.id]:e})),"Could not get a link to the bot.");}refresh(){let t=this.creationLink()!==null||Object.keys(this.connectLinks()).length>0;this.botConfig.agentBots(this.namespaceId(),this.agentId()).pipe(U(this.destroyRef)).subscribe({next:e=>{let n=e.some(o=>o.linked&&!this.bots().some(d=>d.id===o.id&&d.linked));this.bots.set(e),t&&n&&this.reloadMessagingState(),e.some(o=>o.platform==="TELEGRAM")&&this.creationLink.set(null),this.connectLinks.update(o=>Object.fromEntries(Object.entries(o).filter(([d])=>!e.some(M=>M.id===d&&M.linked))));},error:e=>console.error("[AgentMessaging] Could not load the bots of the agent:",e)});}reloadMessagingState(){this.messagingState.load().pipe(U(this.destroyRef)).subscribe({error:()=>{}});}replace(t){this.bots.update(e=>[...e.filter(n=>n.platform!==t.platform),t]);}run(t,e,n){this.error.set(null),this.busy.set(true),t.pipe(U(this.destroyRef)).subscribe({next:o=>{this.busy.set(false),e(o);},error:o=>{console.error("[AgentMessaging]",n,o),this.busy.set(false),this.error.set(o?.error?.message??n);}});}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=JI({type:i,selectors:[["agentos-agent-messaging"]],inputs:{namespaceId:[1,"namespaceId"],agentId:[1,"agentId"]},decls:8,vars:1,consts:[[1,"agent-messaging"],[1,"agent-messaging__title"],[1,"agent-messaging__hint"],[1,"agent-messaging__platform"],["role","alert",1,"agent-messaging__error"],[1,"agent-messaging__platform-title"],[1,"agent-messaging__note"],[1,"agent-messaging__row"],["target","_blank","rel","noopener",1,"agent-messaging__bot",3,"href"],[1,"agent-messaging__status"],[1,"agent-messaging__warning"],[1,"agent-messaging__spacer"],["type","button",1,"agent-messaging__btn",3,"click","disabled"],["type","button",1,"agent-messaging__btn"],["type","button",1,"agent-messaging__btn","agent-messaging__btn--danger",3,"click","disabled"],["type","button",1,"agent-messaging__btn",3,"click"],["target","_blank","rel","noopener",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"href"],[1,"agent-messaging__code"],[1,"agent-messaging__form"],["type","button",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"disabled"],["type","button",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"click","disabled"],[1,"agent-messaging__form",3,"submit"],[1,"agent-messaging__steps"],[1,"agent-messaging__fields"],[1,"agent-messaging__label",3,"for"],["type","password","name","token","autocomplete","off",1,"agent-messaging__input",3,"input","id","placeholder","value"],["type","submit",1,"agent-messaging__btn","agent-messaging__btn--primary",3,"disabled"],["target","_blank","rel","noopener",1,"agent-messaging__link",3,"href"],[1,"agent-messaging__manifest"],["for","agent-messaging-app-token",1,"agent-messaging__label"],["id","agent-messaging-app-token","type","password","name","appToken","autocomplete","off","placeholder","xapp-\u2026",1,"agent-messaging__input",3,"input","value"]],template:function(e,n){if(e&1&&(Gu(0,"section",0)(1,"h2",1),fC(2,"Messaging"),Wu(),Gu(3,"p",2),fC(4," Users talk to this agent from a messaging application through its bot: their messages go to their cases in this namespace, the answers come back in the application. "),Wu(),bw(5,fe,6,2,"div",3,Cw),Ew(7,Ce,2,1,"p",4),Wu()),e&2){let o;EE(5),Tw(n.platforms),EE(2),Iw((o=n.error())?7:-1,o);}},dependencies:[Qb],styles:[".agent-messaging[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;margin-top:1.5rem}.agent-messaging__title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.agent-messaging__hint[_ngcontent-%COMP%], .agent-messaging__note[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-text-secondary)}.agent-messaging__warning[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-warning, #b26a00)}.agent-messaging__error[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-error, #c62828)}.agent-messaging__row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.agent-messaging__spacer[_ngcontent-%COMP%]{flex:1}.agent-messaging__bot[_ngcontent-%COMP%]{font-family:var(--font-mono, monospace);font-size:.9375rem;color:var(--color-accent);text-decoration:none}.agent-messaging__bot[_ngcontent-%COMP%]:hover{text-decoration:underline}.agent-messaging__status[_ngcontent-%COMP%]{padding:.1rem .5rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);font-size:.75rem;font-weight:600}.agent-messaging__status--ok[_ngcontent-%COMP%]{border-color:var(--color-success, #2e7d32);color:var(--color-success, #2e7d32)}.agent-messaging__status--off[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.agent-messaging__status--warn[_ngcontent-%COMP%]{border-color:var(--color-warning, #b26a00);color:var(--color-warning, #b26a00)}.agent-messaging__token[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.agent-messaging__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary)}.agent-messaging__input[_ngcontent-%COMP%]{flex:1;min-width:16rem;padding:.4rem .6rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:var(--color-bg);color:var(--color-text);font-family:var(--font-mono, monospace);font-size:.875rem}.agent-messaging__btn[_ngcontent-%COMP%]{padding:.4rem .9rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;text-decoration:none;cursor:pointer}.agent-messaging__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.agent-messaging__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.agent-messaging__btn--primary[_ngcontent-%COMP%]{border-color:var(--color-accent);color:var(--color-accent)}.agent-messaging__btn--danger[_ngcontent-%COMP%]{border-color:var(--color-error, #c62828);color:var(--color-error, #c62828)}.agent-messaging__platform[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.agent-messaging__platform-title[_ngcontent-%COMP%]{margin:0;font-size:.875rem;font-weight:600;color:var(--color-text)}.agent-messaging__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.agent-messaging__fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.agent-messaging__steps[_ngcontent-%COMP%]{margin:0;padding-left:1.25rem;font-size:.875rem;color:var(--color-text);line-height:1.6}.agent-messaging__steps[_ngcontent-%COMP%] li[_ngcontent-%COMP%] + li[_ngcontent-%COMP%]{margin-top:.25rem}.agent-messaging__manifest[_ngcontent-%COMP%]{max-height:14rem;overflow:auto;margin:.5rem 0;padding:.5rem .75rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:var(--color-bg-subtle, var(--color-bg));font-family:var(--font-mono, monospace);font-size:.75rem}.agent-messaging__code[_ngcontent-%COMP%]{padding:.1rem .4rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);font-family:var(--font-mono, monospace);font-size:.8125rem;word-break:break-all}.agent-messaging__link[_ngcontent-%COMP%]{color:var(--color-accent)}"]})},be=3e3,xe={STARTING:"Starting",RUNNING:"Running",DISABLED:"Off",TOKEN_REJECTED:"Token rejected",CONFLICT:"Used elsewhere",UNREACHABLE:"Unreachable"};export{q};
@@ -1 +0,0 @@
1
- import {f,y,p as pt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,U as Ut,a as po,h as ho,Z as Zr,A as An,O as On,b as hn,c as fn,u as un,d as cn,e as at,i as sn}from'./chunk-COmLfT0N.js';import {g,W,F,v as L,w as we,h as BC,M as Mi,s as sf,x as U,C as w,K as x,J as JI,o as os,H as Hh,E as Ew,z as zu,N as Vh,a as EE,I as Iw,f as fC,n as Aw,Q as qh,R as uI,i as bw,P as Pw,S as dI,d as Bh,T as Tw,Y as Yu,l as lg,q as Pd,L as Ld}from'./main-B6UJJXO7.js';var de=/^(\/|[A-Za-z]:[\\/]|\\\\)/;function me(i){return de.test(i)}function ie(i=()=>true){return t=>{let e=(t.value??"").trim();return !i()||e===""||me(e)?null:{absolutePath:true}}}var ce=(i,t)=>t.value;function ue(i,t){i&1&&(os(0,"p",2),fC(1,"Loading\u2026"),zu());}function he(i,t){if(i&1&&(os(0,"option",23),fC(1),zu()),i&2){let e=t.$implicit;Vh("value",e.value),EE(),lg(e.label);}}function pe(i,t){if(i&1){let e=Aw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let p=Pw();return Ld(p.submit())}),os(1,"ds-form-field",5),Hh(2,"input",6),uI(),zu(),os(3,"ds-form-field",7),Hh(4,"textarea",8),uI(),zu(),os(5,"ds-form-field",9),Hh(6,"input",10),uI(),zu(),os(7,"ds-form-field",11),Hh(8,"input",12),uI(),zu(),os(9,"ds-form-field",13),Hh(10,"input",14),uI(),zu(),os(11,"ds-form-field",15),Hh(12,"input",16),uI(),zu(),os(13,"ds-form-field",17),Hh(14,"input",18),uI(),zu(),os(15,"ds-form-field",19)(16,"input",20),qh("input",function(p){Pd(e);let se=Pw();return Ld(se.onMaxToolRoundsInput(p))}),zu(),uI(),zu(),os(17,"ds-form-field",21)(18,"select",22),bw(19,he,2,2,"option",23,ce),zu(),uI(),zu(),os(21,"ds-form-actions")(22,"button",24),fC(23),zu(),os(24,"button",25),qh("click",function(){Pd(e);let p=Pw();return Ld(p.cancel())}),fC(25,"Cancel"),zu()()();}if(i&2){let e=Pw();Vh("formGroup",e.form),EE(2),Vh("formControl",e.nameControl),dI(),EE(2),Vh("formControl",e.descriptionControl),dI(),EE(2),Vh("formControl",e.externalIdControl),dI(),EE(2),Vh("formControl",e.defaultAgentNameControl),dI(),EE(2),Vh("formControl",e.configPathControl),dI(),EE(),Vh("hint",e.sharedExchangePathHint())("error",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid&&(e.sharedExchangePathControl.dirty||e.sharedExchangePathControl.touched)?"Enter an absolute path (e.g. /home/me/Coday or C:\\Coday), or leave the field empty.":null),EE(),Vh("readOnly",!e.canEditSharedExchangePath())("formControl",e.sharedExchangePathControl),Bh("aria-invalid",e.canEditSharedExchangePath()&&e.sharedExchangePathControl.invalid),dI(),EE(),Vh("hint",e.runCostThresholdHint()),EE(),Vh("placeholder",e.runCostThresholdPlaceholder())("formControl",e.runCostThresholdControl),dI(),EE(),Vh("error",e.maxToolRoundsUnparsable()||e.maxToolRoundsControl.invalid&&(e.maxToolRoundsControl.dirty||e.maxToolRoundsControl.touched)?"Enter a whole number of at least 1, or leave the field empty.":null),EE(),Vh("formControl",e.maxToolRoundsControl),Bh("aria-invalid",e.maxToolRoundsControl.invalid||e.maxToolRoundsUnparsable()),dI(),EE(2),Vh("formControl",e.adminCaseListingControl),dI(),EE(),Tw(e.adminCaseListingOptions),EE(3),Vh("disabled",e.form.invalid||e.isSubmitting()),EE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," ");}}var fe=1,ge=2147483647,Ce=[{value:"",label:"Default"},{value:"OWN",label:"Their own cases"},{value:"SWITCH",label:"Their own, with a switch to see all"},{value:"ALL",label:"All cases of the namespace"}],le=class i{route=g(W);router=g(F);namespaceController=g(L);destroyRef=g(we);usageConfiguration=g(f);userState=g(y);canEditSharedExchangePath=BC(()=>this.userState.currentUser()?.isAdmin===true);sharedExchangePathHint=BC(()=>this.canEditSharedExchangePath()?"Absolute path of a folder on the server that holds the files shared by the namespace. Leave empty for the default location.":"Only a super-admin can change this folder.");runCostThresholdPlaceholder=BC(()=>{let t=this.usageConfiguration.runCostThreshold();return this.usageConfiguration.enabled()?t===null?"No platform limit":`Platform default: ${t}`:"Optional maximum cost per run (e.g. 0.50)"});runCostThresholdHint=BC(()=>{let t="Leave empty to inherit the platform default",e=this.usageConfiguration.runCostThreshold();switch(this.usageConfiguration.state()){case "enabled":return e===null?`${t}: no limit.`:`${t} (${e}).`;case "disabled":return `${t}. Cost limits are inactive while usage tracking is disabled.`;default:return `${t}.`}});form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te("",{nonNullable:true}),configPath:new Te("",{nonNullable:true}),sharedExchangePath:new Te("",{nonNullable:true,validators:[ie(()=>this.canEditSharedExchangePath())]}),externalId:new Te("",{nonNullable:true}),defaultAgentName:new Te("",{nonNullable:true}),runCostThreshold:new Te(null),maxToolRounds:new Te(null,{validators:[gn.min(fe),gn.max(ge),gn.pattern(/^\d+$/)]}),adminCaseListing:new Te("",{nonNullable:true})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get configPathControl(){return this.form.controls.configPath}get sharedExchangePathControl(){return this.form.controls.sharedExchangePath}get externalIdControl(){return this.form.controls.externalId}get defaultAgentNameControl(){return this.form.controls.defaultAgentName}get runCostThresholdControl(){return this.form.controls.runCostThreshold}get maxToolRoundsControl(){return this.form.controls.maxToolRounds}get adminCaseListingControl(){return this.form.controls.adminCaseListing}adminCaseListingOptions=Ce;maxToolRoundsUnparsable=Mi(false);onMaxToolRoundsInput(t){this.maxToolRoundsUnparsable.set(t.target.validity.badInput);}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);existingNamespace=null;constructor(){sf(()=>{this.canEditSharedExchangePath(),this.sharedExchangePathControl.updateValueAndValidity();});}ngOnInit(){this.userState.currentUser()||this.userState.loadMe().pipe(U(this.destroyRef)).subscribe({error:()=>{}});let t=this.route.snapshot.paramMap.get("namespaceId")??this.route.parent?.snapshot.paramMap.get("namespaceId");t&&(this.isEditMode.set(true),this.loadNamespace(t));}loadNamespace(t){this.isLoading.set(true),this.namespaceController.getByIdNamespace(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingNamespace=e,this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??""),this.configPathControl.setValue(e.configPath??""),this.sharedExchangePathControl.setValue(e.sharedExchangePath??""),this.externalIdControl.setValue(e.externalId??""),this.defaultAgentNameControl.setValue(e.defaultAgentName??""),this.runCostThresholdControl.setValue(e.runCostThreshold??null),this.maxToolRoundsControl.setValue(e.maxToolRounds??null),this.adminCaseListingControl.setValue(e.adminCaseListing??""),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.maxToolRoundsUnparsable()||this.isSubmitting())return;this.isSubmitting.set(true);let t=w(x(w({},this.existingNamespace),{name:this.nameControl.value.trim(),description:this.descriptionControl.value.trim()||void 0,configPath:this.configPathControl.value.trim()||void 0,externalId:this.externalIdControl.value.trim()||void 0,defaultAgentName:this.defaultAgentNameControl.value.trim()||void 0,runCostThreshold:this.runCostThresholdControl.value??void 0,maxToolRounds:this.maxToolRoundsControl.value??void 0,adminCaseListing:this.adminCaseListingControl.value||void 0}),this.canEditSharedExchangePath()?{sharedExchangePath:this.sharedExchangePathPayload()}:{});(this.isEditMode()?this.namespaceController.updateNamespace(this.existingNamespace.id??"",t):this.namespaceController.createNamespace(t)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}sharedExchangePathPayload(){return this.sharedExchangePathControl.value.trim()||(this.existingNamespace?.sharedExchangePath?"":void 0)}cancel(){this.navigateBack();}navigateBack(){this.router.navigate(["/agentos/namespaces"]);}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=JI({type:i,selectors:[["agentos-namespace-form"]],decls:4,vars:3,consts:[[3,"framed"],[3,"title"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","ns-name","required",""],["dsControl","","id","ns-name","type","text","placeholder","Namespace name","autocomplete","off",3,"formControl"],["label","Description","controlId","ns-description"],["dsControl","","id","ns-description","rows","4","placeholder","Optional description",3,"formControl"],["label","External ID","controlId","ns-external-id"],["dsControl","","id","ns-external-id","type","text","placeholder","Optional federation ID from an external system","autocomplete","off",3,"formControl"],["label","Default agent","controlId","ns-default-agent"],["dsControl","","id","ns-default-agent","type","text","placeholder","Logical name of the default agent (e.g. coday)","autocomplete","off",3,"formControl"],["label","Config path","controlId","ns-config-path"],["dsControl","","id","ns-config-path","type","text","placeholder","Optional path to base configuration directory","autocomplete","off",3,"formControl"],["label","Shared files folder","controlId","ns-shared-exchange-path","hintId","ns-shared-exchange-path-hint","errorId","ns-shared-exchange-path-error",3,"hint","error"],["dsControl","","id","ns-shared-exchange-path","type","text","placeholder","Default location managed by AgentOS","aria-describedby","ns-shared-exchange-path-hint","autocomplete","off",3,"readOnly","formControl"],["label","Run cost threshold","controlId","ns-run-cost-threshold","hintId","ns-run-cost-threshold-hint",3,"hint"],["dsControl","","id","ns-run-cost-threshold","type","number","min","0","step","0.01","aria-describedby","ns-run-cost-threshold-hint",3,"placeholder","formControl"],["label","Maximum tool rounds","controlId","ns-max-tool-rounds","hintId","ns-max-tool-rounds-hint","errorId","ns-max-tool-rounds-error","hint","Most tool rounds one agent run may take. Leave empty to inherit the server default. A change applies from the next agent run.",3,"error"],["dsControl","","id","ns-max-tool-rounds","type","number","min","1","step","1","placeholder","Server default","aria-describedby","ns-max-tool-rounds-hint",3,"input","formControl"],["label","Cases visible to admins","controlId","ns-admin-case-listing","hintId","ns-admin-case-listing-hint","hint","Choose which conversations the admins of this namespace see in their list. Members always see only their own."],["dsControl","","id","ns-admin-case-listing","aria-describedby","ns-admin-case-listing-hint",3,"formControl"],[3,"value"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"]],template:function(e,u){e&1&&(os(0,"ds-page",0),Hh(1,"ds-section-header",1),Ew(2,ue,2,0,"p",2)(3,pe,26,20,"form",3),zu()),e&2&&(Vh("framed",!u.isEditMode()),EE(),Vh("title",u.isEditMode()?"Edit namespace":"New namespace"),EE(),Iw(u.isLoading()?2:3));},dependencies:[qt,md,Co,Mo,Ht,Fn,Ut,po,ho,Zr,An,On,hn,fn,un,cn,at,sn],encapsulation:2})};export{Ce as ADMIN_CASE_LISTING_OPTIONS,le as NamespaceFormComponent};
@@ -1 +0,0 @@
1
- import {s}from'./chunk-COmLfT0N.js';import {g,W,D as Dm,y,J as JI,G as Gu,f as fC,b as Wu,a as EE,l as lg}from'./main-B6UJJXO7.js';var A=class r{route=g(W);http=g(Dm);config=g(y);message="Authentication in progress\u2026";ngOnInit(){let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),o=this.route.snapshot.queryParamMap.get("error"),i=this.route.snapshot.queryParamMap.get("error_description");if(o){console.warn("[AgentOS OAuth Callback] OAuth error:",o,i),this.notifyParentAndClose({success:false,error:i||o});return}if(!e){console.error("[AgentOS OAuth Callback] Missing authorization code"),this.message="OAuth callback error: missing authorization code.",this.notifyParentAndClose({success:false,error:"Missing authorization code"});return}this.http.post(`${this.config.basePath}/api/oauth/callback`,{code:e,state:t}).subscribe({next:()=>{console.log("[AgentOS OAuth Callback] Backend callback resolved"),this.notifyParentAndClose({success:true});},error:a=>{console.error("[AgentOS OAuth Callback] Backend callback failed:",a),this.notifyParentAndClose({success:false,error:a?.error?.message||a?.message||"Token exchange failed"});}});}notifyParentAndClose(e){if(this.message=e.success?"Authentication complete. You can close this window.":`Authentication failed: ${e.error??"unknown error"}. You can close this window.`,window.opener)try{window.opener.postMessage(e,window.location.origin);}catch(t){console.error("[AgentOS OAuth Callback] postMessage failed:",t),localStorage.setItem(s,JSON.stringify(e));}else console.warn("[AgentOS OAuth Callback] No window.opener \u2014 localStorage fallback"),localStorage.setItem(s,JSON.stringify(e));setTimeout(()=>window.close(),1e3);}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=JI({type:r,selectors:[["agentos-oauth-callback"]],decls:2,vars:1,consts:[[2,"font-family","sans-serif","padding","2rem","text-align","center"]],template:function(t,o){t&1&&(Gu(0,"p",0),fC(1),Wu()),t&2&&(EE(),lg(o.message));},encapsulation:2,changeDetection:1})};export{A as OAuthCallbackComponent};
@@ -1 +0,0 @@
1
- import {p as pt,T as Te,g as gn,b as hn,c as fn,u as un,t as dn,d as cn,e as at,i as sn,q as qt,m as md,C as Co,M as Mo,H as Ht,F as Fn,x as yn,U as Ut,a as po,h as ho,Z as Zr,Y as Yr,A as An,O as On,w as wa}from'./chunk-COmLfT0N.js';import {g,W,F,w as we,au as k,at as F$1,ad as F$2,a6 as Zs,ae as Dr,av as Fe,h as BC,M as Mi,s as sf,x as U,K as x,C as w,J as JI,o as os,Q as qh,f as fC,z as zu,E as Ew,a as EE,N as Vh,I as Iw,n as Aw,H as Hh,R as uI,i as bw,as as Cw,P as Pw,S as dI,T as Tw,Y as Yu,ai as vw,l as lg,$ as dg,q as Pd,L as Ld}from'./main-B6UJJXO7.js';function he(r,t){r&1&&(os(0,"p",2),fC(1,"Loading\u2026"),zu());}function ve(r,t){if(r&1&&Hh(0,"input",6),r&2){let e=Pw(2);Vh("value",e.selectedProviderLabel());}}function ye(r,t){if(r&1&&(os(0,"option",44),fC(1),zu()),r&2){let e=t.$implicit;Vh("value",e.id),EE(),dg("",e.name," (",e.apiType,")");}}function be(r,t){if(r&1&&(os(0,"select",7)(1,"option",43),fC(2,"Select provider"),zu(),bw(3,ye,2,3,"option",44,vw().trackByProvider,true),zu(),uI()),r&2){let e=Pw(2);Vh("formControl",e.aiProviderIdControl),dI(),EE(3),Tw(e.providers());}}function xe(r,t){if(r&1&&(os(0,"option",25),fC(1),zu()),r&2){let e=t.$implicit;Vh("ngValue",e),EE(),lg(e.toLowerCase());}}function _e(r,t){r&1&&(os(0,"p",2),fC(1,"Not supported yet for Anthropic and Gemini providers."),zu());}function Me(r,t){r&1&&(os(0,"p",2),fC(1," Sent as is to OpenAI-compatible providers, which reject levels the model does not support. Through Requesty, Claude models do not apply it faithfully. "),zu());}function Ee(r,t){r&1&&(os(0,"p",26),fC(1," OpenAI reasoning models (GPT-5.1 and later) reject a temperature other than 1 with an effort: leave Temperature empty or set it to 1. "),zu());}function Ae(r,t){if(r&1){let e=Aw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let u=Pw();return Ld(u.submit())}),os(1,"ds-form-field",5),Ew(2,ve,1,1,"input",6)(3,be,5,1,"select",7),zu(),os(4,"ds-form-field",8),Hh(5,"input",9),uI(),zu(),os(6,"ds-form-field",10),Hh(7,"input",11),uI(),zu(),os(8,"ds-form-field",12),Hh(9,"input",13),uI(),zu(),os(10,"ds-form-field",14),Hh(11,"input",15),uI(),zu(),os(12,"div",16)(13,"ds-form-field",17),Hh(14,"input",18),uI(),zu(),os(15,"ds-form-field",19),Hh(16,"input",20),uI(),zu()(),os(17,"ds-form-field",21),Hh(18,"input",22),uI(),zu(),os(19,"ds-form-field",23)(20,"select",24)(21,"option",25),fC(22,"Provider default"),zu(),bw(23,xe,2,2,"option",25,Cw),zu(),uI(),Ew(25,_e,2,0,"p",2)(26,Me,2,0,"p",2),Ew(27,Ee,2,0,"p",26),zu(),os(28,"div",27)(29,"label",28),Hh(30,"input",29),uI(),os(31,"span",30),fC(32,"Supports advanced execution"),zu()(),os(33,"p",31),fC(34," Agents configured in ADVANCED execution mode fail to run on a model that does not support it. SIMPLE agents are not concerned. "),zu()(),os(35,"ds-fieldset",32)(36,"div",16)(37,"ds-form-field",33),Hh(38,"input",34),uI(),zu(),os(39,"ds-form-field",35),Hh(40,"input",36),uI(),zu()(),os(41,"div",16)(42,"ds-form-field",37),Hh(43,"input",38),uI(),zu(),os(44,"ds-form-field",39),Hh(45,"input",40),uI(),zu()()(),os(46,"ds-form-actions")(47,"button",41),fC(48),zu(),os(49,"button",42),qh("click",function(){Pd(e);let u=Pw();return Ld(u.cancel())}),fC(50,"Cancel"),zu()()();}if(r&2){let e=Pw();Vh("formGroup",e.form),EE(2),Iw(e.isEditMode()?2:3),EE(3),Vh("formControl",e.apiModelNameControl),dI(),EE(2),Vh("formControl",e.descriptionControl),dI(),EE(2),Vh("formControl",e.aliasControl),dI(),EE(2),Vh("formControl",e.priorityControl),dI(),EE(3),Vh("formControl",e.temperatureControl),dI(),EE(2),Vh("formControl",e.contextWindowControl),dI(),EE(2),Vh("formControl",e.maxCompletionTokensControl),dI(),EE(2),Vh("formControl",e.reasoningEffortControl),dI(),EE(),Vh("ngValue",null),EE(2),Tw(e.reasoningEffortOptions),EE(2),Iw(e.reasoningEffortUnsupported()?25:26),EE(2),Iw(e.temperatureMayConflictWithEffort()?27:-1),EE(3),Vh("formControl",e.supportsAdvancedExecutionControl),dI(),EE(5),Vh("formGroup",e.pricingGroup),EE(3),dI(),EE(2),dI(),EE(3),dI(),EE(2),dI(),EE(2),Vh("disabled",e.form.invalid||e.isSubmitting()),EE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," ");}}var Ie=["Anthropic","Gemini"],ge=class r{route=g(W);router=g(F);destroyRef=g(we);aiModelController=g(k);aiProviderController=g(F$1);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=this.namespaceId===void 0;providers=F$2(this.aiProviderController.listAiProvider(this.isPlatformMode?"none":this.namespaceId).pipe(Zs(()=>Dr([]))),{initialValue:[]});form=new pt({aiProviderId:new Te("",{nonNullable:true,validators:[gn.required]}),apiModelName:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),alias:new Te("",{nonNullable:true}),priority:new Te(0,{nonNullable:true}),temperature:new Te(null),contextWindow:new Te(null),maxCompletionTokens:new Te(null),reasoningEffort:new Te(null),supportsAdvancedExecution:new Te(false,{nonNullable:true}),pricing:new pt({inputMTokens:new Te(null),outputMTokens:new Te(null),cacheWrite:new Te(null),cacheRead:new Te(null)})});get aiProviderIdControl(){return this.form.controls.aiProviderId}get apiModelNameControl(){return this.form.controls.apiModelName}get descriptionControl(){return this.form.controls.description}get aliasControl(){return this.form.controls.alias}get priorityControl(){return this.form.controls.priority}get temperatureControl(){return this.form.controls.temperature}get contextWindowControl(){return this.form.controls.contextWindow}get maxCompletionTokensControl(){return this.form.controls.maxCompletionTokens}get reasoningEffortControl(){return this.form.controls.reasoningEffort}get supportsAdvancedExecutionControl(){return this.form.controls.supportsAdvancedExecution}get pricingGroup(){return this.form.controls.pricing}reasoningEffortOptions=Object.values(Fe);selectedProviderId=F$2(this.form.controls.aiProviderId.valueChanges,{initialValue:this.form.controls.aiProviderId.value});reasoningEffortUnsupported=BC(()=>{let t=this.providers().find(e=>e.id===this.selectedProviderId())?.apiType;return t!==void 0&&Ie.includes(t)});temperatureValue=F$2(this.form.controls.temperature.valueChanges,{initialValue:this.form.controls.temperature.value});reasoningEffortValue=F$2(this.form.controls.reasoningEffort.valueChanges,{initialValue:this.form.controls.reasoningEffort.value});temperatureMayConflictWithEffort=BC(()=>{let t=this.temperatureValue();return this.reasoningEffortValue()!=null&&t!=null&&t!==1});isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);selectedProviderLabel=BC(()=>{let t=this.aiProviderIdControl.value,e=this.providers().find(c=>c.id===t);return e?`${e.name} (${e.apiType})`:t});existingModel=null;constructor(){sf(()=>{this.reasoningEffortUnsupported()?(this.reasoningEffortControl.setValue(null),this.reasoningEffortControl.disable()):this.reasoningEffortControl.enable();});}ngOnInit(){let t=this.route.snapshot.paramMap.get("modelId");t&&(this.isEditMode.set(true),this.loadModel(t));}loadModel(t){this.isLoading.set(true),this.aiModelController.getByIdAiModel(t).pipe(U(this.destroyRef)).subscribe({next:e=>{this.existingModel=e,this.aiProviderIdControl.setValue(e.aiProviderId),this.aiProviderIdControl.disable(),this.apiModelNameControl.setValue(e.apiModelName),this.descriptionControl.setValue(e.description??null),this.aliasControl.setValue(e.alias??""),this.priorityControl.setValue(e.priority??0),this.temperatureControl.setValue(e.temperature??null),this.contextWindowControl.setValue(e.contextWindow??null),this.maxCompletionTokensControl.setValue(e.maxCompletionTokens??null),this.reasoningEffortControl.setValue(e.reasoningEffort??null),this.supportsAdvancedExecutionControl.setValue(e.supportsAdvancedExecution??false),this.pricingGroup.setValue({inputMTokens:e.pricing?.inputMTokens??null,outputMTokens:e.pricing?.outputMTokens??null,cacheWrite:e.pricing?.cacheWrite??null,cacheRead:e.pricing?.cacheRead??null}),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.form.getRawValue(),e=t.pricing,u=e.inputMTokens!=null||e.outputMTokens!=null||e.cacheWrite!=null||e.cacheRead!=null?{isEmpty:false,inputMTokens:e.inputMTokens??void 0,outputMTokens:e.outputMTokens??void 0,cacheWrite:e.cacheWrite??void 0,cacheRead:e.cacheRead??void 0}:void 0,w$1=x(w({},this.existingModel??{}),{aiProviderId:t.aiProviderId,namespaceId:this.isPlatformMode?void 0:this.existingModel?.namespaceId??this.namespaceId,apiModelName:t.apiModelName.trim(),description:t.description?.trim()||void 0,alias:t.alias.trim()||void 0,priority:t.priority,temperature:t.temperature??void 0,contextWindow:t.contextWindow??void 0,maxCompletionTokens:t.maxCompletionTokens??void 0,reasoningEffort:t.reasoningEffort??void 0,supportsAdvancedExecution:t.supportsAdvancedExecution,pricing:u});(this.isEditMode()?this.aiModelController.updateAiModel(this.existingModel.id??"",w$1):this.aiModelController.createAiModel(w$1)).pipe(U(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(false)});}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","ai-models"]):this.router.navigate(["/agentos",this.namespaceId,"ai-models"]);}trackByProvider(t,e){return e.id??""}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=JI({type:r,selectors:[["agentos-ai-model-form"]],decls:6,vars:2,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to AI models",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Provider","controlId","model-provider","required",""],["dsControl","","id","model-provider","type","text","readonly","","tabindex","-1",3,"value"],["dsControl","","id","model-provider",3,"formControl"],["label","API name","controlId","model-api-name","required",""],["dsControl","","mono","","id","model-api-name","type","text","placeholder","e.g. gpt-4o, claude-3-5-sonnet-20241022","autocomplete","off",3,"formControl"],["label","Description","controlId","model-description"],["dsControl","","id","model-description","type","text","placeholder","Optional \u2014 short description of this model config","autocomplete","off",3,"formControl"],["label","Alias","controlId","model-alias"],["dsControl","","id","model-alias","type","text","placeholder","e.g. fast, smart \u2014 short identifier used internally","autocomplete","off",3,"formControl"],["label","Priority","controlId","model-priority"],["dsControl","","id","model-priority","type","number","placeholder","0 \u2014 higher wins when multiple configs share the same alias","min","0","step","1",3,"formControl"],[1,"ds-grid-2"],["label","Temperature","controlId","model-temperature"],["dsControl","","id","model-temperature","type","number","placeholder","0 \u2013 2","min","0","max","2","step","0.1",3,"formControl"],["label","Context window","controlId","model-context-window"],["dsControl","","id","model-context-window","type","number","placeholder","e.g. 128000","min","1","step","1",3,"formControl"],["label","Max completion tokens","controlId","model-max-completion-tokens"],["dsControl","","id","model-max-completion-tokens","type","number","placeholder","e.g. 4096","min","1","step","1",3,"formControl"],["label","Reasoning effort","controlId","model-reasoning-effort"],["dsControl","","id","model-reasoning-effort",3,"formControl"],[3,"ngValue"],[1,"ds-hint","ds-hint--warning"],[1,"ai-model-form__field"],[1,"ai-model-form__toggle-label"],["type","checkbox",1,"ai-model-form__toggle-checkbox",3,"formControl"],[1,"ai-model-form__toggle-text"],[1,"ai-model-form__toggle-hint"],["legend","Pricing","legendHint","per million tokens \u2014 leave blank to skip cost monitoring",3,"formGroup"],["label","Input","controlId","pricing-input"],["dsControl","","id","pricing-input","type","number","placeholder","e.g. 2.50","min","0","step","0.01","formControlName","inputMTokens"],["label","Output","controlId","pricing-output"],["dsControl","","id","pricing-output","type","number","placeholder","e.g. 10.00","min","0","step","0.01","formControlName","outputMTokens"],["label","Cache write","controlId","pricing-cache-write"],["dsControl","","id","pricing-cache-write","type","number","placeholder","e.g. 3.75","min","0","step","0.01","formControlName","cacheWrite"],["label","Cache read","controlId","pricing-cache-read"],["dsControl","","id","pricing-cache-read","type","number","placeholder","e.g. 0.30","min","0","step","0.01","formControlName","cacheRead"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"click"],["value","","disabled",""],[3,"value"]],template:function(e,c){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return c.cancel()}),fC(3," \u2190 AI models "),zu()(),Ew(4,he,2,0,"p",2)(5,Ae,51,17,"form",3),zu()),e&2&&(EE(),Vh("title",c.isEditMode()?"Edit AI model":"New AI model"),EE(3),Iw(c.isLoading()?4:5));},dependencies:[hn,fn,un,dn,cn,at,sn,qt,md,Co,Mo,Ht,Fn,yn,Ut,po,ho,Zr,Yr,An,On,wa],encapsulation:2})};export{ge as AiModelFormComponent};
@@ -1 +0,0 @@
1
- import {y}from'./chunk-COmLfT0N.js';import {g,aI as ce,aJ as T,ae as Dr,a5 as Ys,ah as te,a6 as Zs,aK as my,aa as k}from'./main-B6UJJXO7.js';var v=class i{userState=g(y);membership=g(ce);currentUser$=T(this.userState.currentUser);cache=new Map;isAdminOfNamespace$(e){if(!e)return Dr(false);let t=this.cache.get(e);if(t)return t;let s=this.currentUser$.pipe(Ys(a=>a?a.isAdmin?Dr(true):this.membership.getMembersNamespaceMembership(e).pipe(te(d=>d.some(n=>n.id===a.id&&n.role==="ADMIN")),Zs(()=>Dr(false))):Dr(false)),my({bufferSize:1,refCount:false}));return this.cache.set(e,s),s}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};export{v};
@@ -1 +0,0 @@
1
- import {G as m,p as pt,L as Lt,T as Te,g as gn,q as qt,m as md,C as Co,M as Mo,H as Ht,U as Ut,a as po,h as ho,A as An,O as On,w as wa,_ as _o,I as vo,b as hn,c as fn,u as un,t as dn,d as cn,E as pn,e as at,i as sn}from'./chunk-COmLfT0N.js';import {g,W,F,w as we,ak as U,M as Mi,x as U$1,a6 as Zs,ae as Dr,K as x,C as w,J as JI,o as os,Q as qh,f as fC,z as zu,E as Ew,a as EE,N as Vh,Y as Yu,I as Iw,n as Aw,H as Hh,R as uI,i as bw,aq as ww,P as Pw,S as dI,l as lg,T as Tw,d as Bh,q as Pd,L as Ld}from'./main-B6UJJXO7.js';var ce=(o,t)=>t.id;function ue(o,t){o&1&&(os(0,"p",2),fC(1,"Loading\u2026"),zu());}function fe(o,t){if(o&1&&(os(0,"ds-form-field",20),Hh(1,"input",22),zu()),o&2){let e=Pw(3);EE(),Vh("value",e.resolveAgentConfigName(e.agentConfigIdControl.value));}}function ge(o,t){if(o&1&&(os(0,"option",24),fC(1),zu()),o&2){let e=t.$implicit;Vh("ngValue",e.id),EE(),lg(e.name);}}function Ce(o,t){if(o&1&&(os(0,"ds-form-field",21)(1,"select",23)(2,"option",24),fC(3,"\u2014 None \u2014"),zu(),bw(4,ge,2,2,"option",24,ce),zu(),uI(),zu()),o&2){let e=Pw(3);EE(),Vh("formControl",e.agentConfigIdControl),dI(),EE(),Vh("ngValue",null),EE(2),Tw(e.availableAgentConfigs());}}function ye(o,t){if(o&1&&Ew(0,fe,2,1,"ds-form-field",20)(1,Ce,6,2,"ds-form-field",21),o&2){let e=Pw(2);Iw(e.isEditMode()&&e.agentConfigIdControl.value?0:e.isEditMode()?-1:1);}}function ve(o,t){o&1&&(os(0,"p",2),fC(1,"No parameters defined."),zu());}function he(o,t){if(o&1){let e=Aw();os(0,"div",11)(1,"div",25)(2,"ds-form-field",26),Hh(3,"input",27),uI(),zu(),os(4,"ds-form-field",28),Hh(5,"input",29),uI(),zu(),os(6,"ds-form-field",30),Hh(7,"input",31),uI(),zu()(),os(8,"button",32),qh("click",function(){let d=Pd(e).$index,m=Pw(2);return Ld(m.removeParameter(d))}),fC(9," \xD7 "),zu()();}if(o&2){let e=t.$implicit,r=t.$index;Vh("formGroupName",r),EE(2),Vh("controlId","param-name-"+r)("error",e.controls.name.invalid&&e.controls.name.touched?"Parameter name is required.":null),EE(),Vh("id","param-name-"+r),dI(),EE(),Vh("controlId","param-desc-"+r),EE(),Vh("id","param-desc-"+r),dI(),EE(),Vh("controlId","param-default-"+r),EE(),Vh("id","param-default-"+r),dI();}}function _e(o,t){if(o&1){let e=Aw();os(0,"div",14)(1,"span",33),fC(2),zu(),os(3,"ds-form-field",34),Hh(4,"textarea",35),uI(),zu(),os(5,"button",36),qh("click",function(){let d=Pd(e).$index,m=Pw(2);return Ld(m.removeContentEntry(d))}),fC(6," \xD7 "),zu()();}if(o&2){let e=t.$implicit,r=t.$index,d=Pw(2);EE(2),lg(r+1),EE(),Vh("error",e.invalid&&e.touched?"Content entry must not be blank.":null),EE(),Vh("formControlName",r),Bh("aria-label","Content entry "+(r+1)),dI(),EE(),Vh("disabled",d.contentArray.length===1);}}function xe(o,t){if(o&1&&(os(0,"ds-notice"),fC(1),zu()),o&2){let e=Pw(2);EE(),lg(e.errorMessage());}}function be(o,t){if(o&1){let e=Aw();os(0,"button",37),qh("click",function(){Pd(e);let d=Pw(2);return Ld(d.exportYaml())}),fC(1),zu();}if(o&2){let e=Pw(2);Vh("disabled",e.isExporting()),EE(),Yu(" ",e.isExporting()?"Exporting\u2026":"Export as YAML"," ");}}function Ee(o,t){if(o&1){let e=Aw();os(0,"form",4),qh("ngSubmit",function(){Pd(e);let d=Pw();return Ld(d.submit())}),os(1,"ds-form-field",5),Hh(2,"input",6),uI(),zu(),os(3,"ds-form-field",7),Hh(4,"input",8),uI(),zu(),Ew(5,ye,2,1),os(6,"ds-fieldset",9)(7,"p",2),fC(8," Each parameter must have a name and a default value. Use "),os(9,"code"),fC(10),zu(),fC(11," in content entries to reference them. "),zu(),os(12,"div",10),Ew(13,ve,2,0,"p",2),bw(14,he,10,8,"div",11,ww),os(16,"div")(17,"button",12),qh("click",function(){Pd(e);let d=Pw();return Ld(d.addParameter())}),fC(18,"+ Add parameter"),zu()()()(),os(19,"ds-fieldset",13)(20,"p",2),fC(21," Each content entry is a command. Use "),os(22,"code"),fC(23,"@AgentName"),zu(),fC(24," to target an agent, "),os(25,"code"),fC(26,"/promptName param1 param2"),zu(),fC(27," to call another prompt, and "),os(28,"code"),fC(29),zu(),fC(30," for parameter placeholders. "),zu(),os(31,"div",10),bw(32,_e,7,5,"div",14,ww),os(34,"div")(35,"button",12),qh("click",function(){Pd(e);let d=Pw();return Ld(d.addContentEntry())}),fC(36,"+ Add content entry"),zu()()()(),Ew(37,xe,2,1,"ds-notice"),os(38,"ds-form-field",15),Hh(39,"textarea",16),uI(),zu(),os(40,"ds-form-actions")(41,"button",17),fC(42),zu(),Ew(43,be,2,2,"button",18),os(44,"button",19),qh("click",function(){Pd(e);let d=Pw();return Ld(d.cancel())}),fC(45,"Cancel"),zu()()();}if(o&2){let e=Pw();Vh("formGroup",e.form),EE(),Vh("error",e.nameControl.invalid&&e.nameControl.touched?"Name is required.":null),EE(),Vh("formControl",e.nameControl),dI(),EE(2),Vh("formControl",e.descriptionControl),dI(),EE(),Iw(e.availableAgentConfigs().length>0?5:-1),EE(5),lg(e.paramPlaceholderSyntax),EE(2),Vh("formArrayName","parameters"),EE(),Iw(e.parametersArray.length===0?13:-1),EE(),Tw(e.parametersArray.controls),EE(15),lg(e.paramPlaceholderSyntax),EE(2),Vh("formArrayName","content"),EE(),Tw(e.contentArray.controls),EE(5),Iw(e.errorMessage()?37:-1),EE(),Vh("error",e.externalMetadataJsonControl.invalid&&e.externalMetadataJsonControl.touched?"Invalid JSON.":null),EE(),Vh("formControl",e.externalMetadataJsonControl),dI(),EE(2),Vh("disabled",e.form.invalid||e.isSubmitting()),EE(),Yu(" ",e.isEditMode()?"Save changes":"Create"," "),EE(),Iw(e.isEditMode()?43:-1);}}var pe=class o{route=g(W);router=g(F);destroyRef=g(we);promptState=g(m);agentConfigController=g(U);namespaceId=this.route.snapshot.params.namespaceId;isPlatformMode=!this.namespaceId;form=new pt({name:new Te("",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(null),agentConfigId:new Te(null),externalMetadataJson:new Te("",{nonNullable:true,validators:[Pe]}),content:new Lt([this.createContentControl()],{validators:[gn.required]}),parameters:new Lt([])});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get agentConfigIdControl(){return this.form.controls.agentConfigId}get externalMetadataJsonControl(){return this.form.controls.externalMetadataJson}get contentArray(){return this.form.controls.content}get parametersArray(){return this.form.controls.parameters}isEditMode=Mi(false);isSubmitting=Mi(false);isLoading=Mi(false);isExporting=Mi(false);errorMessage=Mi(null);paramPlaceholderSyntax="{{paramName}}";agentConfigs=Mi([]);availableAgentConfigs=this.agentConfigs.asReadonly();existingPrompt=null;ngOnInit(){let t=this.route.snapshot.paramMap.get("promptId");t&&(this.isEditMode.set(true),this.loadPrompt(t)),this.isPlatformMode?this.loadPlatformAgentConfigs():this.namespaceId&&this.loadAgentConfigs(this.namespaceId);}loadPrompt(t){this.isLoading.set(true),this.promptState.getById(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.existingPrompt=e,this.hydrateForm(e),this.isLoading.set(false);},error:()=>{this.isLoading.set(false),this.navigateBack();}});}loadAgentConfigs(t){this.agentConfigController.listByParentAgentConfig(t).pipe(U$1(this.destroyRef),Zs(()=>Dr([]))).subscribe(e=>this.agentConfigs.set(e));}loadPlatformAgentConfigs(){this.agentConfigController.listPlatformAgentsAgentConfig().pipe(U$1(this.destroyRef),Zs(()=>Dr([]))).subscribe(t=>this.agentConfigs.set(t));}hydrateForm(t){this.nameControl.setValue(t.name),this.descriptionControl.setValue(t.description??null),this.agentConfigIdControl.setValue(t.agentConfigId??null),this.contentArray.clear(),(t.content.length>0?t.content:[""]).forEach(r=>this.contentArray.push(this.createContentControl(r))),this.parametersArray.clear(),(t.parameters??[]).forEach(r=>this.parametersArray.push(this.createParameterGroup(r))),this.externalMetadataJsonControl.setValue(t.externalMetadata?JSON.stringify(t.externalMetadata,null,2):"");}resolveAgentConfigName(t){return this.agentConfigs().find(e=>e.id===t)?.name??t}createContentControl(t=""){return new Te(t,{nonNullable:true,validators:[gn.required,gn.pattern(/\S/)]})}addContentEntry(){this.contentArray.push(this.createContentControl());}removeContentEntry(t){this.contentArray.length>1&&this.contentArray.removeAt(t);}createParameterGroup(t){return new pt({name:new Te(t?.name??"",{nonNullable:true,validators:[gn.required,gn.minLength(1)]}),description:new Te(t?.description??null),defaultValue:new Te(t?.defaultValue??"",{nonNullable:true,validators:[gn.required]})})}addParameter(){this.parametersArray.push(this.createParameterGroup());}removeParameter(t){this.parametersArray.removeAt(t);}submit(){if(this.form.invalid||this.isSubmitting())return;this.isSubmitting.set(true);let t=this.isEditMode()&&!!this.existingPrompt?.id,e=x(w({},this.existingPrompt??{}),{namespaceId:this.namespaceId,sourceLanguage:this.existingPrompt?.sourceLanguage??"en",name:this.nameControl.value.trim(),description:this.descriptionControl.value?.trim()||void 0,content:this.contentArray.controls.map(m=>m.value.trim()),parameters:this.parametersArray.controls.map(m=>({name:m.controls.name.value.trim(),description:m.controls.description.value?.trim()||void 0,defaultValue:m.controls.defaultValue.value.trim()}))});t||(e.agentConfigId=this.agentConfigIdControl.value||null);let r=this.externalMetadataJsonControl.value.trim();e.externalMetadata=r?JSON.parse(r):null;let d=t?this.promptState.update(this.existingPrompt.id,e):this.promptState.create(e);this.errorMessage.set(null),d.pipe(U$1(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:m=>{this.isSubmitting.set(false),m.status===409?this.errorMessage.set(`A prompt named "${e.name}" already exists in this scope.`):m.status===400?this.errorMessage.set(m.error?.message??"Invalid prompt data."):this.errorMessage.set("An unexpected error occurred. Please try again.");}});}exportYaml(){let t=this.existingPrompt?.id;!t||this.isExporting()||(this.isExporting.set(true),this.promptState.exportAsYaml(t).pipe(U$1(this.destroyRef)).subscribe({next:e=>{let r=new Blob([e],{type:"application/yaml"}),d=URL.createObjectURL(r),m=document.createElement("a");m.href=d,m.download=`${this.existingPrompt?.name??"prompt"}.yaml`,m.click(),URL.revokeObjectURL(d),this.isExporting.set(false);},error:()=>this.isExporting.set(false)}));}cancel(){this.navigateBack();}navigateBack(){this.isPlatformMode?this.router.navigate(["/agentos","admin","prompts"]):this.router.navigate(["/agentos",this.namespaceId,"prompts"]);}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=JI({type:o,selectors:[["agentos-prompt-form"]],decls:6,vars:3,consts:[[3,"title"],["dsButton","","variant","ghost","type","button","title","Back to prompts",3,"click"],[1,"ds-hint"],[1,"ds-form",3,"formGroup"],[1,"ds-form",3,"ngSubmit","formGroup"],["label","Name","controlId","prompt-name","required","",3,"error"],["dsControl","","id","prompt-name","type","text","placeholder","e.g. Summarise meeting notes","autocomplete","off",3,"formControl"],["label","Description","controlId","prompt-description"],["dsControl","","id","prompt-description","type","text","placeholder","Optional \u2014 short description of this prompt","autocomplete","off",3,"formControl"],["legend","Parameters","legendHint","Named placeholders used in content"],[1,"ds-stack",3,"formArrayName"],[1,"ds-panel","ds-inline","ds-inline--start",3,"formGroupName"],["dsButton","","variant","ghost","type","button",3,"click"],["legend","Content","legendHint","Ordered list of text commands"],[1,"ds-inline","ds-inline--start"],["label","External Metadata","controlId","prompt-external-metadata","hint","Optional. Opaque JSON object stored as-is. Leave empty to clear.",3,"error"],["dsControl","","mono","","id","prompt-external-metadata","rows","6","placeholder",'{ "key": "value" }',"spellcheck","false","autocomplete","off",3,"formControl"],["dsButton","","variant","primary","type","submit",3,"disabled"],["dsButton","","type","button",3,"disabled"],["dsButton","","type","button",3,"click"],["label","Agent Config","hint","Agent Config cannot be changed after creation."],["label","Agent Config","controlId","prompt-agent-config","hint","Optional. Links this prompt to an agent as a starter. Immutable after creation."],["dsControl","","type","text","readonly","",3,"value"],["dsControl","","id","prompt-agent-config",3,"formControl"],[3,"ngValue"],[1,"ds-stack","ds-grow"],["label","Name","required","",3,"controlId","error"],["dsControl","","type","text","placeholder","e.g. language","formControlName","name","autocomplete","off",3,"id"],["label","Description",3,"controlId"],["dsControl","","type","text","placeholder","Optional","formControlName","description","autocomplete","off",3,"id"],["label","Default value",3,"controlId"],["dsControl","","type","text","placeholder","e.g. English","formControlName","defaultValue","autocomplete","off",3,"id"],["dsButton","","variant","icon-danger","type","button","title","Remove this parameter","aria-label","Remove this parameter",3,"click"],[1,"ds-index"],["grow","",3,"error"],["dsControl","","rows","4","placeholder","Enter a command\u2026",3,"formControlName"],["dsButton","","variant","icon-danger","type","button","title","Remove this entry","aria-label","Remove this entry",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(e,r){e&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return r.cancel()}),fC(3),zu()(),Ew(4,ue,2,0,"p",2)(5,Ee,46,16,"form",3),zu()),e&2&&(EE(),Vh("title",r.isEditMode()?"Edit prompt":"New prompt"),EE(2),Yu(" \u2190 ",r.isPlatformMode?"Platform prompts":"Prompts"," "),EE(),Iw(r.isLoading()?4:5));},dependencies:[qt,md,Co,Mo,Ht,Ut,po,ho,An,On,wa,_o,vo,hn,fn,un,dn,cn,pn,at,sn],encapsulation:2})};function Pe(o){let t=o.value?.trim();if(!t)return null;try{return JSON.parse(t),null}catch(e){return {invalidJson:true}}}export{pe as PromptFormComponent};
@@ -1 +0,0 @@
1
- import {B as k,k as O$1,e as at,c as fn,l as ko,P,D as P$1}from'./chunk-COmLfT0N.js';import {g,F,w as we,ak as U$1,a3 as vr,M as Mi,a5 as Ys,x as U$2,J as JI,o as os,Q as qh,z as zu,f as fC,E as Ew,a as EE,N as Vh,I as Iw,P as Pw,l as lg,i as bw,T as Tw,Y as Yu,n as Aw,q as Pd,L as Ld,d as Bh}from'./main-B6UJJXO7.js';var B=(n,e)=>e.id??e.name;function j(n,e){if(n&1&&(os(0,"p",3),fC(1),zu()),n&2){let t=Pw();EE(),lg(t.deletion.error());}}function K(n,e){n&1&&(os(0,"p",4),fC(1,"Loading agent configs\u2026"),zu());}function H(n,e){n&1&&(os(0,"p",5),fC(1,"No platform agent configs defined yet."),zu());}function U(n,e){n&1&&(os(0,"p",4),fC(1,"No agent configs match the current filter."),zu());}function z(n,e){if(n&1){let t=Aw();os(0,"button",19),qh("click",function(){Pd(t);let d=Pw().$implicit,c=Pw(2);return Ld(c.inspect(d))}),fC(1," Inspect "),zu(),os(2,"button",19),qh("click",function(){Pd(t);let d=Pw().$implicit,c=Pw(2);return Ld(c.edit(d))}),fC(3,"Edit"),zu();}if(n&2){let t=Pw().$implicit;Bh("aria-label","Inspect "+t.name),EE(2),Bh("aria-label","Edit "+t.name);}}function G(n,e){if(n&1){let t=Aw();os(0,"agentos-row-delete-action",20),qh("deleteRequested",function(){Pd(t);let d=Pw().$implicit,c=Pw(2);return Ld(c.deletion.request(d.id))})("deleteConfirmed",function(){Pd(t);let d=Pw().$implicit,c=Pw(2);return Ld(c.confirmDelete(d))})("deleteCancelled",function(){Pd(t);let d=Pw(3);return Ld(d.deletion.cancel())}),zu();}if(n&2){let t=Pw().$implicit,a=Pw(2);Vh("rowKey",t.id)("rowLabel",t.name)("state",a.deletion);}}function J(n,e){if(n&1&&(os(0,"tr",9)(1,"td",12),fC(2),zu(),os(3,"td",13),fC(4),zu(),os(5,"td",14),fC(6),zu(),os(7,"td",15),fC(8),zu(),os(9,"td",16)(10,"div",17),Ew(11,z,4,2),Ew(12,G,1,3,"agentos-row-delete-action",18),zu()()()),n&2){let t=e.$implicit,a=Pw(2);EE(2),lg(t.name),EE(2),Yu(" ",t.description||"\u2014"," "),EE(2),lg(t.modelName||"\u2014"),EE(2),lg(a.mode(t)),EE(3),Iw(a.deletion.confirmingId()!==t.id?11:-1),EE(),Iw(t.id?12:-1);}}function O(n,e){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),fC(5,"Name"),zu(),os(6,"th",10),fC(7,"Description"),zu(),os(8,"th",10),fC(9,"Model"),zu(),os(10,"th",10),fC(11,"Execution mode"),zu(),os(12,"th",10)(13,"span",11),fC(14,"Actions"),zu()()()(),os(15,"tbody",8),bw(16,J,13,6,"tr",9,B),zu()()()),n&2){let t=Pw();EE(16),Tw(t.rowFilter.filteredRows());}}var I=class n{router=g(F);destroyRef=g(we);agentConfigController=g(U$1);refresh$=new vr(void 0);isLoading=Mi(true);deletion=k();configs=Mi([]);rowFilter=O$1(this.configs,e=>[e.name,e.description,e.modelName,this.mode(e)].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),this.agentConfigController.listPlatformAgentsAgentConfig(true))),U$2(this.destroyRef)).subscribe({next:e=>{this.configs.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}mode(e){return e.executionMode??(e.advancedExecution?"ADVANCED":"SIMPLE")}openCreateForm(){this.router.navigate(["/agentos","admin","agent-configs","new"]);}inspect(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"inspect"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","agent-configs",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.agentConfigController.deleteAgentConfig(e.id).pipe(U$2(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=JI({type:n,selectors:[["agentos-platform-agent-configs"]],decls:9,vars:3,consts:[["title","Platform agents","description","Agent configurations shared across every namespace."],["label","Filter agent configs","placeholder","Filter agent configs\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform agents"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Model"],["role","cell","data-label","Execution mode"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return a.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return a.openCreateForm()}),fC(3,"New agent config"),zu()(),Ew(4,j,2,1,"p",3),Ew(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,18,0,"div",6)),t&2&&(EE(),Vh("query",a.rowFilter.query()),EE(3),Iw(a.deletion.error()?4:-1),EE(),Iw(a.isLoading()?5:a.configs().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{I as PlatformAgentConfigsComponent};
@@ -1 +0,0 @@
1
- import {e}from'./chunk-C6dIhkYp.js';import {n}from'./chunk-CfgXrte_.js';import {v}from'./chunk-aqEkIRN7.js';import {O}from'./chunk-DIVQtNVn.js';import {g,W as W$1,F,w as we,v as L,M as Mi,x as U$1,ah as te$1,a5 as Ys,ae as Dr,J as JI,o as os,Q as qh,z as zu,f as fC,E as Ew,N as Vh,a as EE,I as Iw,P as Pw,l as lg,i as bw,T as Tw,Y as Yu,n as Aw,d as Bh,q as Pd,L as Ld}from'./main-B6UJJXO7.js';import {B as k,k as O$1,e as at,c as fn,l as ko,n as Fo,P,D as P$1}from'./chunk-COmLfT0N.js';import'./chunk-DxIOAne_.js';var Q=(n,e)=>e.key;function W(n,e){if(n&1&&(os(0,"p",3),fC(1),zu()),n&2){let t=Pw();EE(),lg(t.deletion.error());}}function X(n,e){n&1&&(os(0,"p",4),fC(1,"Loading integrations\u2026"),zu());}function Z(n,e){n&1&&(os(0,"p",5),fC(1,"No integrations available."),zu());}function ee(n,e){n&1&&(os(0,"p",4),fC(1,"No integrations match the current filter."),zu());}function te(n,e){n&1&&(os(0,"ds-tag",20),fC(1,"YAML"),zu(),os(2,"ds-tag",21),fC(3,"Read-only"),zu());}function ne(n,e){if(n&1){let t=Aw();os(0,"button",22),qh("click",function(){Pd(t);let s=Pw().$implicit,c=Pw(2);return Ld(c.view(s))}),fC(1,"View"),zu();}if(n&2){let t=Pw().$implicit;Bh("aria-label","View "+t.config.name);}}function ie(n,e){if(n&1){let t=Aw();os(0,"button",22),qh("click",function(){Pd(t);let s=Pw(3).$implicit,c=Pw(2);return Ld(c.edit(s))}),fC(1," Edit "),zu();}if(n&2){let t=Pw(3).$implicit;Bh("aria-label","Edit "+t.config.name);}}function oe(n,e){if(n&1){let t=Aw();os(0,"button",22),qh("click",function(){Pd(t);let s=Pw(2).$implicit,c=Pw(2);return Ld(c.duplicate(s))}),fC(1," Duplicate "),zu(),Ew(2,ie,2,1,"button",19);}if(n&2){let t=Pw(2).$implicit;Bh("aria-label","Duplicate "+t.config.name),EE(2),Iw(t.canEdit?2:-1);}}function ae(n,e){if(n&1){let t=Aw();os(0,"agentos-row-delete-action",25),qh("deleteRequested",function(){Pd(t);let s=Pw(2).$implicit,c=Pw(2);return Ld(c.deletion.request(s.key))})("deleteConfirmed",function(){Pd(t);let s=Pw(2).$implicit,c=Pw(2);return Ld(c.confirmDelete(s))})("deleteCancelled",function(){Pd(t);let s=Pw(4);return Ld(s.deletion.cancel())}),zu();}if(n&2){let t=Pw(2).$implicit,a=Pw(2);Vh("rowKey",t.key)("rowLabel",t.config.name)("state",a.deletion);}}function re(n,e){n&1&&(os(0,"button",24),fC(1,"Inherited"),zu());}function le(n,e){if(n&1&&(Ew(0,oe,3,2),Ew(1,ae,1,3,"agentos-row-delete-action",23),Ew(2,re,2,0,"button",24)),n&2){let t=Pw().$implicit,a=Pw(2);Iw(a.deletion.confirmingId()!==t.key?0:-1),EE(),Iw(t.canDelete?1:-1),EE(),Iw(!t.canEdit&&!t.canDelete?2:-1);}}function se(n,e){if(n&1&&(os(0,"tr",9)(1,"td",12),fC(2),zu(),os(3,"td",13),fC(4),zu(),os(5,"td",14)(6,"div",15)(7,"ds-tag",16),fC(8),zu(),Ew(9,te,4,0),zu()(),os(10,"td",17)(11,"div",18),Ew(12,ne,2,1,"button",19)(13,le,3,3),zu()()()),n&2){let t=e.$implicit;EE(2),lg(t.config.name),EE(2),Yu(" ",t.config.integrationType," "),EE(3),Vh("variant",t.scopeLabel==="Platform"?"neutral":t.scopeLabel==="Personal"?"outline":"accent"),EE(),Yu(" ",t.scopeLabel," "),EE(),Iw(t.source==="FILESYSTEM"?9:-1),EE(3),Iw(t.source==="FILESYSTEM"?12:13);}}function ce(n,e){if(n&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),fC(5,"Name"),zu(),os(6,"th",10),fC(7,"Type"),zu(),os(8,"th",10),fC(9,"Scope"),zu(),os(10,"th",10)(11,"span",11),fC(12,"Actions"),zu()()()(),os(13,"tbody",8),bw(14,se,14,6,"tr",9,Q),zu()()()),n&2){let t=Pw();EE(14),Tw(t.rowFilter.filteredRows());}}var U=class n$1{route=g(W$1);router=g(F);destroyRef=g(we);state=g(O);namespaceRole=g(v);namespaceApi=g(L);namespaceId=this.route.snapshot.params.namespaceId;namespaceName=Mi("this namespace");isAdmin=Mi(false);isLoading=Mi(true);rows=Mi([]);deletion=k();rowFilter=O$1(this.rows,e=>[e.config.name,e.config.integrationType,e.scopeLabel,e.source].join(" "));ngOnInit(){this.state.setNamespace(this.namespaceId),this.namespaceId&&this.namespaceApi.getByIdNamespace(this.namespaceId).pipe(U$1(this.destroyRef)).subscribe({next:e=>this.namespaceName.set(e.name)}),this.route.paramMap.pipe(te$1(e=>e.get("namespaceId")??""),Ys(e=>e?this.namespaceRole.isAdminOfNamespace$(e):Dr(false)),U$1(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(U$1(this.destroyRef)).subscribe({next:e=>{this.rows.set(this.toRows(e)),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n(this.isAdmin())}});}view(e){e.config.id&&this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"view"]);}edit(e){!e.canEdit||!e.config.id||this.router.navigate(["/agentos",this.namespaceId,"integrations",e.config.id,"edit"],{queryParams:{scope:e.scope}});}duplicate(e){if(e.source==="FILESYSTEM"||!e.config.id)return;let a=(e.scope==="platform"||e.scope==="namespace")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:a,template:e.config.id,templateScope:e.scope}});}confirmDelete(e){!e.canDelete||!e.config.id||this.deletion.execute(e.key,{request$:this.state.delete(e.config.id,e.scope).pipe(U$1(this.destroyRef)),errorMessage:`Deleting "${e.config.name}" failed. Try again.`});}toRows(e){return [...this.mapScope(e.platform,"platform","Platform",true),...this.mapScope(e.namespace,"namespace","Namespace",!this.isAdmin()),...this.mapScope(e.userOnNs,"userOnNs","Personal",false),...this.mapScope(e.userGlobal,"userGlobal","Personal",false)]}mapScope(e$1,t,a,s){return e$1.map((c,z)=>{let h=e(c),w=h==="NEO4J"&&!s;return {key:`${t}:${c.id??z}`,config:c,scope:t,scopeLabel:a,source:h,canEdit:w,canDelete:w}})}static \u0275fac=function(t){return new(t||n$1)};static \u0275cmp=JI({type:n$1,selectors:[["agentos-integrations-all-scopes"]],decls:9,vars:4,consts:[["title","Integrations",3,"description"],["label","Filter integrations","placeholder","Filter integrations\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Integrations"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Type",1,"settings-table__secondary"],["role","cell","data-label","Scope"],[1,"settings-table__tags"],[3,"variant"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["variant","neutral"],["variant","outline"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button","disabled",""],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(t,a){t&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(c){return a.rowFilter.query.set(c)}),zu(),os(2,"button",2),qh("click",function(){return a.openCreateForm()}),fC(3,"New integration"),zu()(),Ew(4,W,2,1,"p",3),Ew(5,X,2,0,"p",4)(6,Z,2,0,"p",5)(7,ee,2,0,"p",4)(8,ce,16,0,"div",6)),t&2&&(Vh("description","Integrations for "+a.namespaceName()+", including entries inherited from the platform."),EE(),Vh("query",a.rowFilter.query()),EE(3),Iw(a.deletion.error()?4:-1),EE(),Iw(a.isLoading()?5:a.rows().length===0?6:a.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,Fo,P,P$1],encapsulation:2})};export{U as IntegrationsAllScopesComponent};
@@ -1 +0,0 @@
1
- import {G as m,B as k,k as O$1,e as at,c as fn,l as ko,P,D as P$1}from'./chunk-COmLfT0N.js';import {g,F,w as we,a3 as vr,M as Mi,a5 as Ys,x as U$1,J as JI,o as os,Q as qh,z as zu,f as fC,E as Ew,a as EE,N as Vh,I as Iw,P as Pw,l as lg,i as bw,T as Tw,Y as Yu,n as Aw,d as Bh,q as Pd,L as Ld}from'./main-B6UJJXO7.js';var j=(t,e)=>e.id??e.name;function A(t,e){if(t&1&&(os(0,"p",3),fC(1),zu()),t&2){let n=Pw();EE(),lg(n.deletion.error());}}function K(t,e){t&1&&(os(0,"p",4),fC(1,"Loading prompts\u2026"),zu());}function H(t,e){t&1&&(os(0,"p",5),fC(1,"No platform prompts defined yet."),zu());}function U(t,e){t&1&&(os(0,"p",4),fC(1,"No prompts match the current filter."),zu());}function z(t,e){if(t&1){let n=Aw();os(0,"button",18),qh("click",function(){Pd(n);let m=Pw().$implicit,p=Pw(2);return Ld(p.edit(m))}),fC(1,"Edit"),zu();}if(t&2){let n=Pw().$implicit;Bh("aria-label","Edit "+n.name);}}function G(t,e){if(t&1){let n=Aw();os(0,"agentos-row-delete-action",19),qh("deleteRequested",function(){Pd(n);let m=Pw().$implicit,p=Pw(2);return Ld(p.deletion.request(m.id))})("deleteConfirmed",function(){Pd(n);let m=Pw().$implicit,p=Pw(2);return Ld(p.confirmDelete(m))})("deleteCancelled",function(){Pd(n);let m=Pw(3);return Ld(m.deletion.cancel())}),zu();}if(t&2){let n=Pw().$implicit,r=Pw(2);Vh("rowKey",n.id)("rowLabel",n.name)("state",r.deletion);}}function J(t,e){if(t&1&&(os(0,"tr",9)(1,"td",12),fC(2),zu(),os(3,"td",13),fC(4),zu(),os(5,"td",14)(6,"div",15),Ew(7,z,2,1,"button",16),Ew(8,G,1,3,"agentos-row-delete-action",17),zu()()()),t&2){let n=e.$implicit,r=Pw(2);EE(2),lg(n.name),EE(2),Yu(" ",n.description||"\u2014"," "),EE(3),Iw(r.deletion.confirmingId()!==n.id?7:-1),EE(),Iw(n.id?8:-1);}}function O(t,e){if(t&1&&(os(0,"div",6)(1,"table",7)(2,"thead",8)(3,"tr",9)(4,"th",10),fC(5,"Name"),zu(),os(6,"th",10),fC(7,"Description"),zu(),os(8,"th",10)(9,"span",11),fC(10,"Actions"),zu()()()(),os(11,"tbody",8),bw(12,J,9,4,"tr",9,j),zu()()()),t&2){let n=Pw();EE(12),Tw(n.rowFilter.filteredRows());}}var B=class t{router=g(F);destroyRef=g(we);promptState=g(m);refresh$=new vr(void 0);isLoading=Mi(true);deletion=k();prompts=Mi([]);rowFilter=O$1(this.prompts,e=>[e.name,e.description].filter(Boolean).join(" "));constructor(){this.refresh$.pipe(Ys(()=>(this.isLoading.set(true),this.promptState.listPlatform())),U$1(this.destroyRef)).subscribe({next:e=>{this.prompts.set(e),this.isLoading.set(false);},error:()=>this.isLoading.set(false)});}openCreateForm(){this.router.navigate(["/agentos","admin","prompts","new"]);}edit(e){e.id&&this.router.navigate(["/agentos","admin","prompts",e.id,"edit"]);}confirmDelete(e){e.id&&this.deletion.execute(e.id,{request$:this.promptState.delete(e.id).pipe(U$1(this.destroyRef)),onSuccess:()=>this.refresh$.next(),errorMessage:`Deleting "${e.name}" failed. Try again.`});}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=JI({type:t,selectors:[["agentos-platform-prompts"]],decls:9,vars:3,consts:[["title","Platform prompts","description","Prompts shared across every namespace."],["label","Filter prompts","placeholder","Filter prompts\u2026",3,"queryChange","query"],["dsButton","","variant","primary","type","button",3,"click"],["role","alert",1,"settings-table__error"],["role","status",1,"settings-table__status"],[1,"settings-table__status"],[1,"settings-table__wrap"],["dsTable","","role","table","aria-label","Platform prompts"],["role","rowgroup"],["role","row"],["role","columnheader"],[1,"sr-only"],["role","cell","data-label","Name","data-title","",1,"settings-table__name"],["role","cell","data-label","Description",1,"settings-table__secondary"],["role","cell","data-label","Actions","data-actions",""],[1,"settings-table__actions"],["type","button"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"rowKey","rowLabel","state"],["type","button",3,"click"],["deleteClass","settings-table__delete","confirmLabelClass","settings-table__confirm-label",3,"deleteRequested","deleteConfirmed","deleteCancelled","rowKey","rowLabel","state"]],template:function(n,r){n&1&&(os(0,"ds-section-header",0)(1,"agentos-table-filter",1),qh("queryChange",function(p){return r.rowFilter.query.set(p)}),zu(),os(2,"button",2),qh("click",function(){return r.openCreateForm()}),fC(3,"New prompt"),zu()(),Ew(4,A,2,1,"p",3),Ew(5,K,2,0,"p",4)(6,H,2,0,"p",5)(7,U,2,0,"p",4)(8,O,14,0,"div",6)),n&2&&(EE(),Vh("query",r.rowFilter.query()),EE(3),Iw(r.deletion.error()?4:-1),EE(),Iw(r.isLoading()?5:r.prompts().length===0?6:r.rowFilter.filteredRows().length===0?7:8));},dependencies:[at,fn,ko,P,P$1],encapsulation:2})};export{B as PlatformPromptsComponent};
@@ -1 +0,0 @@
1
- import {g as g$1}from'./chunk-D1kq6J6C.js';import {j as e}from'./chunk-COmLfT0N.js';import {g,w as we,M as Mi,h as BC,x as U,J as JI,_ as Qb,G as Gu,f as fC,b as Wu,E as Ew,a as EE,Y as Yu,$ as dg,I as Iw,n as Aw,a0 as AC,U as Uh,Z as Zh,q as Pd,P as Pw,L as Ld,l as lg,a1 as kC,c as Gh}from'./main-B6UJJXO7.js';function R(r,n){if(r&1){let e=Aw();Gu(0,"span",11),fC(1,"Remove it? The bots it created stay."),Wu(),Gu(2,"button",15),Zh("click",function(){Pd(e);let t=Pw(2);return Ld(t.remove())}),fC(3," Remove "),Wu(),Gu(4,"button",13),Zh("click",function(){Pd(e);let t=Pw(2);return Ld(t.confirmingRemove.set(false))}),fC(5,"Cancel"),Wu();}if(r&2){let e=Pw(2);EE(2),Gh("disabled",e.busy());}}function I(r,n){if(r&1){let e=Aw();Gu(0,"button",13),Zh("click",function(){Pd(e);let t=Pw(2);return Ld(t.confirmingRemove.set(true))}),fC(1,"Remove"),Wu();}}function V(r,n){if(r&1){let e=Aw();Gu(0,"div",5)(1,"span",9),fC(2),Wu(),Gu(3,"span",10),fC(4),Wu(),Gu(5,"span",11),fC(6),AC(7,"date"),Wu(),Uh(8,"span",12),Gu(9,"button",13),Zh("click",function(){Pd(e);let t=Pw();return Ld(t.replacing.set(!t.replacing()))}),fC(10,"Replace"),Wu(),Ew(11,R,6,1)(12,I,2,0,"button",14),Wu();}if(r&2){let e=n,o=Pw();EE(2),Yu("@",e.username),EE(2),lg(o.statusLabel(e.status)),EE(2),Yu("since ",kC(7,4,e.createdAt,"mediumDate")),EE(5),Iw(o.confirmingRemove()?11:12);}}function z(r,n){if(r&1&&(Gu(0,"ol",6)(1,"li"),fC(2),Wu(),Gu(3,"li"),fC(4,"In BotFather's Mini App, open the bot's settings and turn Bot Management Mode on."),Wu(),Gu(5,"li"),fC(6,"Paste the bot's token below. It is stored encrypted and never shown again."),Wu()()),r&2){let e=Pw();EE(2),Yu("In ",e.platformName,', create a bot with @BotFather (/newbot), for example "AgentOS".');}}function B(r,n){if(r&1){let e=Aw();Gu(0,"form",16),Zh("submit",function(t){Pd(e);let p=Pw();return t.preventDefault(),Ld(p.save())}),Gu(1,"label",17),fC(2,"Bot manager token"),Wu(),Gu(3,"input",18),Zh("input",function(t){Pd(e);let p=Pw();return Ld(p.token.set(t.target.value))}),Wu(),Gu(4,"button",19),fC(5),Wu()();}if(r&2){let e=Pw();EE(3),Gh("value",e.token()),EE(),Gh("disabled",e.busy()||!e.token().trim()),EE(),Yu(" ",e.manager()?"Replace":"Set"," ");}}function L(r,n){r&1&&(Gu(0,"p",8),fC(1),Wu()),r&2&&(EE(),lg(n));}var D=class r{botConfig=g(g$1);destroyRef=g(we);platform="TELEGRAM";platformName=e("TELEGRAM");managers=Mi([]);manager=BC(()=>this.managers().find(n=>n.platform===this.platform)??null);replacing=Mi(false);confirmingRemove=Mi(false);token=Mi("");busy=Mi(false);error=Mi(null);ngOnInit(){this.run(this.botConfig.managers(),n=>this.managers.set(n),"Could not load the bot managers.");}statusLabel(n){return n==="RUNNING"?"Running":n.replace("_"," ").toLowerCase()}save(){let n=this.token().trim();n&&this.run(this.botConfig.setManager(this.platform,n),e=>{this.token.set(""),this.replacing.set(false),this.managers.update(o=>[...o.filter(t=>t.platform!==e.platform),e]);},`${this.platformName} refused this token, or the bot cannot manage other bots yet.`);}remove(){this.confirmingRemove.set(false),this.run(this.botConfig.removeManager(this.platform),()=>this.managers.update(n=>n.filter(e=>e.platform!==this.platform)),"Could not remove the bot manager.");}run(n,e,o){this.error.set(null),this.busy.set(true),n.pipe(U(this.destroyRef)).subscribe({next:t=>{this.busy.set(false),e(t);},error:t=>{console.error("[AdminMessaging]",o,t),this.busy.set(false),this.error.set(t?.error?.message??o);}});}static \u0275fac=function(e){return new(e||r)};static \u0275cmp=JI({type:r,selectors:[["agentos-admin-messaging"]],decls:12,vars:6,consts:[[1,"admin-messaging"],[1,"admin-messaging__title"],[1,"admin-messaging__section"],[1,"admin-messaging__section-title"],[1,"admin-messaging__hint"],[1,"admin-messaging__row"],[1,"admin-messaging__steps"],[1,"admin-messaging__token"],["role","alert",1,"admin-messaging__error"],[1,"admin-messaging__bot"],[1,"admin-messaging__status"],[1,"admin-messaging__note"],[1,"admin-messaging__spacer"],["type","button",1,"admin-messaging__btn",3,"click"],["type","button",1,"admin-messaging__btn"],["type","button",1,"admin-messaging__btn","admin-messaging__btn--danger",3,"click","disabled"],[1,"admin-messaging__token",3,"submit"],["for","admin-messaging-token",1,"admin-messaging__label"],["id","admin-messaging-token","type","password","name","token","autocomplete","off","placeholder","123456789:AA\u2026",1,"admin-messaging__input",3,"input","value"],["type","submit",1,"admin-messaging__btn","admin-messaging__btn--primary",3,"disabled"]],template:function(e,o){if(e&1&&(Gu(0,"div",0)(1,"h1",1),fC(2,"Messaging"),Wu(),Gu(3,"section",2)(4,"h2",3),fC(5),Wu(),Gu(6,"p",4),fC(7),Wu(),Ew(8,V,13,7,"div",5)(9,z,7,1,"ol",6),Ew(10,B,6,3,"form",7),Ew(11,L,2,1,"p",8),Wu()()),e&2){let t,p;EE(5),Yu("",o.platformName," bot manager"),EE(2),dg(" The bot manager creates the ",o.platformName," bots of agents for the admins of their namespace: on an agent's page, Create a bot opens ",o.platformName,", the admin confirms, and the bot answers as the agent. Nobody copies a token. Without a bot manager, an agent can still get a bot created with @BotFather, from its token. "),EE(),Iw((t=o.manager())?8:9,t),EE(2),Iw(!o.manager()||o.replacing()?10:-1),EE(),Iw((p=o.error())?11:-1,p);}},dependencies:[Qb],styles:[".admin-messaging[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.admin-messaging__title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:1.25rem;font-weight:600;color:var(--color-text)}.admin-messaging__hint[_ngcontent-%COMP%], .admin-messaging__note[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-text-secondary)}.admin-messaging__warning[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-warning, #b26a00)}.admin-messaging__error[_ngcontent-%COMP%]{margin:0;font-size:.8125rem;color:var(--color-error, #c62828)}.admin-messaging__row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.admin-messaging__spacer[_ngcontent-%COMP%]{flex:1}.admin-messaging__bot[_ngcontent-%COMP%]{font-family:var(--font-mono, monospace);font-size:.9375rem;color:var(--color-accent);text-decoration:none}.admin-messaging__bot[_ngcontent-%COMP%]:hover{text-decoration:underline}.admin-messaging__status[_ngcontent-%COMP%]{padding:.1rem .5rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);font-size:.75rem;font-weight:600}.admin-messaging__status--ok[_ngcontent-%COMP%]{border-color:var(--color-success, #2e7d32);color:var(--color-success, #2e7d32)}.admin-messaging__status--off[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.admin-messaging__status--warn[_ngcontent-%COMP%]{border-color:var(--color-warning, #b26a00);color:var(--color-warning, #b26a00)}.admin-messaging__token[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.admin-messaging__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text-secondary)}.admin-messaging__input[_ngcontent-%COMP%]{flex:1;min-width:16rem;padding:.4rem .6rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:var(--color-bg);color:var(--color-text);font-family:var(--font-mono, monospace);font-size:.875rem}.admin-messaging__btn[_ngcontent-%COMP%]{padding:.4rem .9rem;border:1px solid var(--color-divider);border-radius:var(--radius-sm, 0);background:transparent;color:var(--color-text);font-size:13px;font-family:var(--font-heading);font-weight:600;text-decoration:none;cursor:pointer}.admin-messaging__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-bg-hover);border-color:var(--color-neutral-500)}.admin-messaging__btn[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:default}.admin-messaging__btn--primary[_ngcontent-%COMP%]{border-color:var(--color-accent);color:var(--color-accent)}.admin-messaging__btn--danger[_ngcontent-%COMP%]{border-color:var(--color-error, #c62828);color:var(--color-error, #c62828)}.admin-messaging__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.admin-messaging__section-title[_ngcontent-%COMP%]{margin:0;font-family:var(--font-heading);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--color-neutral-500);border-bottom:1px solid var(--color-divider);padding-bottom:.5rem}.admin-messaging__steps[_ngcontent-%COMP%]{margin:0;padding-left:1.25rem;font-size:.875rem;color:var(--color-text);line-height:1.6}"]})};export{D as AdminMessagingComponent};
@@ -1 +0,0 @@
1
- import {ae as N,b as hn,c as fn,u as un,d as cn,E as pn,e as at,i as sn}from'./chunk-COmLfT0N.js';import {g,W,F,a_ as D,ak as U,w as we,M as Mi,x as U$1,B,a$ as Fm,J as JI,o as os,Q as qh,f as fC,z as zu,H as Hh,E as Ew,a as EE,N as Vh,I as Iw,Y as Yu,P as Pw,l as lg}from'./main-B6UJJXO7.js';function P(l,t){if(l&1&&(os(0,"ds-notice"),fC(1),zu()),l&2){let n=Pw();EE(),lg(n.launchError());}}var T=class l{route=g(W);router=g(F);caseController=g(D);caseState=g(N);agentConfigController=g(U);destroyRef=g(we);namespaceId=this.route.snapshot.params.namespaceId;agentConfigId=this.route.snapshot.params.agentConfigId;resolvedAgentConfig=null;payloadJson=Mi("");launchError=Mi(null);isLaunching=Mi(false);isLoading=Mi(false);ngOnInit(){this.isLoading.set(true),this.agentConfigController.getByIdAgentConfig(this.agentConfigId).pipe(U$1(this.destroyRef)).subscribe({next:t=>{this.resolvedAgentConfig=t,t.loopConfig!=null&&this.payloadJson.set(JSON.stringify(t.loopConfig,null,2)),this.isLoading.set(false);},error:()=>{this.isLoading.set(false);}});}launch(){return B(this,null,function*(){this.launchError.set(null),this.isLaunching.set(true);try{let t=this.resolvedAgentConfig??(yield Fm(this.agentConfigController.getByIdAgentConfig(this.agentConfigId))),n=yield Fm(this.caseController.createCase({namespaceId:this.namespaceId}));this.caseState.addCase(n);let e=n.id??"",d={content:`@${t.name} start`};yield Fm(this.caseController.addMessageCase(e,d)),this.router.navigate(["/agentos/home"],{queryParams:{ns:this.namespaceId,case:e}});}catch(t){console.error("[AgentConfigLaunch] Failed to launch loop agent",t),this.launchError.set("Failed to launch the agent loop. Please check the console for details."),this.isLaunching.set(false);}})}back(){this.router.navigate(["/agentos",this.namespaceId,"agent-configs",this.agentConfigId,"edit"]);}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=JI({type:l,selectors:[["agentos-agent-config-launch"]],decls:17,vars:6,consts:[["title","Launch loop agent"],["dsButton","","variant","ghost","type","button","title","Back to agent config",3,"click"],[1,"ds-hint"],["label","Loop configuration (read-only)","controlId","agent-loop-payload"],["dsControl","","mono","","id","agent-loop-payload","rows","15","readonly","","spellcheck","false","autocomplete","off",3,"value","disabled"],["dsButton","","variant","primary","type","button",3,"click","disabled"],["dsButton","","type","button",3,"click","disabled"]],template:function(n,e){n&1&&(os(0,"ds-page")(1,"ds-section-header",0)(2,"button",1),qh("click",function(){return e.back()}),fC(3," \u2190 Edit agent config "),zu()(),os(4,"p",2),fC(5," The loop configuration below is read from "),os(6,"code"),fC(7,"AgentConfig.loopConfig"),zu(),fC(8," and will be used by the backend when the agent loop starts. A new Case will be created and one child case will be launched per entity found. "),zu(),os(9,"ds-form-field",3),Hh(10,"textarea",4),zu(),Ew(11,P,2,1,"ds-notice"),os(12,"ds-form-actions")(13,"button",5),qh("click",function(){return e.launch()}),fC(14),zu(),os(15,"button",6),qh("click",function(){return e.back()}),fC(16,"Cancel"),zu()()()),n&2&&(EE(10),Vh("value",e.payloadJson())("disabled",e.isLaunching()||e.isLoading()),EE(),Iw(e.launchError()?11:-1),EE(2),Vh("disabled",e.isLaunching()),EE(),Yu(" ",e.isLaunching()?"Launching\u2026":"Launch"," "),EE(),Vh("disabled",e.isLaunching()));},dependencies:[hn,fn,un,cn,pn,at,sn],encapsulation:2})};export{T as AgentConfigLaunchComponent};