@nextclaw/ui 0.20.2 → 0.21.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 (144) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/assets/{api-DvpQWjTS.js → api-DNLQPHfQ.js} +5 -5
  3. package/dist/assets/{appearance-settings-page-U0m0ktu3.js → appearance-settings-page-BlAFMOGV.js} +1 -1
  4. package/dist/assets/{book-open-DRofSTWr.js → book-open-BryfPTTa.js} +1 -1
  5. package/dist/assets/{channels-list-page-BURQarD0.js → channels-list-page-Cfbgubyv.js} +2 -2
  6. package/dist/assets/{config-split-page-BrAQYTIl.js → config-split-page-Dd8xG0Jk.js} +1 -1
  7. package/dist/assets/{confirm-dialog-DDJomLnO.js → confirm-dialog-CZIWjnJ6.js} +2 -2
  8. package/dist/assets/{createLucideIcon-DzkNHr5Z.js → createLucideIcon-BxwVe8ZD.js} +1 -1
  9. package/dist/assets/desktop-capabilities-page-C6YxsHeV.js +1 -0
  10. package/dist/assets/desktop-update-config-BVN4QPJn.js +1 -0
  11. package/dist/assets/{dist-NskPB_yW.js → dist-BRloKr3S.js} +1 -1
  12. package/dist/assets/{dist-DXbLo2b1.js → dist-Cd8Nm3BW.js} +1 -1
  13. package/dist/assets/doc-browser-Bzgqmmiu.js +1 -0
  14. package/dist/assets/doc-browser-D0qI0Z_R.js +1 -0
  15. package/dist/assets/{doc-browser-context-CnKV4gJy.js → doc-browser-context-3JGufiMA.js} +1 -1
  16. package/dist/assets/{extensions-DvlFMpAs.js → extensions-Dedd2oDI.js} +1 -1
  17. package/dist/assets/{form-actions-UnPEZBkx.js → form-actions-FWCEof3V.js} +1 -1
  18. package/dist/assets/index-CXkHcESm.css +1 -0
  19. package/dist/assets/index-D25tRg1p.js +109 -0
  20. package/dist/assets/loader-circle-BoyCoFps.js +1 -0
  21. package/dist/assets/mcp-marketplace-page-Cn-9CDh3.js +1 -0
  22. package/dist/assets/mcp-marketplace-page-e9Rmfz-d.js +10 -0
  23. package/dist/assets/model-config-page-C173Ssil.js +1 -0
  24. package/dist/assets/{navigation-link-NjUdG6Vp.js → navigation-link-DTPOvGGL.js} +1 -1
  25. package/dist/assets/plus-D1R4Vipq.js +1 -0
  26. package/dist/assets/privacy-settings-page-CRserBVF.js +1 -0
  27. package/dist/assets/providers-config-page-C8jUtnZb.js +1 -0
  28. package/dist/assets/react-BAzO6LZS.js +8 -0
  29. package/dist/assets/{refresh-cw-CkeninE0.js → refresh-cw-BCj-yjde.js} +1 -1
  30. package/dist/assets/remote-6BHWP5zi.js +1 -0
  31. package/dist/assets/{rotate-cw-DP33PuXU.js → rotate-cw-BPnW4qUl.js} +1 -1
  32. package/dist/assets/runtime-config-page-aeQ1Dryz.js +1 -0
  33. package/dist/assets/{save-Cw2Xz-pB.js → save-KT0MumfJ.js} +1 -1
  34. package/dist/assets/{search-C2CFAVvd.js → search-Cv1Hx_nx.js} +1 -1
  35. package/dist/assets/{search-config-page-dqNT0Swf.js → search-config-page-b283V-fo.js} +1 -1
  36. package/dist/assets/{secrets-config-page-De6J3wVx.js → secrets-config-page-ss7x3BOo.js} +2 -2
  37. package/dist/assets/security-config-HHz62oxH.js +1 -0
  38. package/dist/assets/{select-DSuMhwVP.js → select-BVgD4EpG.js} +1 -1
  39. package/dist/assets/skeleton-ChUmcyys.js +1 -0
  40. package/dist/assets/{tag-chip-DFBLgsGf.js → tag-chip-DZ4ircUB.js} +1 -1
  41. package/dist/assets/x-BWDRfVWL.js +1 -0
  42. package/dist/index.html +21 -21
  43. package/package.json +5 -5
  44. package/src/app/components/layout/sidebar.tsx +12 -1
  45. package/src/app/configs/app-navigation.config.ts +17 -2
  46. package/src/app/hooks/use-feature-controls.ts +11 -0
  47. package/src/app/index.tsx +10 -0
  48. package/src/features/apps/components/app-package-card.tsx +29 -7
  49. package/src/features/apps/components/app-packages-panel.tsx +4 -0
  50. package/src/features/chat/components/conversation/chat-conversation-content.tsx +18 -2
  51. package/src/features/chat/components/conversation/chat-conversation-workspace-section.tsx +6 -0
  52. package/src/features/chat/components/layout/__tests__/chat-sidebar-session-area.test.tsx +16 -2
  53. package/src/features/chat/components/layout/chat-page-shell.tsx +19 -2
  54. package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +16 -0
  55. package/src/features/chat/components/layout/chat-sidebar.tsx +5 -1
  56. package/src/features/chat/features/message/utils/__tests__/chat-message-timeline-compaction.utils.test.ts +2 -2
  57. package/src/features/chat/features/message/utils/chat-message-timeline.utils.ts +2 -2
  58. package/src/features/chat/features/ncp/hooks/__tests__/use-ncp-session-list-view.test.tsx +11 -3
  59. package/src/features/chat/features/ncp/hooks/use-ncp-session-list-view.ts +12 -5
  60. package/src/features/chat/features/ncp/hooks/use-ncp-session-queries.ts +15 -1
  61. package/src/features/chat/features/session/components/__tests__/chat-sidebar-session-item.test.tsx +12 -0
  62. package/src/features/chat/features/session/components/chat-sidebar-session-entry.tsx +3 -0
  63. package/src/features/chat/features/session/components/chat-sidebar-session-item.tsx +14 -1
  64. package/src/features/chat/features/session/utils/chat-session-deletion.utils.ts +25 -0
  65. package/src/features/chat/features/workspace/components/__tests__/chat-session-token-usage.test.tsx +4 -1
  66. package/src/features/chat/features/workspace/components/__tests__/chat-session-workspace-file-preview.scroll-restoration.test.tsx +182 -0
  67. package/src/features/chat/features/workspace/components/__tests__/session-cron-job-content.test.tsx +78 -0
  68. package/src/features/chat/features/workspace/components/chat-session-workspace-file-preview.tsx +47 -2
  69. package/src/features/chat/features/workspace/components/chat-session-workspace-panel-content.tsx +14 -1
  70. package/src/features/chat/features/workspace/components/chat-session-workspace-panel.tsx +9 -0
  71. package/src/features/chat/features/workspace/components/overview/chat-session-token-usage.tsx +17 -0
  72. package/src/features/chat/features/workspace/components/session-cron-job-content.tsx +269 -75
  73. package/src/features/chat/features/workspace/hooks/use-chat-conversation-workspace-state.ts +5 -0
  74. package/src/features/chat/managers/__tests__/chat-thread-deletion.manager.test.ts +125 -0
  75. package/src/features/chat/managers/__tests__/chat-thread.manager.test.ts +0 -37
  76. package/src/features/chat/managers/chat-thread.manager.ts +17 -28
  77. package/src/features/cron/components/__tests__/cron-config.test.tsx +16 -5
  78. package/src/features/cron/components/cron-config.tsx +20 -46
  79. package/src/features/cron/components/cron-job-row.tsx +1 -1
  80. package/src/features/cron/hooks/__tests__/use-cron-job-actions.test.tsx +95 -0
  81. package/src/features/cron/hooks/use-cron-job-actions.ts +109 -0
  82. package/src/features/cron/index.ts +2 -0
  83. package/src/features/desktop-capabilities/components/desktop-authorization-dialog.test.tsx +58 -0
  84. package/src/features/desktop-capabilities/components/desktop-authorization-dialog.tsx +161 -0
  85. package/src/features/desktop-capabilities/hooks/use-desktop-capabilities.test.ts +10 -0
  86. package/src/features/desktop-capabilities/hooks/use-desktop-capabilities.ts +55 -0
  87. package/src/features/desktop-capabilities/index.ts +1 -0
  88. package/src/features/desktop-capabilities/managers/desktop-capability.manager.ts +25 -0
  89. package/src/features/desktop-capabilities/pages/desktop-capabilities-page.test.tsx +44 -0
  90. package/src/features/desktop-capabilities/pages/desktop-capabilities-page.tsx +171 -0
  91. package/src/features/desktop-capabilities/stores/desktop-authorization.store.ts +21 -0
  92. package/src/features/inbox/pages/inbox-page.tsx +18 -2
  93. package/src/features/marketplace/components/marketplace-page.tsx +7 -0
  94. package/src/features/marketplace/components/mcp/__tests__/mcp-connection-dialog.test.tsx +23 -0
  95. package/src/features/marketplace/components/mcp/mcp-connection-dialog.tsx +35 -0
  96. package/src/features/marketplace/components/mcp/mcp-marketplace-page.tsx +20 -2
  97. package/src/features/panel-apps/pages/panel-app-main-page.tsx +8 -0
  98. package/src/platforms/desktop/components/desktop-app-shell.tsx +10 -1
  99. package/src/platforms/mobile/components/mobile-settings-shell.tsx +5 -1
  100. package/src/shared/components/doc-browser/doc-browser.tsx +0 -1
  101. package/src/shared/components/doc-browser/hooks/use-doc-browser-scroll-restoration.ts +9 -113
  102. package/src/shared/components/ui/__tests__/confirm-dialog.test.tsx +31 -0
  103. package/src/shared/components/ui/confirm-dialog.tsx +11 -1
  104. package/src/shared/hooks/use-panel-app-scroll-restoration.test.tsx +66 -0
  105. package/src/shared/hooks/use-panel-app-scroll-restoration.ts +107 -0
  106. package/src/shared/hooks/use-scroll-restoration.test.tsx +62 -0
  107. package/src/shared/hooks/use-scroll-restoration.ts +61 -0
  108. package/src/shared/lib/api/index.ts +1 -0
  109. package/src/shared/lib/api/ncp-session-query-cache.utils.ts +1 -0
  110. package/src/shared/lib/api/ncp-session.types.ts +3 -0
  111. package/src/shared/lib/api/types.ts +1 -0
  112. package/src/shared/lib/api/utils/mcp-connection.utils.ts +10 -0
  113. package/src/shared/lib/api/utils/ncp-session.utils.ts +3 -0
  114. package/src/shared/lib/i18n/locales/en-US/chat.json +10 -5
  115. package/src/shared/lib/i18n/locales/en-US/core.json +43 -0
  116. package/src/shared/lib/i18n/locales/en-US/cron.json +4 -2
  117. package/src/shared/lib/i18n/locales/en-US/doc-browser.json +1 -0
  118. package/src/shared/lib/i18n/locales/en-US/marketplace.json +29 -1
  119. package/src/shared/lib/i18n/locales/zh-CN/chat.json +10 -5
  120. package/src/shared/lib/i18n/locales/zh-CN/core.json +43 -0
  121. package/src/shared/lib/i18n/locales/zh-CN/cron.json +4 -2
  122. package/src/shared/lib/i18n/locales/zh-CN/doc-browser.json +1 -0
  123. package/src/shared/lib/i18n/locales/zh-CN/marketplace.json +29 -1
  124. package/src/shared/lib/navigation-history/index.ts +1 -0
  125. package/src/shared/lib/navigation-history/scroll-restoration.manager.test.ts +37 -0
  126. package/src/shared/lib/navigation-history/scroll-restoration.manager.ts +60 -0
  127. package/dist/assets/desktop-update-config-BzZFhMv9.js +0 -1
  128. package/dist/assets/doc-browser-DB22tQKU.js +0 -1
  129. package/dist/assets/doc-browser-sJjw9fl5.js +0 -1
  130. package/dist/assets/index-Dc_ZMkmo.css +0 -1
  131. package/dist/assets/index-N1HnesBp.js +0 -109
  132. package/dist/assets/loader-circle-BlPXxgDB.js +0 -1
  133. package/dist/assets/mcp-marketplace-page-BIgFTbMq.js +0 -9
  134. package/dist/assets/mcp-marketplace-page-CZN4ovdK.js +0 -1
  135. package/dist/assets/model-config-page-CnSm7kfa.js +0 -1
  136. package/dist/assets/plus-DVXol9Q5.js +0 -1
  137. package/dist/assets/privacy-settings-page-DVn2HU7W.js +0 -1
  138. package/dist/assets/providers-config-page-CzHJS3eg.js +0 -1
  139. package/dist/assets/react-DCVbGroo.js +0 -8
  140. package/dist/assets/remote-B2lsJF1c.js +0 -1
  141. package/dist/assets/runtime-config-page-D69buyGp.js +0 -1
  142. package/dist/assets/security-config-Dcu9C4OL.js +0 -1
  143. package/dist/assets/skeleton-QoWydNLp.js +0 -1
  144. package/dist/assets/x-BXvAzpjb.js +0 -1
