@nextclaw/ui 0.11.9 → 0.11.10

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 (56) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/assets/{ChannelsList-XGMfinnc.js → ChannelsList-C63gOoYI.js} +3 -3
  3. package/dist/assets/ChatPage-Ci3Gz0qh.js +37 -0
  4. package/dist/assets/{DocBrowser-DTRCNsSM.js → DocBrowser-CI4jOzJY.js} +1 -1
  5. package/dist/assets/{LogoBadge-CPMOwWdA.js → LogoBadge-DImV63-L.js} +1 -1
  6. package/dist/assets/{MarketplacePage-De2qZ9C0.js → MarketplacePage-B360oSAV.js} +1 -1
  7. package/dist/assets/{McpMarketplacePage-cjVKSQ2f.js → McpMarketplacePage-KIQgx_7h.js} +2 -2
  8. package/dist/assets/{ModelConfig-CMn3-VZk.js → ModelConfig-Ben3tQoX.js} +1 -1
  9. package/dist/assets/{ProvidersList-CArDOswN.js → ProvidersList-DE-S9mq0.js} +1 -1
  10. package/dist/assets/RemoteAccessPage-DxUia6R-.js +1 -0
  11. package/dist/assets/RuntimeConfig-CQcGfNZT.js +1 -0
  12. package/dist/assets/{SearchConfig-a38m8Ynx.js → SearchConfig-DeOa-M6j.js} +1 -1
  13. package/dist/assets/{SecretsConfig-B6mf4JY9.js → SecretsConfig-Ci8pJmzd.js} +2 -2
  14. package/dist/assets/{SessionsConfig-B_WQ1lVd.js → SessionsConfig-B6zq55yu.js} +2 -2
  15. package/dist/assets/chat-session-display--oo5yuIw.js +1 -0
  16. package/dist/assets/{index-D-wEIgPn.js → index-LhlkB00c.js} +4 -4
  17. package/dist/assets/{label-usOOP7mv.js → label-3TKt0PoZ.js} +1 -1
  18. package/dist/assets/{page-layout-CuIf20mx.js → page-layout-CopkIM3Q.js} +1 -1
  19. package/dist/assets/{popover-CTtTCP5d.js → popover-CUx8uRJw.js} +1 -1
  20. package/dist/assets/security-config-BL29kTzz.js +1 -0
  21. package/dist/assets/{skeleton-BNUaFYE7.js → skeleton-Bs4zvcql.js} +1 -1
  22. package/dist/assets/{status-dot-BeHTBy9k.js → status-dot-D6vJMwD7.js} +1 -1
  23. package/dist/assets/{switch-CtNnWZpa.js → switch-A3-ClT1P.js} +1 -1
  24. package/dist/assets/{tabs-custom-Dz_4tV62.js → tabs-custom-BVSd5urq.js} +1 -1
  25. package/dist/assets/{useConfirmDialog-C_n_JIEq.js → useConfirmDialog-ChPriea6.js} +1 -1
  26. package/dist/index.html +1 -1
  27. package/package.json +5 -5
  28. package/src/api/ncp-session-query-cache.test.ts +89 -0
  29. package/src/api/ncp-session-query-cache.ts +85 -0
  30. package/src/api/types.ts +2 -0
  31. package/src/components/chat/ChatConversationPanel.test.tsx +1 -1
  32. package/src/components/chat/ChatConversationPanel.tsx +6 -6
  33. package/src/components/chat/ChatSidebar.test.tsx +87 -92
  34. package/src/components/chat/ChatSidebar.tsx +21 -36
  35. package/src/components/chat/chat-session-label.service.ts +3 -3
  36. package/src/components/chat/containers/chat-message-list.container.test.tsx +53 -8
  37. package/src/components/chat/containers/chat-message-list.container.tsx +15 -14
  38. package/src/components/chat/managers/chat-session-list.manager.ts +0 -18
  39. package/src/components/chat/ncp/NcpChatPage.tsx +4 -52
  40. package/src/components/chat/ncp/ncp-chat-thread.manager.ts +4 -18
  41. package/src/components/chat/ncp/ncp-chat.presenter.ts +0 -2
  42. package/src/components/chat/ncp/ncp-session-adapter.test.ts +0 -23
  43. package/src/components/chat/ncp/ncp-session-adapter.ts +0 -19
  44. package/src/components/chat/ncp/use-ncp-session-list-view.ts +42 -0
  45. package/src/components/chat/presenter/chat-presenter-context.tsx +0 -3
  46. package/src/components/chat/stores/chat-session-list.store.ts +1 -7
  47. package/src/components/chat/stores/chat-thread.store.ts +3 -3
  48. package/src/hooks/use-realtime-query-bridge.ts +14 -19
  49. package/src/hooks/useConfig.ts +10 -11
  50. package/dist/assets/ChatPage-DYTcCRPp.js +0 -37
  51. package/dist/assets/RemoteAccessPage-C0I4tHey.js +0 -1
  52. package/dist/assets/RuntimeConfig-B4o6uJq9.js +0 -1
  53. package/dist/assets/ncp-session-adapter-DSacECph.js +0 -1
  54. package/dist/assets/security-config-Bxrrv8Ac.js +0 -1
  55. package/src/components/chat/managers/chat-run-status.manager.ts +0 -32
  56. package/src/components/chat/stores/chat-run-status.store.ts +0 -30
