@nextclaw/ui 0.12.4 → 0.12.6

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 (149) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/dist/assets/ChannelsList-D8p4OlM6.js +8 -0
  3. package/dist/assets/ChatPage-A45t1Rmf.js +58 -0
  4. package/dist/assets/DocBrowser-B2MpsnU9.js +1 -0
  5. package/dist/assets/{DocBrowser-NSzgVKka.js → DocBrowser-Cse_F8Nn.js} +1 -1
  6. package/dist/assets/{DocBrowserContext-DpgVdRgk.js → DocBrowserContext-Bai1WU2H.js} +1 -1
  7. package/dist/assets/{LogoBadge-CHS4YNLw.js → LogoBadge-BdxMPc9v.js} +1 -1
  8. package/dist/assets/MarketplacePage-BNZ3Jx5d.js +1 -0
  9. package/dist/assets/MarketplacePage-BbpAkllU.js +49 -0
  10. package/dist/assets/McpMarketplacePage-CxPFOgxv.js +40 -0
  11. package/dist/assets/ModelConfig-3GLqQ5GY.js +1 -0
  12. package/dist/assets/ProviderScopedModelInput-BYNouw-i.js +1 -0
  13. package/dist/assets/ProvidersList-BR1gJ4Dm.js +1 -0
  14. package/dist/assets/{RemoteAccessPage-yfbrveNQ.js → RemoteAccessPage-DyYVWsyK.js} +1 -1
  15. package/dist/assets/RuntimeConfig-ChdfK4Y_.js +1 -0
  16. package/dist/assets/SearchConfig-DTeJvp8m.js +1 -0
  17. package/dist/assets/{SecretsConfig-CLFSSoTl.js → SecretsConfig-CCYO6NcV.js} +2 -2
  18. package/dist/assets/SessionsConfig-Du39vDgt.js +2 -0
  19. package/dist/assets/app-query-client-Dr5d-K8d.js +1 -0
  20. package/dist/assets/{book-open-C7TAghTk.js → book-open-Da4OEPqB.js} +1 -1
  21. package/dist/assets/chat-session-display-CAlPrnlV.js +1 -0
  22. package/dist/assets/{chunk-JZWAC4HX-DbL4EmiT.js → chunk-JZWAC4HX-CoFVxHXV.js} +1 -1
  23. package/dist/assets/client-CSk58DcF.js +7 -0
  24. package/dist/assets/config-D8KzikVB.js +1 -0
  25. package/dist/assets/{createLucideIcon-BRLFtf-8.js → createLucideIcon-83gaZMtv.js} +1 -1
  26. package/dist/assets/desktop-update-config-CfoVwf-w.js +1 -0
  27. package/dist/assets/dist-aTmhMDVh.js +9 -0
  28. package/dist/assets/{dist-DP-JKR4G.js → dist-toEYs-MZ.js} +1 -1
  29. package/dist/assets/{external-link-BkJkiWbH.js → external-link-QQ0TC6X4.js} +1 -1
  30. package/dist/assets/{hash-CbP6-6R9.js → hash-DaFBEkmi.js} +1 -1
  31. package/dist/assets/i18n-C3jb83S6.js +1 -0
  32. package/dist/assets/index-CE4N7ItL.css +1 -0
  33. package/dist/assets/index-riX7Sg0_.js +6 -0
  34. package/dist/assets/infiniteQueryBehavior-BmHX_ayZ.js +1 -0
  35. package/dist/assets/loader-circle-BjMg63eu.js +1 -0
  36. package/dist/assets/{logos-N3dbS6-I.js → logos-Dzlz30M3.js} +1 -1
  37. package/dist/assets/{page-layout-DyuvlNrg.js → page-layout-D2eRufRQ.js} +1 -1
  38. package/dist/assets/plus-CIXME2pD.js +1 -0
  39. package/dist/assets/{popover-BKKWGUaG.js → popover-BSXxm5bj.js} +1 -1
  40. package/dist/assets/{refresh-ccw-BGMdiNGq.js → refresh-ccw-B3zMtN-_.js} +1 -1
  41. package/dist/assets/refresh-cw-DlZkIHnJ.js +1 -0
  42. package/dist/assets/{save-Dh4GQzzX.js → save-Us9fg4Sj.js} +1 -1
  43. package/dist/assets/search-B_Qr0f6C.js +1 -0
  44. package/dist/assets/security-config-BGWYwxNr.js +1 -0
  45. package/dist/assets/{select-BtIi5fnh.js → select-DLYqySQK.js} +1 -1
  46. package/dist/assets/skeleton-CYQJazv6.js +1 -0
  47. package/dist/assets/{status-dot-C4O-2jZP.js → status-dot-DGayudyB.js} +1 -1
  48. package/dist/assets/{switch-DPegGIa_.js → switch-Dz2ScsKx.js} +1 -1
  49. package/dist/assets/{tabs-custom-x5GZexrF.js → tabs-custom-CdKyjiGk.js} +1 -1
  50. package/dist/assets/{trash-2-CU3LYIpQ.js → trash-2-Db-mZOZs.js} +1 -1
  51. package/dist/assets/use-infinite-scroll-loader-DBJX5hj0.js +1 -0
  52. package/dist/assets/{useConfirmDialog-S5WsGOGf.js → useConfirmDialog-DL0a-oGC.js} +1 -1
  53. package/dist/assets/useMutation-BdZm-9PL.js +1 -0
  54. package/dist/assets/x-B8Tho_xC.js +1 -0
  55. package/dist/index.html +20 -18
  56. package/package.json +6 -6
  57. package/src/App.tsx +2 -0
  58. package/src/account/components/account-panel.tsx +46 -4
  59. package/src/account/managers/account.manager.ts +19 -4
  60. package/src/api/raw-client.test.ts +37 -0
  61. package/src/api/raw-client.ts +51 -8
  62. package/src/api/remote.ts +9 -0
  63. package/src/api/remote.types.ts +5 -0
  64. package/src/components/chat/ChatConversationPanel.test.tsx +344 -142
  65. package/src/components/chat/ChatSidebar.test.tsx +109 -4
  66. package/src/components/chat/ChatSidebar.tsx +62 -9
  67. package/src/components/chat/adapters/chat-message-tool-agent-id.test.ts +11 -11
  68. package/src/components/chat/adapters/chat-message.adapter.test.ts +43 -6
  69. package/src/components/chat/adapters/chat-message.session-request-tool-card.ts +182 -44
  70. package/src/components/chat/adapters/chat-message.session-spawn-tool-card.test.ts +104 -0
  71. package/src/components/chat/chat-child-session-panel.tsx +155 -59
  72. package/src/components/chat/chat-page-runtime.test.ts +16 -19
  73. package/src/components/chat/chat-session-preference-sync.test.ts +13 -0
  74. package/src/components/chat/chat-session-preference-sync.ts +9 -7
  75. package/src/components/chat/chat-sidebar-session-item.tsx +189 -121
  76. package/src/components/chat/containers/chat-message-list.container.test.tsx +21 -3
  77. package/src/components/chat/containers/chat-message-list.container.tsx +14 -0
  78. package/src/components/chat/hooks/use-chat-session-project.test.tsx +5 -5
  79. package/src/components/chat/hooks/use-chat-session-project.ts +0 -5
  80. package/src/components/chat/hooks/use-chat-session-update.test.tsx +75 -0
  81. package/src/components/chat/hooks/use-chat-session-update.ts +4 -2
  82. package/src/components/chat/managers/chat-session-list.manager.test.ts +79 -5
  83. package/src/components/chat/managers/chat-session-list.manager.ts +31 -4
  84. package/src/components/chat/ncp/NcpChatPage.tsx +32 -51
  85. package/src/components/chat/ncp/ncp-app-client-fetch.test.ts +1 -1
  86. package/src/components/chat/ncp/ncp-app-client-fetch.ts +45 -5
  87. package/src/components/chat/ncp/ncp-chat-input.manager.ts +3 -5
  88. package/src/components/chat/ncp/ncp-chat-page-data.ts +0 -1
  89. package/src/components/chat/ncp/ncp-chat.presenter.ts +1 -11
  90. package/src/components/chat/ncp/session-conversation/use-ncp-child-session-tabs-view.ts +35 -9
  91. package/src/components/chat/stores/chat-session-list.store.ts +99 -5
  92. package/src/components/chat/useChatSessionTypeState.test.tsx +0 -3
  93. package/src/components/chat/useChatSessionTypeState.ts +3 -5
  94. package/src/components/config/ChannelsList.test.tsx +68 -0
  95. package/src/components/config/ChannelsList.tsx +22 -4
  96. package/src/components/config/ProviderForm.tsx +9 -15
  97. package/src/components/config/ProvidersList.tsx +17 -3
  98. package/src/components/config/desktop-update-config.tsx +230 -0
  99. package/src/components/config/providers-list.test.tsx +68 -0
  100. package/src/components/layout/Sidebar.tsx +19 -14
  101. package/src/components/layout/sidebar.layout.test.tsx +33 -1
  102. package/src/components/marketplace/MarketplacePage.tsx +30 -30
  103. package/src/components/marketplace/marketplace-page-parts.tsx +16 -24
  104. package/src/components/marketplace/mcp/McpMarketplacePage.tsx +28 -26
  105. package/src/desktop/desktop-update.types.ts +36 -0
  106. package/src/desktop/managers/desktop-update.manager.ts +163 -0
  107. package/src/desktop/stores/desktop-update.store.ts +18 -0
  108. package/src/hooks/marketplace-list-pages.ts +27 -0
  109. package/src/hooks/use-infinite-scroll-loader.ts +88 -0
  110. package/src/hooks/useMarketplace.ts +14 -3
  111. package/src/hooks/useMcpMarketplace.ts +14 -3
  112. package/src/lib/desktop-update-labels.utils.ts +72 -0
  113. package/src/lib/i18n.chat.ts +13 -0
  114. package/src/lib/i18n.remote.ts +15 -0
  115. package/src/lib/i18n.ts +3 -9
  116. package/src/lib/ui-document-title.ts +1 -0
  117. package/src/transport/local.transport.ts +57 -18
  118. package/src/vite-env.d.ts +10 -0
  119. package/dist/assets/ChannelsList-CobWeI2V.js +0 -8
  120. package/dist/assets/ChatPage-ZIdFFVAv.js +0 -43
  121. package/dist/assets/DocBrowser-D55C0iyl.js +0 -1
  122. package/dist/assets/MarketplacePage-BFYsRss_.js +0 -49
  123. package/dist/assets/MarketplacePage-DII-q-Y1.js +0 -1
  124. package/dist/assets/McpMarketplacePage-CPqsGJzz.js +0 -40
  125. package/dist/assets/ModelConfig-Bvuo_IpS.js +0 -1
  126. package/dist/assets/ProviderScopedModelInput-BfY8rGsf.js +0 -1
  127. package/dist/assets/ProvidersList-3tlaqwSS.js +0 -1
  128. package/dist/assets/RuntimeConfig-CAd5Kta3.js +0 -1
  129. package/dist/assets/SearchConfig-DFwgaAa7.js +0 -1
  130. package/dist/assets/SessionsConfig-vYrvc2Fk.js +0 -2
  131. package/dist/assets/chat-session-display-5dVFkJyw.js +0 -1
  132. package/dist/assets/config-CMiW0yaK.js +0 -1
  133. package/dist/assets/dist-BFc_H-lY.js +0 -15
  134. package/dist/assets/i18n-C_2dKw6w.js +0 -1
  135. package/dist/assets/index-ChUXhq0G.css +0 -1
  136. package/dist/assets/index-DAE8Srx-.js +0 -6
  137. package/dist/assets/label-D8yyejJS.js +0 -1
  138. package/dist/assets/loader-circle-B0sKKO29.js +0 -1
  139. package/dist/assets/marketplace-localization-CxSTG9wr.js +0 -1
  140. package/dist/assets/plus-CYXs3JtZ.js +0 -1
  141. package/dist/assets/react-8EIEQjMP.js +0 -1
  142. package/dist/assets/search-DOsLw-P9.js +0 -1
  143. package/dist/assets/security-config-CM_tQRXQ.js +0 -1
  144. package/dist/assets/skeleton-GbHLjPC0.js +0 -1
  145. package/dist/assets/useMutation-DSinpgEq.js +0 -1
  146. package/dist/assets/x-Bnco_K8b.js +0 -1
  147. package/src/components/chat/ChatSessionsSidebar.tsx +0 -100
  148. /package/dist/assets/{config-hints-WtpHP_DW.js → config-hints-GSUMvmSo.js} +0 -0
  149. /package/dist/assets/{config-layout-LQ10ozRC.js → config-layout-CgBMG7OL.js} +0 -0
