agent-relay-server 0.113.0 → 0.115.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/docs/openapi.json +39 -1
  2. package/package.json +3 -3
  3. package/public/assets/MessageBubble-Dy37JuVw.js +4 -0
  4. package/public/assets/{MessageBubble-CFujR6_L.js.map → MessageBubble-Dy37JuVw.js.map} +1 -1
  5. package/public/assets/PlanGraphPanel-C17_n4Ff.js +2 -0
  6. package/public/assets/PlanGraphPanel-C17_n4Ff.js.map +1 -0
  7. package/public/assets/{activity-C7-gIF9O.js → activity-G-s2N4eU.js} +2 -2
  8. package/public/assets/{activity-C7-gIF9O.js.map → activity-G-s2N4eU.js.map} +1 -1
  9. package/public/assets/{agent-profiles-BGPa2-BZ.js → agent-profiles-v4CcpJWT.js} +2 -2
  10. package/public/assets/{agent-profiles-BGPa2-BZ.js.map → agent-profiles-v4CcpJWT.js.map} +1 -1
  11. package/public/assets/{agents-CWCbBuq6.js → agents-CuEoaCLs.js} +2 -2
  12. package/public/assets/{agents-CWCbBuq6.js.map → agents-CuEoaCLs.js.map} +1 -1
  13. package/public/assets/{analytics-BhGpT0JR.js → analytics-Dvg0J33b.js} +3 -3
  14. package/public/assets/{analytics-BhGpT0JR.js.map → analytics-Dvg0J33b.js.map} +1 -1
  15. package/public/assets/{automation-DnpahVqs.js → automation-wXSbBEei.js} +2 -2
  16. package/public/assets/{automation-DnpahVqs.js.map → automation-wXSbBEei.js.map} +1 -1
  17. package/public/assets/{badge-kdQDWO6e.js → badge-BhUZ1cAb.js} +2 -2
  18. package/public/assets/{badge-kdQDWO6e.js.map → badge-BhUZ1cAb.js.map} +1 -1
  19. package/public/assets/{branch-state-badge-CcAq2Igv.js → branch-state-badge-YzkNCHyZ.js} +2 -2
  20. package/public/assets/{branch-state-badge-CcAq2Igv.js.map → branch-state-badge-YzkNCHyZ.js.map} +1 -1
  21. package/public/assets/{button-BKFvNXa3.js → button-C-V4oij1.js} +2 -2
  22. package/public/assets/{button-BKFvNXa3.js.map → button-C-V4oij1.js.map} +1 -1
  23. package/public/assets/card-DAkf5Kzw.js +2 -0
  24. package/public/assets/{card-B0y1i_2D.js.map → card-DAkf5Kzw.js.map} +1 -1
  25. package/public/assets/{channels-DBP3-Gg0.js → channels-Vl9YHoGK.js} +2 -2
  26. package/public/assets/{channels-DBP3-Gg0.js.map → channels-Vl9YHoGK.js.map} +1 -1
  27. package/public/assets/chat-yiXwg4kh.js +2 -0
  28. package/public/assets/{chat-Bue-qNx_.js.map → chat-yiXwg4kh.js.map} +1 -1
  29. package/public/assets/{connectors-BJxbuxoU.js → connectors-C33KsouZ.js} +2 -2
  30. package/public/assets/{connectors-BJxbuxoU.js.map → connectors-C33KsouZ.js.map} +1 -1
  31. package/public/assets/copy-button-BStzXgtd.js +2 -0
  32. package/public/assets/{copy-button-aLaiAkv2.js.map → copy-button-BStzXgtd.js.map} +1 -1
  33. package/public/assets/{dist-EO8jbi2F.js → dist-CBMWGhWc.js} +2 -2
  34. package/public/assets/{dist-EO8jbi2F.js.map → dist-CBMWGhWc.js.map} +1 -1
  35. package/public/assets/{dist-avJPT3qF.js → dist-CDZZxxJq.js} +2 -2
  36. package/public/assets/{dist-avJPT3qF.js.map → dist-CDZZxxJq.js.map} +1 -1
  37. package/public/assets/{dist-DnyQI0qt.js → dist-CQ0Z-TDi.js} +2 -2
  38. package/public/assets/{dist-DnyQI0qt.js.map → dist-CQ0Z-TDi.js.map} +1 -1
  39. package/public/assets/{dist-DQPz52Zx.js → dist-ChDX_t12.js} +2 -2
  40. package/public/assets/{dist-DQPz52Zx.js.map → dist-ChDX_t12.js.map} +1 -1
  41. package/public/assets/{dist-D_qcpfbI.js → dist-CmFeEXMe.js} +2 -2
  42. package/public/assets/{dist-D_qcpfbI.js.map → dist-CmFeEXMe.js.map} +1 -1
  43. package/public/assets/{dist-DKoRwEZq.js → dist-Cs8X0P1d.js} +2 -2
  44. package/public/assets/{dist-DKoRwEZq.js.map → dist-Cs8X0P1d.js.map} +1 -1
  45. package/public/assets/dist-D2jvo5oA.js +2 -0
  46. package/public/assets/{dist-CF28Y5wI.js.map → dist-D2jvo5oA.js.map} +1 -1
  47. package/public/assets/{dist-BDYU37NZ.js → dist-DV83j9tm.js} +2 -2
  48. package/public/assets/{dist-BDYU37NZ.js.map → dist-DV83j9tm.js.map} +1 -1
  49. package/public/assets/{dist-DDh8a_SK.js → dist-DyNJNwpi.js} +2 -2
  50. package/public/assets/{dist-DDh8a_SK.js.map → dist-DyNJNwpi.js.map} +1 -1
  51. package/public/assets/dist-mm7c7nBt.js +2 -0
  52. package/public/assets/{dist-cyag2tir.js.map → dist-mm7c7nBt.js.map} +1 -1
  53. package/public/assets/dist-y03IwOrd.js +2 -0
  54. package/public/assets/{dist-BnfqT2cl.js.map → dist-y03IwOrd.js.map} +1 -1
  55. package/public/assets/{es2015-C9FSEGd7.js → es2015-VnZ2kVIz.js} +2 -2
  56. package/public/assets/{es2015-C9FSEGd7.js.map → es2015-VnZ2kVIz.js.map} +1 -1
  57. package/public/assets/formatted-body-impl-CfnhWZAX.js +3 -0
  58. package/public/assets/formatted-body-impl-CfnhWZAX.js.map +1 -0
  59. package/public/assets/index-4XRZ-n_A.js +23 -0
  60. package/public/assets/index-4XRZ-n_A.js.map +1 -0
  61. package/public/assets/index-DYwuv_Na.css +2 -0
  62. package/public/assets/{input-DfN6sUbX.js → input-CtLT7WXi.js} +2 -2
  63. package/public/assets/{input-DfN6sUbX.js.map → input-CtLT7WXi.js.map} +1 -1
  64. package/public/assets/{insights-CZ_JrJ8M.js → insights-C5Ft13cw.js} +2 -2
  65. package/public/assets/{insights-CZ_JrJ8M.js.map → insights-C5Ft13cw.js.map} +1 -1
  66. package/public/assets/{integrations-L75xhZd5.js → integrations-DR3pboEG.js} +2 -2
  67. package/public/assets/{integrations-L75xhZd5.js.map → integrations-DR3pboEG.js.map} +1 -1
  68. package/public/assets/{lib-DRRHEqRZ.js → lib-BLoevhQO.js} +3 -3
  69. package/public/assets/{lib-DRRHEqRZ.js.map → lib-BLoevhQO.js.map} +1 -1
  70. package/public/assets/lucide-react-Dc3ZwCBi.js +9 -0
  71. package/public/assets/{lucide-react-DmbfpRvJ.js.map → lucide-react-Dc3ZwCBi.js.map} +1 -1
  72. package/public/assets/{maintenance-Dpb87NaB.js → maintenance-Ddl6-McO.js} +2 -2
  73. package/public/assets/{maintenance-Dpb87NaB.js.map → maintenance-Ddl6-McO.js.map} +1 -1
  74. package/public/assets/{managed-agents-DyGbrKwJ.js → managed-agents-pLThsagU.js} +4 -4
  75. package/public/assets/{managed-agents-DyGbrKwJ.js.map → managed-agents-pLThsagU.js.map} +1 -1
  76. package/public/assets/{markdown-preview-impl-Bx4AcI8G.js → markdown-preview-impl-CiENso5E.js} +2 -2
  77. package/public/assets/{markdown-preview-impl-Bx4AcI8G.js.map → markdown-preview-impl-CiENso5E.js.map} +1 -1
  78. package/public/assets/memory-CSzdP2o2.js +2 -0
  79. package/public/assets/{memory-2l6G_m1p.js.map → memory-CSzdP2o2.js.map} +1 -1
  80. package/public/assets/messages-1ton_JT5.js +2 -0
  81. package/public/assets/{messages-DC-QXNwz.js.map → messages-1ton_JT5.js.map} +1 -1
  82. package/public/assets/{orchestrators-D_X3a0dm.js → orchestrators-C2kC07Qm.js} +2 -2
  83. package/public/assets/{orchestrators-D_X3a0dm.js.map → orchestrators-C2kC07Qm.js.map} +1 -1
  84. package/public/assets/overview-CXc2vQRQ.js +2 -0
  85. package/public/assets/{overview-76JPEbGZ.js.map → overview-CXc2vQRQ.js.map} +1 -1
  86. package/public/assets/{pairs-IeLXl-Z8.js → pairs-DLfFKNEf.js} +2 -2
  87. package/public/assets/{pairs-IeLXl-Z8.js.map → pairs-DLfFKNEf.js.map} +1 -1
  88. package/public/assets/{projects-D8ClXDUg.js → projects-TM20JuNI.js} +2 -2
  89. package/public/assets/{projects-D8ClXDUg.js.map → projects-TM20JuNI.js.map} +1 -1
  90. package/public/assets/prompt-settings-DWYbD9TA.js +2 -0
  91. package/public/assets/{prompt-settings-BRduaHOj.js.map → prompt-settings-DWYbD9TA.js.map} +1 -1
  92. package/public/assets/{react-dom-jQ4Vs380.js → react-dom-cLkVFBsS.js} +2 -2
  93. package/public/assets/{react-dom-jQ4Vs380.js.map → react-dom-cLkVFBsS.js.map} +1 -1
  94. package/public/assets/registry-BWRVKBhU.js +2 -0
  95. package/public/assets/{registry-CXyaPToV.js.map → registry-BWRVKBhU.js.map} +1 -1
  96. package/public/assets/{security-8n8VEsf5.js → security-DcNNqoA4.js} +2 -2
  97. package/public/assets/{security-8n8VEsf5.js.map → security-DcNNqoA4.js.map} +1 -1
  98. package/public/assets/{select-D-wcg_2U.js → select-DkpcyiTY.js} +2 -2
  99. package/public/assets/{select-D-wcg_2U.js.map → select-DkpcyiTY.js.map} +1 -1
  100. package/public/assets/settings-C9-w25pF.js +6 -0
  101. package/public/assets/{settings-BhnCGXgo.js.map → settings-C9-w25pF.js.map} +1 -1
  102. package/public/assets/{store-Du8k5mLJ.js → store-BZ2N51To.js} +5 -5
  103. package/public/assets/store-BZ2N51To.js.map +1 -0
  104. package/public/assets/{tasks-DEKQqgPB.js → tasks-DuH_JQJM.js} +2 -2
  105. package/public/assets/{tasks-DEKQqgPB.js.map → tasks-DuH_JQJM.js.map} +1 -1
  106. package/public/assets/{teams-DoRSWZRQ.js → teams-CQZ6a8A5.js} +2 -2
  107. package/public/assets/{teams-DoRSWZRQ.js.map → teams-CQZ6a8A5.js.map} +1 -1
  108. package/public/assets/{terminal-viewer-impl-C_o3BOpu.js → terminal-viewer-impl-B1A49Vs2.js} +3 -3
  109. package/public/assets/{terminal-viewer-impl-C_o3BOpu.js.map → terminal-viewer-impl-B1A49Vs2.js.map} +1 -1
  110. package/public/assets/types-DSwhOFcJ.js.map +1 -1
  111. package/public/assets/{use-keyboard-viewport-Dw2CHZ50.js → use-keyboard-viewport-DucYmqmP.js} +2 -2
  112. package/public/assets/{use-keyboard-viewport-Dw2CHZ50.js.map → use-keyboard-viewport-DucYmqmP.js.map} +1 -1
  113. package/public/assets/user-avatar-C3eL_il0.js +2 -0
  114. package/public/assets/{user-avatar-BQoM4jPT.js.map → user-avatar-C3eL_il0.js.map} +1 -1
  115. package/public/assets/{work-queue-CWnf1_iE.js → work-queue-IfxOcGe5.js} +2 -2
  116. package/public/assets/{work-queue-CWnf1_iE.js.map → work-queue-IfxOcGe5.js.map} +1 -1
  117. package/public/assets/workspaces-gPEVu-L5.js +3 -0
  118. package/public/assets/workspaces-gPEVu-L5.js.map +1 -0
  119. package/public/index.html +21 -21
  120. package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
  121. package/scripts/orchestrator-spawn-smoke.ts +30 -13
  122. package/src/config-store.ts +15 -3
  123. package/src/db/migrations.ts +2 -2
  124. package/src/db/plans.ts +11 -0
  125. package/src/db/provisioning-registry.ts +39 -15
  126. package/src/db/schema.ts +1 -1
  127. package/src/db/task-entity.ts +2 -0
  128. package/src/mcp/index.ts +1 -1
  129. package/src/mcp-plan-tools.ts +3 -0
  130. package/src/routes/index.ts +2 -1
  131. package/src/routes/plans.ts +12 -2
  132. package/src/routes/tasks.ts +1 -0
  133. package/src/services/plan-graph.ts +8 -1
  134. package/public/assets/MessageBubble-CFujR6_L.js +0 -4
  135. package/public/assets/PlanGraphPanel-BfxvqmNS.js +0 -2
  136. package/public/assets/PlanGraphPanel-BfxvqmNS.js.map +0 -1
  137. package/public/assets/card-B0y1i_2D.js +0 -2
  138. package/public/assets/chat-Bue-qNx_.js +0 -2
  139. package/public/assets/copy-button-aLaiAkv2.js +0 -2
  140. package/public/assets/dist-BnfqT2cl.js +0 -2
  141. package/public/assets/dist-CF28Y5wI.js +0 -2
  142. package/public/assets/dist-cyag2tir.js +0 -2
  143. package/public/assets/formatted-body-impl-CTz6wch8.js +0 -3
  144. package/public/assets/formatted-body-impl-CTz6wch8.js.map +0 -1
  145. package/public/assets/index-BMAblAKQ.js +0 -23
  146. package/public/assets/index-BMAblAKQ.js.map +0 -1
  147. package/public/assets/index-D-Ntiy3M.css +0 -2
  148. package/public/assets/lucide-react-DmbfpRvJ.js +0 -9
  149. package/public/assets/memory-2l6G_m1p.js +0 -2
  150. package/public/assets/messages-DC-QXNwz.js +0 -2
  151. package/public/assets/overview-76JPEbGZ.js +0 -2
  152. package/public/assets/prompt-settings-BRduaHOj.js +0 -2
  153. package/public/assets/registry-CXyaPToV.js +0 -2
  154. package/public/assets/settings-BhnCGXgo.js +0 -6
  155. package/public/assets/store-Du8k5mLJ.js.map +0 -1
  156. package/public/assets/user-avatar-BQoM4jPT.js +0 -2
  157. package/public/assets/workspaces-C_fFCoCu.js +0 -3
  158. package/public/assets/workspaces-C_fFCoCu.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,A as n,K as r,L as ee,Nn as te,V as ne,en as re,fr as i,g as ie,k as ae}from"./lucide-react-DmbfpRvJ.js";import{f as oe,t as a}from"./store-Du8k5mLJ.js";import{K as o,d as se,h as s}from"./display-_5kFrHJh.js";import{t as c}from"./badge-kdQDWO6e.js";import{t as l}from"./button-BKFvNXa3.js";import{t as u}from"./input-DfN6sUbX.js";import{B as ce,l as le,u as ue}from"./index-BMAblAKQ.js";import{o as d,r as f,s as p,t as m}from"./card-B0y1i_2D.js";var h=e(i(),1),g=t(),_=[`organization`,`role`,`project`,`task`,`interaction`,`agent`],v=[`private`,`project`,`org`,`public`],y=[`public`,`normal`,`sensitive`,`secret`],de=[`reported`,`inferred`,`verified`];function b(){return{type:`project`,scope:`default`,title:``,content:``,tags:``,visibility:`project`,sensitivity:`normal`,confidence:`reported`,relevanceScore:`0.7`}}function x(e){return{type:e.type,scope:e.scope,title:e.title,content:e.content,tags:e.tags.join(`, `),visibility:e.visibility,sensitivity:e.sensitivity,confidence:e.confidence,relevanceScore:String(e.relevanceScore)}}function S(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function fe(e){let t={limit:100};e.type&&(t.type=e.type),e.scope.trim()&&(t.scope=e.scope.trim()),e.visibility&&(t.visibility=e.visibility);let n=S(e.tags);if(n.length&&(t.tags=n),e.minRelevance.trim()){let n=Number(e.minRelevance);Number.isFinite(n)&&(t.minRelevance=Math.max(0,Math.min(1,n)))}return t}function C(e){return e===`secret`?`bg-red-500/10 text-red-400 border-red-500/30`:e===`sensitive`?`bg-yellow-500/10 text-yellow-400 border-yellow-500/30`:e===`public`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`}function w(e){return e>=.8?`text-emerald-400`:e>=.5?`text-yellow-400`:`text-zinc-400`}function T(e){return e?Object.entries(e).map(([e,t])=>`${e}=${Array.isArray(t)?t.join(` `):String(t)}`).join(` `):`default`}function pe(e){return e.filter(e=>![`system`,`user`,`channel`].includes(e.kind||``))}function E(){let e=oe(),t=a(e=>e.agents),i=a(e=>e.memories),E=a(e=>e.memoryTotal),O=a(e=>e.memoryStats),k=a(e=>e.memoryBrokerInfo),A=a(e=>e.memoryFilters),j=a(e=>e.selectedMemoryId),he=a(e=>e.memoryLoading),M=a(e=>e.set),N=a(e=>e.fetchMemories),P=a(e=>e.refreshMemory),F=a(e=>e.saveMemory),I=a(e=>e.deleteMemory),L=a(e=>e.injectMemory),R=i.find(e=>e.id===j),[z,B]=(0,h.useState)(`create`),[V,H]=(0,h.useState)(b),[U,W]=(0,h.useState)(``),[G,ge]=(0,h.useState)(`manual`),[K,_e]=(0,h.useState)(`1600`),[q,ve]=(0,h.useState)(`8`),[J,ye]=(0,h.useState)(``),Y=(0,h.useMemo)(()=>pe(t),[t]);(0,h.useEffect)(()=>{!U&&Y[0]&&W(Y[0].id)},[Y,U]),(0,h.useEffect)(()=>{R&&z===`edit`&&H(x(R))},[R?.id,z]);let X=(0,h.useMemo)(()=>{let e=A.search.trim().toLowerCase();return e?i.filter(t=>[t.id,t.type,t.scope,t.title,t.content,...t.tags].some(t=>String(t).toLowerCase().includes(e))):i},[i,A.search]);function Z(e){M({memoryFilters:{...A,...e}})}async function be(){let e=Number(V.relevanceScore),t={title:V.title.trim(),content:V.content.trim(),tags:S(V.tags),visibility:V.visibility,sensitivity:V.sensitivity,confidence:V.confidence,relevanceScore:Number.isFinite(e)?Math.max(0,Math.min(1,e)):.7};if(z===`edit`&&R){await F(t,R.id);return}await F({...t,type:V.type,scope:V.scope.trim()}),B(`create`),H(b())}async function Q(e){if(!U)return;let t=await L({agentId:U,memoryIds:e,query:e?.length?void 0:fe(A),reason:G.trim()||`manual`,budget:{maxTokens:Math.max(200,Number(K)||1600),maxMemories:Math.max(1,Number(q)||8),priorityCutoff:3}});t?.command?.id&&ye(t.command.id)}function xe(){B(`create`),H(b())}function Se(){R&&(B(`edit`),H(x(R)))}let Ce=V.title.trim()&&V.content.trim()&&(z===`edit`||V.scope.trim()),$=T(k?.config);return(0,g.jsxs)(`div`,{className:`space-y-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(te,{className:`w-5 h-5 text-muted-foreground`}),(0,g.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Memory`}),(0,g.jsx)(c,{variant:`secondary`,children:O?.total??E}),k&&(0,g.jsx)(c,{className:k.external?`bg-blue-500/15 text-blue-400 border-blue-500/30`:`bg-emerald-500/15 text-emerald-400 border-emerald-500/30`,children:k.type})]}),(0,g.jsxs)(l,{size:`sm`,variant:`outline`,className:`gap-1.5`,onClick:()=>P(),children:[(0,g.jsx)(ee,{className:`w-3.5 h-3.5 ${he?`animate-spin`:``}`}),`Refresh`]})]}),(0,g.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,g.jsxs)(m,{children:[(0,g.jsx)(d,{className:`py-3 px-4`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,g.jsxs)(p,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,g.jsx)(re,{className:`w-4 h-4 text-muted-foreground`}),`Broker`]}),k?.capabilities&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 justify-end`,children:Object.entries(k.capabilities).filter(([,e])=>!!e).map(([e])=>(0,g.jsx)(c,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:e},e))})]})}),(0,g.jsxs)(f,{className:`px-4 pb-4 space-y-3`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-5 gap-2`,children:[(0,g.jsx)(D,{label:`total`,value:O?.total??E}),(0,g.jsx)(D,{label:`project`,value:O?.byType?.project??0}),(0,g.jsx)(D,{label:`task`,value:O?.byType?.task??0}),(0,g.jsx)(D,{label:`agent`,value:O?.byType?.agent??0}),(0,g.jsx)(D,{label:`sensitive`,value:(O?.bySensitivity?.sensitive??0)+(O?.bySensitivity?.secret??0)})]}),(0,g.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground truncate`,title:$,children:$})]})]}),(0,g.jsxs)(m,{children:[(0,g.jsx)(d,{className:`py-3 px-4`,children:(0,g.jsx)(p,{className:`text-sm font-medium`,children:`Inject`})}),(0,g.jsxs)(f,{className:`px-4 pb-4 space-y-2`,children:[(0,g.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:[(0,g.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:U,onChange:e=>W(e.target.value),children:[(0,g.jsx)(`option`,{value:``,children:`Agent`}),Y.map(e=>(0,g.jsx)(`option`,{value:e.id,children:se(e)},e.id))]}),(0,g.jsx)(u,{value:G,onChange:e=>ge(e.target.value),placeholder:`reason`}),(0,g.jsx)(u,{value:K,onChange:e=>_e(e.target.value),inputMode:`numeric`,placeholder:`tokens`}),(0,g.jsx)(u,{value:q,onChange:e=>ve(e.target.value),inputMode:`numeric`,placeholder:`memories`})]}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.jsxs)(l,{size:`sm`,className:`gap-1.5`,disabled:!U||!R,onClick:()=>R&&Q([R.id]),children:[(0,g.jsx)(ae,{className:`w-3.5 h-3.5`}),`Selected`]}),(0,g.jsxs)(l,{size:`sm`,variant:`outline`,className:`gap-1.5`,disabled:!U,onClick:()=>Q(),children:[(0,g.jsx)(n,{className:`w-3.5 h-3.5`}),`Filtered`]}),J&&(0,g.jsx)(c,{variant:`outline`,className:`font-mono text-[10px]`,children:J})]})]})]})]}),(0,g.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]`,children:[(0,g.jsxs)(`div`,{className:`space-y-3`,children:[(0,g.jsx)(m,{children:(0,g.jsx)(f,{className:`p-3`,children:(0,g.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-6 gap-2`,children:[(0,g.jsx)(u,{className:`lg:col-span-2`,value:A.search,onChange:e=>Z({search:e.target.value}),placeholder:`Search visible memories`}),(0,g.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:A.type,onChange:e=>Z({type:e.target.value}),children:[(0,g.jsx)(`option`,{value:``,children:`All types`}),_.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))]}),(0,g.jsx)(u,{value:A.scope,onChange:e=>Z({scope:e.target.value}),placeholder:`scope`}),(0,g.jsx)(u,{value:A.tags,onChange:e=>Z({tags:e.target.value}),placeholder:`tags`}),(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[(0,g.jsx)(u,{value:A.minRelevance,onChange:e=>Z({minRelevance:e.target.value}),placeholder:`score`}),(0,g.jsx)(l,{size:`sm`,variant:`outline`,className:`h-8 px-2`,onClick:()=>N(),children:(0,g.jsx)(n,{className:`w-4 h-4`})})]})]})})}),(0,g.jsx)(ue,{className:`h-[calc(100dvh-24rem)] min-h-[360px]`,children:(0,g.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[X.length===0&&(0,g.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-16`,children:`No memories`}),X.map(t=>(0,g.jsx)(me,{memory:t,selected:t.id===j,now:e,onSelect:()=>M({selectedMemoryId:t.id})},t.id))]})})]}),(0,g.jsxs)(m,{children:[(0,g.jsx)(d,{className:`py-3 px-4`,children:(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,g.jsx)(p,{className:`text-sm font-medium`,children:z===`edit`?`Edit Memory`:`New Memory`}),(0,g.jsxs)(`div`,{className:`flex gap-1`,children:[(0,g.jsx)(l,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:xe,title:`New memory`,children:(0,g.jsx)(ne,{className:`w-3.5 h-3.5`})}),(0,g.jsx)(l,{size:`sm`,variant:`ghost`,className:`h-7 px-2`,onClick:Se,disabled:!R,title:`Edit selected`,children:(0,g.jsx)(r,{className:`w-3.5 h-3.5`})}),(0,g.jsx)(l,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-red-400 hover:text-red-300`,disabled:!R,onClick:()=>R&&I(R.id),title:`Delete selected`,children:(0,g.jsx)(ie,{className:`w-3.5 h-3.5`})})]})]})}),(0,g.jsxs)(f,{className:`px-4 pb-4 space-y-3`,children:[R&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`space-y-2`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,g.jsx)(c,{variant:`secondary`,children:R.type}),(0,g.jsx)(c,{variant:`outline`,children:R.scope}),(0,g.jsx)(c,{className:C(R.sensitivity),children:R.sensitivity}),(0,g.jsx)(c,{variant:`outline`,className:w(R.relevanceScore),children:R.relevanceScore.toFixed(2)})]}),(0,g.jsxs)(`div`,{className:`text-xs text-muted-foreground`,title:s(R.updatedAt),children:[`updated `,o(e,R.updatedAt)]}),(0,g.jsx)(`p`,{className:`text-sm font-medium`,children:R.title}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap max-h-24 overflow-auto`,children:R.content})]}),(0,g.jsx)(ce,{})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,g.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,disabled:z===`edit`,value:V.type,onChange:e=>H({...V,type:e.target.value}),children:_.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))}),(0,g.jsx)(u,{disabled:z===`edit`,value:V.scope,onChange:e=>H({...V,scope:e.target.value}),placeholder:`scope`}),(0,g.jsx)(u,{className:`col-span-2`,value:V.title,onChange:e=>H({...V,title:e.target.value}),placeholder:`title`}),(0,g.jsx)(le,{className:`col-span-2 min-h-32`,value:V.content,onChange:e=>H({...V,content:e.target.value}),placeholder:`content`}),(0,g.jsx)(u,{className:`col-span-2`,value:V.tags,onChange:e=>H({...V,tags:e.target.value}),placeholder:`tags`}),(0,g.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:V.visibility,onChange:e=>H({...V,visibility:e.target.value}),children:v.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))}),(0,g.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:V.sensitivity,onChange:e=>H({...V,sensitivity:e.target.value}),children:y.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))}),(0,g.jsx)(`select`,{className:`rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:V.confidence,onChange:e=>H({...V,confidence:e.target.value}),children:de.map(e=>(0,g.jsx)(`option`,{value:e,children:e},e))}),(0,g.jsx)(u,{value:V.relevanceScore,onChange:e=>H({...V,relevanceScore:e.target.value}),inputMode:`decimal`,placeholder:`score`})]}),(0,g.jsx)(l,{size:`sm`,className:`w-full`,disabled:!Ce,onClick:be,children:z===`edit`?`Save memory`:`Create memory`})]})]})]})]})}function D({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/20 px-3 py-2`,children:[(0,g.jsx)(`div`,{className:`text-lg font-semibold tabular-nums`,children:t}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function me({memory:e,selected:t,now:n,onSelect:r}){return(0,g.jsx)(`button`,{onClick:r,className:`w-full text-left rounded-md border p-3 transition-colors ${t?`border-primary bg-primary/5`:`border-border bg-card hover:border-zinc-600`}`,children:(0,g.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,g.jsxs)(`div`,{className:`min-w-0`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,g.jsx)(c,{variant:`secondary`,className:`text-[10px]`,children:e.type}),(0,g.jsx)(c,{variant:`outline`,className:`text-[10px] font-mono`,children:e.scope}),(0,g.jsx)(c,{className:`text-[10px] ${C(e.sensitivity)}`,children:e.sensitivity})]}),(0,g.jsx)(`div`,{className:`font-medium text-sm mt-2 truncate`,children:e.title}),(0,g.jsx)(`div`,{className:`text-xs text-muted-foreground line-clamp-2 mt-1`,children:e.content}),e.tags.length>0&&(0,g.jsx)(`div`,{className:`flex gap-1 flex-wrap mt-2`,children:e.tags.slice(0,8).map(e=>(0,g.jsxs)(c,{variant:`outline`,className:`text-[10px] text-zinc-400`,children:[`#`,e]},e))})]}),(0,g.jsxs)(`div`,{className:`text-right shrink-0 space-y-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold tabular-nums ${w(e.relevanceScore)}`,children:e.relevanceScore.toFixed(2)}),(0,g.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,title:s(e.updatedAt),children:o(n,e.updatedAt)}),e.accessCount>0&&(0,g.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[e.accessCount,` hits`]})]})]})})}export{E as MemoryView};
2
- //# sourceMappingURL=memory-2l6G_m1p.js.map
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,Dt as n,G as r,P as i,Vn as a,_n as o,a as s,fr as c,g as l,h as u,rt as d,st as f}from"./lucide-react-DmbfpRvJ.js";import{f as p,t as m}from"./store-Du8k5mLJ.js";import{K as h,d as g,f as _,h as v,k as y}from"./display-_5kFrHJh.js";import{t as b}from"./badge-kdQDWO6e.js";import{t as x}from"./button-BKFvNXa3.js";import{K as S,Z as C,t as w}from"./index-BMAblAKQ.js";import{r as T,t as E}from"./card-B0y1i_2D.js";var D=e(c(),1),O=t();function k(e,t){if(t.startsWith(`/`))return t;let n=`${e.replace(/\/+$/,``)}/${t}`.split(`/`),r=[];for(let e of n)!e||e===`.`||(e===`..`?r.pop():r.push(e));return`/`+r.join(`/`)}function A(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>0?t.slice(0,n):`/`}function j(){let e=p(),t=m(e=>e.messages),n=m(e=>e.agentsById),i=m(e=>e.selectedAgent),a=m(e=>e.channelFilter),o=m(e=>e.tagFilter),c=m(e=>e.replyTo),l=m(e=>e.set),u=m(e=>e.openCompose),h=m(e=>e.startReply),_=m(e=>e.doClaim),v=m(e=>e.doDeliveryAction),y=m(e=>e.doDeleteMessage),w=m(e=>e.openThread),T=m(e=>e.cancelReply),E=S(),k=C(),A=(0,D.useMemo)(()=>{let e=[...t].sort((e,t)=>t.id-e.id);return i&&(e=e.filter(e=>e.from===i||e.to===i)),a&&(e=e.filter(e=>e.channel===a)),o&&(e=e.filter(e=>((n[e.from]||n[e.to])?.tags||[]).includes(o))),e},[t,i,a,o,n]),j=(0,D.useMemo)(()=>{let e=[],t=new Map;for(let n of A){let r=n.threadId??n.id;t.has(r)||t.set(r,[]),t.get(r).push(n),n.id===r&&e.push(n)}let n=new Set(e.map(e=>e.id));for(let t of A)!n.has(t.threadId??t.id)&&!e.find(e=>e.id===t.id)&&e.push(t);return e.sort((e,t)=>t.id-e.id),e.map(e=>({root:e,replies:(t.get(e.id)||[]).filter(t=>t.id!==e.id).sort((e,t)=>e.id-t.id)}))},[A]);function N(e){return n[e]?g(n[e]):e.slice(-10)}let P=(0,D.useMemo)(()=>[...new Set(t.map(e=>e.channel).filter(Boolean))],[t]);return(0,O.jsxs)(`div`,{className:`space-y-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between flex-wrap gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(f,{className:`w-5 h-5 text-muted-foreground`}),(0,O.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Messages`}),(0,O.jsx)(b,{variant:`secondary`,children:A.length})]}),(0,O.jsxs)(x,{size:`sm`,onClick:u,children:[(0,O.jsx)(r,{className:`w-4 h-4 mr-1`}),` Compose`]})]}),(0,O.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,O.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:i,onChange:e=>l({selectedAgent:e.target.value}),children:[(0,O.jsx)(`option`,{value:``,children:`All agents`}),E.map(e=>(0,O.jsx)(`option`,{value:e.id,children:g(e)},e.id))]}),(0,O.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:o,onChange:e=>l({tagFilter:e.target.value}),children:[(0,O.jsx)(`option`,{value:``,children:`All tags`}),k.map(e=>(0,O.jsxs)(`option`,{value:e,children:[`#`,e]},e))]}),(0,O.jsxs)(`select`,{className:`rounded-md border border-input bg-background px-3 py-1.5 text-sm`,value:a,onChange:e=>l({channelFilter:e.target.value}),children:[(0,O.jsx)(`option`,{value:``,children:`All channels`}),P.map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))]})]}),c&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-blue-500/10 border border-blue-500/20 px-3 py-2 text-sm text-blue-300`,children:[(0,O.jsx)(d,{className:`w-4 h-4 shrink-0`}),(0,O.jsxs)(`span`,{children:[`Replying to message #`,c.id,` from `,(0,O.jsx)(`strong`,{children:N(c.from)})]}),(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`ml-auto h-6 px-1.5`,onClick:T,children:(0,O.jsx)(s,{className:`w-3.5 h-3.5`})})]}),(0,O.jsx)(`div`,{className:`h-[calc(100dvh-15rem)] overflow-y-auto`,children:(0,O.jsxs)(`div`,{className:`space-y-2 pr-2`,children:[j.length===0&&(0,O.jsx)(`div`,{className:`text-center text-muted-foreground py-16 text-sm`,children:`No messages`}),j.map(({root:t,replies:r})=>(0,O.jsxs)(`div`,{className:`space-y-1`,children:[(0,O.jsx)(M,{msg:t,now:e,agentLabel:N,agentsById:n,onReply:()=>h(t),onClaim:()=>_(t.id),onRetry:()=>v(t.id,`retry-now`),onMarkDead:()=>v(t.id,`mark-dead`,`Marked dead from dashboard`),onClear:()=>v(t.id,`clear`,`Cleared after manual handling`),onDelete:()=>y(t.id),onThread:t.threadId?()=>w(t.threadId):void 0,replyCount:r.length}),r.map(t=>(0,O.jsx)(`div`,{className:`ml-6`,children:(0,O.jsx)(M,{msg:t,now:e,agentLabel:N,agentsById:n,onReply:()=>h(t),onClaim:()=>_(t.id),onRetry:()=>v(t.id,`retry-now`),onMarkDead:()=>v(t.id,`mark-dead`,`Marked dead from dashboard`),onClear:()=>v(t.id,`clear`,`Cleared after manual handling`),onDelete:()=>y(t.id)})},t.id))]},t.id))]})})]})}function M({msg:e,now:t,agentLabel:r,agentsById:s,onReply:c,onClaim:u,onRetry:f,onMarkDead:p,onClear:g,onDelete:S,onThread:C,replyCount:j}){let[M,P]=(0,D.useState)(!1),F=y(e),I=m(e=>e.openFilesAt);m(e=>e.openTaskDetailById);let L=e.deliveryStatus===`queued`||e.deliveryStatus===`failed`||e.deliveryStatus===`dead`||!!(e.deliveryLastError||e.deliveryPoisonReason),R=s[e.from===`user`?e.to:e.from];function z(e){return k((typeof R?.meta?.cwd==`string`?R.meta.cwd:``)||`/`,e)}function B(e,t){let n=z(e);I({path:A(n),selectedPath:n,line:t,overlay:!0})}return(0,O.jsx)(E,{className:`group relative`,children:(0,O.jsxs)(T,{className:`p-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap text-xs text-muted-foreground mb-1`,children:[(0,O.jsx)(`span`,{className:`font-medium text-foreground`,children:r(e.from)}),(0,O.jsx)(`span`,{children:`→`}),(0,O.jsx)(`span`,{children:_(e.to,s)}),e.channel&&(0,O.jsxs)(b,{variant:`outline`,className:`text-xs px-1.5 py-0 gap-0.5`,children:[(0,O.jsx)(n,{className:`w-2.5 h-2.5`}),e.channel]}),e.claimedBy&&(0,O.jsxs)(b,{variant:`outline`,className:`text-xs px-1.5 py-0 text-emerald-400 border-emerald-500/30`,children:[(0,O.jsx)(o,{className:`w-2.5 h-2.5 mr-0.5`}),`claimed`]}),L&&(0,O.jsx)(N,{msg:e,now:t}),e.subject&&(0,O.jsx)(`span`,{className:`font-medium text-foreground`,children:e.subject}),(0,O.jsxs)(`span`,{className:`ml-auto shrink-0`,title:v(e.createdAt),children:[(0,O.jsxs)(`span`,{className:`opacity-40 mr-1`,children:[`#`,e.id]}),h(t,e.createdAt)]})]}),F&&(0,O.jsx)(`div`,{className:`cursor-pointer`,onClick:()=>P(e=>!e),children:(0,O.jsx)(w,{text:F,rawBody:e.body,issueRepo:R?.issueRepo,className:`text-sm text-muted-foreground ${M?``:`max-h-[3.75rem] overflow-hidden`}`,onOpenPath:B,resolvePathTitle:(e,t)=>`${z(e)}${t?`:${t}`:``}`})})]}),(0,O.jsxs)(`div`,{className:`absolute top-2 right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity bg-card rounded-md shadow-sm border border-border px-1 py-0.5`,children:[(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:c,title:`Reply`,children:(0,O.jsx)(d,{className:`w-3.5 h-3.5`})}),e.claimable&&!e.claimedBy&&(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-orange-400 hover:text-orange-300`,onClick:u,title:`Claim`,children:(0,O.jsx)(o,{className:`w-3.5 h-3.5`})}),L&&(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-blue-400 hover:text-blue-300`,onClick:f,title:`Retry delivery now`,children:(0,O.jsx)(i,{className:`w-3.5 h-3.5`})}),e.deliveryStatus!==`dead`&&L&&(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-red-400 hover:text-red-300`,onClick:p,title:`Mark dead`,children:(0,O.jsx)(a,{className:`w-3.5 h-3.5`})}),(e.deliveryStatus===`failed`||e.deliveryStatus===`dead`)&&(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300`,onClick:g,title:`Clear after manual handling`,children:(0,O.jsx)(o,{className:`w-3.5 h-3.5`})}),C&&(j??0)>0&&(0,O.jsxs)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:C,title:`Thread`,children:[`+`,j]}),(0,O.jsx)(x,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-red-400 hover:text-red-300`,onClick:S,title:`Delete`,children:(0,O.jsx)(l,{className:`w-3.5 h-3.5`})})]})]})})}function N({msg:e,now:t}){let n=e.deliveryStatus||`pending`,r=e.deliveryPoisonReason||e.deliveryLastError||(e.deliveryNextRetryAt?`retry ${h(t,e.deliveryNextRetryAt)}`:void 0);return(0,O.jsxs)(b,{variant:`outline`,className:`text-xs px-1.5 py-0 ${n===`dead`?`text-red-300 border-red-500/30 bg-red-500/10`:n===`failed`?`text-amber-300 border-amber-500/30 bg-amber-500/10`:`text-blue-300 border-blue-500/30 bg-blue-500/10`}`,title:r||n,children:[(0,O.jsx)(u,{className:`w-2.5 h-2.5 mr-0.5`}),n,e.deliveryAttempts?` ${e.deliveryAttempts}x`:``]})}export{j as MessagesView};
2
- //# sourceMappingURL=messages-DC-QXNwz.js.map
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,In as n,Xn as r,fr as i,h as a,ht as o,mt as s,nt as c,st as l,u,wt as d}from"./lucide-react-DmbfpRvJ.js";import{f,t as p}from"./store-Du8k5mLJ.js";import{K as m,M as h,X as g,d as _,f as v,g as y,lt as b,q as x}from"./display-_5kFrHJh.js";import{t as S}from"./badge-kdQDWO6e.js";import{A as C,B as w,G as T,W as E,k as D,q as O,u as k}from"./index-BMAblAKQ.js";import{o as A,r as j,s as M,t as N}from"./card-B0y1i_2D.js";var P=e(i(),1),F=t();function I(){let e=p(e=>e.stats),t=p(e=>e.agents),i=p(e=>e.messages),I=p(e=>e.health),L=f(),R=p(e=>e.agentsById),z=p(e=>e.switchView),B=p(e=>e.runHealthAction),V=p(e=>e.managedPolicies),H=p(e=>e.showOffline),U=O(),W=T(),G=E(),K=(0,P.useMemo)(()=>{let e=g(t,!1,V);return H||(e=e.filter(e=>e.status!==`offline`)),[...e].sort((e,t)=>(b[e.status]??9)-(b[t.status]??9)||x(t.lastSeen)-x(e.lastSeen))},[t,H,V]),q=K.slice(0,20),J=[...i].sort((e,t)=>t.id-e.id).slice(0,15),Y=I&&I.status!==`ok`?y(I.checks||[]):[];function X(e){z(e)}return(0,F.jsxs)(`div`,{className:`space-y-6`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,F.jsxs)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors`,onClick:()=>X(`agents`),children:[(0,F.jsx)(A,{className:`pb-1 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,F.jsx)(u,{className:`w-3.5 h-3.5`}),`Agents`]})}),(0,F.jsxs)(j,{className:`px-4 pb-4`,children:[(0,F.jsx)(`div`,{className:`text-2xl font-bold`,children:K.length}),(0,F.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[U,` online`]})]})]}),(0,F.jsxs)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors`,onClick:()=>X(`agents`),children:[(0,F.jsx)(A,{className:`pb-1 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,F.jsx)(r,{className:`w-3.5 h-3.5`}),`Busy`]})}),(0,F.jsxs)(j,{className:`px-4 pb-4`,children:[(0,F.jsx)(`div`,{className:`text-2xl font-bold`,children:W}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`in a turn now`})]})]}),(0,F.jsxs)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors`,onClick:()=>X(`messages`),children:[(0,F.jsx)(A,{className:`pb-1 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,F.jsx)(c,{className:`w-3.5 h-3.5`}),`Messages 24h`]})}),(0,F.jsxs)(j,{className:`px-4 pb-4`,children:[(0,F.jsx)(`div`,{className:`text-2xl font-bold`,children:e.messagesLast24h??`—`}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`last 24 hours`})]})]}),(0,F.jsxs)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors`,onClick:()=>X(`messages`),children:[(0,F.jsx)(A,{className:`pb-1 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-xs font-medium text-muted-foreground flex items-center gap-1.5`,children:[(0,F.jsx)(l,{className:`w-3.5 h-3.5`}),`Total Messages`]})}),(0,F.jsxs)(j,{className:`px-4 pb-4`,children:[(0,F.jsx)(`div`,{className:`text-2xl font-bold`,children:e.messages??`—`}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:`all time`})]})]})]}),Y.length>0&&(0,F.jsxs)(N,{className:`border-yellow-500/40 bg-yellow-500/5`,children:[(0,F.jsx)(A,{className:`pb-2 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-sm font-medium text-yellow-400 flex items-center gap-2`,children:[(0,F.jsx)(a,{className:`w-4 h-4`}),`Health Alerts (`,Y.length,`)`]})}),(0,F.jsx)(j,{className:`px-4 pb-4 space-y-2`,children:Y.map(e=>(0,F.jsxs)(`div`,{className:`text-sm space-y-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(S,{variant:`outline`,className:e.status===`error`?`border-red-500/40 text-red-400`:`border-yellow-500/40 text-yellow-400`,children:e.status}),(0,F.jsx)(`span`,{className:`font-medium`,children:e.name})]}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.detail}),e.subjects.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.subjects.map(e=>(0,F.jsxs)(S,{variant:`secondary`,className:`max-w-full truncate text-[11px]`,title:[e.id,e.status,e.detail].filter(Boolean).join(` · `),children:[e.label||e.id,e.status?` · ${e.status}`:``,e.detail?` · ${e.detail}`:``]},e.id))}),e.actions.length>0&&(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-0.5`,children:e.actions.slice(0,3).map(e=>(0,F.jsx)(`button`,{onClick:()=>B(e),className:`text-xs text-blue-400 hover:text-blue-300 underline underline-offset-2`,children:e.label},e.label))})]},e.name))})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,F.jsx)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors ${G.unreadInbox>0?`border-red-500/40`:``}`,onClick:()=>X(`chat`),children:(0,F.jsxs)(j,{className:`p-4 flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`p-2 rounded-lg ${G.unreadInbox>0?`bg-red-500/15`:`bg-zinc-800`}`,children:(0,F.jsx)(d,{className:`w-4 h-4 ${G.unreadInbox>0?`text-red-400`:`text-zinc-400`}`})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-lg font-bold`,children:G.unreadInbox}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Unread`})]})]})}),(0,F.jsx)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors ${G.pendingPairInvites>0?`border-yellow-500/40`:``}`,onClick:()=>X(`pairs`),children:(0,F.jsxs)(j,{className:`p-4 flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`p-2 rounded-lg ${G.pendingPairInvites>0?`bg-yellow-500/15`:`bg-zinc-800`}`,children:(0,F.jsx)(o,{className:`w-4 h-4 ${G.pendingPairInvites>0?`text-yellow-400`:`text-zinc-400`}`})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-lg font-bold`,children:G.pendingPairInvites}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Pair invites`})]})]})}),(0,F.jsx)(N,{className:`cursor-pointer hover:border-zinc-600 transition-colors ${G.claimableTasks>0?`border-orange-500/40`:``}`,onClick:()=>X(`work`),children:(0,F.jsxs)(j,{className:`p-4 flex items-center gap-3`,children:[(0,F.jsx)(`div`,{className:`p-2 rounded-lg ${G.claimableTasks>0?`bg-orange-500/15`:`bg-zinc-800`}`,children:(0,F.jsx)(s,{className:`w-4 h-4 ${G.claimableTasks>0?`text-orange-400`:`text-zinc-400`}`})}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-lg font-bold`,children:G.claimableTasks}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Claimable waiting`})]})]})})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,F.jsxs)(N,{children:[(0,F.jsx)(A,{className:`pb-2 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,F.jsx)(n,{className:`w-4 h-4 text-muted-foreground`}),`Agents`,(0,F.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-normal`,children:q.length})]})}),(0,F.jsx)(j,{className:`px-0 pb-0`,children:(0,F.jsx)(k,{className:`h-[340px]`,children:q.length===0?(0,F.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground`,children:`No agents registered.`}):(0,F.jsx)(`div`,{className:`space-y-0`,children:q.map((e,t)=>(0,F.jsxs)(`div`,{children:[t>0&&(0,F.jsx)(w,{}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5 px-4 py-2.5 hover:bg-zinc-800/50 transition-colors cursor-pointer`,onClick:()=>p.getState().openAgentDetail(e),children:[(0,F.jsx)(C,{agent:e,now:L}),(0,F.jsx)(D,{agent:e}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium truncate`,children:_(e)}),e.tags.length>0&&(0,F.jsx)(`div`,{className:`flex gap-1 mt-0.5 flex-wrap`,children:e.tags.slice(0,2).map(e=>(0,F.jsx)(S,{variant:`outline`,className:`text-[9px] px-1 py-0 h-4`,children:e},e))})]}),(0,F.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:m(L,e.lastSeen)})]})]},e.id))})})})]}),(0,F.jsxs)(N,{children:[(0,F.jsx)(A,{className:`pb-2 pt-4 px-4`,children:(0,F.jsxs)(M,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,F.jsx)(r,{className:`w-4 h-4 text-muted-foreground`}),`Recent Activity`,(0,F.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground font-normal`,children:J.length})]})}),(0,F.jsx)(j,{className:`px-0 pb-0`,children:(0,F.jsx)(k,{className:`h-[340px]`,children:J.length===0?(0,F.jsx)(`div`,{className:`px-4 pb-4 text-sm text-muted-foreground`,children:`No recent messages.`}):(0,F.jsx)(`div`,{className:`space-y-0`,children:J.map((e,t)=>(0,F.jsxs)(`div`,{children:[t>0&&(0,F.jsx)(w,{}),(0,F.jsxs)(`div`,{className:`px-4 py-2.5 hover:bg-zinc-800/50 transition-colors`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground mb-0.5`,children:[(0,F.jsx)(`span`,{className:`text-foreground font-medium truncate max-w-[100px]`,children:v(e.from,R)}),(0,F.jsx)(`span`,{children:`→`}),(0,F.jsx)(`span`,{className:`truncate max-w-[100px]`,children:v(e.to,R)}),(0,F.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,F.jsxs)(`span`,{className:`opacity-40 mr-1`,children:[`#`,e.id]}),m(L,e.createdAt)]})]}),(0,F.jsx)(`div`,{className:`text-xs text-foreground line-clamp-2 leading-snug`,children:h(e)})]})]},e.id))})})})]})]})]})}export{I as OverviewView};
2
- //# sourceMappingURL=overview-76JPEbGZ.js.map
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,Ht as n,L as r,P as i,Pn as a,Zn as o,er as s,fr as c,j as ee,yn as l}from"./lucide-react-DmbfpRvJ.js";import{u}from"./types-DSwhOFcJ.js";import{K as d}from"./display-_5kFrHJh.js";import{t as f}from"./badge-kdQDWO6e.js";import{t as p}from"./button-BKFvNXa3.js";import{l as m}from"./index-BMAblAKQ.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./card-B0y1i_2D.js";var x=e(c(),1),S=t(),C=`all`;function w(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function T(e){return Array.isArray(e)?[...e].sort((e,t)=>{let n=e.category.localeCompare(t.category);if(n!==0)return n;let r=e.title.localeCompare(t.title);return r===0?e.slug.localeCompare(t.slug):r}):[]}function E(){let[e,t]=(0,x.useState)([]),[c,E]=(0,x.useState)(!0),[D,O]=(0,x.useState)(``),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(C),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)({}),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(()=>Date.now());async function U(){E(!0),O(``);try{t(T((await s(`GET`,`/settings/prompts`)).templates)),H(Date.now())}catch(e){O(u(e))}finally{E(!1)}}(0,x.useEffect)(()=>{U()},[]);let W=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.category,(t.get(n.category)??0)+1);return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,count:t,label:w(e)}))},[e]),G=N===C||W.some(e=>e.key===N)?N:C,K=(0,x.useMemo)(()=>G===C?e:e.filter(e=>e.category===G),[G,e]),q=K.some(e=>e.slug===F)?F:K[0]?.slug??``,J=K.find(e=>e.slug===q)??null,Y=J?L[J.slug]??J.template:``,X=J?Y!==J.template:!1,Z=e.filter(e=>e.template!==e.defaultTemplate).length,Q=J?z===J.slug:!1;function te(e){I(e),A(``),M(``)}function $(e){t(t=>T(t.map(t=>t.slug===e.slug?e:t))),R(t=>({...t,[e.slug]:e.template})),H(Date.now())}async function ne(){if(!(!J||!X)){B(J.slug),A(``),M(``);try{let e=await s(`PUT`,`/settings/prompts/${encodeURIComponent(J.slug)}`,{template:Y});$(e),M(`Saved ${e.title}.`)}catch(e){A(u(e))}finally{B(``)}}}async function re(){if(!(!J||J.template===J.defaultTemplate)){B(J.slug),A(``),M(``);try{let e=await s(`POST`,`/settings/prompts/${encodeURIComponent(J.slug)}/reset`);$(e),M(`Reset ${e.title} to the built-in default.`)}catch(e){A(u(e))}finally{B(``)}}}function ie(){J&&(R(e=>({...e,[J.slug]:J.template})),A(``),M(`Unsaved edits discarded.`))}return(0,S.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Prompts`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(f,{variant:`outline`,className:`gap-1`,children:[(0,S.jsx)(n,{className:`size-3`}),e.length,` template`,e.length===1?``:`s`]}),(0,S.jsxs)(f,{variant:`outline`,className:o(`gap-1`,Z>0&&`border-amber-500/40 bg-amber-500/10 text-amber-300`),children:[Z,` modified`]}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void U(),disabled:c,children:[(0,S.jsx)(r,{className:o(`size-4`,c&&`animate-spin`)}),`Refresh`]})]})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,S.jsx)(l,{className:`mt-0.5 size-4`}),(0,S.jsx)(`span`,{children:D})]}),c&&e.length===0?(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Loading prompt templates…`})}):e.length===0?(0,S.jsx)(b,{children:(0,S.jsx)(v,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No prompt templates are available yet.`})}):(0,S.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]`,children:[(0,S.jsxs)(`nav`,{className:`space-y-1 xl:sticky xl:top-4 xl:self-start`,children:[(0,S.jsxs)(`button`,{type:`button`,className:o(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===C?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(C),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:`All`}),(0,S.jsx)(f,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.length})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:`Every externalized prompt template`})]}),W.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:o(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===e.key?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(e.key),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,S.jsx)(f,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.count})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs font-mono text-muted-foreground`,children:e.key})]},e.key))]}),(0,S.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold`,children:G===C?`All templates`:`${w(G)} templates`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[K.length,` template`,K.length===1?``:`s`,` in this view`]})]})}),K.map(e=>{let t=e.slug===q,n=e.template!==e.defaultTemplate;return(0,S.jsx)(`button`,{type:`button`,className:o(`w-full rounded-xl border p-4 text-left transition-colors`,t?`border-primary/50 bg-primary/10 ring-1 ring-primary/20`:`border-border bg-card hover:border-primary/30 hover:bg-accent`),onClick:()=>te(e.slug),children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),n&&(0,S.jsx)(f,{className:`bg-amber-500/15 text-amber-300 hover:bg-amber-500/15`,children:`Modified`}),(0,S.jsx)(f,{variant:`outline`,className:`text-[10px]`,children:w(e.category)})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:e.slug}),e.description&&(0,S.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:e.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[e.variables.length,` variable`,e.variables.length===1?``:`s`]}),(0,S.jsxs)(`span`,{children:[`Updated `,d(V,e.updatedAt)]})]})]})})},e.slug)})]}),(0,S.jsx)(`div`,{className:`min-w-0`,children:J?(0,S.jsxs)(b,{children:[(0,S.jsxs)(_,{className:`border-b border-border`,children:[(0,S.jsxs)(y,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{children:J.title}),J.template!==J.defaultTemplate&&(0,S.jsx)(f,{className:`bg-amber-500/15 text-amber-300 hover:bg-amber-500/15`,children:`Customized`}),X&&(0,S.jsx)(f,{variant:`outline`,children:`Unsaved`})]}),(0,S.jsxs)(g,{className:`space-y-1`,children:[(0,S.jsx)(`div`,{className:`font-mono text-[11px]`,children:J.slug}),J.description&&(0,S.jsx)(`div`,{children:J.description})]})]}),(0,S.jsxs)(v,{className:`space-y-4 pt-4`,children:[k&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,S.jsx)(l,{className:`mt-0.5 size-3.5`}),(0,S.jsx)(`span`,{children:k})]}),j&&(0,S.jsx)(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-300`,children:j}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,S.jsx)(a,{className:`size-3.5`}),`Available variables`]}),J.variables.length>0?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.variables.map(e=>(0,S.jsx)(f,{variant:`secondary`,className:`font-mono text-[11px]`,children:`{{${e}}}`},e))}):(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This template has no placeholder variables.`})]}),J.template!==J.defaultTemplate&&(0,S.jsx)(`div`,{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:`This template differs from the built-in default. Reset will restore the original text.`}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(`label`,{htmlFor:`prompt-template-editor`,className:`text-xs font-medium text-muted-foreground`,children:`Template text`}),(0,S.jsx)(m,{id:`prompt-template-editor`,value:Y,onChange:e=>{let t=e.target.value;R(e=>({...e,[J.slug]:t})),k&&A(``),j&&M(``)},rows:18,spellCheck:!1,className:`min-h-[360px] resize-y font-mono text-xs leading-5`})]})]}),(0,S.jsxs)(h,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:X?`Editing local changes.`:`Updated ${d(V,J.updatedAt)}.`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[J.template!==J.defaultTemplate&&(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void re(),disabled:Q,children:[(0,S.jsx)(i,{className:`size-4`}),`Reset to default`]}),(0,S.jsx)(p,{variant:`outline`,size:`sm`,onClick:ie,disabled:!X||Q,children:`Cancel`}),(0,S.jsxs)(p,{size:`sm`,onClick:()=>void ne(),disabled:!X||Q,children:[(0,S.jsx)(ee,{className:`size-4`}),`Save`]})]})]})]}):(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Select a prompt template to edit it.`})})})]})]})}export{E as PromptSettingsView};
2
- //# sourceMappingURL=prompt-settings-BRduaHOj.js.map
@@ -1,2 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,$t as n,L as r,U as i,V as a,X as o,er as s,fr as c,gn as l,sn as u,yn as d}from"./lucide-react-DmbfpRvJ.js";import{m as f,p,u as m}from"./types-DSwhOFcJ.js";import{t as h}from"./badge-kdQDWO6e.js";import{t as g}from"./button-BKFvNXa3.js";import{t as _}from"./input-DfN6sUbX.js";import{V as v,c as y}from"./index-BMAblAKQ.js";import{o as b,r as x,s as S,t as C}from"./card-B0y1i_2D.js";var w=e(c(),1),T=t(),E=[{value:`all`,label:`All`},{value:`skill`,label:`Skills`},{value:`plugin`,label:`Plugins`},{value:`mcp`,label:`MCP`}],D=[`any`,...p()];function O(e){return e===`skill`?`bg-blue-500/10 text-blue-400 border-blue-500/30`:e===`plugin`?`bg-violet-500/10 text-violet-400 border-violet-500/30`:`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`}function k(e){return e===`any`?`bg-zinc-500/10 text-zinc-400 border-zinc-500/30`:f(e)}function A(e){return e===`approved`?`bg-emerald-500/10 text-emerald-400 border-emerald-500/30`:e===`rejected`?`bg-red-500/10 text-red-400 border-red-500/30`:`bg-yellow-500/10 text-yellow-400 border-yellow-500/30`}function j({status:e}){return e===`valid`?(0,T.jsx)(l,{className:`h-3.5 w-3.5 text-emerald-400`}):e===`invalid`?(0,T.jsx)(d,{className:`h-3.5 w-3.5 text-red-400`}):(0,T.jsx)(u,{className:`h-3.5 w-3.5 text-zinc-400`})}var M={kind:`skill`,slug:``,title:``},N={githubUrl:``,ref:`main`,subpath:``,provider:`any`,versionConstraint:``},P={command:``,args:``,url:``,approvalStatus:`pending`,versionConstraint:``};function F({variant:e,onToggle:t,onUpdate:r,onValidate:a,busy:o}){let s=o===e.id;return(0,T.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(h,{variant:`outline`,className:`text-[10px] ${k(e.provider)}`,children:e.provider}),(0,T.jsx)(`span`,{className:`text-xs font-medium font-mono`,children:e.name}),e.approvalStatus&&(0,T.jsx)(h,{variant:`outline`,className:`text-[10px] ${A(e.approvalStatus)}`,children:e.approvalStatus}),(0,T.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-1 ml-auto`,children:[(0,T.jsx)(j,{status:e.validationStatus}),e.validationStatus??`unvalidated`]}),(0,T.jsx)(v,{size:`sm`,checked:e.enabled,disabled:s,onCheckedChange:n=>t(e.id,n)})]}),(e.sourceUrl||e.sourceRef)&&(0,T.jsxs)(`div`,{className:`text-[10px] text-muted-foreground font-mono truncate`,title:e.sourceUrl,children:[e.sourceUrl,e.sourceRef?`@${e.resolvedRef??e.sourceRef}`:``,e.sourceSubpath?` · ${e.sourceSubpath}`:``]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(g,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,disabled:s||!e.sourceRef,onClick:()=>r(e.id),title:`Pull latest from source ref`,children:[(0,T.jsx)(n,{className:`h-3 w-3 mr-1`}),`Update ref`]}),(0,T.jsxs)(g,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,disabled:s,onClick:()=>a(e.id),children:[(0,T.jsx)(i,{className:`h-3 w-3 mr-1`}),`Validate`]})]})]})}function I({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,T.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:`New Capability`}),a&&(0,T.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Kind`}),(0,T.jsxs)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.kind,onChange:e=>t({kind:e.target.value}),children:[(0,T.jsx)(`option`,{value:`skill`,children:`Skill`}),(0,T.jsx)(`option`,{value:`plugin`,children:`Plugin`}),(0,T.jsx)(`option`,{value:`mcp`,children:`MCP Server`})]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Slug`}),(0,T.jsx)(_,{value:e.slug,onChange:e=>t({slug:e.target.value}),placeholder:`my-capability`,className:`mt-1 text-sm font-mono`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Title (optional)`}),(0,T.jsx)(_,{value:e.title,onChange:e=>t({title:e.target.value}),placeholder:`My Capability`,className:`mt-1 text-sm`})]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(g,{size:`sm`,onClick:n,disabled:i||!e.slug.trim(),children:i?`Creating…`:`Create`}),(0,T.jsx)(g,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function L({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,T.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:`Import from GitHub`}),a&&(0,T.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`GitHub URL`}),(0,T.jsx)(_,{value:e.githubUrl,onChange:e=>t({githubUrl:e.target.value}),placeholder:`https://github.com/owner/repo`,className:`mt-1 text-sm font-mono`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Ref`}),(0,T.jsx)(_,{value:e.ref,onChange:e=>t({ref:e.target.value}),placeholder:`main`,className:`mt-1 text-sm font-mono`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Subpath (optional)`}),(0,T.jsx)(_,{value:e.subpath,onChange:e=>t({subpath:e.target.value}),placeholder:`skills/my-skill`,className:`mt-1 text-sm font-mono`})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Provider`}),(0,T.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.provider,onChange:e=>t({provider:e.target.value}),children:D.map(e=>(0,T.jsx)(`option`,{value:e,children:e},e))})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Version constraint (optional)`}),(0,T.jsx)(_,{value:e.versionConstraint,onChange:e=>t({versionConstraint:e.target.value}),placeholder:`>=1.0.0`,className:`mt-1 text-sm font-mono`})]})]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(g,{size:`sm`,onClick:n,disabled:i||!e.githubUrl.trim()||!e.ref.trim(),children:i?`Importing…`:`Import`}),(0,T.jsx)(g,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function R({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,T.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,T.jsx)(`div`,{className:`text-sm font-medium`,children:`Add MCP Server Variant`}),a&&(0,T.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Command (for stdio type)`}),(0,T.jsx)(_,{value:e.command,onChange:e=>t({command:e.target.value}),placeholder:`npx -y @modelcontextprotocol/server-foo`,className:`mt-1 text-sm font-mono`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Args (space-separated, overrides command split)`}),(0,T.jsx)(_,{value:e.args,onChange:e=>t({args:e.target.value}),placeholder:`--port 3000`,className:`mt-1 text-sm font-mono`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`URL (for http/sse type)`}),(0,T.jsx)(_,{value:e.url,onChange:e=>t({url:e.target.value}),placeholder:`http://localhost:3000/mcp`,className:`mt-1 text-sm font-mono`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Approval status`}),(0,T.jsxs)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.approvalStatus,onChange:e=>t({approvalStatus:e.target.value}),children:[(0,T.jsx)(`option`,{value:`pending`,children:`Pending`}),(0,T.jsx)(`option`,{value:`approved`,children:`Approved`})]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(y,{className:`text-xs`,children:`Version constraint (optional)`}),(0,T.jsx)(_,{value:e.versionConstraint,onChange:e=>t({versionConstraint:e.target.value}),placeholder:`>=1.0.0`,className:`mt-1 text-sm font-mono`})]})]}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsx)(g,{size:`sm`,onClick:n,disabled:i||!e.command.trim()&&!e.url.trim(),children:i?`Adding…`:`Add MCP Variant`}),(0,T.jsx)(g,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function z(){let[e,t]=(0,w.useState)([]),[n,i]=(0,w.useState)(`all`),[c,l]=(0,w.useState)(``),[u,d]=(0,w.useState)(!0),[f,p]=(0,w.useState)(null),[_,v]=(0,w.useState)(`none`),[y,D]=(0,w.useState)(!1),[k,A]=(0,w.useState)(null),[j,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(M),[H,U]=(0,w.useState)(N),[W,G]=(0,w.useState)(P);async function K(){p(null);try{let e=await s(`GET`,`/provisioning/capabilities${n===`all`?``:`?kind=${n}`}`);t(e.capabilities),!c&&e.capabilities.length>0&&l(e.capabilities[0].capability.id)}catch(e){p(m(e))}finally{d(!1)}}(0,w.useEffect)(()=>{d(!0),K()},[n]);let q=e.find(e=>e.capability.id===c)??null;function J(e){v(e),A(null),D(!1),V(M),U(N),G(P)}async function Y(){D(!0),A(null);try{await s(`POST`,`/provisioning/capabilities`,{kind:B.kind,slug:B.slug.trim(),title:B.title.trim()||void 0}),v(`none`),await K()}catch(e){A(m(e))}finally{D(!1)}}async function X(){if(q){D(!0),A(null);try{await s(`POST`,`/provisioning/capabilities/${encodeURIComponent(q.capability.id)}/variants/import`,{githubUrl:H.githubUrl.trim(),ref:H.ref.trim(),subpath:H.subpath.trim()||void 0,provider:H.provider,versionConstraint:H.versionConstraint.trim()||void 0}),v(`none`),await K()}catch(e){A(m(e))}finally{D(!1)}}}async function Z(){if(q){D(!0),A(null);try{let e={};if(W.url.trim())e.type=`http`,e.url=W.url.trim();else{e.type=`stdio`;let t=W.command.trim().split(/\s+/);e.command=t[0];let n=W.args.trim()?W.args.trim().split(/\s+/):t.slice(1);n.length>0&&(e.args=n)}await s(`POST`,`/provisioning/capabilities/${encodeURIComponent(q.capability.id)}/variants/mcp`,{server:e,approvalStatus:W.approvalStatus,versionConstraint:W.versionConstraint.trim()||void 0}),v(`none`),await K()}catch(e){A(m(e))}finally{D(!1)}}}async function Q(e,n){z(e);try{await s(`PATCH`,`/provisioning/variants/${encodeURIComponent(e)}`,{enabled:n}),t(t=>t.map(t=>({...t,variants:t.variants.map(t=>t.id===e?{...t,enabled:n}:t)})))}catch(e){p(m(e))}finally{z(null)}}async function ee(e){let t=q?.variants.find(t=>t.id===e);if(t?.sourceRef){z(e);try{await s(`POST`,`/provisioning/variants/${encodeURIComponent(e)}/update`,{ref:t.sourceRef,subpath:t.sourceSubpath}),await K()}catch(e){p(m(e))}finally{z(null)}}}async function te(e){z(e);try{await s(`POST`,`/provisioning/variants/${encodeURIComponent(e)}/validate`,{}),await K()}catch(e){p(m(e))}finally{z(null)}}let $=q?.capability;return(0,T.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(o,{className:`size-5 text-primary`}),(0,T.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Registry`}),(0,T.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`provisioning capability registry · #561`}),(0,T.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[E.map(e=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>i(e.value),className:`rounded-md border px-2.5 py-1 text-xs transition-colors ${n===e.value?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-accent`}`,children:e.label},e.value)),(0,T.jsx)(g,{variant:`outline`,size:`sm`,onClick:()=>void K(),children:(0,T.jsx)(r,{className:`size-4`})})]})]}),f&&(0,T.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:f}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[300px_1fr]`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:[e.length,` capabilities`]}),(0,T.jsxs)(g,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>J(`new-capability`),children:[(0,T.jsx)(a,{className:`h-3 w-3`}),`New`]})]}),_===`new-capability`&&(0,T.jsx)(I,{form:B,onChange:e=>V(t=>({...t,...e})),onSubmit:()=>void Y(),onCancel:()=>v(`none`),busy:y,error:k}),u&&e.length===0&&(0,T.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading…`}),!u&&e.length===0&&(0,T.jsx)(C,{children:(0,T.jsx)(x,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No capabilities yet. Click New to create one.`})}),e.map(({capability:e,variants:t})=>(0,T.jsxs)(`button`,{type:`button`,onClick:()=>{l(e.id),v(`none`)},className:`w-full rounded-md border p-3 text-left transition-colors ${c===e.id?`border-primary/50 bg-primary/5`:`border-border bg-card/60 hover:bg-accent`}`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(h,{variant:`outline`,className:`text-[10px] ${O(e.kind)}`,children:e.kind}),(0,T.jsx)(`span`,{className:`text-xs font-medium font-mono truncate flex-1`,children:e.slug}),(0,T.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:[t.length,`v`]})]}),e.title&&(0,T.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground truncate`,children:e.title}),(0,T.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.status===`active`?`bg-emerald-500`:`bg-zinc-500`}`}),(0,T.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]})]},e.id))]}),$?(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(C,{children:[(0,T.jsx)(b,{children:(0,T.jsxs)(S,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(h,{variant:`outline`,className:O($.kind),children:$.kind}),(0,T.jsx)(`span`,{className:`font-mono text-base`,children:$.slug}),$.title&&(0,T.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`· `,$.title]}),(0,T.jsx)(h,{variant:$.status===`active`?`secondary`:`outline`,className:`ml-auto text-[10px]`,children:$.status})]})}),$.description&&(0,T.jsx)(x,{className:`pt-0 text-sm text-muted-foreground`,children:$.description})]}),(0,T.jsxs)(C,{children:[(0,T.jsx)(b,{children:(0,T.jsxs)(S,{className:`flex items-center gap-2 text-base`,children:[`Variants`,(0,T.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,q?.variants.length??0,`)`]}),(0,T.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,T.jsxs)(g,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>J(_===`import-github`?`none`:`import-github`),children:[(0,T.jsx)(a,{className:`h-3 w-3`}),`GitHub`]}),$.kind===`mcp`&&(0,T.jsxs)(g,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>J(_===`import-mcp`?`none`:`import-mcp`),children:[(0,T.jsx)(a,{className:`h-3 w-3`}),`MCP Server`]})]})]})}),(0,T.jsxs)(x,{className:`space-y-3`,children:[_===`import-github`&&(0,T.jsx)(L,{form:H,onChange:e=>U(t=>({...t,...e})),onSubmit:()=>void X(),onCancel:()=>v(`none`),busy:y,error:k}),_===`import-mcp`&&(0,T.jsx)(R,{form:W,onChange:e=>G(t=>({...t,...e})),onSubmit:()=>void Z(),onCancel:()=>v(`none`),busy:y,error:k}),q&&q.variants.length===0&&_===`none`&&(0,T.jsxs)(`div`,{className:`py-6 text-center text-sm text-muted-foreground`,children:[`No variants yet. Add one via GitHub import`,$.kind===`mcp`?` or MCP Server`:``,`.`]}),q?.variants.map(e=>(0,T.jsx)(F,{variant:e,onToggle:(e,t)=>void Q(e,t),onUpdate:e=>void ee(e),onValidate:e=>void te(e),busy:j},e.id))]})]})]}):!u&&(0,T.jsx)(C,{children:(0,T.jsx)(x,{className:`py-16 text-center text-sm text-muted-foreground`,children:`Select a capability to view details and variants.`})})]})]})}export{z as RegistryView};
2
- //# sourceMappingURL=registry-CXyaPToV.js.map
@@ -1,6 +0,0 @@
1
- import{r as e}from"./chunk-CilyBKbf.js";import{$n as t,C as n,Cn as r,G as i,Hn as a,Jt as o,L as s,M as c,Mn as l,Mt as u,O as d,On as f,Q as p,Qt as m,V as h,Zn as g,_n as _,er as v,fr as y,g as b,ir as x,j as S,l as C,m as w,pt as T,qn as E,qt as ee,xn as te,yn as D}from"./lucide-react-DmbfpRvJ.js";import{g as ne,m as O,t as k,u as re}from"./store-Du8k5mLJ.js";import{c as ie,d as ae,h as A,p as oe}from"./types-DSwhOFcJ.js";import{t as se}from"./themes-DjSwmAZN.js";import{a as j,i as M,n as N,r as P,t as F}from"./select-D-wcg_2U.js";import{t as I}from"./badge-kdQDWO6e.js";import{t as L}from"./button-BKFvNXa3.js";import{t as R}from"./input-DfN6sUbX.js";import{V as z,l as ce}from"./index-BMAblAKQ.js";import{i as B,n as V,o as H,r as U,s as W,t as G}from"./card-B0y1i_2D.js";import{t as le}from"./user-avatar-BQoM4jPT.js";var K=e(y(),1);function q(e){return`${e.namespace}/${e.key}`}function ue(e){return`/settings/${encodeURIComponent(e.namespace)}/${encodeURIComponent(e.key)}`}function de(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`settings`}function fe(e){let t=new Map;for(let n of e.filter(e=>e.readable)){let e=n.display?.group?.trim()||n.namespace;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>({group:e,slug:de(e),settings:t.sort(pe)})).sort((e,t)=>me(e.settings)-me(t.settings)||e.group.localeCompare(t.group))}function pe(e,t){return(e.display?.order??2**53-1)-(t.display?.order??2**53-1)||e.display?.label?.localeCompare(t.display?.label??``)||q(e).localeCompare(q(t))}function me(e){return Math.min(...e.map(e=>e.display?.order??2**53-1))}function he(e){return Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type}function ge(e,t,n){if(!t.length)return n;let[r,...i]=t;if(r===void 0)return n;if(typeof r==`number`){let t=Array.isArray(e)?[...e]:[];return t[r]=ge(t[r],i,n),t}let a=ae(e)?{...e}:{},o=ge(a[r],i,n);return o===void 0?delete a[r]:a[r]=o,a}function _e(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;if(e.enum?.length)return e.enum[0];switch(he(e)){case`boolean`:return!1;case`integer`:case`number`:return 0;case`array`:return[];case`object`:return{};case`string`:return``;default:return}}function ve(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function ye(e){return Array.isArray(e)?e.map(e=>String(e)).join(`
2
- `):``}function be(e){return ae(e)?Object.entries(e).map(([e,t])=>`${e}=${String(t??``)}`).join(`
3
- `):``}function xe(e){return Object.fromEntries(e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.indexOf(`=`);return t>=0?[e.slice(0,t).trim(),e.slice(t+1)]:[e,``]}))}var J=t(),Se=`__unset__`;function Ce(e){return e===`server-runtime`?`Server runtime`:e===`bootstrap`?`Bootstrap`:`Browser`}function we(e){return e===`server-runtime`?`Stored by Relay and mutable while the server is running.`:e===`bootstrap`?`Read from startup configuration; restart or host config changes are required.`:`Stored only in this browser profile.`}function Te(e){return e===`browser`?(0,J.jsx)(p,{className:`size-3.5`}):(0,J.jsx)(d,{className:`size-3.5`})}function Ee(e){return e.details??[]}function De({group:e,settings:t,onSaved:n}){let r=[...new Set(t.map(e=>e.tier))];return(0,J.jsxs)(`section`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:e}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,J.jsxs)(I,{variant:`outline`,className:`gap-1`,title:we(e),children:[Te(e),Ce(e)]},e))})]}),t.length===0?(0,J.jsx)(G,{size:`sm`,children:(0,J.jsx)(U,{className:`text-sm text-muted-foreground`,children:`No settings in this group.`})}):(0,J.jsx)(`div`,{className:`space-y-3`,children:t.map(e=>(0,J.jsx)(Oe,{setting:e,onSaved:n},q(e)))})]})}function Oe({setting:e,onSaved:t}){let[n,r]=(0,K.useState)(()=>e.value??e.defaults??_e(e.schema)),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(``),[c,l]=(0,K.useState)([]),u=e.writable&&e.tier===`server-runtime`;function d(e,t){r(n=>ge(n,e,t)),l([]),s(``)}async function f(){if(u){a(!0),l([]),s(``);try{let i=await v(`PUT`,ue(e),{value:n,updatedBy:`dashboard`});r(i.value),t(i),s(`Saved`)}catch(e){let t=Ee(e);l(t.length?t:[e.message])}finally{a(!1)}}}return(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(W,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[e.display.label,(0,J.jsxs)(I,{variant:`outline`,className:`gap-1`,title:we(e.tier),children:[Te(e.tier),Ce(e.tier)]}),!e.writable&&(0,J.jsx)(I,{variant:`secondary`,children:`Read only`})]}),e.display.description&&(0,J.jsx)(B,{children:e.display.description}),(0,J.jsx)(V,{children:(0,J.jsxs)(L,{size:`sm`,onClick:f,disabled:!u||i,children:[(0,J.jsx)(S,{className:`size-4`}),i?`Saving`:`Save`]})})]}),(0,J.jsxs)(U,{className:`space-y-3`,children:[(0,J.jsx)(ke,{schema:e.schema,value:n,path:[],label:e.display.label,required:!0,disabled:!u||i,onChange:d}),(0,J.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-[11px] text-muted-foreground`,children:[(0,J.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono`,children:[e.namespace,`/`,e.key]}),(0,J.jsxs)(`span`,{children:[`read `,(0,J.jsx)(`span`,{className:`text-foreground/70`,children:e.scope.read})]}),(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,J.jsxs)(`span`,{children:[`write `,(0,J.jsx)(`span`,{className:`text-foreground/70`,children:e.scope.write})]})]}),c.length>0&&(0,J.jsxs)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 font-medium`,children:[(0,J.jsx)(D,{className:`size-4`}),`Save failed`]}),(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:c.map(e=>(0,J.jsx)(`li`,{children:e},e))})]}),o&&(0,J.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-emerald-500`,children:[(0,J.jsx)(_,{className:`size-4`}),o]})]})]})}function ke(e){let{schema:t,value:n,path:r,label:i,required:a,disabled:o,onChange:s}=e,c=he(t);if(t.enum?.length){let e=n==null||n===``?Se:String(n);return(0,J.jsx)(Y,{label:i,description:t.description,children:(0,J.jsxs)(F,{value:e,onValueChange:e=>s(r,e===`__unset__`?void 0:e),disabled:o,children:[(0,J.jsx)(M,{children:(0,J.jsx)(j,{})}),(0,J.jsxs)(N,{children:[!a&&(0,J.jsx)(P,{value:`__unset__`,children:`Not set`}),t.enum.map(e=>(0,J.jsx)(P,{value:String(e),children:String(e)},String(e)))]})]})})}if(c===`boolean`)return(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:i}),t.description&&(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description})]}),(0,J.jsx)(z,{checked:!!n,onCheckedChange:e=>s(r,e),disabled:o})]});if(c===`integer`||c===`number`)return(0,J.jsx)(Y,{label:i,description:t.description,children:(0,J.jsx)(R,{type:`number`,min:typeof t.minimum==`number`?t.minimum:void 0,max:typeof t.maximum==`number`?t.maximum:void 0,step:c===`integer`?1:`any`,value:typeof n==`number`?n:``,disabled:o,onChange:e=>s(r,e.target.value===``&&!a?void 0:Number(e.target.value))})});if(c===`array`)return(0,J.jsx)(Y,{label:i,description:t.description??`One item per line.`,children:(0,J.jsx)(ce,{rows:Math.min(8,Math.max(3,Array.isArray(n)?n.length+1:3)),value:ye(n),disabled:o,onChange:e=>s(r,ve(e.target.value))})});if(c===`object`){let e=t.properties??{},a=new Set(t.required??[]);return Object.keys(e).length===0&&t.additionalProperties?(0,J.jsx)(Y,{label:i,description:t.description??`KEY=value, one entry per line.`,children:(0,J.jsx)(ce,{rows:5,value:be(n),disabled:o,onChange:e=>s(r,xe(e.target.value))})}):(0,J.jsxs)(`div`,{className:`space-y-3`,children:[r.length>0&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:i}),t.description&&(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.description})]}),(0,J.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:Object.entries(e).map(([e,t])=>{let i=ae(n)?n[e]:void 0;return(0,J.jsx)(ke,{schema:t,value:i===void 0&&a.has(e)?_e(t):i,path:[...r,e],label:t.title||Ae(e),required:a.has(e),disabled:o,onChange:s},e)})})]})}return(0,J.jsx)(Y,{label:i,description:t.description,children:(0,J.jsx)(R,{value:typeof n==`string`?n:n==null?``:String(n),disabled:o,onChange:e=>s(r,e.target.value===``&&!a?void 0:e.target.value)})})}function Y({label:e,description:t,children:n}){return(0,J.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e}),n,t&&(0,J.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t})]})}function Ae(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).replace(/^\w/,e=>e.toUpperCase())}function je(){let e=k(e=>e.theme),t=k(e=>e.showReasoning),n=k(e=>e.set);return(0,J.jsxs)(`section`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Browser preferences`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`These are stored in local dashboard state, not in Relay server config.`})]}),(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsx)(W,{className:`text-sm`,children:`Dashboard display`}),(0,J.jsx)(B,{className:`text-xs`,children:`Browser tier · persisted in this browser profile.`}),(0,J.jsx)(V,{children:(0,J.jsxs)(I,{variant:`outline`,className:`gap-1`,children:[(0,J.jsx)(p,{className:`size-3.5`}),`Browser`]})})]}),(0,J.jsxs)(U,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsx)(Y,{label:`Theme`,children:(0,J.jsxs)(F,{value:e,onValueChange:e=>n({theme:e}),children:[(0,J.jsx)(M,{children:(0,J.jsx)(j,{})}),(0,J.jsx)(N,{children:se.map(e=>(0,J.jsx)(P,{value:e.id,children:e.label},e.id))})]})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(l,{className:`size-4`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Show reasoning details`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Display captured reasoning/tool steps in chat. Server capture is controlled separately by provider reasoningCapture.`})]})]}),(0,J.jsx)(z,{checked:t,onCheckedChange:e=>n({showReasoning:e})})]})]})]}),(0,J.jsx)(Me,{})]})}function Me(){let e=k(e=>e.voiceTtsEnabled),t=k(e=>e.setVoiceTtsEnabled),n=k(e=>e.voiceTtsMode),r=k(e=>e.setVoiceTtsMode),i=k(e=>e.voiceTtsKokoroVoice),a=k(e=>e.setVoiceTtsKokoroVoice),o=k(e=>e.voiceTtsBrowserVoice),s=k(e=>e.setVoiceTtsBrowserVoice),c=k(e=>e.voiceInputMode),l=k(e=>e.setVoiceInputMode),[u,d]=(0,K.useState)(()=>ne());(0,K.useEffect)(()=>{if(typeof window>`u`||!(`speechSynthesis`in window))return;let e=()=>d(ne());return e(),window.speechSynthesis.addEventListener?.(`voiceschanged`,e),()=>window.speechSynthesis.removeEventListener?.(`voiceschanged`,e)},[]);let f=O.some(e=>e.id===i)?O:[...O,{id:i,label:i}];return(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(W,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(C,{className:`size-4`}),`Voice`]}),(0,J.jsx)(B,{className:`text-xs`,children:`Browser tier TTS and push-to-talk behavior.`}),(0,J.jsx)(V,{children:(0,J.jsx)(z,{checked:e,onCheckedChange:t})})]}),(0,J.jsxs)(U,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsx)(Y,{label:`Speech engine`,children:(0,J.jsxs)(F,{value:n,onValueChange:e=>r(e),children:[(0,J.jsx)(M,{children:(0,J.jsx)(j,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(P,{value:`kokoro`,children:`Kokoro (server, fallback to browser)`}),(0,J.jsx)(P,{value:`browser`,children:`Browser Web Speech API`})]})]})}),(0,J.jsx)(Y,{label:`Kokoro voice`,children:(0,J.jsxs)(F,{value:i,onValueChange:a,children:[(0,J.jsx)(M,{children:(0,J.jsx)(j,{})}),(0,J.jsx)(N,{children:f.map(e=>(0,J.jsx)(P,{value:e.id,children:e.label},e.id))})]})}),(0,J.jsx)(Y,{label:`Browser voice`,children:(0,J.jsxs)(F,{value:o||`__unset__`,onValueChange:e=>s(e===`__unset__`?``:e),children:[(0,J.jsx)(M,{children:(0,J.jsx)(j,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(P,{value:Se,children:`System default`}),u.map(e=>(0,J.jsx)(P,{value:e.uri,children:e.label},e.uri))]})]})}),(0,J.jsx)(Y,{label:`Push-to-talk input`,children:(0,J.jsxs)(F,{value:c,onValueChange:e=>l(e),children:[(0,J.jsx)(M,{children:(0,J.jsx)(j,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(P,{value:`compose`,children:`Fill message box`}),(0,J.jsx)(P,{value:`autosend`,children:`Send immediately`})]})]})})]})]})}function Ne({catalog:e,error:t,canWrite:r,onCatalog:a}){let s=e[0]?.provider??``,[c,l]=(0,K.useState)(s),[u,f]=(0,K.useState)(()=>Pe(s)),[p,m]=(0,K.useState)(``),[g,y]=(0,K.useState)([]),x=e.some(e=>e.provider===c)?c:s,S=e.find(e=>e.provider===x)??e[0],C=e.map(e=>e.provider);function w(e){f(t=>({...t,...e})),y([]),m(``)}function T(e){l(e),f(Pe(e)),y([]),m(``)}async function E(){a((await v(`GET`,`/providers`)).catalog)}async function te(){if(r){y([]),m(``);try{await v(`PUT`,`/providers/${encodeURIComponent(u.provider)}/models/${encodeURIComponent(u.alias)}`,{label:u.label,providerModel:u.providerModel,efforts:ve(u.efforts),defaultEffort:u.defaultEffort.trim()||void 0,limits:u.limits,capabilities:u.capabilities,contextThreshold:Fe(u),disabled:u.disabled,updatedBy:`dashboard`}),await E(),m(`${u.alias} saved`),f(Pe(u.provider))}catch(e){let t=Ee(e);y(t.length?t:[e.message])}}}async function D(e,t){if(r){y([]),m(``);try{await v(`PATCH`,`/providers/${encodeURIComponent(x)}/models/${encodeURIComponent(e.alias)}`,{disabled:t,updatedBy:`dashboard`}),await E(),m(`${e.alias} ${t?`disabled`:`enabled`}`)}catch(e){let t=Ee(e);y(t.length?t:[e.message])}}}async function ne(e){if(r){y([]),m(``);try{await v(`DELETE`,`/providers/${encodeURIComponent(x)}/models/${encodeURIComponent(e.alias)}`),await E(),m(`${e.alias} removed`)}catch(e){let t=Ee(e);y(t.length?t:[e.message])}}}function O(e){f({provider:x,alias:e.alias,label:e.label,providerModel:e.providerModel,efforts:e.efforts.join(`, `),defaultEffort:e.defaultEffort??``,selfCompactUtilization:e.contextThreshold?.selfCompactUtilization?.toString()??``,warnUtilization:e.contextThreshold?.warnUtilization?.toString()??``,hardBackstopUtilization:e.contextThreshold?.hardBackstopUtilization?.toString()??``,disabled:!!e.disabled,limits:e.limits,capabilities:e.capabilities}),y([]),m(``)}return t?(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`text-sm text-muted-foreground`,children:[(0,J.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 font-medium text-foreground`,children:[(0,J.jsx)(n,{className:`size-4`}),`Model catalog`]}),t]})}):(0,J.jsxs)(`section`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Model catalog`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Add override models, disable unavailable models, or remove custom entries from the provider catalog.`})]}),!r&&(0,J.jsx)(I,{variant:`secondary`,children:`Read only: needs settings:write:provider`})]}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:C.map(e=>(0,J.jsx)(L,{variant:e===x?`default`:`outline`,size:`sm`,onClick:()=>T(e),children:e},e))}),(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsx)(W,{className:`text-sm`,children:`Add or edit model`}),(0,J.jsx)(V,{children:(0,J.jsxs)(I,{variant:`outline`,className:`gap-1`,children:[(0,J.jsx)(d,{className:`size-3.5`}),`Server runtime`]})})]}),(0,J.jsxs)(U,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,J.jsx)(Y,{label:`Alias`,children:(0,J.jsx)(R,{value:u.alias,disabled:!r,placeholder:`nightly`,onChange:e=>w({alias:e.target.value.trim()})})}),(0,J.jsx)(Y,{label:`Label`,children:(0,J.jsx)(R,{value:u.label,disabled:!r,placeholder:`Nightly Codex`,onChange:e=>w({label:e.target.value})})}),(0,J.jsx)(Y,{label:`Provider model`,children:(0,J.jsx)(R,{value:u.providerModel,disabled:!r,placeholder:`codex-nightly`,onChange:e=>w({providerModel:e.target.value})})}),(0,J.jsx)(Y,{label:`Efforts`,children:(0,J.jsx)(R,{value:u.efforts,disabled:!r,placeholder:`low, medium, high`,onChange:e=>w({efforts:e.target.value})})}),(0,J.jsx)(Y,{label:`Default effort`,children:(0,J.jsx)(R,{value:u.defaultEffort,disabled:!r,placeholder:`medium`,onChange:e=>w({defaultEffort:e.target.value})})}),(0,J.jsx)(Y,{label:`Self compact utilization`,children:(0,J.jsx)(R,{value:u.selfCompactUtilization,disabled:!r,placeholder:`0.80`,inputMode:`decimal`,onChange:e=>w({selfCompactUtilization:e.target.value})})}),(0,J.jsx)(Y,{label:`Warn utilization`,children:(0,J.jsx)(R,{value:u.warnUtilization,disabled:!r,placeholder:`default: self - 0.10`,inputMode:`decimal`,onChange:e=>w({warnUtilization:e.target.value})})}),(0,J.jsx)(Y,{label:`Hard backstop utilization`,children:(0,J.jsx)(R,{value:u.hardBackstopUtilization,disabled:!r,placeholder:`0.90`,inputMode:`decimal`,onChange:e=>w({hardBackstopUtilization:e.target.value})})}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Disabled`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Keep visible but unavailable for new launches.`})]}),(0,J.jsx)(z,{checked:u.disabled,disabled:!r,onCheckedChange:e=>w({disabled:e})})]})]}),(0,J.jsxs)(L,{onClick:te,disabled:!r||!u.alias||!u.label||!u.providerModel,children:[(0,J.jsx)(h,{className:`size-4`}),`Save model`]})]})]}),(0,J.jsxs)(`div`,{className:`space-y-2`,children:[S&&S.models.length===0&&(0,J.jsx)(G,{size:`sm`,children:(0,J.jsx)(U,{className:`text-sm text-muted-foreground`,children:`No models in this provider catalog yet.`})}),S?.models.map(e=>(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,J.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:e.alias}),e.disabled&&(0,J.jsx)(I,{variant:`secondary`,children:`Disabled`})]}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerModel,e.efforts.length>0?` · efforts ${e.efforts.join(`, `)}`:` · no effort levels`,e.defaultEffort?` · default ${e.defaultEffort}`:``,` · context ${Le(e)}`]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>O(e),children:[(0,J.jsx)(i,{className:`size-4`}),`Edit`]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,disabled:!r,onClick:()=>void D(e,!e.disabled),children:[e.disabled?(0,J.jsx)(ee,{className:`size-4`}):(0,J.jsx)(o,{className:`size-4`}),e.disabled?`Enable`:`Disable`]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,disabled:!r,onClick:()=>void ne(e),children:[(0,J.jsx)(b,{className:`size-4`}),`Remove`]})]})]})},e.alias))]}),g.length>0&&(0,J.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:(0,J.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:g.map(e=>(0,J.jsx)(`li`,{children:e},e))})}),p&&(0,J.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-emerald-500`,children:[(0,J.jsx)(_,{className:`size-4`}),p]})]})}function Pe(e){return{provider:e,alias:``,label:``,providerModel:``,efforts:``,defaultEffort:``,selfCompactUtilization:``,warnUtilization:``,hardBackstopUtilization:``,disabled:!1}}function Fe(e){let t=Ie(e.selfCompactUtilization,`Self compact utilization`),n=Ie(e.warnUtilization,`Warn utilization`),r=Ie(e.hardBackstopUtilization,`Hard backstop utilization`);if(!(t===void 0&&n===void 0&&r===void 0)){if(t===void 0)throw Error(`Self compact utilization is required when setting context thresholds`);return{selfCompactUtilization:t,...n===void 0?{}:{warnUtilization:n},...r===void 0?{}:{hardBackstopUtilization:r}}}}function Ie(e,t){let n=e.trim();if(!n)return;let r=Number(n);if(!Number.isFinite(r))throw Error(`${t} must be a number`);return r}function Le(e){if(e.contextThreshold)return`self ${Re(e.contextThreshold.selfCompactUtilization)}, warn ${Re(e.contextThreshold.warnUtilization??Math.max(0,e.contextThreshold.selfCompactUtilization-.1))}`;let t=re(e.limits?.contextWindowTokens?.value);return`derived self ${Re(t.selfCompactUtilization)}, warn ${Re(t.warnUtilization)}`}function Re(e){return`${Math.round(e*100)}%`}var ze=5,Be=15,Ve={claude:`Claude`,codex:`Codex`};function He(e){return Math.round(e/6e4)}function Ue(e){return`${He(e)} min`}function We({canWrite:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(null);(0,K.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await v(`GET`,`/providers/quota-config`);e||n(t)}catch(t){e||i(t.message)}})(),()=>{e=!0}},[]);async function l(e,t){n(n=>({...n??{},[e]:t})),o(``),c(e);try{let r=await v(`PUT`,`/providers/${e}/quota-config`,t);n(t=>({...t??{},[e]:r}))}catch(t){o(`${Ve[e]??e}: ${t.message}`)}finally{c(null)}}let d=t?Object.keys(t).sort():[];return(0,J.jsxs)(`section`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Quota`}),(0,J.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Per-provider quota collection and display. `,(0,J.jsx)(`strong`,{children:`Enabled`}),` governs collection (disabled stops polling — no API calls);`,(0,J.jsx)(`strong`,{children:` Show in widget`}),` governs display only.`]})]}),r&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-4`}),(0,J.jsx)(`span`,{children:r})]}),a&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-4`}),(0,J.jsx)(`span`,{children:a})]}),!t&&!r&&(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,J.jsx)(T,{className:`size-4 animate-spin`}),`Loading quota config…`]})}),d.map(r=>{let i=t[r],a=!e||s===r;return(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(W,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(u,{className:`size-4`}),Ve[r]??r,s===r&&(0,J.jsx)(T,{className:`size-3 animate-spin text-muted-foreground`})]}),(0,J.jsxs)(B,{className:`text-xs`,children:[i.enabled?`Polled every ${Ue(i.pollIntervalMs)}`:`Collection disabled`,i.enabled&&!i.showInWidget?` · hidden from widget`:``]})]}),(0,J.jsxs)(U,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Enabled`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Collect quota for this provider. Off stops all polling (no API calls, no token spend).`})]}),(0,J.jsx)(z,{checked:i.enabled,disabled:a,onCheckedChange:e=>void l(r,{...i,enabled:e})})]}),(0,J.jsxs)(`div`,{className:`rounded-md border bg-muted/20 p-3 space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Polling interval`}),(0,J.jsx)(I,{variant:`outline`,className:`tabular-nums`,children:Ue(i.pollIntervalMs)})]}),(0,J.jsx)(`input`,{type:`range`,min:ze,max:Be,step:1,value:He(i.pollIntervalMs),disabled:a||!i.enabled,onChange:e=>{let t=Number(e.target.value)*6e4;n(e=>({...e??{},[r]:{...i,pollIntervalMs:t}}))},onPointerUp:e=>void l(r,{...i,pollIntervalMs:Number(e.target.value)*6e4}),onKeyUp:e=>void l(r,{...i,pollIntervalMs:Number(e.target.value)*6e4}),className:`w-full accent-primary disabled:opacity-50`}),(0,J.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,J.jsxs)(`span`,{children:[ze,` min`]}),(0,J.jsxs)(`span`,{children:[Be,` min`]})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Show in quota widget`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Display only. Off hides this provider from the dashboard widget; collection continues if enabled.`})]}),(0,J.jsx)(z,{checked:i.showInWidget,disabled:a,onCheckedChange:e=>void l(r,{...i,showInWidget:e})})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border bg-muted/20 p-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Burn-rate sparkline`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Show a mini utilization chart per window in the expanded widget.`})]}),(0,J.jsx)(z,{checked:i.sparklineEnabled??!0,disabled:a,onCheckedChange:e=>void l(r,{...i,sparklineEnabled:e})})]}),(0,J.jsxs)(`div`,{className:`rounded-md border bg-muted/20 p-3 space-y-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:`Sparkline range`}),(0,J.jsxs)(I,{variant:`outline`,className:`tabular-nums`,children:[i.sparklineRangeHours??8,`h`]})]}),(0,J.jsx)(`input`,{type:`range`,min:1,max:8,step:1,value:i.sparklineRangeHours??8,disabled:a||!(i.sparklineEnabled??!0),onChange:e=>{let t=Number(e.target.value);n(e=>({...e??{},[r]:{...i,sparklineRangeHours:t}}))},onPointerUp:e=>void l(r,{...i,sparklineRangeHours:Number(e.target.value)}),onKeyUp:e=>void l(r,{...i,sparklineRangeHours:Number(e.target.value)}),className:`w-full accent-primary disabled:opacity-50`}),(0,J.jsxs)(`div`,{className:`flex justify-between text-[10px] text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:`1h`}),(0,J.jsx)(`span`,{children:`8h`})]})]})]})]},r)})]})}function Ge({message:e}){return(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-4 shrink-0`}),(0,J.jsx)(`span`,{children:e})]})}var Ke=oe(),X={cautionAt:.15,avoidLargeAt:.5,hardAvoidAt:1},qe=.99,Je=.5;function Z(e,t){return((e??t)*100).toFixed(0)}function Q(e){let t=Number(e);return!Number.isFinite(t)||t<0||t>100?null:t/100}function Ye({policy:e,canWrite:t,onPolicy:n}){let r=e.quotaBands,i=e.providerQuota??{},[a,o]=(0,K.useState)(Z(r?.cautionAt,X.cautionAt)),[s,c]=(0,K.useState)(Z(r?.avoidLargeAt,X.avoidLargeAt)),[l,u]=(0,K.useState)(Z(r?.hardAvoidAt,X.hardAvoidAt)),[d,f]=(0,K.useState)(()=>{let e={};for(let t of Ke){let n=i[t]??{};e[t]={backstop:Z(n.hardBackstopUtilization,qe),floor:Z(n.burnPenaltyUtilizationFloor,Je)}}return e}),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(``),[_,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(``);async function C(){let t=Q(a),r=Q(s),i=Q(l);if(t===null){x(`Caution threshold must be 0–100%.`);return}if(r===null){x(`Avoid-large threshold must be 0–100%.`);return}if(i===null){x(`Hard-avoid threshold must be 0–100%.`);return}if(t>=r){x(`Caution must be less than avoid-large.`);return}if(r>=i){x(`Avoid-large must be less than hard-avoid.`);return}let o={};for(let e of Ke){let t=d[e],n=Q(t.backstop),r=Q(t.floor);if(n===null){x(`${A(e)}: hard-backstop must be 0–100%.`);return}if(r===null){x(`${A(e)}: burn-penalty floor must be 0–100%.`);return}o[e]={hardBackstopUtilization:n,burnPenaltyUtilizationFloor:r}}x(``),m(!0),g(``),y(!1);try{n(await v(`PUT`,`/routing-policy`,{...e,quotaBands:{cautionAt:t,avoidLargeAt:r,hardAvoidAt:i},providerQuota:o})),y(!0),setTimeout(()=>y(!1),2e3)}catch(e){g(e.message)}finally{m(!1)}}function w(e,t){f(n=>({...n,[e]:{...n[e],...t}})),x(``),y(!1)}function E(){x(``),y(!1)}return(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsx)(W,{className:`text-sm`,children:`Quota thresholds`}),(0,J.jsx)(B,{className:`text-xs`,children:`Band cutoffs govern when the orchestrator starts penalising or blocking high-quota providers. Values are utilization percentages (0–100).`})]}),(0,J.jsxs)(U,{className:`space-y-4`,children:[(h||b)&&(0,J.jsx)(Ge,{message:h||b}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`Band cutoffs`}),(0,J.jsx)(Xe,{caution:Number(a),avoidLarge:Number(s),hardAvoid:Number(l)}),(0,J.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[(0,J.jsx)($,{label:`Caution at`,hint:`Default: ${(X.cautionAt*100).toFixed(0)}%`,value:a,disabled:!t||p,onChange:e=>{o(e),E()}}),(0,J.jsx)($,{label:`Avoid-large at`,hint:`Default: ${(X.avoidLargeAt*100).toFixed(0)}%`,value:s,disabled:!t||p,onChange:e=>{c(e),E()}}),(0,J.jsx)($,{label:`Hard-avoid at`,hint:`Default: ${(X.hardAvoidAt*100).toFixed(0)}%`,value:l,disabled:!t||p,onChange:e=>{u(e),E()}})]})]}),Ke.map(e=>{let n=d[e];return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`mb-2 text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:[A(e),` overrides`]}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsx)($,{label:`Hard-backstop utilization`,hint:`Provider blocked above this. Default: ${(qe*100).toFixed(0)}%`,value:n.backstop,disabled:!t||p,onChange:t=>w(e,{backstop:t})}),(0,J.jsx)($,{label:`Burn-penalty floor`,hint:`Penalties suppressed below this. Default: ${(Je*100).toFixed(0)}%`,value:n.floor,disabled:!t||p,onChange:t=>w(e,{floor:t})})]})]},e)}),t&&(0,J.jsxs)(L,{size:`sm`,onClick:()=>void C(),disabled:p,children:[p?(0,J.jsx)(T,{className:`size-4 animate-spin`}):(0,J.jsx)(S,{className:`size-4`}),_?`Saved`:`Save thresholds`]})]})]})}function Xe({caution:e,avoidLarge:t,hardAvoid:n}){let r=e=>Math.max(0,Math.min(100,Number.isFinite(e)?e:0)),i=r(e),a=Math.max(i,r(t)),o=Math.max(a,r(n)),s=e=>`${e.toFixed(0)}%`,c=[{key:`normal`,label:`normal`,color:`bg-emerald-500`,from:0,to:i,range:`0–${s(i)}`},{key:`caution`,label:`caution`,color:`bg-amber-500`,from:i,to:a,range:`${s(i)}–${s(a)}`},{key:`avoid-large`,label:`avoid large`,color:`bg-orange-500`,from:a,to:o,range:`${s(a)}–${s(o)}`},{key:`hard-avoid`,label:`hard avoid`,color:`bg-red-500`,from:o,to:100,range:`≥ ${s(o)}`}];return(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-muted`,role:`img`,"aria-label":`Quota penalty bands from 0 to 100 percent`,children:c.map(e=>(0,J.jsx)(`div`,{className:g(e.color,`transition-[width] duration-300`),style:{width:`${e.to-e.from}%`},title:`${e.label} · ${e.range}`},e.key))}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-[10px] text-muted-foreground`,children:c.map(e=>(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`span`,{className:g(`size-2 shrink-0 rounded-full`,e.color)}),e.label,` `,(0,J.jsx)(`span`,{className:`tabular-nums text-foreground/70`,children:e.range})]},e.key))})]})}function $({label:e,hint:t,value:n,disabled:r,onChange:i}){return(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:e}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(R,{value:n,onChange:e=>i(e.target.value),disabled:r,className:`h-8 pr-6 text-xs tabular-nums`}),(0,J.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 right-2.5 flex items-center text-xs text-muted-foreground`,children:`%`})]}),(0,J.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:t})]})}function Ze(){let[e,t]=(0,K.useState)(null),[n,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(){if(!u){i(!0),o(``);try{let[e,n]=await Promise.all([v(`GET`,`/routing-policy`),v(`GET`,`/agent-profiles/coordinator`).catch(()=>null)]);t({policy:e,profile:n}),d(!0)}catch(e){o(e.message)}finally{i(!1)}}}async function p(){d(!1),i(!0),o(``);try{let[e,n]=await Promise.all([v(`GET`,`/routing-policy`),v(`GET`,`/agent-profiles/coordinator`).catch(()=>null)]);t({policy:e,profile:n}),d(!0)}catch(e){o(e.message)}finally{i(!1)}}function m(){let e=!c;l(e),e&&!u&&f()}return(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`space-y-3`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 text-left`,onClick:m,children:[(0,J.jsx)(ee,{className:`size-4 text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold`,children:`What your coordinator knows`}),(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Active routing policy + coordinator profile instructions (read-only)`})]}),c?(0,J.jsx)(r,{className:`size-4 shrink-0 text-muted-foreground`}):(0,J.jsx)(te,{className:`size-4 shrink-0 text-muted-foreground`})]}),c&&(0,J.jsxs)(`div`,{className:`space-y-4 pt-1`,children:[(0,J.jsx)(`div`,{className:`flex justify-end`,children:(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void p(),disabled:n,children:[(0,J.jsx)(s,{className:g(`size-3.5`,n&&`animate-spin`)}),`Refresh`]})}),a&&(0,J.jsx)(Ge,{message:a}),n&&!e&&(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground py-2`,children:[(0,J.jsx)(T,{className:`size-3.5 animate-spin`}),`Loading…`]}),e&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Qe,{policy:e.policy}),e.profile?(0,J.jsx)(et,{profile:e.profile}):(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`Coordinator profile not found.`})]})]})]})})}function Qe({policy:e}){let t=e.quotaBands,n=e.providerQuota??{};return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:`Active routing policy`}),e.rules.length===0?(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`No rules — coordinators use their own heuristics.`}):(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-border text-xs`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-[1.5rem_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] gap-px bg-border text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:[(0,J.jsx)(`div`,{className:`bg-muted/40 px-2 py-1.5`,children:`#`}),(0,J.jsx)(`div`,{className:`bg-muted/40 px-2 py-1.5`,children:`Match`}),(0,J.jsx)(`div`,{className:`bg-muted/40 px-2 py-1.5`,children:`Target`}),(0,J.jsx)(`div`,{className:`bg-muted/40 px-2 py-1.5`,children:`Status`})]}),e.rules.map((e,t)=>(0,J.jsxs)(`div`,{className:g(`grid grid-cols-[1.5rem_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)] gap-px bg-border`,e.enabled===!1&&`opacity-50`),children:[(0,J.jsx)(`div`,{className:`bg-card px-2 py-1.5 text-muted-foreground tabular-nums`,children:t+1}),(0,J.jsxs)(`div`,{className:`bg-card px-2 py-1.5`,children:[e.label&&(0,J.jsx)(`div`,{className:`font-medium`,children:e.label}),e.match.taskType&&(0,J.jsxs)(`div`,{className:`font-mono`,children:[`task: `,e.match.taskType]}),e.match.capability&&(0,J.jsxs)(`div`,{className:`font-mono`,children:[`cap: `,e.match.capability]})]}),(0,J.jsxs)(`div`,{className:`bg-card px-2 py-1.5`,children:[(0,J.jsx)(`span`,{className:`font-medium`,children:e.target.provider}),e.target.model&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` / `,e.target.model]}),e.target.effort&&(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[` (`,e.target.effort,`)`]})]}),(0,J.jsx)(`div`,{className:`bg-card px-2 py-1.5`,children:e.enabled===!1?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`disabled`}):(0,J.jsx)(`span`,{className:`text-emerald-500`,children:`active`})})]},t))]}),(t||Object.keys(n).length>0)&&(0,J.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/10 px-3 py-2 text-xs space-y-1`,children:[t&&(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5`,children:[t.cautionAt!==void 0&&(0,J.jsxs)(`span`,{children:[`caution ≥ `,(t.cautionAt*100).toFixed(0),`%`]}),t.avoidLargeAt!==void 0&&(0,J.jsxs)(`span`,{children:[`avoid-large ≥ `,(t.avoidLargeAt*100).toFixed(0),`%`]}),t.hardAvoidAt!==void 0&&(0,J.jsxs)(`span`,{children:[`hard-avoid ≥ `,(t.hardAvoidAt*100).toFixed(0),`%`]})]}),Object.entries(n).map(([e,t])=>(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5 text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:A(e)}),t?.hardBackstopUtilization!==void 0&&(0,J.jsxs)(`span`,{children:[`backstop: `,(t.hardBackstopUtilization*100).toFixed(0),`%`]}),t?.burnPenaltyUtilizationFloor!==void 0&&(0,J.jsxs)(`span`,{children:[`floor: `,(t.burnPenaltyUtilizationFloor*100).toFixed(0),`%`]})]},e))]})]})}function $e({text:e,index:t}){return(0,J.jsxs)(`div`,{className:`relative max-h-72 overflow-y-auto rounded-md border border-border bg-muted/20`,children:[t!==void 0&&(0,J.jsxs)(`span`,{className:`sticky top-0 float-right m-1.5 rounded bg-muted px-1.5 py-0.5 text-[9px] font-medium tabular-nums text-muted-foreground`,children:[`#`,t]}),(0,J.jsx)(`pre`,{className:`whitespace-pre-wrap break-words px-3 py-2.5 font-sans text-[11px] leading-relaxed text-foreground/90`,children:e})]})}function et({profile:e}){return(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:[`Coordinator profile instructions`,(0,J.jsx)(I,{variant:`secondary`,className:`ml-2 text-[10px]`,children:e.name}),e.builtIn&&(0,J.jsx)(I,{variant:`outline`,className:`ml-1 text-[10px]`,children:`built-in`})]}),e.description&&(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px]`,children:[(0,J.jsxs)(I,{variant:`outline`,children:[`base: `,e.base]}),(0,J.jsxs)(I,{variant:`outline`,children:[`repo: `,e.instructions.repoInstructions]}),(0,J.jsxs)(I,{variant:`outline`,children:[`global: `,e.instructions.globalInstructions]}),e.provider&&(0,J.jsxs)(I,{variant:`outline`,children:[`provider: `,e.provider]})]}),e.instructions.system&&(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`div`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:`System prompt`}),(0,J.jsx)($e,{text:e.instructions.system})]}),e.instructions.append.length>0&&(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`text-[10px] font-medium text-muted-foreground uppercase tracking-wide`,children:[`Appended instructions (`,e.instructions.append.length,`)`]}),e.instructions.append.map((e,t)=>(0,J.jsx)($e,{text:e,index:t+1},t))]}),e.instructions.append.length===0&&!e.instructions.system&&(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:`No instruction blocks defined.`})]})}var tt=oe();function nt(){return{label:``,matchTaskType:``,matchCapability:``,targetProvider:tt[0]??``,targetModel:``,targetEffort:``,enabled:!0}}function rt(e){return{label:e.label??``,matchTaskType:e.match.taskType??``,matchCapability:e.match.capability??``,targetProvider:e.target.provider,targetModel:e.target.model??``,targetEffort:e.target.effort??``,enabled:e.enabled!==!1}}function it(e){return{...e.label.trim()?{label:e.label.trim()}:{},match:{...e.matchTaskType.trim()?{taskType:e.matchTaskType.trim()}:{},...e.matchCapability.trim()?{capability:e.matchCapability.trim()}:{}},target:{provider:e.targetProvider,...e.targetModel.trim()?{model:e.targetModel.trim()}:{},...e.targetEffort.trim()?{effort:e.targetEffort.trim()}:{}},enabled:e.enabled}}function at(e){return!e.matchTaskType.trim()&&!e.matchCapability.trim()?`At least one match criterion (task type or capability) is required.`:null}function ot({message:e}){return(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-4 shrink-0`}),(0,J.jsx)(`span`,{children:e})]})}function st({canWrite:e}){let[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),[c,l]=(0,K.useState)(!1);!c&&!r&&!a&&(i(!0),(async()=>{try{n(await v(`GET`,`/routing-policy`)),l(!0)}catch(e){o(e.message)}finally{i(!1)}})());async function u(){i(!0),o(``);try{n(await v(`GET`,`/routing-policy`)),l(!0)}catch(e){o(e.message)}finally{i(!1)}}return(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold`,children:`Routing`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Declarative rules mapping task types and capabilities to providers. Rules are advisory — coordinators apply them; explicit per-spawn arguments always take precedence.`})]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void u(),disabled:r,children:[(0,J.jsx)(s,{className:g(`size-4`,r&&`animate-spin`)}),`Refresh`]})]}),a&&(0,J.jsx)(ot,{message:a}),r&&!t&&(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,J.jsx)(T,{className:`size-4 animate-spin`}),`Loading routing policy…`]})}),t&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ct,{policy:t,canWrite:e,onPolicy:n}),(0,J.jsx)(Ye,{policy:t,canWrite:e,onPolicy:n})]}),(0,J.jsx)(Ze,{})]})}function ct({policy:e,canWrite:t,onPolicy:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),[s,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(nt),[f,p]=(0,K.useState)(``),[m,g]=(0,K.useState)(null),[_,y]=(0,K.useState)(nt),[b,x]=(0,K.useState)(``);async function S(e){i(!0),o(``);try{n(await v(`PUT`,`/routing-policy`,e))}catch(e){o(e.message)}finally{i(!1)}}function C(t,n){let r=[...e.rules],i=t+n;i<0||i>=r.length||([r[t],r[i]]=[r[i],r[t]],S({...e,rules:r}))}function w(t){let n=e.rules.map((e,n)=>n===t?{...e,enabled:e.enabled===!1}:e);S({...e,rules:n})}function E(t){S({...e,rules:e.rules.filter((e,n)=>n!==t)})}function ee(){d(nt()),p(``),l(!0)}function te(){l(!1),p(``)}function D(){let t=at(u);if(t){p(t);return}l(!1),S({...e,rules:[...e.rules,it(u)]})}function ne(t){g(t),y(rt(e.rules[t])),x(``)}function O(){g(null),x(``)}function k(){if(m===null)return;let t=at(_);if(t){x(t);return}let n=e.rules.map((e,t)=>t===m?it(_):e);g(null),S({...e,rules:n})}return(0,J.jsxs)(G,{size:`sm`,children:[(0,J.jsxs)(H,{children:[(0,J.jsxs)(W,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(c,{className:`size-4`}),`Rules`,(0,J.jsxs)(I,{variant:`outline`,className:`ml-auto text-[10px]`,children:[e.rules.length,` rule`,e.rules.length===1?``:`s`]}),r&&(0,J.jsx)(T,{className:`size-3 animate-spin text-muted-foreground`})]}),(0,J.jsx)(B,{className:`text-xs`,children:`Evaluated in order — first matching enabled rule wins. Rules are advisory; explicit spawn arguments override them.`})]}),(0,J.jsxs)(U,{className:`space-y-2`,children:[a&&(0,J.jsx)(ot,{message:a}),e.rules.length===0&&!s&&(0,J.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-xs text-muted-foreground`,children:`No rules — coordinators fall back to their own heuristics.`}),e.rules.map((n,i)=>m===i?(0,J.jsx)(ut,{form:_,error:b,onChange:y,onSave:k,onCancel:O},i):(0,J.jsx)(lt,{rule:n,idx:i,total:e.rules.length,canWrite:t,saving:r,onMoveUp:()=>C(i,-1),onMoveDown:()=>C(i,1),onToggle:()=>w(i),onEdit:()=>ne(i),onRemove:()=>E(i)},i)),s&&(0,J.jsx)(ut,{form:u,error:f,onChange:d,onSave:D,onCancel:te,isNew:!0}),t&&!s&&m===null&&(0,J.jsxs)(L,{variant:`outline`,size:`sm`,className:`w-full gap-1`,onClick:ee,disabled:r,children:[(0,J.jsx)(h,{className:`size-4`}),`Add rule`]})]})]})}function lt({rule:e,idx:t,total:n,canWrite:r,saving:i,onMoveUp:o,onMoveDown:s,onToggle:c,onEdit:l,onRemove:u}){return(0,J.jsxs)(`div`,{className:g(`group flex items-start gap-3 rounded-md border bg-muted/20 p-3`,e.enabled===!1&&`opacity-60`),children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 pt-0.5`,children:[(0,J.jsx)(`button`,{type:`button`,title:`Move up`,onClick:o,disabled:!r||i||t===0,className:`rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-30`,children:(0,J.jsx)(a,{className:`size-3.5`})}),(0,J.jsx)(`button`,{type:`button`,title:`Move down`,onClick:s,disabled:!r||i||t===n-1,className:`rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-30`,children:(0,J.jsx)(E,{className:`size-3.5`})})]}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`text-[10px] tabular-nums text-muted-foreground`,children:[`#`,t+1]}),e.label&&(0,J.jsx)(`span`,{className:`text-xs font-medium`,children:e.label}),(0,J.jsx)(I,{variant:`outline`,className:`text-[10px]`,children:e.target.provider}),e.target.model&&(0,J.jsx)(I,{variant:`outline`,className:`text-[10px] font-mono`,children:e.target.model}),e.target.effort&&(0,J.jsx)(I,{variant:`outline`,className:`text-[10px]`,children:e.target.effort})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-muted-foreground`,children:[e.match.taskType&&(0,J.jsxs)(`span`,{children:[`task-type: `,(0,J.jsx)(`span`,{className:`font-mono text-foreground`,children:e.match.taskType})]}),e.match.capability&&(0,J.jsxs)(`span`,{children:[`capability: `,(0,J.jsx)(`span`,{className:`font-mono text-foreground`,children:e.match.capability})]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 opacity-70 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,children:[(0,J.jsx)(z,{checked:e.enabled!==!1,disabled:!r||i,onCheckedChange:c,title:e.enabled===!1?`Enable rule`:`Disable rule`}),r&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,title:`Edit`,onClick:l,disabled:i,className:`rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:pointer-events-none`,children:(0,J.jsxs)(`svg`,{className:`size-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,children:[(0,J.jsx)(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),(0,J.jsx)(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})]})}),(0,J.jsx)(`button`,{type:`button`,title:`Remove`,onClick:u,disabled:i,className:`rounded p-1 text-destructive hover:bg-destructive/10 disabled:pointer-events-none`,children:(0,J.jsx)(b,{className:`size-3.5`})})]})]})]})}function ut({form:e,error:t,onChange:n,onSave:r,onCancel:i,isNew:a}){function o(t){n({...e,...t})}return(0,J.jsxs)(`div`,{className:`rounded-md border border-primary/30 bg-primary/5 p-3 space-y-3`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wide`,children:a?`New rule`:`Edit rule`}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:`Label (optional)`}),(0,J.jsx)(R,{value:e.label,onChange:e=>o({label:e.target.value}),placeholder:`e.g. Route GUI tasks to Claude`,className:`h-8 text-xs`})]}),(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:`Target provider`}),(0,J.jsxs)(F,{value:e.targetProvider,onValueChange:e=>o({targetProvider:e}),children:[(0,J.jsx)(M,{className:`h-8 text-xs`,children:(0,J.jsx)(j,{})}),(0,J.jsx)(N,{children:tt.map(e=>(0,J.jsx)(P,{value:e,className:`text-xs`,children:A(e)},e))})]})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:`Match task-type (prefix)`}),(0,J.jsx)(R,{value:e.matchTaskType,onChange:e=>o({matchTaskType:e.target.value}),placeholder:`e.g. gui, backend, mechanical`,className:`h-8 font-mono text-xs`}),(0,J.jsxs)(`span`,{className:`block text-[10px] leading-snug text-muted-foreground`,children:[`Prefix match — `,(0,J.jsx)(`span`,{className:`font-mono text-foreground`,children:`gui`}),` matches `,(0,J.jsx)(`span`,{className:`font-mono text-foreground`,children:`gui/ux`}),`, `,(0,J.jsx)(`span`,{className:`font-mono text-foreground`,children:`gui/layout`}),`.`]})]}),(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:`Match capability (exact)`}),(0,J.jsx)(R,{value:e.matchCapability,onChange:e=>o({matchCapability:e.target.value}),placeholder:`e.g. code, research, bounded`,className:`h-8 font-mono text-xs`}),(0,J.jsx)(`span`,{className:`block text-[10px] leading-snug text-muted-foreground`,children:`Exact match against the agent's capability tag. Both fields are AND-ed.`})]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:`Model alias (optional)`}),(0,J.jsx)(R,{value:e.targetModel,onChange:e=>o({targetModel:e.target.value}),placeholder:`e.g. opus, gpt-5.4`,className:`h-8 font-mono text-xs`})]}),(0,J.jsxs)(`label`,{className:`space-y-1`,children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:`Effort (optional)`}),(0,J.jsx)(R,{value:e.targetEffort,onChange:e=>o({targetEffort:e.target.value}),placeholder:`e.g. high, low`,className:`h-8 text-xs`})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(z,{checked:e.enabled,onCheckedChange:e=>o({enabled:e})}),(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Enabled`})]}),t&&(0,J.jsx)(ot,{message:t}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsxs)(L,{size:`sm`,onClick:r,children:[(0,J.jsx)(S,{className:`size-4`}),a?`Add`:`Save`]}),(0,J.jsx)(L,{size:`sm`,variant:`outline`,onClick:i,children:`Cancel`})]})]})}var dt=`browser`,ft=`models`,pt=`profile`,mt=`routing`,ht=[`branch.landed`,`landed-failure`,`agent.ready`,`agent.exited`,`agent.spawn_failed`,`agent.context_threshold`,`agent.quota_threshold`,`workspace.steward_task`,`workspace.conflict`,`workspace.review_request`];function gt(){if(typeof window>`u`)return``;let e=window.location.hash.replace(/^#/,``);return e.startsWith(`settings/`)?decodeURIComponent(e.slice(9)):``}function _t(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=`settings/${encodeURIComponent(e)}`,window.history.pushState({},``,t)}function vt(){let[e,t]=(0,K.useState)([]),[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)([]),[o,c]=(0,K.useState)(()=>gt()),[l,u]=(0,K.useState)(!0),[d,f]=(0,K.useState)(``),[p,h]=(0,K.useState)(``);async function _(){u(!0),f(``),h(``);try{let[e,n,i]=await Promise.all([v(`GET`,`/settings`),v(`GET`,`/tokens/me`),v(`GET`,`/providers`).catch(e=>(h(e.message),{catalog:[]}))]);t(e.settings),r(n),a(i.catalog)}catch(e){f(e.message)}finally{u(!1)}}(0,K.useEffect)(()=>{_()},[]),(0,K.useEffect)(()=>{let e=()=>c(gt());return window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[]);let y=(0,K.useMemo)(()=>fe(e),[e]),b=(0,K.useMemo)(()=>[...y.map(e=>({slug:e.slug,label:e.group,description:`${e.settings.length} schema setting${e.settings.length===1?``:`s`}`,kind:`descriptors`,settings:e.settings})),{slug:mt,label:`Routing`,description:`Rules, quota thresholds, coordinator view`,kind:`routing`,settings:[]},{slug:pt,label:`Profile`,description:`Display name and avatar`,kind:`profile`,settings:[]},{slug:dt,label:`Browser`,description:`Local dashboard preferences`,kind:`browser`,settings:[]},{slug:ft,label:`Models`,description:`Provider model catalog`,kind:`models`,settings:[]}],[y]),x=b.find(e=>e.slug===o)??b[0];function S(e){c(e),_t(e)}function C(e){t(t=>t.map(t=>q(t)===q(e)?e:t))}return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Settings`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Schema-driven Relay settings, browser preferences, and model catalog controls.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,J.jsxs)(I,{variant:`outline`,className:`gap-1`,children:[(0,J.jsx)(m,{className:`size-3`}),n.kind,`:`,n.actor]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void _(),disabled:l,children:[(0,J.jsx)(s,{className:g(`size-4`,l&&`animate-spin`)}),`Refresh`]})]})]}),d&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-4`}),(0,J.jsx)(`span`,{children:d})]}),(0,J.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[230px_minmax(0,1fr)]`,children:[(0,J.jsx)(`nav`,{className:`space-y-1 lg:sticky lg:top-4 lg:self-start`,children:b.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:g(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,x?.slug===e.slug?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>S(e.slug),children:[(0,J.jsx)(`span`,{className:`block font-medium`,children:e.label}),(0,J.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.description})]},e.slug))}),(0,J.jsx)(`div`,{className:`min-w-0 space-y-4`,children:l&&!e.length?(0,J.jsx)(G,{size:`sm`,children:(0,J.jsx)(U,{className:`text-sm text-muted-foreground`,children:`Loading settings…`})}):x?.kind===`routing`?(0,J.jsx)(st,{canWrite:ie(n?.scopes,`settings:write:routing`)}):x?.kind===`descriptors`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(De,{group:x.label,settings:x.settings,onSaved:C}),x.label===`Providers`&&(0,J.jsx)(We,{canWrite:ie(n?.scopes,`settings:write:provider`)}),x.label===`Notifications`&&(0,J.jsx)(yt,{})]}):x?.kind===`profile`?(0,J.jsx)(bt,{}):x?.kind===`browser`?(0,J.jsx)(je,{}):(0,J.jsx)(Ne,{catalog:i,error:p,canWrite:ie(n?.scopes,`settings:write:provider`),onCatalog:a})})]})]})}function yt(){let[e,t]=(0,K.useState)(`branch.landed`),[n,r]=(0,K.useState)(`{
4
- "repoRoot": "/repo"
5
- }`),[i,a]=(0,K.useState)(null),[o,s]=(0,K.useState)(!1),[l,u]=(0,K.useState)(``);async function d(){s(!0),u(``);try{let t=JSON.parse(n);if(!t||typeof t!=`object`||Array.isArray(t))throw Error(`Scope must be a JSON object`);a((await v(`POST`,`/notifications/preview`,{type:e,scope:t})).preview)}catch(e){a(null),u(e.message)}finally{s(!1)}}return(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Who gets what`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Dry-run notification routing without sending.`})]}),(0,J.jsxs)(L,{size:`sm`,onClick:()=>void d(),disabled:o,children:[(0,J.jsx)(c,{className:`size-4`}),`Preview`]})]}),(0,J.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Type`}),(0,J.jsxs)(F,{value:e,onValueChange:t,children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(j,{})}),(0,J.jsx)(N,{children:ht.map(e=>(0,J.jsx)(P,{value:e,children:e},e))})]})]}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(`label`,{className:`text-xs font-medium text-muted-foreground`,children:`Scope`}),(0,J.jsx)(ce,{value:n,onChange:e=>r(e.target.value),rows:4,className:`font-mono text-xs`})]})]}),l&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-3.5`}),(0,J.jsx)(`span`,{children:l})]}),i&&(0,J.jsx)(`div`,{className:`overflow-hidden rounded-md border border-border`,children:i.recipients.length===0?(0,J.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:`No recipients`}):i.recipients.map(e=>(0,J.jsxs)(`div`,{className:`grid gap-1 border-b border-border px-3 py-2 text-xs last:border-b-0 md:grid-cols-[minmax(0,180px)_minmax(0,160px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`span`,{className:`truncate font-medium`,children:e.recipient}),(0,J.jsx)(`span`,{className:`truncate font-mono text-muted-foreground`,children:e.matchedRule}),(0,J.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.reason})]},`${e.recipient}-${e.matchedRule}`))})]})})}function bt(){let e=k(e=>e.fetchUsers),t=(0,K.useRef)(null),[n,r]=(0,K.useState)(null),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(!0),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(``);async function p(){s(!0),d(``);try{let e=await v(`GET`,`/users/me`);r(e),a(e.displayName||e.handle)}catch(e){d(e.message)}finally{s(!1)}}(0,K.useEffect)(()=>{p()},[]);async function m(){l(!0),d(``);try{let t=await v(`PATCH`,`/users/me`,{displayName:i});r(t),a(t.displayName||t.handle),await e()}catch(e){d(e.message)}finally{l(!1)}}async function h(n){if(n){l(!0),d(``);try{let t=await x(`/users/me/avatar`,n);r(t.user),a(t.user.displayName||t.user.handle),await e()}catch(e){d(e.message)}finally{l(!1),t.current&&(t.current.value=``)}}}async function g(){l(!0),d(``);try{r(await v(`DELETE`,`/users/me/avatar`)),await e()}catch(e){d(e.message)}finally{l(!1)}}return(0,J.jsx)(G,{size:`sm`,children:(0,J.jsxs)(U,{className:`space-y-4`,children:[u&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,J.jsx)(D,{className:`mt-0.5 size-4`}),(0,J.jsx)(`span`,{children:u})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,J.jsx)(le,{user:n??void 0,distinct:!0,className:`size-16 text-lg`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,J.jsx)(`label`,{className:`block text-xs font-medium text-muted-foreground`,htmlFor:`profile-display-name`,children:`Display name`}),(0,J.jsx)(`input`,{id:`profile-display-name`,className:`h-9 w-full rounded-md border border-input bg-background px-3 text-sm`,value:i,onChange:e=>a(e.target.value),disabled:o||c,maxLength:120})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(L,{size:`sm`,onClick:()=>void m(),disabled:o||c||!i.trim(),children:[(0,J.jsx)(S,{className:`size-4`}),`Save`]}),(0,J.jsxs)(L,{size:`sm`,variant:`outline`,onClick:()=>t.current?.click(),disabled:o||c,children:[(0,J.jsx)(w,{className:`size-4`}),`Upload`]}),(0,J.jsxs)(L,{size:`sm`,variant:`outline`,onClick:()=>void g(),disabled:o||c||!n?.avatarArtifactId,children:[(0,J.jsx)(b,{className:`size-4`}),`Remove`]}),c&&(0,J.jsx)(f,{className:`size-4 animate-pulse text-muted-foreground`}),(0,J.jsx)(`input`,{ref:t,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp`,className:`hidden`,onChange:e=>void h(e.target.files?.[0])})]})]})})}export{vt as SettingsView};
6
- //# sourceMappingURL=settings-BhnCGXgo.js.map