@@ -1 +0,0 @@
1
- import{r as y,j as r,b7 as C,S as H,b8 as L}from"./vendor-BEQcLDx6.js";import{P as k,a as z}from"./page-layout-CuIf20mx.js";import{t,a9 as T,aa as E,ab as q,ac as P,C as R,Y as j,Z as N,_ as w,y as A,i as I,B as b}from"./index-D-wEIgPn.js";import{S as d}from"./status-dot-BeHTBy9k.js";const M=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function B(i){var n,e;return((e=(n=i==null?void 0:i.runtime)==null?void 0:n.lastError)==null?void 0:e.trim())||""}function O(i){if(!(i!=null&&i.settings.enabled))return!1;const n=B(i);return M.some(e=>e.test(n))}function V(i){var e,a;return O(i)?{hero:{badgeStatus:"warning",badgeLabel:t("remoteStateReauthorizationRequired"),title:t("remoteStatusReauthorizationTitle"),description:t("remoteStatusReauthorizationDescription")},primaryAction:{kind:"reauthorize",label:t("remoteReauthorizeNow"),showRefreshIcon:!1},issueHint:{title:t("remoteStatusRecoveryTitle"),body:t("remoteStatusReauthorizationHint")},shouldShowIssueHint:!0,requiresReauthorization:!0}:i!=null&&i.account.loggedIn?i.settings.enabled?i.service.running?((e=i.runtime)==null?void 0:e.state)==="connected"?{hero:{badgeStatus:"ready",badgeLabel:t("statusReady"),title:t("remoteStatusReadyTitle"),description:t("remoteStatusReadyDescription")},primaryAction:{kind:"repair",label:t("remoteReconnectNow"),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:((a=i.runtime)==null?void 0:a.state)==="connecting"?{hero:{badgeStatus:"active",badgeLabel:t("connecting"),title:t("remoteStatusConnectingTitle"),description:t("remoteStatusConnectingDescription")},primaryAction:{kind:"repair",label:t("remoteReconnectNow"),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:"warning",badgeLabel:t("remoteStateDisconnected"),title:t("remoteStatusIssueTitle"),description:t("remoteStatusIssueDescription")},primaryAction:{kind:"repair",label:t("remoteReconnectNow"),showRefreshIcon:!0},issueHint:{title:t("remoteStatusRecoveryTitle"),body:t("remoteStatusIssueDetailGeneric")},shouldShowIssueHint:!!(i.settings.enabled&&i.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:"warning",badgeLabel:t("remoteServiceStopped"),title:t("remoteStatusNeedsServiceTitle"),description:t("remoteStatusNeedsServiceDescription")},primaryAction:{kind:"repair",label:t("remoteReconnectNow"),showRefreshIcon:!0},issueHint:{title:t("remoteStatusRecoveryTitle"),body:t("remoteStatusIssueDetailServiceStopped")},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:"inactive",badgeLabel:t("statusInactive"),title:t("remoteStatusNeedsEnable"),description:t("remoteStatusNeedsEnableDescription")},primaryAction:{kind:"enable",label:t("remoteEnableNow"),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:"setup",badgeLabel:t("statusSetup"),title:t("remoteStatusNeedsSignIn"),description:t("remoteStatusNeedsSignInDescription")},primaryAction:{kind:"sign-in-enable",label:t("remoteSignInAndEnable"),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}function s(i){const{label:n,muted:e,value:a}=i,o=a==null||a===""?"-":String(a);return r.jsxs("div",{className:"flex items-start justify-between gap-4 py-2 text-sm",children:[r.jsx("span",{className:"text-gray-500",children:n}),r.jsx("span",{className:e?"text-right text-gray-500":"text-right text-gray-900",children:o})]})}function G(){var h,p,x,S,v;const i=T(),n=E(),e=n.data,a=q(c=>c.actionLabel),o=y.useMemo(()=>V(e),[e]),m=!!a,g=((p=(h=e==null?void 0:e.runtime)==null?void 0:h.deviceName)==null?void 0:p.trim())||((x=e==null?void 0:e.settings.deviceName)==null?void 0:x.trim())||t("remoteDeviceNameAuto"),D=!!(e!=null&&e.account.loggedIn&&P(e)),{hero:l,issueHint:u}=o;return y.useEffect(()=>{i.remoteAccessManager.syncStatus(e)},[i,e]),n.isLoading&&!e?r.jsx("div",{className:"p-8 text-gray-400",children:t("remoteLoading")}):r.jsxs(k,{className:"space-y-6",children:[r.jsx(z,{title:t("remotePageTitle"),description:t("remotePageDescription")}),r.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1.2fr_0.8fr]",children:[r.jsxs(R,{children:[r.jsxs(j,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(N,{children:l.title}),r.jsx(d,{status:l.badgeStatus,label:l.badgeLabel})]}),r.jsx(w,{children:l.description})]}),r.jsxs(A,{className:"space-y-5",children:[r.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3",children:[r.jsx(s,{label:t("remoteSignedInAccount"),value:e==null?void 0:e.account.email}),r.jsx(s,{label:t("remoteDeviceName"),value:g}),r.jsx(s,{label:t("remoteConnectionStatus"),value:l.badgeLabel}),r.jsx(s,{label:t("remoteLastConnectedAt"),value:(S=e==null?void 0:e.runtime)!=null&&S.lastConnectedAt?I(e.runtime.lastConnectedAt):"-",muted:!0})]}),r.jsxs("div",{className:"flex flex-wrap gap-3",children:[o.primaryAction?r.jsxs(b,{onClick:()=>{var c,f;if(((c=o.primaryAction)==null?void 0:c.kind)==="reauthorize"){i.remoteAccessManager.reauthorizeRemoteAccess(e);return}if(((f=o.primaryAction)==null?void 0:f.kind)==="repair"){i.remoteAccessManager.repairRemoteAccess(e);return}i.remoteAccessManager.enableRemoteAccess(e)},disabled:m,children:[o.primaryAction.showRefreshIcon?r.jsx(C,{className:"mr-2 h-4 w-4"}):null,a||o.primaryAction.label]}):null,r.jsxs(b,{variant:"outline",onClick:()=>void i.accountManager.openNextClawWeb(),disabled:m||!D,children:[r.jsx(H,{className:"mr-2 h-4 w-4"}),t("remoteOpenDeviceList")]}),e!=null&&e.settings.enabled?r.jsx(b,{variant:"outline",onClick:()=>void i.remoteAccessManager.disableRemoteAccess(e),disabled:m,children:t("remoteDisable")}):null]}),o.shouldShowIssueHint&&u?r.jsxs("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 px-4 py-3",children:[r.jsx("p",{className:"text-sm font-medium text-amber-900",children:u.title}),r.jsx("p",{className:"mt-1 text-sm leading-6 text-amber-800",children:u.body})]}):null,r.jsx("p",{className:"text-xs text-gray-500",children:t("remoteOpenWebHint")})]})]}),r.jsxs(R,{children:[r.jsxs(j,{children:[r.jsxs(N,{className:"flex items-center gap-2",children:[r.jsx(L,{className:"h-4 w-4 text-primary"}),t("remoteDeviceSectionTitle")]}),r.jsx(w,{children:t("remoteDeviceSectionDescription")})]}),r.jsxs(A,{className:"space-y-5",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(d,{status:e!=null&&e.account.loggedIn?"ready":"inactive",label:e!=null&&e.account.loggedIn?t("remoteAccountConnected"):t("remoteAccountNotConnected")}),r.jsx(d,{status:e!=null&&e.settings.enabled?"active":"inactive",label:e!=null&&e.settings.enabled?t("remoteEnabled"):t("remoteStateDisabled")}),r.jsx(d,{status:e!=null&&e.service.running?"active":"inactive",label:e!=null&&e.service.running?t("remoteServiceRunning"):t("remoteServiceStopped")})]}),r.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-gray-50 px-4 py-3",children:[r.jsx(s,{label:t("remoteDeviceName"),value:g}),r.jsx(s,{label:t("remoteConnectionStatus"),value:l.badgeLabel}),r.jsx(s,{label:t("remoteLastConnectedAt"),value:(v=e==null?void 0:e.runtime)!=null&&v.lastConnectedAt?I(e.runtime.lastConnectedAt):"-",muted:!0})]}),r.jsx("div",{className:"rounded-2xl border border-dashed border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600",children:e!=null&&e.account.loggedIn?t("remoteOpenWebHint"):t("remoteStatusNeedsSignInDescription")})]})]})]})]})}export{G as RemoteAccessPage};
@@ -1 +0,0 @@
1
- import{r as p,j as e,ay as ee,aw as ae,b4 as de,e as se}from"./vendor-BEQcLDx6.js";import{u as me,b as he,X as ue,t,C as R,Y as $,Z as z,_ as D,y as L,I as i,S as te,e as re,f as ne,g as le,h as w,B as S}from"./index-D-wEIgPn.js";import{S as pe}from"./switch-CtNnWZpa.js";import{h as x}from"./config-hints-CApS3K_7.js";import{P as xe,a as ge}from"./page-layout-CuIf20mx.js";const je=[{value:"main",label:"main"},{value:"per-peer",label:"per-peer"},{value:"per-channel-peer",label:"per-channel-peer"},{value:"per-account-channel-peer",label:"per-account-channel-peer"}];function ve(){return{id:"",default:!1,workspace:"",model:"",engine:"",contextTokens:void 0,maxToolIterations:void 0}}function fe(){return{agentId:"",match:{channel:"",accountId:""}}}function ce(d){const b=d.trim();if(!b)return;const j=Number.parseInt(b,10);return Number.isFinite(j)?j:void 0}function Ce(){const{data:d,isLoading:b}=me(),{data:j}=he(),A=ue(),[_,N]=p.useState([]),[q,E]=p.useState([]),[K,F]=p.useState("per-channel-peer"),[V,U]=p.useState(0),[X,Y]=p.useState(2e5),[Z,G]=p.useState("native");p.useEffect(()=>{var a,r,n;d&&(N((d.agents.list??[]).map(s=>({id:s.id??"",default:!!s.default,workspace:s.workspace??"",model:s.model??"",engine:s.engine??"",contextTokens:s.contextTokens,maxToolIterations:s.maxToolIterations}))),E((d.bindings??[]).map(s=>{var c,l,o;return{agentId:s.agentId??"",match:{channel:((c=s.match)==null?void 0:c.channel)??"",accountId:((l=s.match)==null?void 0:l.accountId)??"",peer:(o=s.match)!=null&&o.peer?{kind:s.match.peer.kind,id:s.match.peer.id}:void 0}}})),F(((a=d.session)==null?void 0:a.dmScope)??"per-channel-peer"),U(((n=(r=d.session)==null?void 0:r.agentToAgent)==null?void 0:n.maxPingPongTurns)??0),Y(d.agents.defaults.contextTokens??2e5),G(d.agents.defaults.engine??"native"))},[d]);const u=j==null?void 0:j.uiHints,h=x("session.dmScope",u),v=x("session.agentToAgent.maxPingPongTurns",u),f=x("agents.defaults.contextTokens",u),I=x("agents.defaults.engine",u),O=x("agents.list.*.contextTokens",u),B=x("agents.list.*.engine",u),y=x("agents.list",u),k=x("bindings",u),oe=p.useMemo(()=>{const a=new Set(["main"]);return _.forEach(r=>{const n=r.id.trim();n&&a.add(n)}),a},[_]),g=(a,r)=>{N(n=>n.map((s,c)=>c===a?{...s,...r}:s))},T=(a,r)=>{E(n=>n.map((s,c)=>c===a?r:s))},ie=()=>{try{const a=_.map((s,c)=>{var m,C,P;const l=s.id.trim();if(!l)throw new Error(t("agentIdRequiredError").replace("{index}",String(c)));const o={id:l};return s.default&&(o.default=!0),(m=s.workspace)!=null&&m.trim()&&(o.workspace=s.workspace.trim()),(C=s.model)!=null&&C.trim()&&(o.model=s.model.trim()),(P=s.engine)!=null&&P.trim()&&(o.engine=s.engine.trim()),typeof s.contextTokens=="number"&&(o.contextTokens=Math.max(1e3,s.contextTokens)),typeof s.maxToolIterations=="number"&&(o.maxToolIterations=s.maxToolIterations),o}),r=a.map(s=>s.id).filter((s,c,l)=>l.indexOf(s)!==c);if(r.length>0){se.error(`${t("duplicateAgentId")}: ${r[0]}`);return}const n=q.map((s,c)=>{var J,Q,W,H;const l=s.agentId.trim(),o=s.match.channel.trim(),m=((J=s.match.accountId)==null?void 0:J.trim())??"",C=(Q=s.match.peer)==null?void 0:Q.kind,P=((H=(W=s.match.peer)==null?void 0:W.id)==null?void 0:H.trim())??"";if(!l)throw new Error(t("bindingAgentIdRequired").replace("{index}",String(c)));if(!oe.has(l))throw new Error(`${t("bindingAgentIdNotFound").replace("{index}",String(c))}: ${l}`);if(!o)throw new Error(t("bindingChannelRequired").replace("{index}",String(c)));const M={agentId:l,match:{channel:o}};if(m&&(M.match.accountId=m),C){if(!P)throw new Error(t("bindingPeerIdRequired").replace("{index}",String(c)));M.match.peer={kind:C,id:P}}return M});A.mutate({data:{agents:{defaults:{contextTokens:Math.max(1e3,X),engine:Z.trim()||"native"},list:a},bindings:n,session:{dmScope:K,agentToAgent:{maxPingPongTurns:Math.min(5,Math.max(0,V))}}}})}catch(a){const r=a instanceof Error?a.message:String(a);se.error(r)}};return b||!d?e.jsx("div",{className:"p-8 text-gray-400",children:t("runtimeLoading")}):e.jsxs(xe,{className:"space-y-6",children:[e.jsx(ge,{title:t("runtimePageTitle"),description:t("runtimePageDescription")}),e.jsxs(R,{children:[e.jsxs($,{children:[e.jsx(z,{children:(h==null?void 0:h.label)??t("dmScope")}),e.jsx(D,{children:(h==null?void 0:h.help)??t("dmScopeHelp")})]}),e.jsxs(L,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(f==null?void 0:f.label)??t("defaultContextTokens")}),e.jsx(i,{type:"number",min:1e3,step:1e3,value:X,onChange:a=>Y(Math.max(1e3,Number.parseInt(a.target.value,10)||1e3))}),e.jsx("p",{className:"text-xs text-gray-500",children:(f==null?void 0:f.help)??t("defaultContextTokensHelp")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(I==null?void 0:I.label)??t("defaultEngine")}),e.jsx(i,{value:Z,onChange:a=>G(a.target.value),placeholder:t("defaultEnginePlaceholder")}),e.jsx("p",{className:"text-xs text-gray-500",children:(I==null?void 0:I.help)??t("defaultEngineHelp")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(h==null?void 0:h.label)??t("dmScope")}),e.jsxs(te,{value:K,onValueChange:a=>F(a),children:[e.jsx(re,{children:e.jsx(ne,{})}),e.jsx(le,{children:je.map(a=>e.jsx(w,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-gray-800",children:(v==null?void 0:v.label)??t("maxPingPongTurns")}),e.jsx(i,{type:"number",min:0,max:5,value:V,onChange:a=>U(Math.max(0,Number.parseInt(a.target.value,10)||0))}),e.jsx("p",{className:"text-xs text-gray-500",children:(v==null?void 0:v.help)??t("maxPingPongTurnsHelp")})]})]})]}),e.jsxs(R,{children:[e.jsxs($,{children:[e.jsx(z,{children:(y==null?void 0:y.label)??t("agentList")}),e.jsx(D,{children:(y==null?void 0:y.help)??t("agentListHelp")})]}),e.jsxs(L,{className:"space-y-3",children:[_.map((a,r)=>e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(i,{value:a.id,onChange:n=>g(r,{id:n.target.value}),placeholder:t("agentIdPlaceholder")}),e.jsx(i,{value:a.workspace??"",onChange:n=>g(r,{workspace:n.target.value}),placeholder:t("workspaceOverridePlaceholder")}),e.jsx(i,{value:a.model??"",onChange:n=>g(r,{model:n.target.value}),placeholder:t("modelOverridePlaceholder")}),e.jsx(i,{value:a.engine??"",onChange:n=>g(r,{engine:n.target.value}),placeholder:(B==null?void 0:B.label)??t("engineOverridePlaceholder")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[e.jsx(i,{type:"number",min:1e3,step:1e3,value:a.contextTokens??"",onChange:n=>g(r,{contextTokens:ce(n.target.value)}),placeholder:(O==null?void 0:O.label)??t("contextTokensPlaceholder")}),e.jsx(i,{type:"number",min:1,value:a.maxToolIterations??"",onChange:n=>g(r,{maxToolIterations:ce(n.target.value)}),placeholder:t("maxToolsPlaceholder")})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx(pe,{checked:!!a.default,onCheckedChange:n=>{if(!n){g(r,{default:!1});return}N(s=>s.map((c,l)=>({...c,default:l===r})))}}),e.jsx("span",{children:t("defaultAgent")})]}),e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>N(n=>n.filter((s,c)=>c!==r)),children:[e.jsx(ee,{className:"h-4 w-4 mr-1"}),t("remove")]})]})]},`${r}-${a.id}`)),e.jsxs(S,{type:"button",variant:"outline",onClick:()=>N(a=>[...a,ve()]),children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),t("addAgent")]})]})]}),e.jsxs(R,{children:[e.jsxs($,{children:[e.jsx(z,{children:(k==null?void 0:k.label)??t("bindings")}),e.jsx(D,{children:(k==null?void 0:k.help)??t("bindingsHelp")})]}),e.jsxs(L,{className:"space-y-3",children:[q.map((a,r)=>{var s,c;const n=((s=a.match.peer)==null?void 0:s.kind)??"";return e.jsxs("div",{className:"rounded-xl border border-gray-200 p-3 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[e.jsx(i,{value:a.agentId,onChange:l=>T(r,{...a,agentId:l.target.value}),placeholder:t("targetAgentIdPlaceholder")}),e.jsx(i,{value:a.match.channel,onChange:l=>T(r,{...a,match:{...a.match,channel:l.target.value}}),placeholder:t("channelPlaceholder")}),e.jsx(i,{value:a.match.accountId??"",onChange:l=>T(r,{...a,match:{...a.match,accountId:l.target.value}}),placeholder:t("accountIdOptionalPlaceholder")}),e.jsxs(te,{value:n||"__none__",onValueChange:l=>{var m;const o=l==="__none__"?"":l;if(!o){T(r,{...a,match:{...a.match,peer:void 0}});return}T(r,{...a,match:{...a.match,peer:{kind:o,id:((m=a.match.peer)==null?void 0:m.id)??""}}})},children:[e.jsx(re,{children:e.jsx(ne,{})}),e.jsxs(le,{children:[e.jsx(w,{value:"__none__",children:t("peerKindOptional")}),e.jsx(w,{value:"direct",children:"direct"}),e.jsx(w,{value:"group",children:"group"}),e.jsx(w,{value:"channel",children:"channel"})]})]}),e.jsx(i,{value:((c=a.match.peer)==null?void 0:c.id)??"",onChange:l=>T(r,{...a,match:{...a.match,peer:n?{kind:n,id:l.target.value}:void 0}}),placeholder:t("peerIdPlaceholder")})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(S,{type:"button",variant:"outline",size:"sm",onClick:()=>E(l=>l.filter((o,m)=>m!==r)),children:[e.jsx(ee,{className:"h-4 w-4 mr-1"}),t("remove")]})})]},`${r}-${a.agentId}`)}),e.jsxs(S,{type:"button",variant:"outline",onClick:()=>E(a=>[...a,fe()]),children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),t("addBinding")]})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(S,{type:"button",onClick:ie,disabled:A.isPending,children:[e.jsx(de,{className:"h-4 w-4 mr-2"}),A.isPending?t("saving"):t("saveRuntimeSettings")]})})]})}export{Ce as RuntimeConfig};
@@ -1 +0,0 @@
1
- import{j as o,ae as l}from"./vendor-BEQcLDx6.js";import{t as u,c}from"./index-D-wEIgPn.js";function R({status:e,className:n}){const t=e==="running"?u("sessionsRunStatusRunning"):u("sessionsRunStatusQueued");return o.jsxs("span",{className:c("inline-flex h-3.5 w-3.5 items-center justify-center text-gray-400",n),title:t,"aria-label":t,children:[o.jsx(l,{className:"h-3 w-3 animate-spin"}),o.jsx("span",{className:"sr-only",children:t})]})}var s=(e=>(e.CALL="call",e.RESULT="result",e.PARTIAL_CALL="partial-call",e.ERROR="error",e.CANCELLED="cancelled",e))(s||{});function b(e){if(e.label&&e.label.trim())return e.label.trim();const n=e.key.split(":");return n[n.length-1]||e.key}const p=new Set(["off","minimal","low","medium","high","adaptive","xhigh"]);function f(e){if(typeof e=="string")return e;try{return JSON.stringify(e??{})}catch{return String(e??"")}}function r(e){if(typeof e!="string")return null;const n=e.trim();return n.length>0?n:null}function a(e){const{metadata:n}=e;return!n||typeof n!="object"||Array.isArray(n)?null:n}function d(e){const n=a(e);return n?r(n.preferred_model)??r(n.preferredModel)??r(n.model):null}function m(e){const n=a(e);if(!n)return null;const t=r(n.preferred_thinking)??r(n.thinking)??r(n.thinking_level)??r(n.thinkingLevel);if(!t)return null;const i=t.toLowerCase();return p.has(i)?i:null}function y(e){const n=a(e);return n?r(n.label):null}function g(e){const n=a(e);return n?r(n.session_type)??r(n.sessionType)??"native":"native"}function h(e){return e.state==="result"?s.RESULT:e.state==="partial-call"?s.PARTIAL_CALL:s.CALL}function S(e){const n=[];for(const t of e){if(t.type==="text"){n.push({type:"text",text:t.text});continue}if(t.type==="rich-text"){n.push({type:"text",text:t.text});continue}if(t.type==="reasoning"){n.push({type:"reasoning",reasoning:t.text,details:[]});continue}if(t.type==="source"){n.push({type:"source",source:{sourceType:"url",id:t.url??t.title??Math.random().toString(36).slice(2,8),url:t.url??"",...t.title?{title:t.title}:{}}});continue}if(t.type==="file"&&t.contentBase64){n.push({type:"file",...t.name?{name:t.name}:{},mimeType:t.mimeType??"application/octet-stream",data:t.contentBase64,...t.url?{url:t.url}:{},...typeof t.sizeBytes=="number"?{sizeBytes:t.sizeBytes}:{}});continue}if(t.type==="file"&&t.url){n.push({type:"file",...t.name?{name:t.name}:{},mimeType:t.mimeType??"application/octet-stream",data:"",url:t.url,...typeof t.sizeBytes=="number"?{sizeBytes:t.sizeBytes}:{}});continue}if(t.type==="step-start"){n.push({type:"step-start"});continue}t.type==="tool-invocation"&&n.push({type:"tool-invocation",toolInvocation:{status:h(t),toolCallId:t.toolCallId??`${t.toolName}-${Math.random().toString(36).slice(2,8)}`,toolName:t.toolName,args:f(t.args),result:t.result}})}return n}function L(e){return e==="service"?"system":e==="tool"?"assistant":e}function N(e){return{id:e.id,role:L(e.role),parts:S(e.parts),meta:{source:"stream",status:e.status,sessionKey:e.sessionId,timestamp:e.timestamp}}}function M(e){return e.map(N)}function x(e){const n=y(e),t=d(e),i=m(e);return{key:e.sessionId,createdAt:e.updatedAt,updatedAt:e.updatedAt,...n?{label:n}:{},...t?{preferredModel:t}:{},...i?{preferredThinking:i}:{},sessionType:g(e),sessionTypeMutable:!1,messageCount:e.messageCount}}function C(e){return e.map(x)}function k(e){const n=new Map;for(const i of e.summaries)i.status==="running"&&n.set(i.sessionId,"running");const t=r(e.activeSessionId);return e.isLocallyRunning&&t&&n.set(t,"running"),n}function B(){return`ncp-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}export{R as S,C as a,M as b,B as c,k as d,b as s};
@@ -1 +0,0 @@
1
- import{r as c,j as e,e as M}from"./vendor-BEQcLDx6.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-D-wEIgPn.js";import{L as o}from"./label-usOOP7mv.js";import{S as G}from"./switch-CtNnWZpa.js";import{P as V,a as W}from"./page-layout-CuIf20mx.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};
@@ -1,32 +0,0 @@
1
- import { useChatRunStatusStore } from '@/components/chat/stores/chat-run-status.store';
2
- import type { ChatRunStatusSnapshot } from '@/components/chat/stores/chat-run-status.store';
3
-
4
- function isMapEqual<T>(left: ReadonlyMap<string, T>, right: ReadonlyMap<string, T>): boolean {
5
- if (left === right) {
6
- return true;
7
- }
8
- if (left.size !== right.size) {
9
- return false;
10
- }
11
- for (const [key, value] of left.entries()) {
12
- if (!Object.is(value, right.get(key))) {
13
- return false;
14
- }
15
- }
16
- return true;
17
- }
18
-
19
- export class ChatRunStatusManager {
20
- syncSnapshot = (patch: Partial<ChatRunStatusSnapshot>) => {
21
- const current = useChatRunStatusStore.getState().snapshot;
22
- const nextMap = patch.sessionRunStatusByKey;
23
- if (
24
- (nextMap ? isMapEqual(current.sessionRunStatusByKey, nextMap) : true) &&
25
- (patch.isLocallyRunning === undefined || Object.is(current.isLocallyRunning, patch.isLocallyRunning)) &&
26
- (patch.activeBackendRunId === undefined || Object.is(current.activeBackendRunId, patch.activeBackendRunId))
27
- ) {
28
- return;
29
- }
30
- useChatRunStatusStore.getState().setSnapshot(patch);
31
- };
32
- }
@@ -1,30 +0,0 @@
1
- import { create } from 'zustand';
2
- import type { SessionRunStatus } from '@/lib/session-run-status';
3
-
4
- export type ChatRunStatusSnapshot = {
5
- sessionRunStatusByKey: ReadonlyMap<string, SessionRunStatus>;
6
- isLocallyRunning: boolean;
7
- activeBackendRunId: string | null;
8
- };
9
-
10
- type ChatRunStatusStore = {
11
- snapshot: ChatRunStatusSnapshot;
12
- setSnapshot: (patch: Partial<ChatRunStatusSnapshot>) => void;
13
- };
14
-
15
- const initialSnapshot: ChatRunStatusSnapshot = {
16
- sessionRunStatusByKey: new Map(),
17
- isLocallyRunning: false,
18
- activeBackendRunId: null
19
- };
20
-
21
- export const useChatRunStatusStore = create<ChatRunStatusStore>((set) => ({
22
- snapshot: initialSnapshot,
23
- setSnapshot: (patch) =>
24
- set((state) => ({
25
- snapshot: {
26
- ...state.snapshot,
27
- ...patch
28
- }
29
- }))
30
- }));