@nextclaw/ui 0.11.12 → 0.11.14

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 (44) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/assets/{ChannelsList-C63gOoYI.js → ChannelsList-CvK4qHfg.js} +4 -4
  3. package/dist/assets/ChatPage-Co3GqIVP.js +37 -0
  4. package/dist/assets/{DocBrowser-CI4jOzJY.js → DocBrowser-BFmW6e-4.js} +1 -1
  5. package/dist/assets/{LogoBadge-DImV63-L.js → LogoBadge-DZL-zQTr.js} +1 -1
  6. package/dist/assets/{MarketplacePage-B360oSAV.js → MarketplacePage-B__MZRrD.js} +1 -1
  7. package/dist/assets/{McpMarketplacePage-KIQgx_7h.js → McpMarketplacePage-C_VKm1uq.js} +2 -2
  8. package/dist/assets/{ModelConfig-Ben3tQoX.js → ModelConfig-CqJubuwU.js} +1 -1
  9. package/dist/assets/{ProvidersList-DE-S9mq0.js → ProvidersList-BoSsFBk5.js} +1 -1
  10. package/dist/assets/RemoteAccessPage-S1ChRWMX.js +1 -0
  11. package/dist/assets/RuntimeConfig-WnFUsayT.js +1 -0
  12. package/dist/assets/{SearchConfig-DeOa-M6j.js → SearchConfig-D9V07oqj.js} +1 -1
  13. package/dist/assets/{SecretsConfig-Ci8pJmzd.js → SecretsConfig-Ci8sEzaV.js} +2 -2
  14. package/dist/assets/{SessionsConfig-B6zq55yu.js → SessionsConfig-5Nznhx9P.js} +2 -2
  15. package/dist/assets/{chat-session-display--oo5yuIw.js → chat-session-display-D0ZcEkUq.js} +1 -1
  16. package/dist/assets/{index-LhlkB00c.js → index-BvCYcN48.js} +3 -3
  17. package/dist/assets/{index-Bro-iRcb.css → index-CfVmBgkf.css} +1 -1
  18. package/dist/assets/{label-3TKt0PoZ.js → label-AurG3ZpO.js} +1 -1
  19. package/dist/assets/{page-layout-CopkIM3Q.js → page-layout-Q2hHkfJy.js} +1 -1
  20. package/dist/assets/{popover-CUx8uRJw.js → popover-BKInm43u.js} +1 -1
  21. package/dist/assets/security-config-BbPGNJAB.js +1 -0
  22. package/dist/assets/skeleton-CuKw6-Ww.js +1 -0
  23. package/dist/assets/{status-dot-D6vJMwD7.js → status-dot-DLk8UxLB.js} +1 -1
  24. package/dist/assets/{switch-A3-ClT1P.js → switch-BxMSKsQS.js} +1 -1
  25. package/dist/assets/{tabs-custom-BVSd5urq.js → tabs-custom-B6gK-RY6.js} +1 -1
  26. package/dist/assets/{useConfirmDialog-ChPriea6.js → useConfirmDialog-Dth62a0a.js} +1 -1
  27. package/dist/assets/{vendor-BEQcLDx6.js → vendor-MCpnpiKt.js} +35 -35
  28. package/dist/index.html +3 -3
  29. package/package.json +4 -4
  30. package/src/components/chat/adapters/chat-input-bar.adapter.test.ts +107 -1
  31. package/src/components/chat/adapters/chat-input-bar.adapter.ts +40 -6
  32. package/src/components/chat/chat-recent-models.manager.ts +8 -0
  33. package/src/components/chat/containers/chat-input-bar.container.tsx +14 -1
  34. package/src/components/chat/ncp/NcpChatPage.tsx +47 -0
  35. package/src/components/chat/ncp/ncp-chat-input.manager.ts +2 -0
  36. package/src/components/chat/ncp/ncp-chat-realtime-reload.test.ts +44 -0
  37. package/src/components/chat/ncp/ncp-chat-realtime-reload.ts +20 -0
  38. package/src/lib/recent-selection.manager.test.ts +68 -0
  39. package/src/lib/recent-selection.manager.ts +105 -0
  40. package/dist/assets/ChatPage-Ci3Gz0qh.js +0 -37
  41. package/dist/assets/RemoteAccessPage-DxUia6R-.js +0 -1
  42. package/dist/assets/RuntimeConfig-CQcGfNZT.js +0 -1
  43. package/dist/assets/security-config-BL29kTzz.js +0 -1
  44. package/dist/assets/skeleton-Bs4zvcql.js +0 -1
