@nextclaw/ui 0.11.0 → 0.11.2

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 (87) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/dist/assets/{ChannelsList-BqsOYnXz.js → ChannelsList-CKl1Zg8f.js} +3 -3
  3. package/dist/assets/ChatPage-BJgO27mk.js +37 -0
  4. package/dist/assets/{DocBrowser-BmL0QXBZ.js → DocBrowser-DYRBs4-z.js} +1 -1
  5. package/dist/assets/{LogoBadge-C1HiPZPf.js → LogoBadge-33Qlv3Hg.js} +1 -1
  6. package/dist/assets/MarketplacePage-B8BZVtjV.js +49 -0
  7. package/dist/assets/{McpMarketplacePage-CLHFnNBd.js → McpMarketplacePage-BRuE5fJJ.js} +2 -2
  8. package/dist/assets/{ModelConfig-LQSR58tc.js → ModelConfig-BiFblwO-.js} +1 -1
  9. package/dist/assets/ProvidersList-9goRgHE4.js +1 -0
  10. package/dist/assets/RemoteAccessPage-5vCxZPS6.js +1 -0
  11. package/dist/assets/RuntimeConfig-BmDFHBdW.js +1 -0
  12. package/dist/assets/{SearchConfig-Chzo_JGs.js → SearchConfig-CJx5CKwG.js} +1 -1
  13. package/dist/assets/{SecretsConfig-CEIbjZYA.js → SecretsConfig-B91efXoK.js} +2 -2
  14. package/dist/assets/SessionsConfig-CbFPVmx3.js +2 -0
  15. package/dist/assets/index-BtAuUyww.css +1 -0
  16. package/dist/assets/index-COJomMe9.js +8 -0
  17. package/dist/assets/{label-GACO2RzW.js → label-BnSDpjhL.js} +1 -1
  18. package/dist/assets/ncp-session-adapter-w8ZHprab.js +1 -0
  19. package/dist/assets/{page-layout-DjXaK3A3.js → page-layout-B1RIu5-r.js} +1 -1
  20. package/dist/assets/popover-ChzbCIfO.js +1 -0
  21. package/dist/assets/security-config-eYa6Ovfa.js +1 -0
  22. package/dist/assets/skeleton-D4Eyop0R.js +1 -0
  23. package/dist/assets/{status-dot-IWEBezqb.js → status-dot-CrCw5tkJ.js} +1 -1
  24. package/dist/assets/{switch-DCHAJSrA.js → switch-C3vVTpfU.js} +1 -1
  25. package/dist/assets/tabs-custom-Ilrgt6n1.js +1 -0
  26. package/dist/assets/useConfirmDialog-BeaFLDO8.js +1 -0
  27. package/dist/assets/{vendor-CNhxtHCf.js → vendor-waGu-koL.js} +101 -86
  28. package/dist/index.html +3 -3
  29. package/package.json +5 -5
  30. package/src/App.test.tsx +42 -10
  31. package/src/App.tsx +5 -40
  32. package/src/api/api-base.test.ts +37 -0
  33. package/src/api/api-base.ts +0 -4
  34. package/src/api/config.ts +2 -270
  35. package/src/api/types.ts +0 -117
  36. package/src/components/chat/ChatPage.tsx +1 -11
  37. package/src/components/chat/ChatSidebar.test.tsx +1 -50
  38. package/src/components/chat/ChatSidebar.tsx +0 -5
  39. package/src/components/chat/README.md +2 -0
  40. package/src/components/chat/adapters/chat-message.adapter.test.ts +71 -4
  41. package/src/components/chat/adapters/chat-message.adapter.ts +195 -78
  42. package/src/components/chat/chat-attachment-upload-limit.test.ts +41 -0
  43. package/src/components/chat/chat-session-display.ts +9 -0
  44. package/src/components/chat/chat-session-label.service.ts +3 -12
  45. package/src/components/chat/chat-session-preference-sync.test.ts +10 -13
  46. package/src/components/chat/chat-stream/types.ts +4 -57
  47. package/src/components/chat/containers/chat-message-list.container.tsx +7 -0
  48. package/src/components/chat/ncp/NcpChatPage.tsx +3 -3
  49. package/src/components/chat/useHydratedNcpAgent.test.tsx +77 -0
  50. package/src/components/config/README.md +2 -0
  51. package/src/components/config/SessionsConfig.tsx +152 -132
  52. package/src/hooks/use-auth.test.ts +3 -3
  53. package/src/hooks/use-auth.ts +16 -4
  54. package/src/hooks/use-realtime-query-bridge.ts +0 -24
  55. package/src/hooks/useConfig.ts +10 -137
  56. package/src/lib/i18n.chat.ts +7 -0
  57. package/src/lib/session-run-status.ts +1 -63
  58. package/src/vite-env.d.ts +1 -0
  59. package/vite.config.ts +4 -4
  60. package/dist/assets/ChatPage-CJBYKR-Y.js +0 -38
  61. package/dist/assets/MarketplacePage-BIRP0NRS.js +0 -49
  62. package/dist/assets/ProvidersList-CwI-mxah.js +0 -1
  63. package/dist/assets/RemoteAccessPage-Cw5BqZb6.js +0 -1
  64. package/dist/assets/RuntimeConfig-DbowSRAb.js +0 -1
  65. package/dist/assets/SessionsConfig-BR8GfGWL.js +0 -2
  66. package/dist/assets/chat-message-CPG7zxRR.js +0 -3
  67. package/dist/assets/index-j6A_-1b6.js +0 -8
  68. package/dist/assets/index-kaPUhd-8.css +0 -1
  69. package/dist/assets/popover-DTaFiTmU.js +0 -1
  70. package/dist/assets/security-config-Dk-yoKvK.js +0 -1
  71. package/dist/assets/skeleton-Dm2xOBSA.js +0 -1
  72. package/dist/assets/tabs-custom-DKSbDSB9.js +0 -1
  73. package/dist/assets/useConfirmDialog-ByJ8A8n7.js +0 -1
  74. package/src/api/config.stream.test.ts +0 -115
  75. package/src/components/chat/chat-chain.test.ts +0 -22
  76. package/src/components/chat/chat-chain.ts +0 -23
  77. package/src/components/chat/chat-page-data.ts +0 -171
  78. package/src/components/chat/chat-page-runtime.ts +0 -190
  79. package/src/components/chat/chat-stream/nextbot-parsers.ts +0 -52
  80. package/src/components/chat/chat-stream/nextbot-runtime-agent.ts +0 -413
  81. package/src/components/chat/chat-stream/stream-event-adapter.ts +0 -98
  82. package/src/components/chat/chat-stream/transport.ts +0 -253
  83. package/src/components/chat/legacy/LegacyChatPage.tsx +0 -223
  84. package/src/components/chat/managers/chat-input.manager.ts +0 -228
  85. package/src/components/chat/managers/chat-thread.manager.ts +0 -87
  86. package/src/components/chat/presenter/chat.presenter.ts +0 -32
  87. package/src/components/chat/useChatRuntimeController.ts +0 -134
