@nextclaw/ui 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/assets/{ChannelsList-DDfZIiJa.js → ChannelsList-Byfj2R01.js} +1 -1
- package/dist/assets/{ChatPage-FpRraTxm.js → ChatPage-DM1ewbWf.js} +1 -1
- package/dist/assets/{DocBrowser-Kndx8OJj.js → DocBrowser-BLv77lJ0.js} +1 -1
- package/dist/assets/{LogoBadge-hKHoLH9n.js → LogoBadge-D7j1al-w.js} +1 -1
- package/dist/assets/{MarketplacePage-CZIJyfjK.js → MarketplacePage-DuskLKYh.js} +1 -1
- package/dist/assets/{McpMarketplacePage-BGrAMA37.js → McpMarketplacePage-DpMjaD3m.js} +1 -1
- package/dist/assets/{ModelConfig-BpKQeGfb.js → ModelConfig-ubaecweS.js} +1 -1
- package/dist/assets/{ProvidersList-qfUL6mrW.js → ProvidersList-w8MJH2LI.js} +1 -1
- package/dist/assets/RemoteAccessPage-D79_5Kbn.js +1 -0
- package/dist/assets/{RuntimeConfig-CVlqNWKO.js → RuntimeConfig-BbX4yFKy.js} +1 -1
- package/dist/assets/{SearchConfig-DXFV6Mvx.js → SearchConfig-BmmmeyJd.js} +1 -1
- package/dist/assets/{SecretsConfig-BGW9aUqv.js → SecretsConfig-CWG8J01H.js} +1 -1
- package/dist/assets/{SessionsConfig-BByfa1ke.js → SessionsConfig-D-vg_Lgv.js} +1 -1
- package/dist/assets/{chat-message-ZwnDwDuQ.js → chat-message-CGXiVhyN.js} +1 -1
- package/dist/assets/{index-BWvap_iq.js → index-CeRbsQ90.js} +2 -2
- package/dist/assets/{label-Bklr3fXc.js → label-CCSffS1D.js} +1 -1
- package/dist/assets/{page-layout-sNhcbwtm.js → page-layout-ud8wZ8gX.js} +1 -1
- package/dist/assets/{popover-C3rJrJJG.js → popover-Bfoe6YBX.js} +1 -1
- package/dist/assets/{security-config-BueosYw1.js → security-config-DJJUCMov.js} +1 -1
- package/dist/assets/{skeleton-CiG6msbm.js → skeleton-IOOTmHzP.js} +1 -1
- package/dist/assets/{status-dot-CsIV5YrS.js → status-dot-Fz9-eKsl.js} +1 -1
- package/dist/assets/{switch-DSdHSIsC.js → switch-B-_SrMSL.js} +1 -1
- package/dist/assets/{tabs-custom-BB-VjdL2.js → tabs-custom-6Tm1ZHfS.js} +1 -1
- package/dist/assets/{useConfirmDialog-BL5s8KDC.js → useConfirmDialog-BeOW2bOI.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/src/components/remote/RemoteAccessPage.tsx +334 -241
- package/dist/assets/RemoteAccessPage-BQuMsngI.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as J,d as v,b as C,e as l,r as i,j as e,aY as X,aZ as ee,a_ as te,K as re,a$ as se,b0 as ae,b1 as ne}from"./vendor-CwsIoNvJ.js";import{af as u,t as r,C as w,a3 as b,a4 as S,a5 as A,z as N,s as k,I as W,B as c}from"./index-BWvap_iq.js";import{P as oe,a as ie}from"./page-layout-sNhcbwtm.js";import{L as G}from"./label-Bklr3fXc.js";import{S as B}from"./status-dot-CsIV5YrS.js";import{S as le}from"./switch-DSdHSIsC.js";async function ce(){const s=await u.get("/api/remote/status");if(!s.ok)throw new Error(s.error.message);return s.data}async function me(){const s=await u.get("/api/remote/doctor");if(!s.ok)throw new Error(s.error.message);return s.data}async function de(s){const a=await u.post("/api/remote/auth/start",s);if(!a.ok)throw new Error(a.error.message);return a.data}async function ue(s){const a=await u.post("/api/remote/auth/poll",s);if(!a.ok)throw new Error(a.error.message);return a.data}async function xe(){const s=await u.post("/api/remote/logout",{});if(!s.ok)throw new Error(s.error.message);return s.data}async function ge(s){const a=await u.put("/api/remote/settings",s);if(!a.ok)throw new Error(a.error.message);return a.data}async function pe(s){const a=await u.post(`/api/remote/service/${s}`,{});if(!a.ok)throw new Error(a.error.message);return a.data}function he(){return J({queryKey:["remote-status"],queryFn:ce,staleTime:5e3,refetchOnWindowFocus:!0})}function ve(){return v({mutationFn:de,onError:s=>{l.error(`${r("remoteBrowserAuthStartFailed")}: ${s.message}`)}})}function fe(){const s=C();return v({mutationFn:ue,onSuccess:a=>{a.status==="authorized"&&(s.invalidateQueries({queryKey:["remote-status"]}),l.success(r("remoteLoginSuccess")))},onError:a=>{l.error(`${r("remoteBrowserAuthPollFailed")}: ${a.message}`)}})}function je(){const s=C();return v({mutationFn:xe,onSuccess:()=>{s.invalidateQueries({queryKey:["remote-status"]}),l.success(r("remoteLogoutSuccess"))},onError:a=>{l.error(`${r("remoteLogoutFailed")}: ${a.message}`)}})}function ye(){const s=C();return v({mutationFn:ge,onSuccess:()=>{s.invalidateQueries({queryKey:["remote-status"]}),l.success(r("remoteSettingsSaved"))},onError:a=>{l.error(`${r("remoteSettingsSaveFailed")}: ${a.message}`)}})}function we(){return v({mutationFn:me,onSuccess:()=>{l.success(r("remoteDoctorCompleted"))},onError:s=>{l.error(`${r("remoteDoctorFailed")}: ${s.message}`)}})}function be(){const s=C();return v({mutationFn:pe,onSuccess:a=>{s.invalidateQueries({queryKey:["remote-status"]}),l.success(a.message)},onError:a=>{l.error(`${r("remoteServiceActionFailed")}: ${a.message}`)}})}function Se(s){return s?s.state==="connected"?{status:"ready",label:r("remoteStateConnected")}:s.state==="connecting"?{status:"warning",label:r("remoteStateConnecting")}:s.state==="error"?{status:"warning",label:r("remoteStateError")}:s.state==="disconnected"?{status:"warning",label:r("remoteStateDisconnected")}:{status:"inactive",label:r("remoteStateDisabled")}:{status:"inactive",label:r("remoteRuntimeMissing")}}function Ae(s){return s.running?s.currentProcess?{status:"ready",label:r("remoteServiceManagedRunning")}:{status:"active",label:r("remoteServiceRunning")}:{status:"inactive",label:r("remoteServiceStopped")}}function o(s){const a=s.value===void 0||s.value===null||s.value===""?"-":String(s.value);return e.jsxs("div",{className:"flex items-start justify-between gap-4 py-2 text-sm",children:[e.jsx("span",{className:"text-gray-500",children:s.label}),e.jsx("span",{className:s.muted?"text-right text-gray-500":"text-right text-gray-800",children:a})]})}function De(){var _,z,V;const s=he(),a=ve(),F=fe(),P=je(),E=ye(),x=we(),m=be(),t=s.data,I=i.useMemo(()=>Se((t==null?void 0:t.runtime)??null),[t==null?void 0:t.runtime]),M=i.useMemo(()=>Ae((t==null?void 0:t.service)??{running:!1,currentProcess:!1}),[t==null?void 0:t.service]),[L,$]=i.useState(!1),[T,q]=i.useState(""),[g,K]=i.useState(""),[p,f]=i.useState(null),[R,j]=i.useState(null),[H,h]=i.useState(""),[U,O]=i.useState(null),[Q,D]=i.useState(1500);i.useEffect(()=>{t&&($(t.settings.enabled),q(t.settings.deviceName),K(t.settings.platformApiBase))},[t]),i.useEffect(()=>{t!=null&&t.account.loggedIn&&(f(null),j(null),O(null),h(""),D(1500))},[t==null?void 0:t.account.loggedIn]),i.useEffect(()=>{if(!p||t!=null&&t.account.loggedIn)return;let n=!1;const d=window.setTimeout(async()=>{try{const y=await F.mutateAsync({sessionId:p,apiBase:g.trim()||(t==null?void 0:t.settings.platformApiBase)||(t==null?void 0:t.account.apiBase)||void 0});if(n)return;if(y.status==="pending"){h(r("remoteBrowserAuthWaiting")),D(y.nextPollMs??1500);return}if(y.status==="authorized"){h(r("remoteBrowserAuthCompleted")),f(null),j(null);return}h(y.message||r("remoteBrowserAuthExpired")),f(null),j(null)}catch{if(n)return;f(null),j(null)}},Q);return()=>{n=!0,window.clearTimeout(d)}},[Q,p,F,g,t==null?void 0:t.account.apiBase,t==null?void 0:t.account.loggedIn,t==null?void 0:t.settings.platformApiBase]);const Y=async()=>{const n=g.trim()||(t==null?void 0:t.settings.platformApiBase)||(t==null?void 0:t.account.apiBase)||void 0,d=await a.mutateAsync({apiBase:n});f(d.sessionId),j(d.verificationUri),O(d.expiresAt),D(d.intervalMs),h(r("remoteBrowserAuthWaiting")),window.open(d.verificationUri,"_blank","noopener,noreferrer")||h(r("remoteBrowserAuthPopupBlocked"))},Z=()=>{R&&window.open(R,"_blank","noopener,noreferrer")};return s.isLoading&&!t?e.jsx("div",{className:"p-8 text-gray-400",children:r("remoteLoading")}):e.jsxs(oe,{className:"space-y-6",children:[e.jsx(ie,{title:r("remotePageTitle"),description:r("remotePageDescription")}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1.35fr_0.95fr]",children:[e.jsxs(w,{children:[e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-4 w-4 text-primary"}),r("remoteOverviewTitle")]}),e.jsx(A,{children:r("remoteOverviewDescription")})]}),e.jsxs(N,{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(B,{status:t!=null&&t.account.loggedIn?"ready":"inactive",label:t!=null&&t.account.loggedIn?r("remoteAccountConnected"):r("remoteAccountNotConnected")}),e.jsx(B,{status:M.status,label:M.label}),e.jsx(B,{status:I.status,label:I.label})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200/70 bg-gray-50/70 px-4 py-3",children:[e.jsx(o,{label:r("remoteLocalOrigin"),value:t==null?void 0:t.localOrigin}),e.jsx(o,{label:r("remotePublicPlatform"),value:(t==null?void 0:t.platformBase)??(t==null?void 0:t.account.platformBase)}),e.jsx(o,{label:r("remoteDeviceId"),value:(_=t==null?void 0:t.runtime)==null?void 0:_.deviceId,muted:!0}),e.jsx(o,{label:r("remoteLastConnectedAt"),value:(z=t==null?void 0:t.runtime)!=null&&z.lastConnectedAt?k(t.runtime.lastConnectedAt):"-",muted:!0}),e.jsx(o,{label:r("remoteLastError"),value:(V=t==null?void 0:t.runtime)==null?void 0:V.lastError,muted:!0})]})]})]}),e.jsxs(w,{children:[e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-primary"}),r("remoteDeviceTitle")]}),e.jsx(A,{children:r("remoteDeviceDescription")})]}),e.jsxs(N,{className:"space-y-4",children:[e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"flex items-center justify-between rounded-2xl border border-gray-200/70 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:r("remoteEnabled")}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:r("remoteEnabledHelp")})]}),e.jsx(le,{checked:L,onCheckedChange:$})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(G,{htmlFor:"remote-device-name",children:r("remoteDeviceName")}),e.jsx(W,{id:"remote-device-name",value:T,onChange:n=>q(n.target.value),placeholder:r("remoteDeviceNamePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(G,{htmlFor:"remote-platform-api-base",children:r("remotePlatformApiBase")}),e.jsx(W,{id:"remote-platform-api-base",value:g,onChange:n=>K(n.target.value),placeholder:"https://ai-gateway-api.nextclaw.io/v1"}),e.jsx("p",{className:"text-xs text-gray-500",children:r("remotePlatformApiBaseHelp")})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(c,{onClick:()=>E.mutate({enabled:L,deviceName:T,platformApiBase:g}),disabled:E.isPending,children:E.isPending?r("saving"):r("remoteSaveSettings")}),e.jsxs(c,{variant:"outline",onClick:()=>m.mutate("restart"),disabled:m.isPending,children:[e.jsx(te,{className:"mr-2 h-4 w-4"}),r("remoteRestartService")]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:r("remoteSaveHint")})]})]})]}),e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_1fr]",children:[e.jsxs(w,{children:[e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(re,{className:"h-4 w-4 text-primary"}),r("remoteAccountTitle")]}),e.jsx(A,{children:r("remoteAccountDescription")})]}),e.jsx(N,{className:"space-y-4",children:t!=null&&t.account.loggedIn?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200/70 bg-gray-50/70 px-4 py-3",children:[e.jsx(o,{label:r("remoteAccountEmail"),value:t.account.email}),e.jsx(o,{label:r("remoteAccountRole"),value:t.account.role}),e.jsx(o,{label:r("remoteApiBase"),value:t.account.apiBase})]}),e.jsx(c,{variant:"outline",onClick:()=>P.mutate(),disabled:P.isPending,children:P.isPending?r("remoteLoggingOut"):r("remoteLogout")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200/70 bg-gray-50/70 px-4 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:r("remoteBrowserAuthTitle")}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:r("remoteBrowserAuthDescription")}),e.jsxs("div",{className:"mt-3 border-t border-white/80 pt-3",children:[e.jsx(o,{label:r("remoteApiBase"),value:g||(t==null?void 0:t.settings.platformApiBase)||(t==null?void 0:t.account.apiBase),muted:!0}),e.jsx(o,{label:r("remoteBrowserAuthSession"),value:p,muted:!0}),e.jsx(o,{label:r("remoteBrowserAuthExpiresAt"),value:U?k(U):"-",muted:!0})]})]}),H?e.jsx("p",{className:"text-sm text-gray-600",children:H}):null,e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(c,{onClick:Y,disabled:a.isPending||!!p,children:a.isPending?r("remoteBrowserAuthStarting"):p?r("remoteBrowserAuthAuthorizing"):r("remoteBrowserAuthAction")}),R?e.jsx(c,{variant:"outline",onClick:Z,children:r("remoteBrowserAuthResume")}):null]}),e.jsx("p",{className:"text-xs text-gray-500",children:r("remoteBrowserAuthHint")})]})})]}),e.jsxs(w,{children:[e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-primary"}),r("remoteServiceTitle")]}),e.jsx(A,{children:r("remoteServiceDescription")})]}),e.jsxs(N,{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200/70 bg-gray-50/70 px-4 py-3",children:[e.jsx(o,{label:r("remoteServicePid"),value:t==null?void 0:t.service.pid}),e.jsx(o,{label:r("remoteServiceUiUrl"),value:t==null?void 0:t.service.uiUrl}),e.jsx(o,{label:r("remoteServiceCurrentProcess"),value:t!=null&&t.service.currentProcess?r("yes"):r("no")})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(c,{variant:"primary",onClick:()=>m.mutate("start"),disabled:m.isPending,children:r("remoteStartService")}),e.jsx(c,{variant:"outline",onClick:()=>m.mutate("restart"),disabled:m.isPending,children:r("remoteRestartService")}),e.jsx(c,{variant:"outline",onClick:()=>m.mutate("stop"),disabled:m.isPending,children:r("remoteStopService")})]}),e.jsx("p",{className:"text-xs text-gray-500",children:r("remoteServiceHint")})]})]})]}),e.jsxs(w,{children:[e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-primary"}),r("remoteDoctorTitle")]}),e.jsx(A,{children:r("remoteDoctorDescription")})]}),e.jsxs(N,{className:"space-y-4",children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:e.jsxs(c,{variant:"outline",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx(ne,{className:"mr-2 h-4 w-4"}),x.isPending?r("remoteDoctorRunning"):r("remoteRunDoctor")]})}),x.data?e.jsxs("div",{className:"rounded-2xl border border-gray-200/70 bg-gray-50/70 px-4 py-3",children:[e.jsx(o,{label:r("remoteDoctorGeneratedAt"),value:k(x.data.generatedAt),muted:!0}),e.jsx("div",{className:"mt-3 space-y-2",children:x.data.checks.map(n=>e.jsxs("div",{className:"rounded-xl border border-white bg-white px-3 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-gray-900",children:n.name}),e.jsx(B,{status:n.ok?"ready":"warning",label:n.ok?r("remoteCheckPassed"):r("remoteCheckFailed")})]}),e.jsx("p",{className:"mt-2 text-sm text-gray-600",children:n.detail})]},n.name))})]}):e.jsx("p",{className:"text-sm text-gray-500",children:r("remoteDoctorEmpty")})]})]})]})}export{De as RemoteAccessPage};
|