@@ -1 +0,0 @@
1
- function e(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function t(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function n(e,n,r){if(e){let n=Object.entries(e).map(([e,n])=>({locale:t(e),text:typeof n==`string`?n.trim():``})).filter(e=>e.text.length>0);if(n.length>0){let e=new Map(n.map(e=>[e.locale,e.text]));for(let n of r){let r=t(n),i=e.get(r);if(i)return i}for(let e of r){let r=t(e).split(`-`)[0];if(!r)continue;let i=n.find(e=>e.locale===r||e.locale.startsWith(`${r}-`));if(i)return i.text}return n[0]?.text??``}}return n?.trim()??``}function r(e,n){if(!e)return``;for(let r of n)if(t(r).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}export{r as n,n as r,e as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-BRLFtf-8.js";var t=e(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +0,0 @@
1
- import{_ as e,m as t}from"./i18n-C_2dKw6w.js";import{C as n,D as r,E as i,M as a,O as o,S as s,T as c,_ as l,b as u,d,g as f,h as p,j as m,m as h,p as g,v as _,w as v,x as y,y as b}from"./dist-BFc_H-lY.js";function x(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,d=async()=>{let n=!1,d=e=>{l(e,()=>t.signal,()=>n=!0)},f=u(t.options,t.fetchOptions),p=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await f((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return d(e),e})()),{maxPages:o}=t.options,s=i?b:_;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?C:S,n={pages:a,pageParams:o};s=await p(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:S(r,s);if(c>0&&e==null)break;s=await p(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=d}}}function S(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function C(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var w=class extends a{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new d({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=T(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=T(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=T(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=T(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){p.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>v(t,e))}findAll(e={}){return this.getAll().filter(t=>v(e,t))}notify(e){p.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return p.batch(()=>Promise.all(e.map(e=>e.continue().catch(i))))}};function T(e){return e.options.scope?.id}var E=class extends a{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){let i=t.queryKey,a=t.queryHash??n(i,t),o=this.get(a);return o||(o=new g({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){p.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>c(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>c(e,t)):t}notify(e){p.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){p.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){p.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},D=new class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new E,this.#t=e.mutationCache||new w,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=f.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=h.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(o(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return p.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;p.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return p.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=p.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(i).catch(i)}invalidateQueries(e,t={}){return p.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=p.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(i)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(i)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(o(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(i).catch(i)}fetchInfiniteQuery(e){return e.behavior=x(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(i).catch(i)}ensureInfiniteQueryData(e){return e.behavior=x(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(s(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{r(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(s(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{r(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=n(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===m&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}}({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!0}}}),O=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},k=(e=>e?O(e):O),A=e(t(),1),j=e=>e;function M(e,t=j){let n=A.useSyncExternalStore(e.subscribe,A.useCallback(()=>t(e.getState()),[e,t]),A.useCallback(()=>t(e.getInitialState()),[e,t]));return A.useDebugValue(n),n}var N=e=>{let t=k(e),n=e=>M(t,e);return Object.assign(n,t),n},P=(e=>e?N(e):N);export{D as n,P as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-BRLFtf-8.js";var t=e(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]);export{t};
@@ -1 +0,0 @@
1
- import{_ as e,i as t,m as n,p as r}from"./i18n-C_2dKw6w.js";import{n as i,o as a}from"./dist-BFc_H-lY.js";import{B as o,G as s,H as c,J as l,K as u,U as d,V as f,W as p,Y as m,q as h,z as g}from"./index-DAE8Srx-.js";import{t as _}from"./label-D8yyejJS.js";import{n as v,t as y}from"./page-layout-DyuvlNrg.js";import{t as b}from"./switch-DPegGIa_.js";var x=e(n(),1),S=r(),C=8;function w(e){return e.trim().length>=C}function T(e,n){return e===n?!0:(i.error(t(`authPasswordMismatch`)),!1)}function E(){let e=g(),n=f(),r=c(),i=d(),v=o(),[y,C]=(0,x.useState)(``),[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(``),[A,j]=(0,x.useState)(``),[M,N]=(0,x.useState)(``),P=e.data,F=y.trim().length>0&&w(E)&&E===O&&!n.isPending,I=w(A)&&A===M&&!i.isPending,L=async()=>{if(T(E,O))try{await n.mutateAsync({username:y.trim(),password:E}),D(``),k(``)}catch{}},R=async()=>{if(T(A,M))try{await i.mutateAsync({password:A}),j(``),N(``)}catch{}},z=async e=>{try{await r.mutateAsync({enabled:e})}catch{}},B=async()=>{try{await v.mutateAsync()}catch{}};return e.isLoading&&!P?(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsx)(u,{className:`text-sm text-gray-500`,children:t(`loading`)})]}):e.isError||!P?(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(u,{className:`space-y-4`,children:[(0,S.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`authStatusLoadFailed`)}),(0,S.jsx)(a,{variant:`outline`,onClick:()=>{e.refetch()},children:t(`authRetryStatus`)})]})]}):P.configured?(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(u,{className:`space-y-6`,children:[(0,S.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-start md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authStatusLabel`)}),(0,S.jsx)(`p`,{className:`text-sm text-gray-600`,children:t(`authStatusConfiguredUser`).replace(`{username}`,P.username??``)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authUsernameFixedHelp`)})]}),(0,S.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:P.enabled?t(`enabled`):t(`disabled`)})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4 border-t border-gray-200 pt-4 md:flex-row md:items-center md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authEnableLabel`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:P.enabled?t(`authEnableOnHelp`):t(`authEnableOffHelp`)})]}),(0,S.jsx)(b,{checked:P.enabled,disabled:r.isPending,onCheckedChange:e=>{z(e)}})]})]}),(0,S.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-4 space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authPasswordSectionTitle`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authPasswordSectionDescription`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-password-next`,children:t(`authPassword`)}),(0,S.jsx)(p,{id:`auth-password-next`,type:`password`,value:A,onChange:e=>j(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-password-confirm`,children:t(`authConfirmPassword`)}),(0,S.jsx)(p,{id:`auth-password-confirm`,type:`password`,value:M,onChange:e=>N(e.target.value),placeholder:t(`authConfirmPasswordPlaceholder`)})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,S.jsx)(a,{type:`button`,disabled:!I,onClick:()=>void R(),children:i.isPending?t(`authPasswordUpdating`):t(`authPasswordAction`)}),P.enabled&&P.authenticated?(0,S.jsx)(a,{type:`button`,variant:`outline`,disabled:v.isPending,onClick:()=>void B(),children:v.isPending?t(`authLoggingOut`):t(`authLogoutAction`)}):null]}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authSessionMemoryNotice`)})]})]})]}):(0,S.jsxs)(s,{children:[(0,S.jsxs)(l,{children:[(0,S.jsx)(m,{children:t(`authSecurityTitle`)}),(0,S.jsx)(h,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(u,{className:`space-y-5`,children:[(0,S.jsxs)(`div`,{className:`rounded-xl border border-dashed border-gray-200 bg-gray-50/70 p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authSetupTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t(`authSetupDescription`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-setup-username`,children:t(`authUsername`)}),(0,S.jsx)(p,{id:`auth-setup-username`,value:y,onChange:e=>C(e.target.value),placeholder:t(`authUsernamePlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-setup-password`,children:t(`authPassword`)}),(0,S.jsx)(p,{id:`auth-setup-password`,type:`password`,value:E,onChange:e=>D(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(_,{htmlFor:`auth-setup-confirm`,children:t(`authConfirmPassword`)}),(0,S.jsx)(p,{id:`auth-setup-confirm`,type:`password`,value:O,onChange:e=>k(e.target.value),placeholder:t(`authConfirmPasswordPlaceholder`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authPasswordMinLengthHint`)})]}),(0,S.jsx)(a,{type:`button`,disabled:!F,onClick:()=>void L(),children:n.isPending?t(`authSettingUp`):t(`authSetupAction`)})]})]})}function D(){return(0,S.jsxs)(v,{className:`space-y-6`,children:[(0,S.jsx)(y,{title:t(`authSecurityTitle`),description:t(`authSecurityDescription`)}),(0,S.jsx)(E,{})]})}export{D as SecurityConfig};
@@ -1 +0,0 @@
1
- import{p as e,u as t}from"./i18n-C_2dKw6w.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{_ as e,m as t}from"./i18n-C_2dKw6w.js";import{A as n,E as r,M as i,S as a,f as o,h as s,k as c,u as l}from"./dist-BFc_H-lY.js";var u=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&a(t.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??o();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){s.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},d=e(t(),1);function f(e,t){let i=l(t),[a]=d.useState(()=>new u(i,e));d.useEffect(()=>{a.setOptions(e)},[a,e]);let o=d.useSyncExternalStore(d.useCallback(e=>a.subscribe(s.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=d.useCallback((e,t)=>{a.mutate(e,t).catch(r)},[a]);if(o.error&&n(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}export{f as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-BRLFtf-8.js";var t=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
@@ -1,100 +0,0 @@
1
- import type { SessionEntryView } from '@/api/types';
2
- import { Button } from '@/components/ui/button';
3
- import { Input } from '@/components/ui/input';
4
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
5
- import { cn } from '@/lib/utils';
6
- import { formatDateTime, t } from '@/lib/i18n';
7
- import { MessageSquareText, Plus, RefreshCw, Search } from 'lucide-react';
8
-
9
- type ChatSessionsSidebarProps = {
10
- query: string;
11
- onQueryChange: (value: string) => void;
12
- selectedChannel: string;
13
- onSelectedChannelChange: (value: string) => void;
14
- channelOptions: string[];
15
- channelLabel: (channel: string) => string;
16
- isLoading: boolean;
17
- isRefreshing: boolean;
18
- sessions: SessionEntryView[];
19
- selectedSessionKey: string | null;
20
- onSelectSession: (key: string) => void;
21
- sessionTitle: (session: SessionEntryView) => string;
22
- onRefresh: () => void;
23
- onCreateSession: () => void;
24
- };
25
-
26
- export function ChatSessionsSidebar(props: ChatSessionsSidebarProps) {
27
- return (
28
- <aside className="w-[320px] max-lg:w-full shrink-0 rounded-2xl border border-gray-200 bg-white shadow-card flex flex-col min-h-0">
29
- <div className="p-4 border-b border-gray-100 space-y-3">
30
- <div className="relative">
31
- <Search className="h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400" />
32
- <Input
33
- value={props.query}
34
- onChange={(event) => props.onQueryChange(event.target.value)}
35
- placeholder={t('chatSearchSessionPlaceholder')}
36
- className="pl-8 h-9 rounded-lg text-xs"
37
- />
38
- </div>
39
- <Select value={props.selectedChannel} onValueChange={props.onSelectedChannelChange}>
40
- <SelectTrigger className="h-9 rounded-lg text-xs">
41
- <SelectValue placeholder={t('sessionsAllChannels')} />
42
- </SelectTrigger>
43
- <SelectContent>
44
- <SelectItem value="all">{t('sessionsAllChannels')}</SelectItem>
45
- {props.channelOptions.map((channel) => (
46
- <SelectItem key={channel} value={channel}>
47
- {props.channelLabel(channel)}
48
- </SelectItem>
49
- ))}
50
- </SelectContent>
51
- </Select>
52
- <div className="grid grid-cols-2 gap-2">
53
- <Button variant="outline" size="sm" className="rounded-lg" onClick={props.onRefresh}>
54
- <RefreshCw className={cn('h-3.5 w-3.5 mr-1.5', props.isRefreshing && 'animate-spin')} />
55
- {t('chatRefresh')}
56
- </Button>
57
- <Button variant="subtle" size="sm" className="rounded-lg" onClick={props.onCreateSession}>
58
- <Plus className="h-3.5 w-3.5 mr-1.5" />
59
- {t('chatNewSession')}
60
- </Button>
61
- </div>
62
- </div>
63
-
64
- <div className="flex-1 min-h-0 overflow-y-auto custom-scrollbar p-2">
65
- {props.isLoading ? (
66
- <div className="text-sm text-gray-500 p-4">{t('sessionsLoading')}</div>
67
- ) : props.sessions.length === 0 ? (
68
- <div className="p-5 m-2 rounded-xl border border-dashed border-gray-200 text-center text-sm text-gray-500">
69
- <MessageSquareText className="h-7 w-7 mx-auto mb-2 text-gray-300" />
70
- {t('sessionsEmpty')}
71
- </div>
72
- ) : (
73
- <div className="space-y-1">
74
- {props.sessions.map((session) => {
75
- const active = props.selectedSessionKey === session.key;
76
- return (
77
- <button
78
- key={session.key}
79
- onClick={() => props.onSelectSession(session.key)}
80
- className={cn(
81
- 'w-full rounded-xl border px-3 py-2.5 text-left transition-all',
82
- active
83
- ? 'border-primary/30 bg-primary/5'
84
- : 'border-transparent hover:border-gray-200 hover:bg-gray-50'
85
- )}
86
- >
87
- <div className="text-sm font-semibold text-gray-900 truncate">{props.sessionTitle(session)}</div>
88
- <div className="mt-1 text-[11px] text-gray-500 truncate">{session.key}</div>
89
- <div className="mt-1 text-[11px] text-gray-400">
90
- {session.messageCount} · {formatDateTime(session.updatedAt)}
91
- </div>
92
- </button>
93
- );
94
- })}
95
- </div>
96
- )}
97
- </div>
98
- </aside>
99
- );
100
- }