@nextclaw/ui 0.10.2 → 0.10.4
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.
- package/CHANGELOG.md +15 -0
- package/dist/assets/{ChannelsList-DSMuOmMG.js → ChannelsList-ohaw9GpD.js} +1 -1
- package/dist/assets/{ChatPage-do9TwNxj.js → ChatPage-BqFTFaut.js} +19 -19
- package/dist/assets/{DocBrowser-BjoTblYl.js → DocBrowser-Cm8LqQ8S.js} +1 -1
- package/dist/assets/{LogoBadge-2yDaYdxw.js → LogoBadge-GTNIKJO9.js} +1 -1
- package/dist/assets/{MarketplacePage-DVVk4dlH.js → MarketplacePage-CfSXSQFi.js} +1 -1
- package/dist/assets/{McpMarketplacePage-B4WUzuLw.js → McpMarketplacePage-BRJudD8Z.js} +1 -1
- package/dist/assets/{ModelConfig-Dr0eI9nN.js → ModelConfig-B-P04UNK.js} +1 -1
- package/dist/assets/{ProvidersList-C7A-mIbe.js → ProvidersList-D9IocmDB.js} +1 -1
- package/dist/assets/{RemoteAccessPage-CI3Am3w1.js → RemoteAccessPage-58fYdCYK.js} +1 -1
- package/dist/assets/{RuntimeConfig-DvSNVSs8.js → RuntimeConfig-C5NlEc57.js} +1 -1
- package/dist/assets/{SearchConfig-B6TGIZow.js → SearchConfig-Cw17ED0n.js} +1 -1
- package/dist/assets/{SecretsConfig-CpxaKU1j.js → SecretsConfig-DliEIjCS.js} +1 -1
- package/dist/assets/{SessionsConfig-B-VHnv4G.js → SessionsConfig-BRqvuKqq.js} +1 -1
- package/dist/assets/{chat-message-BMqngrjp.js → chat-message-C6dxqsRj.js} +1 -1
- package/dist/assets/{index-C6MeoecJ.js → index-B3caHNCU.js} +6 -6
- package/dist/assets/index-kaPUhd-8.css +1 -0
- package/dist/assets/{label-s2ILtQeP.js → label-B3FlNUAA.js} +1 -1
- package/dist/assets/{page-layout-BX5Ro4Sj.js → page-layout-HrT1hpq7.js} +1 -1
- package/dist/assets/{popover-qmNpQSIy.js → popover-BEo9XeN-.js} +1 -1
- package/dist/assets/{security-config--F-f-nDl.js → security-config-BRE-9ipr.js} +1 -1
- package/dist/assets/{skeleton-DthPOKSc.js → skeleton-BeC_fgbu.js} +1 -1
- package/dist/assets/{status-dot-DWj7aUy8.js → status-dot-D9tZgJWo.js} +1 -1
- package/dist/assets/{switch-62r7L4Lj.js → switch-Cq7y46-d.js} +1 -1
- package/dist/assets/{tabs-custom-DEmoGMsc.js → tabs-custom-xrIDQNF2.js} +1 -1
- package/dist/assets/{useConfirmDialog-DzT94nC_.js → useConfirmDialog-DCZbJzHW.js} +1 -1
- package/dist/index.html +3 -3
- package/index.html +1 -1
- package/package.json +4 -4
- package/src/components/chat/chat-composer-state.test.ts +74 -0
- package/src/components/chat/chat-composer-state.ts +41 -15
- package/src/components/chat/chat-stream/types.ts +2 -0
- package/src/components/chat/containers/chat-input-bar.container.tsx +12 -2
- package/src/components/chat/ncp/NcpChatPage.tsx +1 -0
- package/src/components/chat/ncp/ncp-chat-input.manager.ts +26 -9
- package/src/components/chat/ncp/ncp-session-adapter.test.ts +40 -0
- package/src/components/chat/presenter/chat-presenter-context.tsx +1 -1
- package/src/components/layout/AppLayout.tsx +8 -1
- package/src/hooks/use-auth.test.ts +33 -0
- package/src/hooks/use-auth.ts +31 -1
- package/src/lib/ui-document-title.ts +41 -0
- package/dist/assets/index-DdXzLuNG.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,j as e,aB as I,G as J,b7 as T,b2 as X,a0 as Z,M as Q,b8 as ee,al as se,am as te}from"./vendor-CNhxtHCf.js";import{u as ae}from"./useConfirmDialog-
|
|
1
|
+
import{r,j as e,aB as I,G as J,b7 as T,b2 as X,a0 as Z,M as Q,b8 as ee,al as se,am as te}from"./vendor-CNhxtHCf.js";import{u as ae}from"./useConfirmDialog-DCZbJzHW.js";import{j as re,i as ne,l as le,ae as ie,af as oe,t,B as f,c as i,S as de,e as ce,f as xe,g as me,h as U,I as k,ag as ue,n as he}from"./index-B3caHNCU.js";import{b as ge,a as fe,S as ye,e as be}from"./chat-message-C6dxqsRj.js";import{P as pe,a as je}from"./page-layout-HrT1hpq7.js";const y="__unknown_channel__";function ve(a){return he(a)}function j(a){const l=a.indexOf(":");return l<=0?y:a.slice(0,l).trim()||y}function C(a){return a===y?t("sessionsUnknownChannel"):a}function Ne({session:a,channel:l,runStatus:d,isSelected:x,onSelect:n}){const b=C(l),m=a.label||a.key.split(":").pop()||a.key;return e.jsxs("button",{onClick:n,className:i("w-full text-left p-3.5 rounded-xl transition-all duration-200 outline-none focus:outline-none focus:ring-0 group",x?"bg-brand-50 border border-brand-100/50":"bg-transparent border border-transparent hover:bg-gray-50/80"),children:[e.jsxs("div",{className:"flex items-start justify-between mb-1.5",children:[e.jsx("div",{className:i("font-semibold truncate pr-2 flex-1 text-sm",x?"text-brand-800":"text-gray-900"),children:m}),e.jsx("div",{className:i("text-[10px] font-bold px-2 py-0.5 rounded-full shrink-0 capitalize",x?"bg-white text-brand-600 shadow-[0_1px_2px_rgba(0,0,0,0.02)]":"bg-gray-100 text-gray-500"),children:b})]}),e.jsxs("div",{className:i("flex items-center text-xs justify-between mt-2 font-medium",x?"text-brand-600/80":"text-gray-400"),children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:d?e.jsx(ye,{status:d}):null}),e.jsx(ee,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{className:"truncate max-w-[100px]",children:ue(a.updatedAt)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{className:"w-3.5 h-3.5 opacity-70"}),e.jsx("span",{children:a.messageCount})]})]})]})}function we({message:a}){const l=a.role.toLowerCase()==="user",d=be(a.content).trim();return e.jsx("div",{className:i("flex w-full mb-6",l?"justify-end":"justify-start"),children:e.jsxs("div",{className:i("max-w-[85%] rounded-[1.25rem] p-5 flex gap-3 text-sm",l?"bg-primary text-white rounded-tr-sm":"bg-gray-50 text-gray-800 rounded-tl-sm border border-gray-100/50"),children:[e.jsx("div",{className:"shrink-0 pt-0.5",children:l?e.jsx(se,{className:"w-4 h-4 text-primary-100"}):e.jsx(te,{className:"w-4 h-4 text-gray-400"})}),e.jsxs("div",{className:"flex-1 space-y-1 overflow-x-hidden",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4 mb-2",children:[e.jsx("span",{className:i("font-semibold text-xs",l?"text-primary-50":"text-gray-900 capitalize"),children:a.role}),e.jsx("span",{className:i("text-[10px]",l?"text-primary-200":"text-gray-400"),children:ve(a.timestamp)})]}),e.jsx("div",{className:"whitespace-pre-wrap break-words leading-relaxed text-[15px]",children:d||"-"})]})]})})}function De(){var B,E,K,R;const[a,l]=r.useState(""),[d]=r.useState(100),[x]=r.useState(0),[n,b]=r.useState(null),[m,q]=r.useState("all"),[M,v]=r.useState(""),[L,N]=r.useState(""),[w,S]=r.useState(!1),F=r.useMemo(()=>({q:a.trim()||void 0,limit:d,activeMinutes:x}),[a,d,x]),g=re(F),D=ne({states:["queued","running"],limit:200}),u=le(n,200),p=ie(),_=oe(),{confirm:P,ConfirmDialog:O}=ae(),c=r.useMemo(()=>{var s;return((s=g.data)==null?void 0:s.sessions)??[]},[(B=g.data)==null?void 0:B.sessions]),z=r.useMemo(()=>{var s;return ge(((s=D.data)==null?void 0:s.runs)??[])},[(E=D.data)==null?void 0:E.runs]),V=r.useMemo(()=>fe(z),[z]),o=r.useMemo(()=>c.find(s=>s.key===n),[c,n]),$=r.useMemo(()=>{const s=new Set;for(const h of c)s.add(j(h.key));return Array.from(s).sort((h,A)=>h===y?1:A===y?-1:h.localeCompare(A))},[c]),H=r.useMemo(()=>m==="all"?c:c.filter(s=>j(s.key)===m),[c,m]);r.useEffect(()=>{o?(v(o.label||""),N(o.preferredModel||"")):(v(""),N("")),S(!1)},[o]);const G=()=>{n&&(p.mutate({key:n,data:{label:M.trim()||null,preferredModel:L.trim()||null}}),S(!1))},W=async()=>{if(!n)return;await P({title:t("sessionsClearHistory")+"?",variant:"destructive",confirmLabel:t("sessionsClearHistory")})&&p.mutate({key:n,data:{clearHistory:!0}})},Y=async()=>{if(!n)return;await P({title:t("sessionsDeleteConfirm")+"?",variant:"destructive",confirmLabel:t("sessionsDeleteConfirm")})&&_.mutate({key:n},{onSuccess:()=>b(null)})};return e.jsxs(pe,{fullHeight:!0,children:[e.jsx(je,{title:t("sessionsPageTitle"),description:t("sessionsPageDescription")}),e.jsxs("div",{className:"flex-1 flex gap-6 min-h-0 relative",children:[e.jsxs("div",{className:"w-[320px] flex flex-col shrink-0 bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-4 border-b border-gray-100 bg-white z-10 shrink-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:[c.length," ",t("sessionsListTitle")]}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100",onClick:()=>g.refetch(),children:e.jsx(I,{className:i("h-3.5 w-3.5",g.isFetching&&"animate-spin")})})]}),e.jsxs(de,{value:m,onValueChange:q,children:[e.jsx(ce,{className:"w-full h-8.5 rounded-lg bg-gray-50/50 hover:bg-gray-100 border-gray-200 focus:ring-0 shadow-none text-xs font-medium text-gray-700",children:e.jsx(xe,{placeholder:t("sessionsAllChannels")})}),e.jsxs(me,{className:"rounded-xl shadow-lg border-gray-100 max-w-[280px]",children:[e.jsx(U,{value:"all",className:"rounded-lg text-xs",children:t("sessionsAllChannels")}),$.map(s=>e.jsx(U,{value:s,className:"rounded-lg text-xs truncate pr-6",children:C(s)},s))]})]}),e.jsxs("div",{className:"relative w-full",children:[e.jsx(J,{className:"h-3.5 w-3.5 absolute left-3 top-2.5 text-gray-400"}),e.jsx(k,{value:a,onChange:s=>l(s.target.value),placeholder:t("sessionsSearchPlaceholder"),className:"pl-8 h-8.5 rounded-lg bg-gray-50/50 border-gray-200 focus-visible:bg-white text-xs"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-1 pb-10 custom-scrollbar relative",children:g.isLoading?e.jsx("div",{className:"text-sm text-gray-400 p-4 text-center",children:t("sessionsLoading")}):H.length===0?e.jsxs("div",{className:"text-sm text-gray-400 p-4 text-center border-2 border-dashed border-gray-100 rounded-xl mt-4",children:[e.jsx(T,{className:"w-8 h-8 mx-auto mb-2 text-gray-300"}),t("sessionsEmpty")]}):H.map(s=>e.jsx(Ne,{session:s,channel:j(s.key),runStatus:V.get(s.key),isSelected:n===s.key,onSelect:()=>b(s.key)},s.key))})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col overflow-hidden relative bg-white rounded-2xl shadow-sm border border-gray-200",children:[(p.isPending||_.isPending)&&e.jsx("div",{className:"absolute top-0 left-0 w-full h-1 bg-primary/20 overflow-hidden z-20",children:e.jsx("div",{className:"h-full bg-primary animate-pulse w-1/3 rounded-r-full"})}),n&&o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-gray-100 bg-white px-8 py-5 z-10 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-[14px] bg-gray-50 border border-gray-100 flex items-center justify-center text-gray-400 shrink-0",children:e.jsx(X,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-1.5",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 tracking-tight",children:o.label||o.key.split(":").pop()||o.key}),e.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-full bg-gray-100 text-gray-500 uppercase tracking-widest",children:C(j(o.key))})]}),e.jsx("div",{className:"text-xs text-gray-500 font-mono break-all line-clamp-1 opacity-70",title:n,children:n})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>S(!w),className:i("h-8.5 rounded-lg shadow-none border-gray-200 transition-all text-xs font-semibold",w?"bg-gray-100 text-gray-900":"hover:bg-gray-50 hover:text-gray-900"),children:[e.jsx(Z,{className:"w-3.5 h-3.5 mr-1.5"}),t("sessionsMetadata")]}),e.jsx(f,{variant:"outline",size:"sm",onClick:W,className:"h-8.5 rounded-lg shadow-none hover:bg-gray-50 hover:text-gray-900 border-gray-200 text-xs font-semibold text-gray-500",children:t("sessionsClearHistory")}),e.jsx(f,{variant:"outline",size:"sm",onClick:Y,className:"h-8.5 rounded-lg shadow-none hover:bg-red-50 hover:text-red-600 hover:border-red-200 border-gray-200 text-xs font-semibold text-red-500",children:t("delete")})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-3 bg-gray-50/50 p-3 rounded-lg border border-gray-100 animate-slide-in",children:[e.jsx(k,{placeholder:t("sessionsLabelPlaceholder"),value:M,onChange:s=>v(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(k,{placeholder:t("sessionsModelPlaceholder"),value:L,onChange:s=>N(s.target.value),className:"h-8 text-sm bg-white"}),e.jsx(f,{size:"sm",onClick:G,className:"h-8 px-4 shrink-0 shadow-none",disabled:p.isPending,children:t("sessionsSaveMeta")})]})]}),e.jsxs("div",{className:`flex-1 overflow-y-auto p-6 relative
|
|
2
2
|
[&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:bg-gray-300/80 [&::-webkit-scrollbar-thumb]:rounded-full`,children:[u.isLoading&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50/50 backdrop-blur-sm z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx(I,{className:"w-6 h-6 text-primary animate-spin"}),e.jsx("span",{className:"text-sm font-medium text-gray-500",children:t("sessionsHistoryLoading")})]})}),u.error&&e.jsx("div",{className:"text-center p-6 bg-red-50 rounded-xl text-red-600 border border-red-100 text-sm",children:u.error.message}),!u.isLoading&&((K=u.data)==null?void 0:K.messages.length)===0&&e.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[e.jsx(Q,{className:"w-12 h-12 mb-3 text-gray-300"}),e.jsx("p",{className:"text-sm",children:t("sessionsEmpty")})]}),e.jsx("div",{className:"max-w-3xl mx-auto",children:(((R=u.data)==null?void 0:R.messages)??[]).map((s,h)=>e.jsx(we,{message:s},`${s.timestamp}-${h}`))})]})]}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-gray-400 p-8 h-full bg-white",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-50 rounded-3xl flex items-center justify-center mb-6 border border-gray-100 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.02)] rotate-3",children:e.jsx(T,{className:"h-8 w-8 text-gray-300 -rotate-3"})}),e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2",children:t("sessionsNoSelectionTitle")}),e.jsx("p",{className:"text-sm text-center max-w-sm leading-relaxed",children:t("sessionsNoSelectionDescription")})]})]})]}),e.jsx(O,{})]})}export{De as SessionsConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as u,ae as m}from"./vendor-CNhxtHCf.js";import{t as p,c as g}from"./index-
|
|
1
|
+
import{j as u,ae as m}from"./vendor-CNhxtHCf.js";import{t as p,c as g}from"./index-B3caHNCU.js";const l={queued:1,running:2};function o(t){return t==="queued"||t==="running"?t:null}function y(t){const n=Date.parse(t??"");return Number.isFinite(n)?n:0}function d(t,n){const e=o(t.state),r=o(n.state);if(!e||!r)return!1;const s=l[e],i=l[r];return i!==s?i>s:y(n.requestedAt)>=y(t.requestedAt)}function R(t){var e;const n=new Map;for(const r of t){const s=(e=r.sessionKey)==null?void 0:e.trim();if(!s||!o(r.state))continue;const i=n.get(s);(!i||d(i,r))&&n.set(s,r)}return n}function A(t){const n=new Map;for(const[e,r]of t.entries()){const s=o(r.state);s&&n.set(e,s)}return n}function j({status:t,className:n}){const e=t==="running"?p("sessionsRunStatusRunning"):p("sessionsRunStatusQueued");return u.jsxs("span",{className:g("inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400",n),title:e,"aria-label":e,children:[u.jsx(m,{className:"h-3 w-3 animate-spin"}),u.jsx("span",{className:"sr-only",children:e})]})}const h=["cmd","command","query","q","path","url","to","channel","agentId","sessionKey"];function c(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function f(t,n=2400){return t.length<=n?t:`${t.slice(0,n)}
|
|
2
2
|
…`}function a(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t==null)return"";try{return f(JSON.stringify(t,null,2))}catch{return String(t)}}function S(t){if(c(t))return t;if(typeof t!="string")return null;const n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return null;try{const e=JSON.parse(n);return c(e)?e:null}catch{return null}}function T(t){const n=S(t);if(!n){const r=a(t).trim();return r?f(r,120):void 0}const e=[];for(const r of h){const s=n[r];if(typeof s=="string"&&s.trim()?e.push(`${r}: ${s.trim()}`):(typeof s=="number"||typeof s=="boolean")&&e.push(`${r}: ${String(s)}`),e.length>=2)break}return e.length>0?e.join(" · "):f(a(n),140)}function N(t){if(typeof t=="string")return t;if(Array.isArray(t)){const n=[];for(const e of t){if(typeof e=="string"){n.push(e);continue}if(c(e)){if(typeof e.text=="string"){n.push(e.text);continue}typeof e.content=="string"&&n.push(e.content)}}if(n.length>0)return n.join(`
|
|
3
3
|
`)}return a(t)}export{j as S,A as a,R as b,a as c,N as e,T as s};
|