@@ -0,0 +1 @@
1
+ import{r as c,j as e,e as M}from"./vendor-waGu-koL.js";import{$ as O,a0 as R,a1 as I,a2 as _,a3 as B,C as u,Y as h,Z as x,t as s,_ as m,y as p,B as j,I as l}from"./index-COJomMe9.js";import{L as o}from"./label-BnSDpjhL.js";import{S as G}from"./switch-C3vVTpfU.js";import{P as V,a as W}from"./page-layout-B1RIu5-r.js";const Y=8;function A(r){return r.trim().length>=Y}function L(r,n){return r!==n?(M.error(s("authPasswordMismatch")),!1):!0}function Z(){const r=O(),n=R(),S=I(),y=_(),g=B(),[f,U]=c.useState(""),[i,N]=c.useState(""),[w,b]=c.useState(""),[d,v]=c.useState(""),[P,C]=c.useState(""),a=r.data,E=f.trim().length>0&&A(i)&&i===w&&!n.isPending,D=A(d)&&d===P&&!y.isPending,T=async()=>{if(L(i,w))try{await n.mutateAsync({username:f.trim(),password:i}),N(""),b("")}catch{}},F=async()=>{if(L(d,P))try{await y.mutateAsync({password:d}),v(""),C("")}catch{}},H=async t=>{try{await S.mutateAsync({enabled:t})}catch{}},k=async()=>{try{await g.mutateAsync()}catch{}};return r.isLoading&&!a?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsx(p,{className:"text-sm text-gray-500",children:s("loading")})]}):r.isError||!a?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-gray-500",children:s("authStatusLoadFailed")}),e.jsx(j,{variant:"outline",onClick:()=>{r.refetch()},children:s("authRetryStatus")})]})]}):a.configured?e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authStatusLabel")}),e.jsx("p",{className:"text-sm text-gray-600",children:s("authStatusConfiguredUser").replace("{username}",a.username??"")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authUsernameFixedHelp")})]}),e.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700",children:a.enabled?s("enabled"):s("disabled")})]}),e.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:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authEnableLabel")}),e.jsx("p",{className:"text-xs text-gray-500",children:a.enabled?s("authEnableOnHelp"):s("authEnableOffHelp")})]}),e.jsx(G,{checked:a.enabled,disabled:S.isPending,onCheckedChange:t=>{H(t)}})]})]}),e.jsxs("div",{className:"rounded-xl border border-gray-200 p-4 space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authPasswordSectionTitle")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authPasswordSectionDescription")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-password-next",children:s("authPassword")}),e.jsx(l,{id:"auth-password-next",type:"password",value:d,onChange:t=>v(t.target.value),placeholder:s("authPasswordPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-password-confirm",children:s("authConfirmPassword")}),e.jsx(l,{id:"auth-password-confirm",type:"password",value:P,onChange:t=>C(t.target.value),placeholder:s("authConfirmPasswordPlaceholder")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(j,{type:"button",disabled:!D,onClick:()=>void F(),children:y.isPending?s("authPasswordUpdating"):s("authPasswordAction")}),a.enabled&&a.authenticated?e.jsx(j,{type:"button",variant:"outline",disabled:g.isPending,onClick:()=>void k(),children:g.isPending?s("authLoggingOut"):s("authLogoutAction")}):null]}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authSessionMemoryNotice")})]})]})]}):e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(x,{children:s("authSecurityTitle")}),e.jsx(m,{children:s("authSecurityDescription")})]}),e.jsxs(p,{className:"space-y-5",children:[e.jsxs("div",{className:"rounded-xl border border-dashed border-gray-200 bg-gray-50/70 p-4",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:s("authSetupTitle")}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:s("authSetupDescription")})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-username",children:s("authUsername")}),e.jsx(l,{id:"auth-setup-username",value:f,onChange:t=>U(t.target.value),placeholder:s("authUsernamePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-password",children:s("authPassword")}),e.jsx(l,{id:"auth-setup-password",type:"password",value:i,onChange:t=>N(t.target.value),placeholder:s("authPasswordPlaceholder")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"auth-setup-confirm",children:s("authConfirmPassword")}),e.jsx(l,{id:"auth-setup-confirm",type:"password",value:w,onChange:t=>b(t.target.value),placeholder:s("authConfirmPasswordPlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500",children:s("authPasswordMinLengthHint")})]}),e.jsx(j,{type:"button",disabled:!E,onClick:()=>void T(),children:n.isPending?s("authSettingUp"):s("authSetupAction")})]})]})}function Q(){return e.jsxs(V,{className:"space-y-6",children:[e.jsx(W,{title:s("authSecurityTitle"),description:s("authSecurityDescription")}),e.jsx(Z,{})]})}export{Q as SecurityConfig};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-waGu-koL.js";import{c as o}from"./index-COJomMe9.js";function m({className:e,...s}){return t.jsx("div",{className:o("animate-pulse rounded-md bg-slate-200",e),...s})}export{m as S};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-CNhxtHCf.js";import{c as a}from"./index-j6A_-1b6.js";const n={active:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},ready:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},inactive:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},setup:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},warning:{dot:"bg-amber-400",text:"text-amber-600",bg:"bg-amber-50"}};function m({status:r,label:s,className:g}){const t=n[r];return e.jsxs("div",{className:a("inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5",t.bg,g),children:[e.jsx("span",{className:a("h-1.5 w-1.5 rounded-full",t.dot)}),e.jsx("span",{className:a("text-[11px] font-medium",t.text),children:s})]})}export{m as S};
1
+ import{j as e}from"./vendor-waGu-koL.js";import{c as a}from"./index-COJomMe9.js";const n={active:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},ready:{dot:"bg-emerald-500",text:"text-emerald-600",bg:"bg-emerald-50"},inactive:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},setup:{dot:"bg-gray-300",text:"text-gray-400",bg:"bg-gray-100/80"},warning:{dot:"bg-amber-400",text:"text-amber-600",bg:"bg-amber-50"}};function m({status:r,label:s,className:g}){const t=n[r];return e.jsxs("div",{className:a("inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5",t.bg,g),children:[e.jsx("span",{className:a("h-1.5 w-1.5 rounded-full",t.dot)}),e.jsx("span",{className:a("text-[11px] font-medium",t.text),children:s})]})}export{m as S};
@@ -1 +1 @@
1
- import{r as e,j as i}from"./vendor-CNhxtHCf.js";import{c as t}from"./index-j6A_-1b6.js";const l=e.forwardRef(({className:o,checked:r=!1,onCheckedChange:s,...a},n)=>i.jsx("button",{type:"button",role:"switch","aria-checked":r,ref:n,className:t("peer inline-flex h-[22px] w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",r?"bg-primary":"bg-gray-200/80 hover:bg-gray-300/80",o),onClick:()=>s==null?void 0:s(!r),...a,children:i.jsx("span",{className:t("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-fast",r?"translate-x-5":"translate-x-0")})}));l.displayName="Switch";export{l as S};
1
+ import{r as e,j as i}from"./vendor-waGu-koL.js";import{c as t}from"./index-COJomMe9.js";const l=e.forwardRef(({className:o,checked:r=!1,onCheckedChange:s,...a},n)=>i.jsx("button",{type:"button",role:"switch","aria-checked":r,ref:n,className:t("peer inline-flex h-[22px] w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50",r?"bg-primary":"bg-gray-200/80 hover:bg-gray-300/80",o),onClick:()=>s==null?void 0:s(!r),...a,children:i.jsx("span",{className:t("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-fast",r?"translate-x-5":"translate-x-0")})}));l.displayName="Switch";export{l as S};
@@ -0,0 +1 @@
1
+ import{j as e}from"./vendor-waGu-koL.js";import{aj as m,c as a}from"./index-COJomMe9.js";function c({tabs:s,activeTab:i,onChange:o,className:n}){return e.jsx("div",{className:a("flex items-center gap-6 border-b border-gray-200/60 mb-6",n),children:s.map(t=>{const r=i===t.id;return e.jsxs("button",{onClick:()=>o(t.id),className:a("relative pb-3 text-[14px] font-medium transition-all duration-fast flex items-center gap-1.5",r?"text-gray-900":"text-gray-600 hover:text-gray-900"),children:[t.label,t.count!==void 0&&e.jsx("span",{className:a("text-[11px] font-medium","text-gray-500"),children:m(t.count)}),r&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[2px] bg-primary rounded-full"})]},t.id)})})}export{c as T};
@@ -0,0 +1 @@
1
+ import{j as a,r as t}from"./vendor-waGu-koL.js";import{ad as C,ae as h,af as p,ag as g,ah as x,ai as D,B as d,t as r}from"./index-COJomMe9.js";const j=({open:l,onOpenChange:i,title:c,description:o,confirmLabel:s=r("confirm"),cancelLabel:e=r("cancel"),variant:n="default",onConfirm:f,onCancel:u})=>{const m=()=>{f(),i(!1)},v=()=>{u(),i(!1)};return a.jsx(C,{open:l,onOpenChange:i,children:a.jsxs(h,{className:"[&>:last-child]:hidden",onCloseAutoFocus:b=>b.preventDefault(),children:[a.jsxs(p,{children:[a.jsx(g,{children:c}),o?a.jsx(x,{children:o}):null]}),a.jsxs(D,{className:"gap-2 sm:gap-0",children:[a.jsx(d,{type:"button",variant:"outline",onClick:v,children:e}),a.jsx(d,{type:"button",variant:n==="destructive"?"destructive":"default",onClick:m,children:s})]})]})})},L={open:!1,title:"",description:"",confirmLabel:r("confirm"),cancelLabel:r("cancel"),variant:"default",resolve:null};function y(){const[l,i]=t.useState(L),c=t.useCallback(e=>new Promise(n=>{i({open:!0,title:e.title,description:e.description??"",confirmLabel:e.confirmLabel??r("confirm"),cancelLabel:e.cancelLabel??r("cancel"),variant:e.variant??"default",resolve:f=>{n(f),i(u=>({...u,open:!1,resolve:null}))}})}),[]),o=t.useCallback(e=>{i(n=>(!e&&n.resolve&&n.resolve(!1),{...n,open:e,resolve:e?n.resolve:null}))},[]),s=t.useCallback(()=>a.jsx(j,{open:l.open,onOpenChange:o,title:l.title,description:l.description||void 0,confirmLabel:l.confirmLabel,cancelLabel:l.cancelLabel,variant:l.variant,onConfirm:()=>{var e;return(e=l.resolve)==null?void 0:e.call(l,!0)},onCancel:()=>{var e;return(e=l.resolve)==null?void 0:e.call(l,!1)}}),[l,o]);return{confirm:c,ConfirmDialog:s}}export{y as u};