@@ -1 +0,0 @@
1
- import{r as R,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-CopkIM3Q.js";import{t,ac as T,ad as E,ae as q,af as P,C as y,$ as j,a0 as N,a1 as w,E as A,i as I,B as b}from"./index-LhlkB00c.js";import{S as d}from"./status-dot-D6vJMwD7.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=R.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 R.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(y,{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(y,{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,_ as ue,t,C as R,$,a0 as z,a1 as D,E 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-LhlkB00c.js";import{S as pe}from"./switch-A3-ClT1P.js";import{h as x}from"./config-hints-CApS3K_7.js";import{P as xe,a as ge}from"./page-layout-CopkIM3Q.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),[G,J]=p.useState(2e5),[Q,W]=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),J(d.agents.defaults.contextTokens??2e5),W(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 X,Y,Z,H;const l=s.agentId.trim(),o=s.match.channel.trim(),m=((X=s.match.accountId)==null?void 0:X.trim())??"",C=(Y=s.match.peer)==null?void 0:Y.kind,P=((H=(Z=s.match.peer)==null?void 0:Z.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,G),engine:Q.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:G,onChange:a=>J(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:Q,onChange:a=>W(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{r as c,j as e,e as M}from"./vendor-BEQcLDx6.js";import{a2 as O,a3 as R,a4 as I,a5 as B,a6 as _,C as u,$ as h,a0 as x,t as s,a1 as m,E as p,B as j,I as l}from"./index-LhlkB00c.js";import{L as o}from"./label-3TKt0PoZ.js";import{S as G}from"./switch-A3-ClT1P.js";import{P as V,a as W}from"./page-layout-CopkIM3Q.js";const $=8;function A(r){return r.trim().length>=$}function L(r,n){return r!==n?(M.error(s("authPasswordMismatch")),!1):!0}function q(){const r=O(),n=R(),S=I(),g=B(),y=_(),[f,U]=c.useState(""),[i,N]=c.useState(""),[w,b]=c.useState(""),[d,v]=c.useState(""),[P,C]=c.useState(""),t=r.data,E=f.trim().length>0&&A(i)&&i===w&&!n.isPending,D=A(d)&&d===P&&!g.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 g.mutateAsync({password:d}),v(""),C("")}catch{}},H=async a=>{try{await S.mutateAsync({enabled:a})}catch{}},k=async()=>{try{await y.mutateAsync()}catch{}};return r.isLoading&&!t?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||!t?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")})]})]}):t.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}",t.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:t.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:t.enabled?s("authEnableOnHelp"):s("authEnableOffHelp")})]}),e.jsx(G,{checked:t.enabled,disabled:S.isPending,onCheckedChange:a=>{H(a)}})]})]}),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:a=>v(a.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:a=>C(a.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:g.isPending?s("authPasswordUpdating"):s("authPasswordAction")}),t.enabled&&t.authenticated?e.jsx(j,{type:"button",variant:"outline",disabled:y.isPending,onClick:()=>void k(),children:y.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:a=>U(a.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:a=>N(a.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:a=>b(a.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 Y(){return e.jsxs(V,{className:"space-y-6",children:[e.jsx(W,{title:s("authSecurityTitle"),description:s("authSecurityDescription")}),e.jsx(q,{})]})}export{Y as SecurityConfig};
@@ -1 +0,0 @@
1
- import{j as t}from"./vendor-BEQcLDx6.js";import{c as o}from"./index-LhlkB00c.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};