@@ -1 +0,0 @@
1
- import{st as e}from"./index-N1HnesBp.js";export{e as RemoteAccessPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{B as t,H as n,a as r}from"./react-DCVbGroo.js";import{$t as i,Bt as a,Jt as o,Qt as s,Xt as c,an as l,hn as u,in as d,ln as f,nn as p,rn as m,un as h}from"./api-DvpQWjTS.js";import{g}from"./mcp-marketplace-page-BIgFTbMq.js";import{a as _,i as v,n as y,r as b,t as x}from"./select-DSuMhwVP.js";import{t as S}from"./loader-circle-BlPXxgDB.js";import{t as C}from"./plus-DVXol9Q5.js";import{t as w}from"./rotate-cw-DP33PuXU.js";import{t as T}from"./save-Cw2Xz-pB.js";import{O as ee,dt as te,ht as E,i as D,l as O,o as k,r as A,ut as j}from"./index-N1HnesBp.js";import{t as M}from"./form-actions-UnPEZBkx.js";var N=e(n(),1),P=t(),F={healthy:`runtimeControlHealthy`,"starting-service":`runtimeControlStartingService`,"restarting-service":`runtimeControlRestartingService`,"stopping-service":`runtimeControlStoppingService`,"restarting-app":`runtimeControlRestartingApp`,recovering:`runtimeControlRecovering`,failed:`runtimeControlFailed`},I={running:`runtimeControlServiceRunning`,stopped:`runtimeControlServiceStopped`,starting:`runtimeControlServiceStarting`,stopping:`runtimeControlServiceStopping`,restarting:`runtimeControlServiceRestarting`},L={"desktop-embedded":`runtimeControlEnvironmentDesktop`,"managed-local-service":`runtimeControlEnvironmentManagedService`,"self-hosted-web":`runtimeControlEnvironmentSelfHosted`,"shared-web":`runtimeControlEnvironmentSharedWeb`};function R(e){return r(F[e]??`runtimeControlUnavailable`)}function z(e){return r(I[e]??`runtimeControlServiceUnknown`)}function B(e){return r(L[e.environment])}function V(e,t){return t===`start-service`?e?.canStartService:t===`stop-service`?e?.canStopService:e?.canRestartService}function H(e){return e?[{action:`start-service`,capability:e.canStartService,label:r(`runtimeControlStartService`),icon:`play`},{action:`restart-service`,capability:e.canRestartService,label:r(`runtimeControlRestartService`),icon:`rotate`},{action:`stop-service`,capability:e.canStopService,label:r(`runtimeControlStopService`),icon:`square`,variant:`destructive`},{action:`restart-app`,capability:e.canRestartApp,label:r(`runtimeControlRestartApp`),icon:`rotate`,variant:`secondary`}].filter(e=>e.capability.available||!!e.capability.reasonIfUnavailable):[]}function U(e){let{busy:t,icon:n}=e;return t?(0,P.jsx)(S,{className:`mr-2 h-4 w-4 animate-spin`}):n===`play`?(0,P.jsx)(E,{className:`mr-2 h-4 w-4`}):n===`square`?(0,P.jsx)(te,{className:`mr-2 h-4 w-4`}):(0,P.jsx)(w,{className:`mr-2 h-4 w-4`})}function W(){let{busy:e,busyAction:t,controlView:n,errorMessage:a,pendingRestart:c,visibleLifecycle:l,visibleMessage:f,visibleServiceState:p}=o(),g=H(n??void 0),_=async e=>{let t=V(n,e);if(!t?.available){u.error(i(t?.reasonIfUnavailable)??r(`runtimeControlLoadFailed`));return}if(!(e===`stop-service`&&t.requiresConfirmation&&!window.confirm(r(`runtimeControlStopServiceConfirm`))))try{let t=await s.runRuntimeControlAction(e);u.success(i(t.message)??t.message)}catch(e){let t=e instanceof Error?e.message:r(`runtimeControlActionFailed`);u.error(`${r(`runtimeControlActionFailed`)}: ${t}`)}},v=async()=>{if(!n?.canRestartApp.available){u.error(i(n?.canRestartApp.reasonIfUnavailable)??r(`runtimeRestartAppUnavailable`));return}if(window.confirm(r(`runtimeControlRestartAppConfirm`)))try{let e=await s.runRuntimeControlAction(`restart-app`);u.success(i(e.message)??e.message)}catch(e){let t=e instanceof Error?e.message:r(`runtimeControlActionFailed`);u.error(`${r(`runtimeControlActionFailed`)}: ${t}`)}};return(0,P.jsx)(d,{title:r(`runtimeControlTitle`),description:r(`runtimeControlDescription`),children:(0,P.jsxs)(m,{children:[(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 md:flex-row md:items-center md:justify-between`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:z(p)}),(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:n?B(n):r(`runtimeControlLoading`)})]}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:R(l)}),n?.managementHint?(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(n.managementHint)}):null,a&&!e?(0,P.jsx)(`p`,{className:`text-sm text-amber-700`,children:a}):null]}),c?(0,P.jsxs)(`div`,{className:`space-y-3 bg-amber-50/75 p-4 dark:bg-amber-950/20`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-amber-900`,children:r(`runtimeControlPendingRestartTitle`)}),(0,P.jsx)(`p`,{className:`text-sm text-amber-800`,children:r(`runtimeControlPendingRestartDescription`)}),c.changedPaths.length>0?(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-amber-700`,children:r(`runtimeControlPendingRestartPaths`)}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.changedPaths.map(e=>(0,P.jsx)(`span`,{className:`rounded-full bg-background/80 px-2.5 py-1 text-xs text-amber-800 dark:text-amber-300`,children:e},e))})]}):null]}):null,(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsx)(`div`,{className:`flex flex-col gap-3 md:flex-row md:flex-wrap`,children:g.map(n=>(0,P.jsxs)(h,{type:`button`,variant:n.variant??`default`,onClick:()=>{if(n.action===`restart-app`){v();return}_(n.action)},disabled:!n.capability.available||e,children:[(0,P.jsx)(U,{icon:n.icon,busy:t===n.action}),n.label]},n.action))}),g.filter(e=>!e.capability.available&&e.capability.reasonIfUnavailable).map(e=>(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(e.capability.reasonIfUnavailable)},`${e.action}-reason`))]})]})})}function G(e){let{description:t,title:n}=e;return(0,P.jsx)(g,{tone:`neutral`,title:n,description:t})}function K(e){let{children:t}=e;return(0,P.jsx)(d,{title:r(`runtimePresenceTitle`),description:r(`runtimePresenceDescription`),children:(0,P.jsx)(m,{children:t})})}function ne(){let e=c().runtimeControlView?.environment,t=D(e=>e.supported),n=D(e=>e.initialized),i=D(e=>e.busyAction),o=D(e=>e.snapshot);return(0,N.useEffect)(()=>{if(e===`desktop-embedded`){A.start();return}A.markUnsupported()},[e]),e===`desktop-embedded`?(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(g,{tone:`neutral`,title:r(`runtimePresenceBehaviorLabel`),description:o?.closeToBackground?r(`runtimePresenceBehaviorBackground`):r(`runtimePresenceBehaviorQuit`),className:`rounded-xl`})}),!n||t&&!o?(0,P.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:r(`runtimePresenceLoading`)}):null,o?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(p,{title:r(`runtimePresenceCloseToBackground`),description:r(`runtimePresenceCloseToBackgroundHelp`),control:(0,P.jsx)(a,{id:`runtime-presence-close-background`,"aria-label":r(`runtimePresenceCloseToBackground`),checked:o.closeToBackground,disabled:i===`saving-preferences`,onCheckedChange:e=>{A.updatePreferences({closeToBackground:e})}})}),(0,P.jsx)(p,{title:r(`runtimePresenceLaunchAtLogin`),description:o.supportsLaunchAtLogin?r(`runtimePresenceLaunchAtLoginHelp`):o.launchAtLoginReason??r(`runtimePresenceLaunchAtLoginUnavailable`),control:(0,P.jsx)(a,{id:`runtime-presence-launch-login`,"aria-label":r(`runtimePresenceLaunchAtLogin`),checked:o.launchAtLogin,disabled:!o.supportsLaunchAtLogin||i===`saving-preferences`,onCheckedChange:e=>{A.updatePreferences({launchAtLogin:e})}})})]}):null]}):e===`managed-local-service`?(0,P.jsx)(K,{children:(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(G,{title:r(`runtimePresenceManagedLocalTitle`),description:r(`runtimePresenceManagedLocalDescription`)})})}):e===`self-hosted-web`?(0,P.jsx)(K,{children:(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(G,{title:r(`runtimePresenceSelfHostedTitle`),description:r(`runtimePresenceSelfHostedDescription`)})})}):e===`shared-web`?(0,P.jsx)(K,{children:(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(G,{title:r(`runtimePresenceSharedTitle`),description:r(`runtimePresenceSharedDescription`)})})}):(0,P.jsx)(K,{children:(0,P.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,children:r(`runtimePresenceLoading`)})})}function q(){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(W,{}),(0,P.jsx)(ne,{}),(0,P.jsx)(k,{})]})}var J={wireDialect:`acp`,processScope:`per-session`,command:``,args:[`acp`],env:{},cwd:``,startupTimeoutMs:8e3,probeTimeoutMs:3e3,requestTimeoutMs:12e4};function Y(){return{id:``,default:!1,workspace:``,model:``,runtime:``,contextTokens:void 0,maxToolIterations:void 0}}function X(){return{agentId:``,match:{channel:``,accountId:``}}}function Z(){return{id:``,enabled:!0,label:``,type:`narp-stdio`,config:J,configText:JSON.stringify(J,null,2)}}function re(e){return{id:e.id??``,default:!!e.default,displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,workspace:e.workspace??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:e.contextTokens,maxToolIterations:e.maxToolIterations}}function ie(e){return{agentId:e.agentId??``,match:{channel:e.match?.channel??``,accountId:e.match?.accountId??``,peer:e.match?.peer?{kind:e.match.peer.kind,id:e.match.peer.id}:void 0}}}function Q(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);return Number.isFinite(n)?n:void 0}function $(e){return{companionEnabled:e.companion?.enabled===!0,agents:(e.agents.list??[]).map(re),bindings:(e.bindings??[]).map(ie),runtimeEntries:Object.entries(e.agents.runtimes?.entries??{}).map(([e,t])=>({id:e,enabled:t.enabled!==!1,label:t.label??``,type:t.type,config:t.config??{},configText:JSON.stringify(t.config??{},null,2)})),dmScope:e.session?.dmScope??`per-channel-peer`,defaultContextTokens:e.agents.defaults.contextTokens??2e5,defaultEngine:e.agents.defaults.engine??`native`}}function ae(e){let t={id:e.id.trim()};e.default&&(t.default=!0),e.displayName?.trim()&&(t.displayName=e.displayName.trim()),e.description?.trim()&&(t.description=e.description.trim()),e.avatar?.trim()&&(t.avatar=e.avatar.trim()),e.workspace?.trim()&&(t.workspace=e.workspace.trim()),e.model?.trim()&&(t.model=e.model.trim());let n=e.runtime?.trim()??e.engine?.trim();return n&&(t.engine=n),typeof e.contextTokens==`number`&&(t.contextTokens=Math.max(1e3,e.contextTokens)),typeof e.maxToolIterations==`number`&&(t.maxToolIterations=e.maxToolIterations),t}function oe(e){let t=e.agents.map((e,t)=>{if(!e.id.trim())throw Error(r(`agentIdRequiredError`).replace(`{index}`,String(t)));return ae(e)}),n=t.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t);if(n.length>0)throw Error(`${r(`duplicateAgentId`)}: ${n[0]}`);let i=e.bindings.map((t,n)=>{let i=t.agentId.trim(),a=t.match.channel.trim(),o=t.match.accountId?.trim()??``,s=t.match.peer?.kind,c=t.match.peer?.id?.trim()??``;if(!i)throw Error(r(`bindingAgentIdRequired`).replace(`{index}`,String(n)));if(!e.knownAgentIds.has(i))throw Error(`${r(`bindingAgentIdNotFound`).replace(`{index}`,String(n))}: ${i}`);if(!a)throw Error(r(`bindingChannelRequired`).replace(`{index}`,String(n)));let l={agentId:i,match:{channel:a}};if(o&&(l.match.accountId=o),s){if(!c)throw Error(r(`bindingPeerIdRequired`).replace(`{index}`,String(n)));l.match.peer={kind:s,id:c}}return l}),a=e.runtimeEntries.reduce((e,t,n)=>{let i=t.id.trim(),a=t.type.trim();if(!i)throw Error(r(`runtimeEntryIdRequired`).replace(`{index}`,String(n)));if(!a)throw Error(r(`runtimeEntryTypeRequired`).replace(`{id}`,i));if(e[i])throw Error(`${r(`runtimeEntryDuplicate`)}: ${i}`);let o=t.configText.trim()?JSON.parse(t.configText):{};if(o&&(typeof o!=`object`||Array.isArray(o)))throw Error(r(`runtimeEntryConfigObjectRequired`).replace(`{id}`,i));return e[i]={enabled:t.enabled!==!1,...t.label?.trim()?{label:t.label.trim()}:{},type:a,config:o??{}},e},{});return{companion:{enabled:e.companionEnabled},agents:{defaults:{contextTokens:Math.max(1e3,e.defaultContextTokens),engine:e.defaultEngine.trim()||`native`},list:t,runtimes:{entries:a}},bindings:i,session:{dmScope:e.dmScope}}}function se({agents:e,onAddAgent:t,onRemoveAgent:n,onSetDefaultAgent:i,onUpdateAgent:o}){return(0,P.jsx)(d,{title:r(`agentList`),description:r(`agentListHelp`),actions:(0,P.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,P.jsx)(C,{className:`mr-2 h-4 w-4`}),r(`addAgent`)]}),children:(0,P.jsx)(m,{children:e.map((e,t)=>(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,P.jsx)(f,{value:e.id,onChange:e=>o(t,{id:e.target.value}),placeholder:r(`agentIdPlaceholder`)}),(0,P.jsx)(f,{value:e.workspace??``,onChange:e=>o(t,{workspace:e.target.value}),placeholder:r(`workspaceOverridePlaceholder`)}),(0,P.jsx)(f,{value:e.model??``,onChange:e=>o(t,{model:e.target.value}),placeholder:r(`modelOverridePlaceholder`)}),(0,P.jsx)(f,{value:e.runtime??e.engine??``,onChange:e=>o(t,{runtime:e.target.value}),placeholder:r(`engineOverridePlaceholder`)}),(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-2`,children:[(0,P.jsx)(f,{type:`number`,min:1e3,step:1e3,value:e.contextTokens??``,onChange:e=>o(t,{contextTokens:Q(e.target.value)}),placeholder:r(`contextTokensPlaceholder`)}),(0,P.jsx)(f,{type:`number`,min:1,value:e.maxToolIterations??``,onChange:e=>o(t,{maxToolIterations:Q(e.target.value)}),placeholder:r(`maxToolsPlaceholder`)})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,P.jsx)(a,{checked:!!e.default,onCheckedChange:e=>i(t,e)}),(0,P.jsx)(`span`,{children:r(`defaultAgent`)})]}),(0,P.jsxs)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>n(t),children:[(0,P.jsx)(j,{className:`h-4 w-4 mr-1`}),r(`remove`)]})]})]},`${t}-${e.id}`))})})}function ce({bindings:e,onAddBinding:t,onRemoveBinding:n,onUpdateBinding:i}){return(0,P.jsx)(d,{title:r(`bindings`),description:r(`bindingsHelp`),actions:(0,P.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,P.jsx)(C,{className:`mr-2 h-4 w-4`}),r(`addBinding`)]}),children:(0,P.jsx)(m,{children:e.map((e,t)=>{let a=e.match.peer?.kind??``;return(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,P.jsx)(f,{value:e.agentId,onChange:n=>i(t,{...e,agentId:n.target.value}),placeholder:r(`targetAgentIdPlaceholder`)}),(0,P.jsx)(f,{value:e.match.channel,onChange:n=>i(t,{...e,match:{...e.match,channel:n.target.value}}),placeholder:r(`channelPlaceholder`)}),(0,P.jsx)(f,{value:e.match.accountId??``,onChange:n=>i(t,{...e,match:{...e.match,accountId:n.target.value}}),placeholder:r(`accountIdOptionalPlaceholder`)}),(0,P.jsxs)(x,{value:a||`__none__`,onValueChange:n=>{let r=n===`__none__`?``:n;i(t,r?{...e,match:{...e.match,peer:{kind:r,id:e.match.peer?.id??``}}}:{...e,match:{...e.match,peer:void 0}})},children:[(0,P.jsx)(v,{children:(0,P.jsx)(_,{})}),(0,P.jsxs)(y,{children:[(0,P.jsx)(b,{value:`__none__`,children:r(`peerKindOptional`)}),(0,P.jsx)(b,{value:`direct`,children:r(`peerKindDirect`)}),(0,P.jsx)(b,{value:`group`,children:r(`peerKindGroup`)}),(0,P.jsx)(b,{value:`channel`,children:r(`peerKindChannel`)})]})]}),(0,P.jsx)(f,{value:e.match.peer?.id??``,onChange:n=>i(t,{...e,match:{...e.match,peer:a?{kind:a,id:n.target.value}:void 0}}),placeholder:r(`peerIdPlaceholder`)})]}),(0,P.jsx)(`div`,{className:`flex justify-end`,children:(0,P.jsxs)(h,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>n(t),children:[(0,P.jsx)(j,{className:`h-4 w-4 mr-1`}),r(`remove`)]})})]},`${t}-${e.agentId}`)})})})}function le({entries:e,onAddEntry:t,onRemoveEntry:n,onUpdateEntry:i}){return(0,P.jsx)(d,{title:r(`runtimeEntries`),description:r(`runtimeEntriesHelp`),actions:(0,P.jsxs)(h,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:[(0,P.jsx)(C,{className:`mr-2 h-4 w-4`}),r(`addRuntimeEntry`)]}),children:(0,P.jsx)(m,{children:e.map((e,t)=>(0,P.jsxs)(`div`,{className:`space-y-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,P.jsx)(f,{value:e.id,onChange:e=>i(t,{id:e.target.value}),placeholder:r(`runtimeEntryIdPlaceholder`)}),(0,P.jsx)(f,{value:e.label??``,onChange:e=>i(t,{label:e.target.value}),placeholder:r(`runtimeEntryLabelPlaceholder`)}),(0,P.jsx)(f,{value:e.type,onChange:e=>i(t,{type:e.target.value}),placeholder:r(`runtimeEntryTypePlaceholder`)}),(0,P.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg bg-background/65 px-3 py-2`,children:[(0,P.jsx)(`span`,{className:`text-sm text-foreground`,children:r(`enabled`)}),(0,P.jsx)(a,{checked:e.enabled!==!1,onCheckedChange:e=>i(t,{enabled:e})})]})]}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-foreground`,children:r(`runtimeEntryConfigJson`)}),(0,P.jsx)(`textarea`,{className:`min-h-32 w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-sm`,value:e.configText,onChange:e=>i(t,{configText:e.target.value}),spellCheck:!1})]}),(0,P.jsx)(`div`,{className:`flex justify-end`,children:(0,P.jsxs)(h,{type:`button`,variant:`outline`,onClick:()=>n(t),children:[(0,P.jsx)(j,{className:`mr-2 h-4 w-4`}),r(`delete`)]})})]},`${t}-${e.id||`runtime-entry`}`))})})}var ue=[{value:`main`,labelKey:`dmScopeMain`},{value:`per-peer`,labelKey:`dmScopePerPeer`},{value:`per-channel-peer`,labelKey:`dmScopePerChannelPeer`},{value:`per-account-channel-peer`,labelKey:`dmScopePerAccountChannelPeer`}];function de({companionEnabled:e,defaultContextTokens:t,defaultEngine:n,dmScope:i,onCompanionEnabledChange:o,onDefaultContextTokensChange:s,onDefaultEngineChange:c,onDmScopeChange:l}){return(0,P.jsx)(d,{title:r(`dmScope`),description:r(`dmScopeHelp`),children:(0,P.jsxs)(m,{children:[(0,P.jsx)(p,{title:r(`runtimeCompanionEnabled`),description:r(`runtimeCompanionEnabledHelp`),control:(0,P.jsx)(a,{checked:e,onCheckedChange:o})}),(0,P.jsx)(p,{title:r(`defaultContextTokens`),description:r(`defaultContextTokensHelp`),control:(0,P.jsx)(f,{type:`number`,min:1e3,step:1e3,value:t,onChange:e=>s(Math.max(1e3,Number.parseInt(e.target.value,10)||1e3)),className:`w-36`})}),(0,P.jsx)(p,{title:r(`defaultEngine`),description:r(`defaultEngineHelp`),control:(0,P.jsx)(f,{value:n,onChange:e=>c(e.target.value),placeholder:r(`defaultEnginePlaceholder`),className:`w-56`})}),(0,P.jsx)(p,{title:r(`dmScope`),control:(0,P.jsxs)(x,{value:i,onValueChange:e=>l(e),children:[(0,P.jsx)(v,{className:`w-56`,children:(0,P.jsx)(_,{})}),(0,P.jsx)(y,{children:ue.map(e=>(0,P.jsx)(b,{value:e.value,children:r(e.labelKey)},e.value))})]})})]})})}function fe({config:e,updateRuntime:t}){let n=(0,N.useMemo)(()=>$(e),[e]),[i,a]=(0,N.useState)(n.agents),[o,s]=(0,N.useState)(n.bindings),[c,d]=(0,N.useState)(n.runtimeEntries),[f,p]=(0,N.useState)(n.dmScope),[m,g]=(0,N.useState)(n.companionEnabled),[_,v]=(0,N.useState)(n.defaultContextTokens),[y,b]=(0,N.useState)(n.defaultEngine),x=(0,N.useMemo)(()=>{let e=new Set([`main`]);return i.forEach(t=>{let n=t.id.trim();n&&e.add(n)}),e},[i]);return(0,P.jsxs)(l,{title:r(`runtimePageTitle`),description:r(`runtimePageDescription`),children:[(0,P.jsx)(q,{}),(0,P.jsx)(de,{companionEnabled:m,dmScope:f,defaultContextTokens:_,defaultEngine:y,onCompanionEnabledChange:g,onDmScopeChange:p,onDefaultContextTokensChange:v,onDefaultEngineChange:b}),(0,P.jsx)(le,{entries:c,onUpdateEntry:(e,t)=>d(n=>n.map((n,r)=>r===e?{...n,...t}:n)),onRemoveEntry:e=>d(t=>t.filter((t,n)=>n!==e)),onAddEntry:()=>d(e=>[...e,Z()])}),(0,P.jsx)(se,{agents:i,onUpdateAgent:(e,t)=>{a(n=>n.map((n,r)=>r===e?{...n,...t}:n))},onRemoveAgent:e=>a(t=>t.filter((t,n)=>n!==e)),onAddAgent:()=>a(e=>[...e,Y()]),onSetDefaultAgent:(e,t)=>a(n=>t?n.map((t,n)=>({...t,default:n===e})):n.map((t,n)=>n===e?{...t,default:!1}:t))}),(0,P.jsx)(ce,{bindings:o,onUpdateBinding:(e,t)=>{s(n=>n.map((n,r)=>r===e?t:n))},onRemoveBinding:e=>s(t=>t.filter((t,n)=>n!==e)),onAddBinding:()=>s(e=>[...e,X()])}),(0,P.jsx)(M,{children:(0,P.jsxs)(h,{type:`button`,size:`sm`,onClick:()=>{try{let e=oe({companionEnabled:m,agents:i,bindings:o,runtimeEntries:c,dmScope:f,defaultContextTokens:_,defaultEngine:y,knownAgentIds:x});t.mutate({data:e})}catch(e){u.error(e instanceof Error?e.message:String(e))}},disabled:t.isPending,children:[(0,P.jsx)(T,{className:`mr-1.5 h-3.5 w-3.5`}),t.isPending?r(`saving`):r(`saveRuntimeSettings`)]})})]})}function pe(){let{data:e,isLoading:t}=O(),n=ee();return t||!e?(0,P.jsx)(l,{title:r(`runtimePageTitle`),description:r(`runtimePageDescription`),children:(0,P.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:r(`runtimeLoading`)})}):(0,P.jsx)(fe,{config:e,updateRuntime:n})}export{pe as RuntimeConfig};
@@ -1 +0,0 @@
1
- import{It as e}from"./api-DvpQWjTS.js";export{e as SecurityConfig};
@@ -1 +0,0 @@
1
- import{B as e,L as t}from"./react-DCVbGroo.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`animate-pulse rounded-md bg-slate-200`,e),...r})}export{r as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DzkNHr5Z.js";var t=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};