@undefineds.co/xpod 0.4.16 → 0.4.18

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 (134) hide show
  1. package/config/xpod.base.json +3 -0
  2. package/dist/components/context.jsonld +14 -0
  3. package/dist/identity/ValidatingIdentityProviderHttpHandler.d.ts +32 -1
  4. package/dist/identity/ValidatingIdentityProviderHttpHandler.js +53 -1
  5. package/dist/identity/ValidatingIdentityProviderHttpHandler.jsonld +53 -0
  6. package/node_modules/@undefineds.co/ai-connections/dist/AiClientConfigurationSection.js +39 -10
  7. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsList.js +15 -4
  8. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.d.ts +1 -1
  9. package/node_modules/@undefineds.co/ai-connections/dist/AiConnectionsPanel.js +4 -1
  10. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.d.ts +5 -1
  11. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeyRow.js +2 -2
  12. package/node_modules/@undefineds.co/ai-connections/dist/AiGatewayKeysSection.js +5 -1
  13. package/node_modules/@undefineds.co/ai-connections/dist/controller.d.ts +4 -0
  14. package/node_modules/@undefineds.co/ai-connections/dist/controller.js +3 -1
  15. package/node_modules/@undefineds.co/extension-sdk/dist/layout.d.ts +39 -0
  16. package/node_modules/@undefineds.co/extension-sdk/dist/layout.js +40 -0
  17. package/node_modules/@undefineds.co/extension-sdk/dist/react/app-layout.d.ts +13 -1
  18. package/node_modules/@undefineds.co/extension-sdk/dist/react/app-layout.js +11 -3
  19. package/node_modules/@undefineds.co/extension-sdk/dist/react/workspace-layout.d.ts +13 -4
  20. package/node_modules/@undefineds.co/extension-sdk/dist/react/workspace-layout.js +68 -11
  21. package/node_modules/@undefineds.co/shared-ui/dist/auth-surface.js +6 -6
  22. package/node_modules/@undefineds.co/shared-ui/dist/dialog.js +4 -4
  23. package/node_modules/@undefineds.co/shared-ui/dist/login.js +1 -1
  24. package/node_modules/@undefineds.co/shared-ui/dist/theme.css +128 -79
  25. package/node_modules/@undefineds.co/shared-ui/dist/toast.js +1 -1
  26. package/node_modules/@undefineds.co/shared-ui/dist/tooltip.js +1 -1
  27. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.cjs +87 -9
  28. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.d.ts +31 -3
  29. package/node_modules/@undefineds.co/solid-sdk/dist/access-route.js +156 -14
  30. package/node_modules/@undefineds.co/solid-sdk/dist/index.cjs +86 -8
  31. package/package.json +2 -2
  32. package/static/app/assets/global.css +1 -0
  33. package/static/app/assets/{index-BCZVzMpj.js → index-BeAi28iA.js} +1 -1
  34. package/static/app/assets/inrupt-smoke.js +37 -36
  35. package/static/app/assets/main.js +3 -3
  36. package/static/app/index.html +2 -2
  37. package/static/app/inrupt-smoke.html +2 -1
  38. package/static/dashboard/assets/{AiConfigContext-BedwuLTE.js → AiConfigContext-DelSqO6L.js} +1 -1
  39. package/static/dashboard/assets/{AiConfigPage-hNTayf8G.js → AiConfigPage-dbg0aDvd.js} +1 -1
  40. package/static/dashboard/assets/DocumentProcessingPanel-0-3nlwQf.js +1 -0
  41. package/static/dashboard/assets/IndexLifecyclePanel-DOI3IxOD.js +1 -0
  42. package/static/dashboard/assets/{IndexSubjectPanel-Bv97-ouZ.js → IndexSubjectPanel-ClDgj0SY.js} +1 -1
  43. package/static/dashboard/assets/ModelAssignmentsPanel-BSWH19oT.js +1 -0
  44. package/static/dashboard/assets/ModelsPage-BrzxCkEl.js +11 -0
  45. package/static/{settings/assets/NetworkPage-D50kdbEu.js → dashboard/assets/NetworkPage-CxEKeaPz.js} +2 -2
  46. package/static/dashboard/assets/{PaneListHeader-ByqK_C6i.js → PaneListHeader-xEjcBu9g.js} +1 -1
  47. package/static/dashboard/assets/SearchIndexingPanel-BGlSvEl5.js +1 -0
  48. package/static/dashboard/assets/{StatusSubjectPanel-DPegcFpA.js → StatusSubjectPanel-6s3JXbOd.js} +1 -1
  49. package/static/dashboard/assets/StatusWorkspace-LYMDa4b0.js +1 -0
  50. package/static/dashboard/assets/{SystemSettingsPage-LyXmd6uP.js → SystemSettingsPage-CF_vH-qe.js} +1 -1
  51. package/static/dashboard/assets/SystemSettingsSubjectPanel-hsfHcJRV.js +33 -0
  52. package/static/dashboard/assets/{XpodAiConnectionsPodStore-DXNERI2-.js → XpodAiConnectionsPodStore-CHM-ZwI3.js} +1 -1
  53. package/static/dashboard/assets/{activity-BwRbcTha.js → activity-B7UdTZ1N.js} +1 -1
  54. package/static/dashboard/assets/{badge-BbRb9MsQ.js → badge-B6RuxNt1.js} +1 -1
  55. package/static/dashboard/assets/collection-runtime-CKBQm3Fl.js +1 -0
  56. package/static/dashboard/assets/dashboard-1zrtbMhM.css +1 -0
  57. package/static/dashboard/assets/{dashboard-D2ozrATv.js → dashboard-Dm_h60lA.js} +175 -135
  58. package/static/dashboard/assets/{download-SIHe8Y5t.js → download-BW035kpj.js} +1 -1
  59. package/static/dashboard/assets/{external-link-CiYw5Q4U.js → external-link-BMrNvf3c.js} +1 -1
  60. package/static/dashboard/assets/{index-DC1jRaVA.js → index-2jlFzexm.js} +1 -1
  61. package/static/dashboard/assets/index-CQDQ8WVr.js +4 -0
  62. package/static/dashboard/assets/{key-round-nKtxP6pb.js → key-round-C9vxhn7T.js} +1 -1
  63. package/static/dashboard/assets/{rotate-ccw-CQm5hHMN.js → rotate-ccw-8Vm0-INc.js} +1 -1
  64. package/static/dashboard/assets/{skeleton-TKyLbiPs.js → skeleton-CY_602wn.js} +1 -1
  65. package/static/dashboard/assets/{waypoints-BQS9t0ky.js → waypoints-DdEdgkxD.js} +1 -1
  66. package/static/dashboard/assets/workspace-layout-Wed840qR.js +1 -0
  67. package/static/dashboard/dashboard.html +2 -2
  68. package/static/settings/assets/{AiConfigContext-eLRkXFtH.js → AiConfigContext-CR3YhTA-.js} +1 -1
  69. package/static/settings/assets/AiConfigPage-DnOvX2Kx.js +1 -0
  70. package/static/settings/assets/DocumentProcessingPanel-CccpHBs3.js +1 -0
  71. package/static/settings/assets/IndexLifecyclePanel-BrECzBoM.js +1 -0
  72. package/static/settings/assets/{IndexSubjectPanel-DT0c11VQ.js → IndexSubjectPanel-CP84xXye.js} +1 -1
  73. package/static/settings/assets/ModelAssignmentsPanel-DbFi67Kk.js +1 -0
  74. package/static/settings/assets/ModelsPage-xjHA88qy.js +11 -0
  75. package/static/settings/assets/NetworkPage-Bj4wc0bh.js +2 -0
  76. package/static/settings/assets/{PaneListHeader-Da5jZFvG.js → PaneListHeader-Bz0UAhZr.js} +1 -1
  77. package/static/settings/assets/SearchIndexingPanel-ykhvw1Vl.js +1 -0
  78. package/static/settings/assets/{StatusSubjectPanel-Upqqlvon.js → StatusSubjectPanel-B2Y6ib3d.js} +1 -1
  79. package/static/settings/assets/StatusWorkspace-tx3Xg56J.js +1 -0
  80. package/static/settings/assets/SystemSettingsPage-BbFkv_Wn.js +1 -0
  81. package/static/settings/assets/SystemSettingsSubjectPanel-CcbpQmTc.js +33 -0
  82. package/static/settings/assets/{XpodAiConnectionsPodStore-nFgD_usD.js → XpodAiConnectionsPodStore-B11u0BOi.js} +2 -2
  83. package/static/settings/assets/{activity-CWy1W2W0.js → activity-BE8Hz8WF.js} +1 -1
  84. package/static/settings/assets/auth-callback-5waKJF0n.js +1 -0
  85. package/static/settings/assets/{badge-v30yFaaj.js → badge-xeRbYBMf.js} +1 -1
  86. package/static/settings/assets/collection-runtime-DIBObcT5.js +1 -0
  87. package/static/settings/assets/{download-C3Dzb60R.js → download-xI5yyfk7.js} +1 -1
  88. package/static/settings/assets/{external-link-DnkJGKNc.js → external-link-DmbiCMuc.js} +1 -1
  89. package/static/settings/assets/global-1zrtbMhM.css +1 -0
  90. package/static/settings/assets/{global-B_WO-aYY.js → global-BOl78fr8.js} +160 -120
  91. package/static/settings/assets/index-CFVXiUnV.js +4 -0
  92. package/static/settings/assets/index-DK6qlahe.js +1 -0
  93. package/static/settings/assets/{index-browser-DzhsXZHm.js → index-browser-Bk7jaLCd.js} +1 -1
  94. package/static/settings/assets/{key-round-DoDbsLae.js → key-round-B3VIp8oI.js} +1 -1
  95. package/static/settings/assets/{rotate-ccw-DNR_R3oT.js → rotate-ccw-DRzTN49Z.js} +1 -1
  96. package/static/settings/assets/{settings-BOznrBjy.js → settings-CCM17CMX.js} +1 -1
  97. package/static/settings/assets/{skeleton-BjHhu9qI.js → skeleton-Ckhw5HG7.js} +1 -1
  98. package/static/settings/assets/{waypoints-BXNph9Fd.js → waypoints-BFMI-qS6.js} +1 -1
  99. package/static/settings/assets/workspace-layout-Co0KpMKd.js +1 -0
  100. package/static/settings/auth-callback.html +3 -3
  101. package/static/settings/settings.html +3 -3
  102. package/static/app/assets/main.css +0 -1
  103. package/static/dashboard/assets/DocumentProcessingPanel-BSb_vOj7.js +0 -1
  104. package/static/dashboard/assets/IndexLifecyclePanel-DAHx-PBG.js +0 -1
  105. package/static/dashboard/assets/ModelAssignmentsPanel-CEJZs9At.js +0 -1
  106. package/static/dashboard/assets/ModelsPage-DkBVXmKT.js +0 -11
  107. package/static/dashboard/assets/NetworkPage-BDqKgRZQ.js +0 -2
  108. package/static/dashboard/assets/SearchIndexingPanel-M-WYaQP3.js +0 -1
  109. package/static/dashboard/assets/StatusWorkspace-CPIkjO9S.js +0 -1
  110. package/static/dashboard/assets/SystemSettingsSubjectPanel-CYHqNIn2.js +0 -33
  111. package/static/dashboard/assets/collection-runtime-BRfZD5oS.js +0 -1
  112. package/static/dashboard/assets/dashboard-rk080mvG.css +0 -1
  113. package/static/dashboard/assets/dialog-BbRbILBP.js +0 -1
  114. package/static/dashboard/assets/index-CExLoewO.js +0 -41
  115. package/static/dashboard/assets/index-CTgU8YW1.js +0 -4
  116. package/static/dashboard/assets/workspace-layout-Csbbr3vZ.js +0 -1
  117. package/static/settings/assets/AiConfigPage-BMO-ytdK.js +0 -1
  118. package/static/settings/assets/DocumentProcessingPanel-CH-HBRzQ.js +0 -1
  119. package/static/settings/assets/IndexLifecyclePanel-ChEMn9D8.js +0 -1
  120. package/static/settings/assets/ModelAssignmentsPanel-T59L_wOk.js +0 -1
  121. package/static/settings/assets/ModelsPage-m_SP4PdE.js +0 -11
  122. package/static/settings/assets/SearchIndexingPanel-DQQd3-Jw.js +0 -1
  123. package/static/settings/assets/StatusWorkspace-CPB49bGd.js +0 -1
  124. package/static/settings/assets/SystemSettingsPage-C0wrxcNw.js +0 -1
  125. package/static/settings/assets/SystemSettingsSubjectPanel-BOm7tUH1.js +0 -33
  126. package/static/settings/assets/auth-callback-HhgEuohz.js +0 -1
  127. package/static/settings/assets/collection-runtime-B7oomxic.js +0 -1
  128. package/static/settings/assets/dialog-BAe7moyL.js +0 -1
  129. package/static/settings/assets/global-rk080mvG.css +0 -1
  130. package/static/settings/assets/index-B51ot_m_.js +0 -1
  131. package/static/settings/assets/index-CHBQVfuZ.js +0 -41
  132. package/static/settings/assets/index-DbqRFton.js +0 -4
  133. package/static/settings/assets/workspace-layout-TZ7fteel.js +0 -1
  134. /package/static/app/assets/{_commonjsHelpers-B-UnjaXt.js → global-BGMlqT2c.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{c as I,Y as xe,r as c,aj as U,j as e,C as w,a as k,b as C,d as S,e as P,B as j,ak as ne,R as he,_ as fe,$ as ve,a0 as be}from"./global-B_WO-aYY.js";import{P as ge}from"./PaneListHeader-Da5jZFvG.js";import{N as ie,W as je}from"./waypoints-BXNph9Fd.js";import{A as oe}from"./activity-CWy1W2W0.js";import{T as ye,u as Ne}from"./workspace-layout-TZ7fteel.js";import{E as le}from"./external-link-DnkJGKNc.js";import{B as $}from"./badge-v30yFaaj.js";import{R as we}from"./rotate-ccw-DNR_R3oT.js";import{D as ke}from"./download-C3Dzb60R.js";const Ce=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Se=I("cable",Ce);const Pe=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],de=I("earth",Pe);const Re=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],De=I("lock-keyhole",Re);const Te=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ae=I("radio",Te);const Ee=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Le=I("route",Ee);const $e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ie=I("shield-check",$e);const Me=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Oe=I("wifi",Me);async function Ue({fetchImpl:t}){return H(t,z("/api/network/settings/status"),{method:"GET",credentials:"include",headers:{accept:"application/json"}})}async function qe({fetchImpl:t}){return H(t,z("/api/network/settings/diagnose"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function ze({fetchImpl:t}){return H(t,z("/api/network/settings/tunnel-clients"),{method:"GET",credentials:"include",headers:{accept:"application/json"}})}async function He({fetchImpl:t,provider:s}){return H(t,z(`/api/network/settings/tunnel-clients/${encodeURIComponent(s)}/install`),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function Ve({fetchImpl:t}){await H(t,z("/api/network/settings/certificate/renew"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function _e({podUrl:t,fetchImpl:s,patch:a}){return H(s,Be("/api/network/settings/configuration",t),{method:"PUT",credentials:"include",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(a)})}function z(t){const s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(t,s).toString()}function Be(t,s){return s?new URL(t,s).toString():z(t)}async function H(t,s,a){const i=await t(s,a);if(!i.ok)throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");if(!i.headers.get("content-type")?.includes("application/json"))throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");return await i.json()}const se=[{id:"overview",label:"Overview",path:"",icon:ie},{id:"endpoints",label:"Endpoints",path:"endpoints",icon:Se},{id:"addresses",label:"Addresses",path:"addresses",icon:de},{id:"domain-dns",label:"Domain & DNS",path:"domain-dns",icon:Le},{id:"https",label:"HTTPS",path:"https",icon:De},{id:"tunnel-profiles",label:"Tunnel Profiles",path:"tunnel-profiles",icon:je},{id:"p2p",label:"P2P",path:"p2p",icon:Ae},{id:"diagnostics",label:"Diagnostics",path:"diagnostics",icon:oe}];function Fe(t){const s=["Xpod Network Diagnostics",`Generated: ${t.generatedAt}`,`Canonical URL: ${t.endpoint??"Unavailable"}`],a=t.checks.flatMap(i=>["",`[${i.status.toUpperCase()}] ${i.label}`,...i.detail?[i.detail]:[]]);return[...s,...a].join(`
2
- `)}function yt(){const t=xe(),[s,a]=c.useState(),[i,n]=c.useState([]),[l,o]=c.useState(),[f,u]=c.useState(),[d,x]=c.useState(!1),[T,A]=c.useState(!1),[K,E]=c.useState(!1),[M,W]=c.useState(!1),[r,p]=c.useState(),b=c.useRef(0),N=c.useRef(0),V=c.useRef(0),_=c.useRef(void 0),B=c.useRef(!0),G=typeof window>"u"?void 0:window.location.origin,R=G?`local-host:${G}`:void 0,D=globalThis.fetch;c.useEffect(()=>(B.current=!0,()=>{B.current=!1,b.current+=1,N.current+=1,V.current+=1}),[]);const J=c.useCallback((m,h)=>B.current&&b.current===m&&_.current===h,[]),Y=c.useCallback((m,h)=>B.current&&N.current===m&&_.current===h,[]),X=c.useCallback((m,h)=>B.current&&V.current===m&&_.current===h,[]),F=c.useCallback(async()=>{const m=R;if(!m)return;const h=b.current+1;b.current=h,x(!0),u(void 0);try{const L=await Ue({fetchImpl:D});J(h,m)&&a(L)}catch{J(h,m)&&u("网络设置请求失败,请重试。")}finally{J(h,m)&&x(!1)}},[D,R,J]);c.useEffect(()=>{let m=!1;return _.current=R,b.current+=1,N.current+=1,V.current+=1,queueMicrotask(()=>{m||_.current!==R||(a(void 0),n([]),o(void 0),u(void 0),x(!1),A(!1),E(!1),R&&F())}),()=>{m=!0}},[R,F]);const ue=c.useCallback(async()=>{const m=R;if(!m)return;const h=N.current+1;N.current=h,A(!0),u(void 0);try{const L=await qe({fetchImpl:D});Y(h,m)&&(n(L.checks),o(new Date),U({description:"诊断完成"}))}catch{Y(h,m)&&u("网络诊断失败,请重试。")}finally{Y(h,m)&&A(!1)}},[D,R,Y]),me=c.useCallback(async()=>{const m=R;if(!m)return;const h=V.current+1;V.current=h,E(!0),u(void 0);try{await Ve({fetchImpl:D}),X(h,m)&&(U({variant:"success",description:"证书续签成功"}),await F())}catch{X(h,m)&&u("证书续签失败,请重试。")}finally{X(h,m)&&E(!1)}},[D,R,X,F]),Q=c.useCallback(async m=>{if(G){W(!0),u(void 0);try{const h=await _e({fetchImpl:D,patch:m});a(L=>L&&{...L,configuration:h.configuration}),p(h.applyState),U({variant:"success",description:"Network configuration saved"})}catch{u("网络配置保存失败,请重试。")}finally{W(!1)}}},[D,G]),pe=c.useMemo(()=>[{key:"local",title:"本机",values:s?.addresses.local??[]},{key:"lan",title:"局域网",values:s?.addresses.lan??[]},{key:"public",title:"公网",values:s?.addresses.public??[]}],[s]),re=t.pathname.split("/").filter(Boolean).at(-1),g=se.some(m=>m.path===re)?re:"overview";return e.jsx(ye,{mode:"auto",listHeader:e.jsx(ge,{title:"Network"}),list:e.jsx(Ke,{}),mainHeader:e.jsx(We,{title:se.find(m=>(m.path||"overview")===g)?.label??"Overview",loading:d,stale:d&&!!s,onRefresh:F}),main:e.jsxs("section",{className:"flex min-h-full flex-col gap-4 bg-background p-6",children:[f?e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:f}):null,(g==="overview"||g==="endpoints")&&e.jsx(st,{endpoint:s?.endpoint,loading:d&&!s}),g==="overview"&&e.jsx(Ge,{status:s}),(g==="overview"||g==="addresses")&&e.jsx(at,{sections:pe,loading:d&&!s,diagnostics:i,checkedAt:l}),g==="overview"&&e.jsx(dt,{status:s}),g==="domain-dns"&&e.jsxs(e.Fragment,{children:[e.jsx(ot,{status:s}),e.jsx(Ye,{configuration:s?.configuration,saving:M,applyState:r,onSave:Q})]}),g==="https"&&e.jsxs(e.Fragment,{children:[e.jsx(lt,{status:s}),e.jsx(Xe,{configuration:s?.configuration,saving:M,applyState:r,onSave:Q})]}),g==="tunnel-profiles"&&e.jsxs(e.Fragment,{children:[e.jsx(Je,{title:"Observed tunnel",label:"Tunnel",capability:s?.tunnel}),e.jsx(Ze,{configuration:s?.configuration,providers:s?.providers??[],ingress:s?.ingress,saving:M,applyState:r,onSave:Q}),e.jsx(Qe,{fetchImpl:D})]}),g==="p2p"&&e.jsx(tt,{configuration:s?.configuration,saving:M,applyState:r,onSave:Q}),(g==="overview"||g==="diagnostics"||g==="https")&&e.jsx(ct,{status:s,endpoint:s?.endpoint,diagnostics:i,diagnosing:T,renewing:K,onDiagnose:ue,onRenewCertificate:me})]}),className:"min-h-full"})}function Ke(){const t=Ne();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Network sections","data-list-navigation":!0,children:se.map(s=>{const a=s.icon,i=`/network${s.path?`/${s.path}`:""}`;return e.jsxs(fe,{to:i,onClick:()=>t.openMain(),onKeyDown:ve,className:({isActive:n})=>be(n,{compact:!1}),end:s.path==="",children:[e.jsx(a,{className:"h-4 w-4","aria-hidden":"true"}),s.label]},s.id)})})})}function We({title:t,loading:s,stale:a,onRefresh:i}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"text-sm font-semibold text-foreground",children:["Network · ",t]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground","aria-live":"polite",children:a?"Refreshing · showing previous snapshot":"接入点、DNS、TLS、隧道与连通性诊断"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:s,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"刷新"]})})]})}function Ge({status:t}){const s=t?.addresses.public[0]??t?.addresses.lan[0]??t?.addresses.local[0]??t?.endpoint,a=t?!t.dns.supported||t.dns.status==="unsupported"?"Configure Domain & DNS, then recheck observed DNS.":!t.tls.supported||!["valid","active","ready"].includes(t.tls.status)?"Review HTTPS configuration and certificate renewal evidence.":"No connectivity action is currently required.":"Refresh network status.",i=t?.tunnel.supported===!0;return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Preferred access path"}),e.jsx(S,{children:"First address this runtime has configured, in public → LAN → local order"})]}),e.jsxs(P,{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium",children:s??"Not configured"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[e.jsxs($,{variant:"outline",children:["Local ",t?.addresses.local.length?"configured":"not configured"]}),e.jsxs($,{variant:"outline",children:["LAN ",t?.addresses.lan.length?"configured":"not configured"]}),e.jsxs($,{variant:"outline",children:["Public ",t?.addresses.public.length?"configured":"not configured"]}),e.jsxs($,{variant:"outline",children:["Tunnel ",i?t?.tunnel.status??"unknown":"not observed"]})]}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Configured addresses are not probe results; reachability is reported per route."}),e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsx("div",{className:"font-medium",children:"Next action"}),e.jsx("div",{className:"mt-1 text-muted-foreground",children:a})]})]})]})}function Je({title:t,label:s,capability:a,extra:i}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:t}),e.jsx(S,{children:"Observed runtime state"})]}),e.jsx(P,{children:e.jsx(q,{label:s,capability:a,extra:i})})]})}function Z({title:t}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:t}),e.jsx(S,{children:"Desired configuration"})]}),e.jsxs(P,{className:"text-sm text-muted-foreground",children:["This runtime does not report a configurable ",t," capability."]})]})}function Ye({configuration:t,saving:s,applyState:a,onSave:i}){const[n,l]=c.useState(t?.domainDns),[o,f]=c.useState("");return c.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||l(t?.domainDns)}),()=>{u=!0}},[t]),n?e.jsxs(ee,{title:"Saved configuration",applyState:a,children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{name:"domain",label:"Domain",value:n.domain,onChange:u=>l({...n,domain:u})}),e.jsx(y,{name:"provider",label:"DNS provider",value:n.provider,onChange:u=>l({...n,provider:u})}),e.jsx(ce,{name:"recordTtl",label:"Record TTL (seconds)",value:n.recordTtl,min:30,max:86400,onChange:u=>l({...n,recordTtl:u})}),e.jsx(y,{name:"dnsCredential",label:n.credentialConfigured?"Replace credential (configured)":"Credential",value:o,type:"password",onChange:f})]}),e.jsx(ae,{label:"Enable DDNS",checked:n.ddnsEnabled,onChange:u=>l({...n,ddnsEnabled:u})}),e.jsx(te,{label:"Save DNS configuration",saving:s,onClick:()=>i({domainDns:{domain:n.domain,ddnsEnabled:n.ddnsEnabled,provider:n.provider,recordTtl:n.recordTtl,...o?{credential:o}:{}}})})]}):e.jsx(Z,{title:"Domain & DNS"})}function Xe({configuration:t,saving:s,applyState:a,onSave:i}){const[n,l]=c.useState(t?.https);return c.useEffect(()=>{let o=!1;return queueMicrotask(()=>{o||l(t?.https)}),()=>{o=!0}},[t]),n?e.jsxs(ee,{title:"Saved configuration",applyState:a,children:[e.jsx(ae,{label:"Enable HTTPS",checked:n.enabled,onChange:o=>l({...n,enabled:o})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{name:"acmeEmail",label:"ACME email",value:n.acmeEmail,onChange:o=>l({...n,acmeEmail:o})}),e.jsx(y,{name:"acmeDomains",label:"Certificate domains",value:n.domains.join(", "),onChange:o=>l({...n,domains:o.split(",").map(f=>f.trim()).filter(Boolean)})}),e.jsx(y,{name:"certificatePath",label:"Certificate path",value:n.certificatePath??"",onChange:o=>l({...n,certificatePath:o})}),e.jsx(y,{name:"certificateKeyPath",label:"Private-key path",value:n.certificateKeyPath??"",onChange:o=>l({...n,certificateKeyPath:o})}),e.jsx(ce,{name:"renewBeforeDays",label:"Renew before (days)",value:n.renewBeforeDays,min:1,max:90,onChange:o=>l({...n,renewBeforeDays:o})})]}),e.jsx(te,{label:"Save HTTPS configuration",saving:s,onClick:()=>i({https:n})})]}):e.jsx(Z,{title:"HTTPS"})}function Qe({fetchImpl:t}){const[s,a]=c.useState(void 0),[i,n]=c.useState(void 0),[l,o]=c.useState(void 0),f=async()=>{n("inspect"),o(void 0);try{const d=await ze({fetchImpl:t});a(d.clients)}catch(d){o(d instanceof Error?d.message:String(d))}finally{n(void 0)}},u=async d=>{n(d),o(void 0);try{const x=await He({fetchImpl:t,provider:d});a(x.clients)}catch(x){o(x instanceof Error?x.message:String(x))}finally{n(void 0)}};return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Tunnel clients"}),e.jsx(S,{children:"Clients are not bundled with this build: check where one comes from, or download it into the plugin directory."})]}),e.jsxs(P,{className:"space-y-3 text-sm",children:[e.jsx(j,{type:"button",size:"sm",variant:"outline",onClick:f,disabled:i==="inspect",children:i==="inspect"?"Checking…":"Check clients"}),l&&e.jsx("div",{className:"text-destructive",children:l}),s&&e.jsx("div",{className:"space-y-2",children:s.map(d=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-border p-2",children:[e.jsx($,{variant:d.state==="ready"?"default":"outline",children:d.state==="ready"?"Ready":"Missing"}),e.jsx("span",{className:"font-medium",children:d.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.path??d.binary,d.version?` · ${d.version}`:"",d.source==="bundled"?" · plugin directory":""]}),d.state==="missing"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:d.installHint}),d.state==="missing"&&d.installable&&e.jsx(j,{type:"button",size:"sm",onClick:()=>u(d.provider),disabled:i===d.provider,children:i===d.provider?"Downloading…":"Download"}),d.state==="missing"&&!d.installable&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",d.installableReason,")"]})]},d.provider))})]})]})}function Ze({configuration:t,providers:s,ingress:a,saving:i,applyState:n,onSave:l}){const[o,f]=c.useState(t?.tunnelProfiles.activeProfileId??""),[u,d]=c.useState(t?.tunnelProfiles.profiles??[]),[x,T]=c.useState({});if(c.useEffect(()=>{let r=!1;return queueMicrotask(()=>{r||(f(t?.tunnelProfiles.activeProfileId??""),d(t?.tunnelProfiles.profiles??[]),T({}))}),()=>{r=!0}},[t]),!t)return e.jsx(Z,{title:"Tunnel Profiles"});const A=(r,p)=>d(b=>b.map(N=>N.id===r?{...N,...p}:N)),K=s.filter(r=>r.runtimeSupported),E=r=>s.find(p=>p.id===r),M=()=>{const r=`tunnel-${Date.now()}`,p=K[0]?.id??"ngrok";d(b=>[...b,{id:r,provider:p,label:"New tunnel",credentialConfigured:!1,parameters:{}}])},W=r=>{d(p=>p.filter(b=>b.id!==r)),o===r&&f("none")};return e.jsxs(ee,{title:"Saved tunnel profiles",applyState:n,children:[e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Active profile",e.jsxs("select",{value:o||"none",onChange:r=>f(r.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"none",children:"None"}),u.map(r=>e.jsxs("option",{value:r.id,children:[r.label," · ",r.provider]},r.id))]})]}),e.jsx("div",{className:"space-y-3",children:u.map(r=>e.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3 text-sm",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(y,{name:`tunnel-label-${r.id}`,label:"Label",value:r.label,onChange:p=>A(r.id,{label:p})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Provider",e.jsx("select",{value:r.provider,onChange:p=>A(r.id,{provider:p.target.value,parameters:{}}),className:"block h-10 w-full rounded-md border border-input bg-background px-3",children:K.map(p=>e.jsx("option",{value:p.id,children:p.label},p.id))})]}),E(r.provider)?.endpointSource==="declared"?e.jsx(y,{name:`tunnel-url-${r.id}`,label:"Public endpoint (declared)",value:r.publicUrl??"",onChange:p=>A(r.id,{publicUrl:p})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"The provider reports its public endpoint; there is nothing to type here."}),e.jsx(y,{name:`tunnel-credential-${r.id}`,label:r.credentialConfigured?"Replace credential (configured)":"Credential",type:"password",value:x[r.id]??"",onChange:p=>T(b=>({...b,[r.id]:p}))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer font-medium",children:"Provider-specific parameters"}),e.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:(E(r.provider)?.parameterFields??[]).map(({key:p,label:b})=>e.jsx(y,{name:`tunnel-${p}-${r.id}`,label:b,value:r.parameters?.[p]??"",onChange:N=>A(r.id,{parameters:{...r.parameters,[p]:N}})},p))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o===r.id?"Active after restart":"Inactive"," · credential ",r.credentialConfigured?"configured":"missing"]}),e.jsx(j,{type:"button",size:"sm",variant:"ghost",onClick:()=>W(r.id),children:"Remove"})]})]},r.id))}),e.jsx(j,{type:"button",size:"sm",variant:"outline",onClick:M,children:"Add tunnel profile"}),e.jsx(et,{ingress:a,descriptor:E(u.find(r=>r.id===o)?.provider??"")}),e.jsx(te,{label:"Save tunnel profiles",saving:i,onClick:()=>l({tunnelProfiles:{activeProfileId:o,profiles:u.map(r=>({id:r.id,provider:r.provider,label:r.label,publicUrl:r.publicUrl,parameters:r.parameters,...x[r.id]?{credential:x[r.id]}:{}}))}})})]})}function et({ingress:t,descriptor:s}){if(!t||s?.originOwner!=="console")return null;const a=async()=>{await window.navigator.clipboard.writeText(t.originUrl),U({description:"Tunnel origin copied"})};return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3","data-testid":"ingress-origin",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Tunnel origin (paste into the provider console)"}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-all font-mono text-sm",children:t.originUrl}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Set the tunnel's local port / service to this address, not the Gateway port: this is the entry that never treats a tunnelled caller as local."})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":"Copy tunnel origin",onClick:()=>{a()},children:e.jsx(ne,{className:"h-4 w-4","aria-hidden":"true"})}),s.consoleUrl?e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${s.label} console`,onClick:()=>window.open(s.consoleUrl,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})}):null]})]})]})}function tt({configuration:t,saving:s,applyState:a,onSave:i}){const[n,l]=c.useState(t?.p2p);return c.useEffect(()=>{let o=!1;return queueMicrotask(()=>{o||l(t?.p2p)}),()=>{o=!0}},[t]),n?e.jsxs(ee,{title:"Saved P2P configuration",applyState:a,children:[e.jsx(ae,{label:"Enable P2P fallback",checked:n.enabled,onChange:o=>l({...n,enabled:o})}),e.jsx(y,{name:"signalService",label:"Signal service",value:n.signalService,onChange:o=>l({...n,signalService:o})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Fallback policy",e.jsxs("select",{value:n.fallbackPolicy,onChange:o=>l({...n,fallbackPolicy:o.target.value}),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"when-direct-unavailable",children:"When direct is unavailable"}),e.jsx("option",{value:"prefer-p2p",children:"Prefer P2P"})]})]}),e.jsx(te,{label:"Save P2P configuration",saving:s,onClick:()=>i({p2p:n})})]}):e.jsx(Z,{title:"P2P"})}function ee({title:t,applyState:s,children:a}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:t}),e.jsx(S,{children:"Desired configuration · not presented as observed until verified"})]}),e.jsxs(P,{className:"space-y-4",children:[s==="restart-required"?e.jsx("div",{role:"status",className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:bg-amber-950/20 dark:text-amber-200",children:"Saved · restart required"}):null,a]})]})}function y({name:t,label:s,value:a,type:i="text",onChange:n}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[s,e.jsx("input",{name:t,type:i,value:a,onChange:l=>n(l.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ce({name:t,label:s,value:a,min:i,max:n,onChange:l}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[s,e.jsx("input",{name:t,type:"number",value:a,min:i,max:n,onChange:o=>l(o.target.valueAsNumber),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ae({label:t,checked:s,onChange:a}){return e.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:[t,e.jsx("input",{type:"checkbox",checked:s,onChange:i=>a(i.target.checked)})]})}function te({label:t,saving:s,onClick:a}){return e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"button",onClick:a,disabled:s,children:s?"Saving…":t})})}function st({endpoint:t,loading:s}){const a=[{label:"Canonical URL",value:t},{label:"API endpoint",value:t?nt(t,"/api/"):void 0}],i=async(n,l)=>{await window.navigator.clipboard.writeText(l),U({description:`${n} copied`})};return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4","aria-hidden":"true"}),"接入点"]}),e.jsx(S,{children:s?"正在解析接入点":"Observed endpoints · Currently effective route is the canonical URL"})]}),e.jsx(P,{className:"space-y-3",children:a.map(({label:n,value:l})=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:n}),e.jsx("div",{className:"mt-1 break-words text-sm text-foreground",children:l||"Unavailable"})]}),l?e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":`Copy ${n}`,onClick:()=>{i(n,l)},children:e.jsx(ne,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${n}`,onClick:()=>window.open(l,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})})]}):null]},n))})]})}function nt(t,s){try{return new URL(s,t).toString()}catch{return t}}function at({sections:t,loading:s,diagnostics:a,checkedAt:i}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(Oe,{className:"h-4 w-4","aria-hidden":"true"}),"网络地址"]}),e.jsx(S,{children:s?"正在刷新地址":"由运行时网络能力上报"})]}),e.jsx(P,{className:"space-y-4",children:t.map(n=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:n.title}),n.values.length>0?e.jsx("div",{className:"mt-1 space-y-1",children:n.values.map(l=>e.jsx(rt,{scope:n.key,value:l,diagnostics:a,checkedAt:i},l))}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"未提供"})]},n.key))})]})}function rt({scope:t,value:s,diagnostics:a,checkedAt:i}){const n=it(s),l=a.find(o=>o.id==="address-configuration");return e.jsxs("div",{className:"rounded-md border border-border p-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium text-foreground",children:s}),e.jsxs("dl",{className:"mt-2 grid gap-x-4 gap-y-1 text-xs sm:grid-cols-2",children:[e.jsx(v,{label:"Interface",value:t==="local"?"Loopback":t==="lan"?"LAN interface (name not reported)":"Public route"}),e.jsx(v,{label:"IP version",value:n.ipVersion}),e.jsx(v,{label:"Port",value:n.port}),e.jsx(v,{label:"Configured",value:l?l.status==="ok"?"Yes":"No":"Not checked"}),e.jsx(v,{label:"Reachability",value:"Not probed"}),e.jsx(v,{label:"Configuration checked",value:l?.checkedAt?O(l.checkedAt):i?i.toLocaleString():"Not checked"})]})]})}function v({label:t,value:s}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:t}),e.jsx("dd",{className:"text-right text-foreground",children:s})]})}function it(t){try{const s=new URL(t),a=s.hostname.replace(/^\[|\]$/g,"");return{ipVersion:a.includes(":")?"IPv6":/^\d{1,3}(?:\.\d{1,3}){3}$/.test(a)?"IPv4":"Resolved hostname",port:s.port||(s.protocol==="https:"?"443":s.protocol==="http:"?"80":"Not reported")}}catch{return{ipVersion:"Not reported",port:"Not reported"}}}function ot({status:t}){const s=t?.configuration?.domainDns,a=(t?.addresses.public??[]).map(i=>{try{return new URL(i).hostname}catch{return i}});return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Observed DNS"}),e.jsx(S,{children:"Observed state is kept separate from desired DNS policy."})]}),e.jsxs(P,{className:"space-y-3",children:[e.jsx(q,{label:"Runtime status",capability:t?.dns}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(v,{label:"Observed hostnames",value:a.join(", ")||"Not reported"}),e.jsx(v,{label:"Expected domain",value:s?.domain||"Not configured"}),e.jsx(v,{label:"Expected value",value:t?.addresses.public[0]||"Not reported"}),e.jsx(v,{label:"Provider",value:s?.provider||"Not configured"})]})]})]})}function lt({status:t}){const s=t?.configuration?.https;return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Observed HTTPS"}),e.jsx(S,{children:"Certificate evidence reported by the active runtime."})]}),e.jsxs(P,{className:"space-y-3",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`Expires ${O(t.tls.expiresAt)}`:void 0}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(v,{label:"Certificate domains",value:t?.tls.domains?.join(", ")||s?.domains.join(", ")||"Not reported"}),e.jsx(v,{label:"Issuer",value:t?.tls.issuer||"Not reported by runtime"}),e.jsx(v,{label:"Validity",value:t?.tls.validFrom?`${O(t.tls.validFrom)} — ${t.tls.expiresAt?O(t.tls.expiresAt):"open"}`:t?.tls.status??"Not reported"}),e.jsx(v,{label:"Expiry",value:t?.tls.expiresAt?O(t.tls.expiresAt):"Not reported"}),e.jsx(v,{label:"Renewal status",value:t?.tls.renewalStatus||(t?.actions.renewCertificate?"Renewal available":"Renewal unavailable")}),e.jsx(v,{label:"Renewal policy",value:s?`${s.renewBeforeDays} days before expiry`:"Not configured"})]})]})]})}function dt({status:t}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(ie,{className:"h-4 w-4","aria-hidden":"true"}),"网络能力"]}),e.jsx(S,{children:"服务端声明的网络支持"})]}),e.jsxs(P,{className:"grid gap-3 text-sm",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`到期时间 ${O(t.tls.expiresAt)}`:void 0}),e.jsx(q,{label:"DNS",capability:t?.dns}),e.jsx(q,{label:"Tunnel",capability:t?.tunnel})]})]})}function ct({status:t,endpoint:s,diagnostics:a,diagnosing:i,renewing:n,onDiagnose:l,onRenewCertificate:o}){const f=a.length>0?Fe({generatedAt:new Date().toISOString(),endpoint:s,checks:a}):void 0,u=async()=>{f&&(await window.navigator.clipboard.writeText(f),U({description:"Diagnostic report copied"}))},d=()=>{if(!f)return;const x=URL.createObjectURL(new Blob([f],{type:"text/plain;charset=utf-8"})),T=document.createElement("a");T.href=x,T.download=`xpod-network-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.txt`,T.click(),URL.revokeObjectURL(x)};return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(oe,{className:"h-4 w-4","aria-hidden":"true"}),"操作"]}),e.jsx(S,{children:"仅显示网络能力允许的操作"})]}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t?.actions.diagnose?e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:l,disabled:i,children:[e.jsx(Ie,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"连通性诊断"]}):null,t?.actions.renewCertificate?e.jsxs(j,{type:"button",size:"sm",variant:"subtle",onClick:o,disabled:n,children:[e.jsx(we,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"续签证书"]}):null,e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:()=>{u()},disabled:!f,children:[e.jsx(ne,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Copy diagnostics"]}),e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:d,disabled:!f,children:[e.jsx(ke,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Export diagnostics"]})]}),a.length>0?e.jsx("div",{className:"space-y-2",children:a.map(x=>e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:x.label}),e.jsx($,{variant:x.status==="ok"?"secondary":"outline",children:x.status})]}),x.detail?e.jsx("div",{className:"mt-1 break-words text-xs text-muted-foreground",children:x.detail}):null]},x.id))}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"尚未运行过诊断。"})]})]})}function q({label:t,capability:s,extra:a}){const i=s?.supported===!0;return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:i?t:`${t} 不支持`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s?.status??"读取中",s?.detail?` · ${s.detail}`:""]})]}),e.jsx($,{variant:i?"secondary":"outline",children:i?"支持":"不支持"})]}),a?e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a}):null]})}function O(t){if(!t)return"暂无记录";const s=new Date(t);return Number.isNaN(s.getTime())?"暂无记录":s.toLocaleString()}export{yt as default};
1
+ import{c as I,s as xe,r as c,Z as U,j as e,C as w,a as k,b as C,d as S,e as P,B as j,_ as ne,R as he,N as fe,t as ve,v as ge}from"./dashboard-Dm_h60lA.js";import{P as be}from"./PaneListHeader-xEjcBu9g.js";import{N as ie,W as je}from"./waypoints-DdEdgkxD.js";import{A as oe}from"./activity-B7UdTZ1N.js";import{T as ye,u as Ne}from"./workspace-layout-Wed840qR.js";import{E as le}from"./external-link-BMrNvf3c.js";import{B as $}from"./badge-B6RuxNt1.js";import{R as we}from"./rotate-ccw-8Vm0-INc.js";import{D as ke}from"./download-BW035kpj.js";const Ce=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],Se=I("cable",Ce);const Pe=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],de=I("earth",Pe);const Re=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],De=I("lock-keyhole",Re);const Te=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ae=I("radio",Te);const Ee=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],Le=I("route",Ee);const $e=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ie=I("shield-check",$e);const Me=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Oe=I("wifi",Me);async function Ue({fetchImpl:t}){return H(t,z("/api/network/settings/status"),{method:"GET",credentials:"include",headers:{accept:"application/json"}})}async function qe({fetchImpl:t}){return H(t,z("/api/network/settings/diagnose"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function ze({fetchImpl:t}){return H(t,z("/api/network/settings/tunnel-clients"),{method:"GET",credentials:"include",headers:{accept:"application/json"}})}async function He({fetchImpl:t,provider:s}){return H(t,z(`/api/network/settings/tunnel-clients/${encodeURIComponent(s)}/install`),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function Ve({fetchImpl:t}){await H(t,z("/api/network/settings/certificate/renew"),{method:"POST",credentials:"include",headers:{accept:"application/json"}})}async function _e({podUrl:t,fetchImpl:s,patch:a}){return H(s,Be("/api/network/settings/configuration",t),{method:"PUT",credentials:"include",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(a)})}function z(t){const s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(t,s).toString()}function Be(t,s){return s?new URL(t,s).toString():z(t)}async function H(t,s,a){const i=await t(s,a);if(!i.ok)throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");if(!i.headers.get("content-type")?.includes("application/json"))throw await i.arrayBuffer(),new Error("Network settings request failed. Please try again.");return await i.json()}const se=[{id:"overview",label:"Overview",path:"",icon:ie},{id:"endpoints",label:"Endpoints",path:"endpoints",icon:Se},{id:"addresses",label:"Addresses",path:"addresses",icon:de},{id:"domain-dns",label:"Domain & DNS",path:"domain-dns",icon:Le},{id:"https",label:"HTTPS",path:"https",icon:De},{id:"tunnel-profiles",label:"Tunnel Profiles",path:"tunnel-profiles",icon:je},{id:"p2p",label:"P2P",path:"p2p",icon:Ae},{id:"diagnostics",label:"Diagnostics",path:"diagnostics",icon:oe}];function Fe(t){const s=["Xpod Network Diagnostics",`Generated: ${t.generatedAt}`,`Canonical URL: ${t.endpoint??"Unavailable"}`],a=t.checks.flatMap(i=>["",`[${i.status.toUpperCase()}] ${i.label}`,...i.detail?[i.detail]:[]]);return[...s,...a].join(`
2
+ `)}function yt(){const t=xe(),[s,a]=c.useState(),[i,n]=c.useState([]),[l,o]=c.useState(),[f,u]=c.useState(),[d,x]=c.useState(!1),[T,A]=c.useState(!1),[K,E]=c.useState(!1),[M,W]=c.useState(!1),[r,p]=c.useState(),g=c.useRef(0),N=c.useRef(0),V=c.useRef(0),_=c.useRef(void 0),B=c.useRef(!0),G=typeof window>"u"?void 0:window.location.origin,R=G?`local-host:${G}`:void 0,D=globalThis.fetch;c.useEffect(()=>(B.current=!0,()=>{B.current=!1,g.current+=1,N.current+=1,V.current+=1}),[]);const J=c.useCallback((m,h)=>B.current&&g.current===m&&_.current===h,[]),X=c.useCallback((m,h)=>B.current&&N.current===m&&_.current===h,[]),Y=c.useCallback((m,h)=>B.current&&V.current===m&&_.current===h,[]),F=c.useCallback(async()=>{const m=R;if(!m)return;const h=g.current+1;g.current=h,x(!0),u(void 0);try{const L=await Ue({fetchImpl:D});J(h,m)&&a(L)}catch{J(h,m)&&u("网络设置请求失败,请重试。")}finally{J(h,m)&&x(!1)}},[D,R,J]);c.useEffect(()=>{let m=!1;return _.current=R,g.current+=1,N.current+=1,V.current+=1,queueMicrotask(()=>{m||_.current!==R||(a(void 0),n([]),o(void 0),u(void 0),x(!1),A(!1),E(!1),R&&F())}),()=>{m=!0}},[R,F]);const ue=c.useCallback(async()=>{const m=R;if(!m)return;const h=N.current+1;N.current=h,A(!0),u(void 0);try{const L=await qe({fetchImpl:D});X(h,m)&&(n(L.checks),o(new Date),U({description:"诊断完成"}))}catch{X(h,m)&&u("网络诊断失败,请重试。")}finally{X(h,m)&&A(!1)}},[D,R,X]),me=c.useCallback(async()=>{const m=R;if(!m)return;const h=V.current+1;V.current=h,E(!0),u(void 0);try{await Ve({fetchImpl:D}),Y(h,m)&&(U({variant:"success",description:"证书续签成功"}),await F())}catch{Y(h,m)&&u("证书续签失败,请重试。")}finally{Y(h,m)&&E(!1)}},[D,R,Y,F]),Z=c.useCallback(async m=>{if(G){W(!0),u(void 0);try{const h=await _e({fetchImpl:D,patch:m});a(L=>L&&{...L,configuration:h.configuration}),p(h.applyState),U({variant:"success",description:"Network configuration saved"})}catch{u("网络配置保存失败,请重试。")}finally{W(!1)}}},[D,G]),pe=c.useMemo(()=>[{key:"local",title:"本机",values:s?.addresses.local??[]},{key:"lan",title:"局域网",values:s?.addresses.lan??[]},{key:"public",title:"公网",values:s?.addresses.public??[]}],[s]),re=t.pathname.split("/").filter(Boolean).at(-1),b=se.some(m=>m.path===re)?re:"overview";return e.jsx(ye,{mode:"auto",listHeader:e.jsx(be,{title:"Network"}),list:e.jsx(Ke,{}),mainHeader:e.jsx(We,{title:se.find(m=>(m.path||"overview")===b)?.label??"Overview",loading:d,stale:d&&!!s,onRefresh:F}),main:e.jsxs("section",{className:"flex min-h-full flex-col gap-4 bg-background p-6",children:[f?e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:f}):null,(b==="overview"||b==="endpoints")&&e.jsx(st,{endpoint:s?.endpoint,loading:d&&!s}),b==="overview"&&e.jsx(Ge,{status:s}),(b==="overview"||b==="addresses")&&e.jsx(at,{sections:pe,loading:d&&!s,diagnostics:i,checkedAt:l}),b==="overview"&&e.jsx(dt,{status:s}),b==="domain-dns"&&e.jsxs(e.Fragment,{children:[e.jsx(ot,{status:s}),e.jsx(Xe,{configuration:s?.configuration,saving:M,applyState:r,onSave:Z})]}),b==="https"&&e.jsxs(e.Fragment,{children:[e.jsx(lt,{status:s}),e.jsx(Ye,{configuration:s?.configuration,saving:M,applyState:r,onSave:Z})]}),b==="tunnel-profiles"&&e.jsxs(e.Fragment,{children:[e.jsx(Je,{title:"Observed tunnel",label:"Tunnel",capability:s?.tunnel}),e.jsx(Qe,{configuration:s?.configuration,providers:s?.providers??[],ingress:s?.ingress,saving:M,applyState:r,onSave:Z}),e.jsx(Ze,{fetchImpl:D})]}),b==="p2p"&&e.jsx(tt,{configuration:s?.configuration,saving:M,applyState:r,onSave:Z}),(b==="overview"||b==="diagnostics"||b==="https")&&e.jsx(ct,{status:s,endpoint:s?.endpoint,diagnostics:i,diagnosing:T,renewing:K,onDiagnose:ue,onRenewCertificate:me})]}),className:"min-h-full"})}function Ke(){const t=Ne();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Network sections","data-list-navigation":!0,children:se.map(s=>{const a=s.icon,i=`/network${s.path?`/${s.path}`:""}`;return e.jsxs(fe,{to:i,onClick:()=>t.openMain(),onKeyDown:ve,className:({isActive:n})=>ge(n,{compact:!1}),end:s.path==="",children:[e.jsx(a,{className:"h-4 w-4","aria-hidden":"true"}),s.label]},s.id)})})})}function We({title:t,loading:s,stale:a,onRefresh:i}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"text-sm font-semibold text-foreground",children:["Network · ",t]}),e.jsx("div",{className:"truncate text-xs text-muted-foreground","aria-live":"polite",children:a?"Refreshing · showing previous snapshot":"接入点、DNS、TLS、隧道与连通性诊断"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:s,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"刷新"]})})]})}function Ge({status:t}){const s=t?.addresses.public[0]??t?.addresses.lan[0]??t?.addresses.local[0]??t?.endpoint,a=t?!t.dns.supported||t.dns.status==="unsupported"?"Configure Domain & DNS, then recheck observed DNS.":!t.tls.supported||!["valid","active","ready"].includes(t.tls.status)?"Review HTTPS configuration and certificate renewal evidence.":"No connectivity action is currently required.":"Refresh network status.",i=t?.tunnel.supported===!0;return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Preferred access path"}),e.jsx(S,{children:"First address this runtime has configured, in public → LAN → local order"})]}),e.jsxs(P,{className:"space-y-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium",children:s??"Not configured"}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[e.jsxs($,{variant:"outline",children:["Local ",t?.addresses.local.length?"configured":"not configured"]}),e.jsxs($,{variant:"outline",children:["LAN ",t?.addresses.lan.length?"configured":"not configured"]}),e.jsxs($,{variant:"outline",children:["Public ",t?.addresses.public.length?"configured":"not configured"]}),e.jsxs($,{variant:"outline",children:["Tunnel ",i?t?.tunnel.status??"unknown":"not observed"]})]}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Configured addresses are not probe results; reachability is reported per route."}),e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsx("div",{className:"font-medium",children:"Next action"}),e.jsx("div",{className:"mt-1 text-muted-foreground",children:a})]})]})]})}function Je({title:t,label:s,capability:a,extra:i}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:t}),e.jsx(S,{children:"Observed runtime state"})]}),e.jsx(P,{children:e.jsx(q,{label:s,capability:a,extra:i})})]})}function Q({title:t}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:t}),e.jsx(S,{children:"Desired configuration"})]}),e.jsxs(P,{className:"text-sm text-muted-foreground",children:["This runtime does not report a configurable ",t," capability."]})]})}function Xe({configuration:t,saving:s,applyState:a,onSave:i}){const[n,l]=c.useState(t?.domainDns),[o,f]=c.useState("");return c.useEffect(()=>{let u=!1;return queueMicrotask(()=>{u||l(t?.domainDns)}),()=>{u=!0}},[t]),n?e.jsxs(ee,{title:"Saved configuration",applyState:a,children:[e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{name:"domain",label:"Domain",value:n.domain,onChange:u=>l({...n,domain:u})}),e.jsx(y,{name:"provider",label:"DNS provider",value:n.provider,onChange:u=>l({...n,provider:u})}),e.jsx(ce,{name:"recordTtl",label:"Record TTL (seconds)",value:n.recordTtl,min:30,max:86400,onChange:u=>l({...n,recordTtl:u})}),e.jsx(y,{name:"dnsCredential",label:n.credentialConfigured?"Replace credential (configured)":"Credential",value:o,type:"password",onChange:f})]}),e.jsx(ae,{label:"Enable DDNS",checked:n.ddnsEnabled,onChange:u=>l({...n,ddnsEnabled:u})}),e.jsx(te,{label:"Save DNS configuration",saving:s,onClick:()=>i({domainDns:{domain:n.domain,ddnsEnabled:n.ddnsEnabled,provider:n.provider,recordTtl:n.recordTtl,...o?{credential:o}:{}}})})]}):e.jsx(Q,{title:"Domain & DNS"})}function Ye({configuration:t,saving:s,applyState:a,onSave:i}){const[n,l]=c.useState(t?.https);return c.useEffect(()=>{let o=!1;return queueMicrotask(()=>{o||l(t?.https)}),()=>{o=!0}},[t]),n?e.jsxs(ee,{title:"Saved configuration",applyState:a,children:[e.jsx(ae,{label:"Enable HTTPS",checked:n.enabled,onChange:o=>l({...n,enabled:o})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(y,{name:"acmeEmail",label:"ACME email",value:n.acmeEmail,onChange:o=>l({...n,acmeEmail:o})}),e.jsx(y,{name:"acmeDomains",label:"Certificate domains",value:n.domains.join(", "),onChange:o=>l({...n,domains:o.split(",").map(f=>f.trim()).filter(Boolean)})}),e.jsx(y,{name:"certificatePath",label:"Certificate path",value:n.certificatePath??"",onChange:o=>l({...n,certificatePath:o})}),e.jsx(y,{name:"certificateKeyPath",label:"Private-key path",value:n.certificateKeyPath??"",onChange:o=>l({...n,certificateKeyPath:o})}),e.jsx(ce,{name:"renewBeforeDays",label:"Renew before (days)",value:n.renewBeforeDays,min:1,max:90,onChange:o=>l({...n,renewBeforeDays:o})})]}),e.jsx(te,{label:"Save HTTPS configuration",saving:s,onClick:()=>i({https:n})})]}):e.jsx(Q,{title:"HTTPS"})}function Ze({fetchImpl:t}){const[s,a]=c.useState(void 0),[i,n]=c.useState(void 0),[l,o]=c.useState(void 0),f=async()=>{n("inspect"),o(void 0);try{const d=await ze({fetchImpl:t});a(d.clients)}catch(d){o(d instanceof Error?d.message:String(d))}finally{n(void 0)}},u=async d=>{n(d),o(void 0);try{const x=await He({fetchImpl:t,provider:d});a(x.clients)}catch(x){o(x instanceof Error?x.message:String(x))}finally{n(void 0)}};return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Tunnel clients"}),e.jsx(S,{children:"Clients are not bundled with this build: check where one comes from, or download it into the plugin directory."})]}),e.jsxs(P,{className:"space-y-3 text-sm",children:[e.jsx(j,{type:"button",size:"sm",variant:"outline",onClick:f,disabled:i==="inspect",children:i==="inspect"?"Checking…":"Check clients"}),l&&e.jsx("div",{className:"text-destructive",children:l}),s&&e.jsx("div",{className:"space-y-2",children:s.map(d=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-border p-2",children:[e.jsx($,{variant:d.state==="ready"?"default":"outline",children:d.state==="ready"?"Ready":"Missing"}),e.jsx("span",{className:"font-medium",children:d.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[d.path??d.binary,d.version?` · ${d.version}`:"",d.source==="bundled"?" · plugin directory":""]}),d.state==="missing"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:d.installHint}),d.state==="missing"&&d.installable&&e.jsx(j,{type:"button",size:"sm",onClick:()=>u(d.provider),disabled:i===d.provider,children:i===d.provider?"Downloading…":"Download"}),d.state==="missing"&&!d.installable&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",d.installableReason,")"]})]},d.provider))})]})]})}function Qe({configuration:t,providers:s,ingress:a,saving:i,applyState:n,onSave:l}){const[o,f]=c.useState(t?.tunnelProfiles.activeProfileId??""),[u,d]=c.useState(t?.tunnelProfiles.profiles??[]),[x,T]=c.useState({});if(c.useEffect(()=>{let r=!1;return queueMicrotask(()=>{r||(f(t?.tunnelProfiles.activeProfileId??""),d(t?.tunnelProfiles.profiles??[]),T({}))}),()=>{r=!0}},[t]),!t)return e.jsx(Q,{title:"Tunnel Profiles"});const A=(r,p)=>d(g=>g.map(N=>N.id===r?{...N,...p}:N)),K=s.filter(r=>r.runtimeSupported),E=r=>s.find(p=>p.id===r),M=()=>{const r=`tunnel-${Date.now()}`,p=K[0]?.id??"ngrok";d(g=>[...g,{id:r,provider:p,label:"New tunnel",credentialConfigured:!1,parameters:{}}])},W=r=>{d(p=>p.filter(g=>g.id!==r)),o===r&&f("none")};return e.jsxs(ee,{title:"Saved tunnel profiles",applyState:n,children:[e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Active profile",e.jsxs("select",{value:o||"none",onChange:r=>f(r.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"none",children:"None"}),u.map(r=>e.jsxs("option",{value:r.id,children:[r.label," · ",r.provider]},r.id))]})]}),e.jsx("div",{className:"space-y-3",children:u.map(r=>e.jsxs("div",{className:"space-y-3 rounded-md border border-border p-3 text-sm",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(y,{name:`tunnel-label-${r.id}`,label:"Label",value:r.label,onChange:p=>A(r.id,{label:p})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Provider",e.jsx("select",{value:r.provider,onChange:p=>A(r.id,{provider:p.target.value,parameters:{}}),className:"block h-10 w-full rounded-md border border-input bg-background px-3",children:K.map(p=>e.jsx("option",{value:p.id,children:p.label},p.id))})]}),E(r.provider)?.endpointSource==="declared"?e.jsx(y,{name:`tunnel-url-${r.id}`,label:"Public endpoint (declared)",value:r.publicUrl??"",onChange:p=>A(r.id,{publicUrl:p})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:"The provider reports its public endpoint; there is nothing to type here."}),e.jsx(y,{name:`tunnel-credential-${r.id}`,label:r.credentialConfigured?"Replace credential (configured)":"Credential",type:"password",value:x[r.id]??"",onChange:p=>T(g=>({...g,[r.id]:p}))})]}),e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer font-medium",children:"Provider-specific parameters"}),e.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:(E(r.provider)?.parameterFields??[]).map(({key:p,label:g})=>e.jsx(y,{name:`tunnel-${p}-${r.id}`,label:g,value:r.parameters?.[p]??"",onChange:N=>A(r.id,{parameters:{...r.parameters,[p]:N}})},p))})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o===r.id?"Active after restart":"Inactive"," · credential ",r.credentialConfigured?"configured":"missing"]}),e.jsx(j,{type:"button",size:"sm",variant:"ghost",onClick:()=>W(r.id),children:"Remove"})]})]},r.id))}),e.jsx(j,{type:"button",size:"sm",variant:"outline",onClick:M,children:"Add tunnel profile"}),e.jsx(et,{ingress:a,descriptor:E(u.find(r=>r.id===o)?.provider??"")}),e.jsx(te,{label:"Save tunnel profiles",saving:i,onClick:()=>l({tunnelProfiles:{activeProfileId:o,profiles:u.map(r=>({id:r.id,provider:r.provider,label:r.label,publicUrl:r.publicUrl,parameters:r.parameters,...x[r.id]?{credential:x[r.id]}:{}}))}})})]})}function et({ingress:t,descriptor:s}){if(!t||s?.originOwner!=="console")return null;const a=async()=>{await window.navigator.clipboard.writeText(t.originUrl),U({description:"Tunnel origin copied"})};return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3","data-testid":"ingress-origin",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Tunnel origin (paste into the provider console)"}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"break-all font-mono text-sm",children:t.originUrl}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Set the tunnel's local port / service to this address, not the Gateway port: this is the entry that never treats a tunnelled caller as local."})]}),e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":"Copy tunnel origin",onClick:()=>{a()},children:e.jsx(ne,{className:"h-4 w-4","aria-hidden":"true"})}),s.consoleUrl?e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${s.label} console`,onClick:()=>window.open(s.consoleUrl,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})}):null]})]})]})}function tt({configuration:t,saving:s,applyState:a,onSave:i}){const[n,l]=c.useState(t?.p2p);return c.useEffect(()=>{let o=!1;return queueMicrotask(()=>{o||l(t?.p2p)}),()=>{o=!0}},[t]),n?e.jsxs(ee,{title:"Saved P2P configuration",applyState:a,children:[e.jsx(ae,{label:"Enable P2P fallback",checked:n.enabled,onChange:o=>l({...n,enabled:o})}),e.jsx(y,{name:"signalService",label:"Signal service",value:n.signalService,onChange:o=>l({...n,signalService:o})}),e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Fallback policy",e.jsxs("select",{value:n.fallbackPolicy,onChange:o=>l({...n,fallbackPolicy:o.target.value}),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-sm",children:[e.jsx("option",{value:"never",children:"Never"}),e.jsx("option",{value:"when-direct-unavailable",children:"When direct is unavailable"}),e.jsx("option",{value:"prefer-p2p",children:"Prefer P2P"})]})]}),e.jsx(te,{label:"Save P2P configuration",saving:s,onClick:()=>i({p2p:n})})]}):e.jsx(Q,{title:"P2P"})}function ee({title:t,applyState:s,children:a}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:t}),e.jsx(S,{children:"Desired configuration · not presented as observed until verified"})]}),e.jsxs(P,{className:"space-y-4",children:[s==="restart-required"?e.jsx("div",{role:"status",className:"rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-sm text-warning dark:bg-warning/20 dark:text-warning",children:"Saved · restart required"}):null,a]})]})}function y({name:t,label:s,value:a,type:i="text",onChange:n}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[s,e.jsx("input",{name:t,type:i,value:a,onChange:l=>n(l.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ce({name:t,label:s,value:a,min:i,max:n,onChange:l}){return e.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[s,e.jsx("input",{name:t,type:"number",value:a,min:i,max:n,onChange:o=>l(o.target.valueAsNumber),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm"})]})}function ae({label:t,checked:s,onChange:a}){return e.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:[t,e.jsx("input",{type:"checkbox",checked:s,onChange:i=>a(i.target.checked)})]})}function te({label:t,saving:s,onClick:a}){return e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{type:"button",onClick:a,disabled:s,children:s?"Saving…":t})})}function st({endpoint:t,loading:s}){const a=[{label:"Canonical URL",value:t},{label:"API endpoint",value:t?nt(t,"/api/"):void 0}],i=async(n,l)=>{await window.navigator.clipboard.writeText(l),U({description:`${n} copied`})};return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(de,{className:"h-4 w-4","aria-hidden":"true"}),"接入点"]}),e.jsx(S,{children:s?"正在解析接入点":"Observed endpoints · Currently effective route is the canonical URL"})]}),e.jsx(P,{className:"space-y-3",children:a.map(({label:n,value:l})=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:n}),e.jsx("div",{className:"mt-1 break-words text-sm text-foreground",children:l||"Unavailable"})]}),l?e.jsxs("div",{className:"flex shrink-0 gap-1",children:[e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":`Copy ${n}`,onClick:()=>{i(n,l)},children:e.jsx(ne,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(j,{type:"button",size:"icon",variant:"ghost","aria-label":`Open ${n}`,onClick:()=>window.open(l,"_blank","noopener,noreferrer"),children:e.jsx(le,{className:"h-4 w-4","aria-hidden":"true"})})]}):null]},n))})]})}function nt(t,s){try{return new URL(s,t).toString()}catch{return t}}function at({sections:t,loading:s,diagnostics:a,checkedAt:i}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(Oe,{className:"h-4 w-4","aria-hidden":"true"}),"网络地址"]}),e.jsx(S,{children:s?"正在刷新地址":"由运行时网络能力上报"})]}),e.jsx(P,{className:"space-y-4",children:t.map(n=>e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:n.title}),n.values.length>0?e.jsx("div",{className:"mt-1 space-y-1",children:n.values.map(l=>e.jsx(rt,{scope:n.key,value:l,diagnostics:a,checkedAt:i},l))}):e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"未提供"})]},n.key))})]})}function rt({scope:t,value:s,diagnostics:a,checkedAt:i}){const n=it(s),l=a.find(o=>o.id==="address-configuration");return e.jsxs("div",{className:"rounded-md border border-border p-3 text-sm",children:[e.jsx("div",{className:"break-words font-medium text-foreground",children:s}),e.jsxs("dl",{className:"mt-2 grid gap-x-4 gap-y-1 text-xs sm:grid-cols-2",children:[e.jsx(v,{label:"Interface",value:t==="local"?"Loopback":t==="lan"?"LAN interface (name not reported)":"Public route"}),e.jsx(v,{label:"IP version",value:n.ipVersion}),e.jsx(v,{label:"Port",value:n.port}),e.jsx(v,{label:"Configured",value:l?l.status==="ok"?"Yes":"No":"Not checked"}),e.jsx(v,{label:"Reachability",value:"Not probed"}),e.jsx(v,{label:"Configuration checked",value:l?.checkedAt?O(l.checkedAt):i?i.toLocaleString():"Not checked"})]})]})}function v({label:t,value:s}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:t}),e.jsx("dd",{className:"text-right text-foreground",children:s})]})}function it(t){try{const s=new URL(t),a=s.hostname.replace(/^\[|\]$/g,"");return{ipVersion:a.includes(":")?"IPv6":/^\d{1,3}(?:\.\d{1,3}){3}$/.test(a)?"IPv4":"Resolved hostname",port:s.port||(s.protocol==="https:"?"443":s.protocol==="http:"?"80":"Not reported")}}catch{return{ipVersion:"Not reported",port:"Not reported"}}}function ot({status:t}){const s=t?.configuration?.domainDns,a=(t?.addresses.public??[]).map(i=>{try{return new URL(i).hostname}catch{return i}});return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Observed DNS"}),e.jsx(S,{children:"Observed state is kept separate from desired DNS policy."})]}),e.jsxs(P,{className:"space-y-3",children:[e.jsx(q,{label:"Runtime status",capability:t?.dns}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(v,{label:"Observed hostnames",value:a.join(", ")||"Not reported"}),e.jsx(v,{label:"Expected domain",value:s?.domain||"Not configured"}),e.jsx(v,{label:"Expected value",value:t?.addresses.public[0]||"Not reported"}),e.jsx(v,{label:"Provider",value:s?.provider||"Not configured"})]})]})]})}function lt({status:t}){const s=t?.configuration?.https;return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsx(C,{className:"text-base",children:"Observed HTTPS"}),e.jsx(S,{children:"Certificate evidence reported by the active runtime."})]}),e.jsxs(P,{className:"space-y-3",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`Expires ${O(t.tls.expiresAt)}`:void 0}),e.jsxs("dl",{className:"grid gap-2 text-sm sm:grid-cols-2",children:[e.jsx(v,{label:"Certificate domains",value:t?.tls.domains?.join(", ")||s?.domains.join(", ")||"Not reported"}),e.jsx(v,{label:"Issuer",value:t?.tls.issuer||"Not reported by runtime"}),e.jsx(v,{label:"Validity",value:t?.tls.validFrom?`${O(t.tls.validFrom)} — ${t.tls.expiresAt?O(t.tls.expiresAt):"open"}`:t?.tls.status??"Not reported"}),e.jsx(v,{label:"Expiry",value:t?.tls.expiresAt?O(t.tls.expiresAt):"Not reported"}),e.jsx(v,{label:"Renewal status",value:t?.tls.renewalStatus||(t?.actions.renewCertificate?"Renewal available":"Renewal unavailable")}),e.jsx(v,{label:"Renewal policy",value:s?`${s.renewBeforeDays} days before expiry`:"Not configured"})]})]})]})}function dt({status:t}){return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(ie,{className:"h-4 w-4","aria-hidden":"true"}),"网络能力"]}),e.jsx(S,{children:"服务端声明的网络支持"})]}),e.jsxs(P,{className:"grid gap-3 text-sm",children:[e.jsx(q,{label:"TLS",capability:t?.tls,extra:t?.tls.expiresAt?`到期时间 ${O(t.tls.expiresAt)}`:void 0}),e.jsx(q,{label:"DNS",capability:t?.dns}),e.jsx(q,{label:"Tunnel",capability:t?.tunnel})]})]})}function ct({status:t,endpoint:s,diagnostics:a,diagnosing:i,renewing:n,onDiagnose:l,onRenewCertificate:o}){const f=a.length>0?Fe({generatedAt:new Date().toISOString(),endpoint:s,checks:a}):void 0,u=async()=>{f&&(await window.navigator.clipboard.writeText(f),U({description:"Diagnostic report copied"}))},d=()=>{if(!f)return;const x=URL.createObjectURL(new Blob([f],{type:"text/plain;charset=utf-8"})),T=document.createElement("a");T.href=x,T.download=`xpod-network-diagnostics-${new Date().toISOString().replace(/[:.]/g,"-")}.txt`,T.click(),URL.revokeObjectURL(x)};return e.jsxs(w,{children:[e.jsxs(k,{children:[e.jsxs(C,{className:"flex items-center gap-2 text-base",children:[e.jsx(oe,{className:"h-4 w-4","aria-hidden":"true"}),"操作"]}),e.jsx(S,{children:"仅显示网络能力允许的操作"})]}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t?.actions.diagnose?e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:l,disabled:i,children:[e.jsx(Ie,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"连通性诊断"]}):null,t?.actions.renewCertificate?e.jsxs(j,{type:"button",size:"sm",variant:"subtle",onClick:o,disabled:n,children:[e.jsx(we,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"续签证书"]}):null,e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:()=>{u()},disabled:!f,children:[e.jsx(ne,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Copy diagnostics"]}),e.jsxs(j,{type:"button",size:"sm",variant:"outline",onClick:d,disabled:!f,children:[e.jsx(ke,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Export diagnostics"]})]}),a.length>0?e.jsx("div",{className:"space-y-2",children:a.map(x=>e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:x.label}),e.jsx($,{variant:x.status==="ok"?"secondary":"outline",children:x.status})]}),x.detail?e.jsx("div",{className:"mt-1 break-words text-xs text-muted-foreground",children:x.detail}):null]},x.id))}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"尚未运行过诊断。"})]})]})}function q({label:t,capability:s,extra:a}){const i=s?.supported===!0;return e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:i?t:`${t} 不支持`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s?.status??"读取中",s?.detail?` · ${s.detail}`:""]})]}),e.jsx($,{variant:i?"secondary":"outline",children:i?"支持":"不支持"})]}),a?e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a}):null]})}function O(t){if(!t)return"暂无记录";const s=new Date(t);return Number.isNaN(s.getTime())?"暂无记录":s.toLocaleString()}export{yt as default};
@@ -1 +1 @@
1
- import{j as t}from"./dashboard-D2ozrATv.js";function s({title:e}){return t.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:e})}export{s as P};
1
+ import{j as t}from"./dashboard-Dm_h60lA.js";function s({title:e}){return t.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:e})}export{s as P};
@@ -0,0 +1 @@
1
+ import{r as g,j as n}from"./dashboard-Dm_h60lA.js";import{i as p,A as f}from"./ModelAssignmentsPanel-BSWH19oT.js";import{u as k}from"./AiConfigContext-DelSqO6L.js";import"./ai-connections-Dr4-rSzX.js";import"./XpodAiConnectionsPodStore-CHM-ZwI3.js";import"@comunica/query-sparql-solid";function C(){const{config:s,capabilities:d,save:o,rebuild:c,saveAndRebuild:i,saving:l,rebuilding:r}=k(),[e,a]=g.useState(s?.searchIndexing);if(g.useEffect(()=>{let t=!1;return queueMicrotask(()=>{t||a(s?.searchIndexing)}),()=>{t=!0}},[s]),!e)return null;const u=async t=>{t.preventDefault(),await o({searchIndexing:e})},x=e.ftsEnabled&&e.vectorEnabled?"all":e.vectorEnabled?"vector":"fts",b=d?.rebuildTargets?.includes(x)===!0,m=p(e,s?.searchIndexing);return n.jsxs(f,{title:"Search & Indexing",description:"Choose which derived search indexes Xpod maintains for this Pod.",onSubmit:u,onRestore:()=>o({searchIndexing:{ftsEnabled:!0,vectorEnabled:!0,progressiveIndexingEnabled:!0,textBackend:"auto",vectorBackend:"auto"}}),saving:l||r,dirty:m,footerActions:n.jsx("button",{type:"button",disabled:!b||l||r,onClick:()=>m?i({searchIndexing:e},x):c(x),className:"h-9 rounded-md border border-input px-3 text-sm font-medium disabled:opacity-50",children:r?"Scheduling…":m&&b?"Save and schedule rebuild":b?"Schedule rebuild":"Rebuild unavailable on this runtime"}),children:[n.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[n.jsx(h,{title:"Full-text Search",enabled:e.ftsEnabled,onEnabled:t=>a({...e,ftsEnabled:t}),backend:e.textBackend,onBackend:t=>a({...e,textBackend:t}),backends:[["auto","Auto"],...(d?.textBackends??[]).map(t=>[t,t==="fts5"?"FTS5":"PostgreSQL FTS"])]}),n.jsx(h,{title:"Vector Search",enabled:e.vectorEnabled,onEnabled:t=>a({...e,vectorEnabled:t}),backend:e.vectorBackend,onBackend:t=>a({...e,vectorBackend:t}),backends:[["auto","Auto"],...(d?.vectorBackends??[]).map(t=>[t,t==="vec"?"VEC":"pgvector"])]})]}),n.jsxs("label",{className:"flex items-start justify-between gap-4 rounded-xl border border-border p-4",children:[n.jsxs("span",{children:[n.jsx("span",{className:"block text-sm font-medium",children:"Progressive indexing"}),n.jsx("span",{className:"block text-xs text-muted-foreground",children:"Expand coverage as content becomes relevant instead of embedding everything eagerly."})]}),n.jsx("input",{name:"progressiveIndexingEnabled",type:"checkbox",checked:e.progressiveIndexingEnabled,onChange:t=>a({...e,progressiveIndexingEnabled:t.target.checked}),className:"mt-1 h-4 w-4 rounded border-input"})]})]})}function h({title:s,enabled:d,onEnabled:o,backend:c,onBackend:i,backends:l}){const r=l.filter(([a])=>a!=="auto"),e=v(c);return n.jsxs("section",{className:"rounded-xl border border-border p-4",children:[n.jsxs("label",{className:"flex items-center justify-between gap-3 text-sm font-medium",children:[s,n.jsx("input",{type:"checkbox",checked:d,onChange:a=>o(a.target.checked),className:"h-4 w-4 rounded border-input"})]}),n.jsxs("label",{className:"mt-4 flex items-center justify-between gap-3 text-xs font-medium text-muted-foreground",children:["Choose backend manually",n.jsx("input",{type:"checkbox",checked:e,disabled:r.length===0,onChange:a=>i(a.target.checked?r[0]?.[0]??"auto":"auto"),className:"h-4 w-4 rounded border-input"})]}),e?n.jsxs("label",{className:"mt-3 block space-y-2 text-xs font-medium text-muted-foreground",children:["Backend",n.jsx("select",{value:c,onChange:a=>i(a.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground",children:r.map(([a,u])=>n.jsx("option",{value:a,children:u},a))})]}):n.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Auto selects the runtime-supported backend."})]})}function v(s){return s!=="auto"}export{C as SearchIndexingPanel,v as isManualBackendSelection};
@@ -1 +1 @@
1
- import{c as L,r as o,j as e,B as N,R as T,C as l,a as u,b as h,d as f,e as m}from"./dashboard-D2ozrATv.js";import{f as D,a as M,t as _,r as O}from"./admin-C6qCRFiY.js";import{E as q}from"./external-link-CiYw5Q4U.js";const G=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],U=L("rotate-cw",G);function Q({serviceId:t,title:r}){const[s,d]=o.useState(),[g,R]=o.useState(),[j,k]=o.useState([]),[v,p]=o.useState(),[b,S]=o.useState(!0),[y,w]=o.useState(!1),[C,$]=o.useState(),c=o.useCallback(async a=>{S(!0);try{const[n,A]=await Promise.all([D({signal:a}),M({source:t,level:"error",limit:5})]);d(t==="gateway"?{name:"gateway",status:"running",pid:n.adminData?.pid,uptime:n.adminData?.uptime?n.adminData.uptime*1e3:void 0,restartCount:0}:n.servicesData?.find(E=>E.name===t)),R(n.configData??void 0),k(A),$(n.checkedAt),p(void 0)}catch(n){n instanceof DOMException&&n.name==="AbortError"||p("Service status could not be loaded. The previous snapshot is retained.")}finally{S(!1)}},[t]);o.useEffect(()=>{const a=new AbortController;let n=!0;return Promise.resolve().then(()=>{n&&c(a.signal)}),()=>{n=!1,a.abort()}},[c]);const x=o.useMemo(()=>X(t,g),[g,t]),P=async()=>{const a=t==="gateway"?"the whole Xpod runtime":`${r} only`;if(!window.confirm(`Restart ${a}? Active requests may be interrupted.`))return;w(!0);const n=t==="gateway"?await _():await O(t);w(!1),n?setTimeout(()=>{c()},750):p(`Restart request for ${r} was not accepted by this runtime.`)};return e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{"aria-live":"polite",className:"text-xs text-muted-foreground",children:b?"Refreshing service evidence…":C?`Checked ${C.toLocaleString()}`:"Not checked"}),e.jsxs(N,{type:"button",size:"sm",variant:"outline",onClick:()=>{c()},disabled:b,children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),v&&e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:v}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:r}),e.jsx(f,{children:"Observed state, endpoint, health evidence, dependencies, and explicitly scoped lifecycle action."})]}),e.jsxs(m,{className:"grid gap-3 text-sm sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(i,{label:"State",value:s?.status??"Unknown"}),e.jsx(i,{label:"PID",value:s?.pid?.toString()??"Not reported"}),e.jsx(i,{label:"Uptime",value:s?.uptime?z(s.uptime):"Not reported"}),e.jsx(i,{label:"Restart count",value:s?.restartCount?.toString()??"Not reported"}),e.jsx(i,{label:"Internal endpoint",value:x.endpoint}),e.jsx(i,{label:"Health check",value:x.healthCheck})]})]}),e.jsxs(l,{children:[e.jsx(u,{children:e.jsx(h,{children:"Dependencies"})}),e.jsx(m,{className:"grid gap-3 text-sm sm:grid-cols-2",children:x.dependencies.map(a=>e.jsx(i,{label:a,value:B(a,t,s)},a))})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Recent errors"}),e.jsxs(f,{children:["Latest supervisor errors scoped to ",r,"."]})]}),e.jsxs(m,{className:"space-y-2",children:[j.length?j.map(a=>e.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(a.timestamp).toLocaleString()}),e.jsx("div",{className:"mt-1 break-words",children:a.message})]},`${a.timestamp}-${a.message}`)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent errors reported."}),e.jsxs("a",{className:"inline-flex items-center text-sm font-medium text-primary hover:underline",href:`/status/logs?source=${t}`,children:[e.jsx(q,{className:"mr-1.5 h-4 w-4"}),"Open related logs"]})]})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Lifecycle"}),e.jsx(f,{children:t==="gateway"?"Gateway is the parent process, so this action restarts the whole Xpod runtime.":`This action restarts ${r} only; dependent requests may briefly fail.`})]}),e.jsx(m,{children:e.jsxs(N,{type:"button",variant:"destructive",onClick:()=>{P()},disabled:y,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),y?"Restarting…":t==="gateway"?"Restart Xpod runtime…":`Restart ${r}…`]})})]})]})}function X(t,r){const s=r?.env??{};return t==="gateway"?{endpoint:window.location.origin,healthCheck:"GET /service/status",dependencies:["Solid Server","API Server"]}:t==="css"?{endpoint:s.CSS_PORT?`http://127.0.0.1:${s.CSS_PORT}`:"Internal endpoint not reported",healthCheck:"TCP readiness + Solid root request",dependencies:["Authority storage","Identity service"]}:{endpoint:s.API_INTERNAL_URL||(s.API_PORT?`http://127.0.0.1:${s.API_PORT}`:"Internal endpoint not reported"),healthCheck:"GET /health",dependencies:["Solid Server","Configuration store"]}}function B(t,r,s){return s?s.status!=="running"?`${H(r)} is ${s.status}; dependency health is not implied`:`${t} required; direct probe evidence is not reported by this runtime`:"Not reported"}function H(t){return t==="gateway"?"Gateway":t==="css"?"Solid Server":"API Server"}function i({label:t,value:r}){return e.jsxs("div",{className:"rounded-lg border border-border p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"mt-1 break-all font-medium",children:r})]})}function z(t){const r=Math.floor(t/1e3),s=Math.floor(r/3600),d=Math.floor(r%3600/60);return s?`${s}h ${d}m`:`${d}m ${r%60}s`}export{Q as ServiceStatusPanel};
1
+ import{c as L,r as o,j as e,B as N,R as T,C as l,a as u,b as h,d as f,e as m}from"./dashboard-Dm_h60lA.js";import{f as D,a as M,t as _,r as O}from"./admin-C6qCRFiY.js";import{E as q}from"./external-link-BMrNvf3c.js";const G=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],U=L("rotate-cw",G);function Q({serviceId:t,title:r}){const[s,d]=o.useState(),[g,R]=o.useState(),[j,k]=o.useState([]),[v,p]=o.useState(),[b,S]=o.useState(!0),[y,w]=o.useState(!1),[C,$]=o.useState(),c=o.useCallback(async a=>{S(!0);try{const[n,A]=await Promise.all([D({signal:a}),M({source:t,level:"error",limit:5})]);d(t==="gateway"?{name:"gateway",status:"running",pid:n.adminData?.pid,uptime:n.adminData?.uptime?n.adminData.uptime*1e3:void 0,restartCount:0}:n.servicesData?.find(E=>E.name===t)),R(n.configData??void 0),k(A),$(n.checkedAt),p(void 0)}catch(n){n instanceof DOMException&&n.name==="AbortError"||p("Service status could not be loaded. The previous snapshot is retained.")}finally{S(!1)}},[t]);o.useEffect(()=>{const a=new AbortController;let n=!0;return Promise.resolve().then(()=>{n&&c(a.signal)}),()=>{n=!1,a.abort()}},[c]);const x=o.useMemo(()=>X(t,g),[g,t]),P=async()=>{const a=t==="gateway"?"the whole Xpod runtime":`${r} only`;if(!window.confirm(`Restart ${a}? Active requests may be interrupted.`))return;w(!0);const n=t==="gateway"?await _():await O(t);w(!1),n?setTimeout(()=>{c()},750):p(`Restart request for ${r} was not accepted by this runtime.`)};return e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{"aria-live":"polite",className:"text-xs text-muted-foreground",children:b?"Refreshing service evidence…":C?`Checked ${C.toLocaleString()}`:"Not checked"}),e.jsxs(N,{type:"button",size:"sm",variant:"outline",onClick:()=>{c()},disabled:b,children:[e.jsx(T,{className:"mr-2 h-4 w-4"}),"Refresh"]})]}),v&&e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:v}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:r}),e.jsx(f,{children:"Observed state, endpoint, health evidence, dependencies, and explicitly scoped lifecycle action."})]}),e.jsxs(m,{className:"grid gap-3 text-sm sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(i,{label:"State",value:s?.status??"Unknown"}),e.jsx(i,{label:"PID",value:s?.pid?.toString()??"Not reported"}),e.jsx(i,{label:"Uptime",value:s?.uptime?z(s.uptime):"Not reported"}),e.jsx(i,{label:"Restart count",value:s?.restartCount?.toString()??"Not reported"}),e.jsx(i,{label:"Internal endpoint",value:x.endpoint}),e.jsx(i,{label:"Health check",value:x.healthCheck})]})]}),e.jsxs(l,{children:[e.jsx(u,{children:e.jsx(h,{children:"Dependencies"})}),e.jsx(m,{className:"grid gap-3 text-sm sm:grid-cols-2",children:x.dependencies.map(a=>e.jsx(i,{label:a,value:B(a,t,s)},a))})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Recent errors"}),e.jsxs(f,{children:["Latest supervisor errors scoped to ",r,"."]})]}),e.jsxs(m,{className:"space-y-2",children:[j.length?j.map(a=>e.jsxs("div",{className:"rounded-lg border border-border p-3 text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(a.timestamp).toLocaleString()}),e.jsx("div",{className:"mt-1 break-words",children:a.message})]},`${a.timestamp}-${a.message}`)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent errors reported."}),e.jsxs("a",{className:"inline-flex items-center text-sm font-medium text-primary hover:underline",href:`/status/logs?source=${t}`,children:[e.jsx(q,{className:"mr-1.5 h-4 w-4"}),"Open related logs"]})]})]}),e.jsxs(l,{children:[e.jsxs(u,{children:[e.jsx(h,{children:"Lifecycle"}),e.jsx(f,{children:t==="gateway"?"Gateway is the parent process, so this action restarts the whole Xpod runtime.":`This action restarts ${r} only; dependent requests may briefly fail.`})]}),e.jsx(m,{children:e.jsxs(N,{type:"button",variant:"destructive",onClick:()=>{P()},disabled:y,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),y?"Restarting…":t==="gateway"?"Restart Xpod runtime…":`Restart ${r}…`]})})]})]})}function X(t,r){const s=r?.env??{};return t==="gateway"?{endpoint:window.location.origin,healthCheck:"GET /service/status",dependencies:["Solid Server","API Server"]}:t==="css"?{endpoint:s.CSS_PORT?`http://127.0.0.1:${s.CSS_PORT}`:"Internal endpoint not reported",healthCheck:"TCP readiness + Solid root request",dependencies:["Authority storage","Identity service"]}:{endpoint:s.API_INTERNAL_URL||(s.API_PORT?`http://127.0.0.1:${s.API_PORT}`:"Internal endpoint not reported"),healthCheck:"GET /health",dependencies:["Solid Server","Configuration store"]}}function B(t,r,s){return s?s.status!=="running"?`${H(r)} is ${s.status}; dependency health is not implied`:`${t} required; direct probe evidence is not reported by this runtime`:"Not reported"}function H(t){return t==="gateway"?"Gateway":t==="css"?"Solid Server":"API Server"}function i({label:t,value:r}){return e.jsxs("div",{className:"rounded-lg border border-border p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"mt-1 break-all font-medium",children:r})]})}function z(t){const r=Math.floor(t/1e3),s=Math.floor(r/3600),d=Math.floor(r%3600/60);return s?`${s}h ${d}m`:`${d}m ${r%60}s`}export{Q as ServiceStatusPanel};
@@ -0,0 +1 @@
1
+ import{c as r,w as u,S as c,Q as p,s as m,j as s,O as g,N as k,t as w,v as f}from"./dashboard-Dm_h60lA.js";import{A as l}from"./activity-B7UdTZ1N.js";import{W as x,N}from"./waypoints-DdEdgkxD.js";import{P as b}from"./PaneListHeader-xEjcBu9g.js";import{T as j,u as I}from"./workspace-layout-Wed840qR.js";const S=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],h=r("boxes",S);const M=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],L=r("braces",M);const _=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],v=r("hard-drive",_);const z=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],y=r("scroll-text",z);const H=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],A=r("server",H);const D=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],O=r("timer",D);function e(i,t,a,n,o){return{id:i,label:t,path:a,href:`/status/${a}`,end:!0,group:n,icon:o}}const d=[e("overview","Overview","overview","Overview",l),e("gateway","Gateway","services/gateway","Services",x),e("solid-server","Solid Server","services/solid-server","Services",u),e("api-server","API Server","services/api-server","Services",A),e("usage-overview","Usage","usage/overview","Usage",l),e("usage-storage","Storage","usage/storage","Usage",v),e("usage-bandwidth","Bandwidth","usage/bandwidth","Usage",x),e("usage-ai","AI usage","usage/ai","Usage",c),e("usage-index-storage","Index storage","usage/index-storage","Usage",h),e("logs","Logs","logs","Diagnostics",y),e("index-overview","Index Overview","index","Index",h),e("rdf","RDF","index/rdf","Index",L),e("fts","FTS","index/fts","Index",y),e("vector","Vector","index/vector","Index",c),e("retrieval-points","Retrieval Points","index/retrieval-points","Index",N),e("cache","Cache","index/cache","Index",v),e("slow-queries","Slow Queries","index/slow-queries","Index",O),e("benchmark","Benchmark","index/benchmark","Index",p)],V=["Overview","Services","Diagnostics","Index"];function B(){const i=m(),t=[...d].sort((a,n)=>n.path.length-a.path.length).find(a=>i.pathname.endsWith(a.path))??d[0];return s.jsx(j,{mode:"auto",listHeader:s.jsx(b,{title:"Status"}),list:s.jsx(q,{}),mainHeader:s.jsx("div",{className:"flex h-full items-center px-4",children:s.jsxs("div",{children:[s.jsxs("h1",{className:"text-sm font-semibold",children:["Status · ",t.label]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:"Observed state and operational evidence"})]})}),main:s.jsx("section",{className:"min-h-full bg-background",children:s.jsx(g,{})}),className:"min-h-full"})}function q(){const i=I();return s.jsx("aside",{"data-list-navigation":!0,className:"h-full overflow-y-auto border-r border-border bg-muted/20 py-2",children:V.map(t=>s.jsxs("section",{className:"mb-3",children:[s.jsx("h2",{className:"px-5 py-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:t}),d.filter(a=>a.group===t).map(a=>{const n=a.icon;return s.jsxs(k,{to:a.path,end:a.end,onKeyDown:w,onClick:()=>i.openMain(),className:({isActive:o})=>f(o,{compact:!1}),children:[s.jsx(n,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),a.label]},a.id)})]},t))})}export{B as default};
@@ -1 +1 @@
1
- import{c as l,D as h,q as u,r as c,j as e,O as x,N as b,s as y,t as g}from"./dashboard-D2ozrATv.js";import{K as f}from"./key-round-nKtxP6pb.js";import{b as v,c as k}from"./admin-C6qCRFiY.js";import{p as j}from"./settings-projection-CUkyprDQ.js";import{P as N}from"./PaneListHeader-ByqK_C6i.js";import{T as S,u as w}from"./workspace-layout-Csbbr3vZ.js";const M=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],P=l("box",M);const L=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],C=l("cloud",L);const A=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],_=l("server-cog",A);const D=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],H=l("wrench",D),I=[{scope:"account",label:"Account",description:"Your Pod and its session.",items:[{id:"pod",label:"Pod",path:"pod",description:"Current Pod identity and data boundary.",icon:P},{id:"identity-access",label:"Identity & Access",path:"identity-access",description:"Session, WebID, and account access.",icon:f}]},{scope:"node",label:"This node",description:"Shared by every Pod on this machine.",items:[{id:"storage",label:"Storage",path:"storage",description:"Authority storage backend and limits.",icon:h},{id:"runtime",label:"Runtime",path:"runtime",description:"Low-frequency runtime configuration.",icon:_},{id:"cloud",label:"Cloud",path:"cloud",description:"Cloud coordination settings when supported.",icon:C},{id:"advanced",label:"Advanced",path:"advanced",description:"Expert and compatibility controls.",icon:H}]}];function T(){const r=u(),[n,s]=c.useState(!1);c.useEffect(()=>{let t=!1;return Promise.all([v(),k()]).then(([d,p])=>{t||s(j({registered:d?.registered===!0,managed:d?.managed===!0,domainAllocated:p?.allocated===!0}).cloud)}),()=>{t=!0}},[]);const a=c.useMemo(()=>I.map(t=>({...t,items:t.items.filter(d=>d.id!=="cloud"||n)})).filter(t=>t.items.length>0),[n]),o=c.useMemo(()=>a.flatMap(t=>t.items),[a]),i=o.find(t=>r.pathname.endsWith(`/${t.path}`))??o[0],m=a.find(t=>t.items.includes(i))?.scope;return e.jsx(S,{mode:"auto",listHeader:e.jsx(N,{title:"Settings"}),list:e.jsx(z,{groups:a}),mainHeader:e.jsx("div",{className:"flex h-full items-center px-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-sm font-semibold",children:["Settings · ",i.label]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i.description}),m==="node"?e.jsx("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:"Applies to every Pod on this machine."}):null]})}),main:e.jsx("section",{className:"min-h-full bg-background",children:e.jsx(x,{})}),className:"min-h-full"})}function z({groups:r}){const n=w();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Settings sections","data-list-navigation":!0,children:r.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"px-4 pb-1 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s.label}),e.jsx("div",{className:"text-xs leading-4 text-muted-foreground",children:s.description})]}),s.items.map(a=>{const o=a.icon;return e.jsxs(b,{to:a.path,"aria-label":a.label,onKeyDown:y,onClick:()=>n.openMain(),className:({isActive:i})=>g(i,{compact:!1}),children:[e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:a.label}),e.jsx("span",{className:"block text-xs leading-4 text-muted-foreground",children:a.description})]})]},a.id)})]},s.scope))})})}export{T as default};
1
+ import{c as l,w as h,s as u,r as c,j as e,O as x,N as y,t as b,v as g}from"./dashboard-Dm_h60lA.js";import{K as f}from"./key-round-C9vxhn7T.js";import{b as v,c as k}from"./admin-C6qCRFiY.js";import{p as j}from"./settings-projection-CUkyprDQ.js";import{P as N}from"./PaneListHeader-xEjcBu9g.js";import{T as S,u as w}from"./workspace-layout-Wed840qR.js";const M=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],P=l("box",M);const L=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],C=l("cloud",L);const A=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],_=l("server-cog",A);const H=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],D=l("wrench",H),I=[{scope:"account",label:"Account",description:"Your Pod and its session.",items:[{id:"pod",label:"Pod",path:"pod",description:"Current Pod identity and data boundary.",icon:P},{id:"identity-access",label:"Identity & Access",path:"identity-access",description:"Session, WebID, and account access.",icon:f}]},{scope:"node",label:"This node",description:"Shared by every Pod on this machine.",items:[{id:"storage",label:"Storage",path:"storage",description:"Authority storage backend and limits.",icon:h},{id:"runtime",label:"Runtime",path:"runtime",description:"Low-frequency runtime configuration.",icon:_},{id:"cloud",label:"Cloud",path:"cloud",description:"Cloud coordination settings when supported.",icon:C},{id:"advanced",label:"Advanced",path:"advanced",description:"Expert and compatibility controls.",icon:D}]}];function q(){const r=u(),[n,s]=c.useState(!1);c.useEffect(()=>{let t=!1;return Promise.all([v(),k()]).then(([d,m])=>{t||s(j({registered:d?.registered===!0,managed:d?.managed===!0,domainAllocated:m?.allocated===!0}).cloud)}),()=>{t=!0}},[]);const a=c.useMemo(()=>I.map(t=>({...t,items:t.items.filter(d=>d.id!=="cloud"||n)})).filter(t=>t.items.length>0),[n]),o=c.useMemo(()=>a.flatMap(t=>t.items),[a]),i=o.find(t=>r.pathname.endsWith(`/${t.path}`))??o[0],p=a.find(t=>t.items.includes(i))?.scope;return e.jsx(S,{mode:"auto",listHeader:e.jsx(N,{title:"Settings"}),list:e.jsx(z,{groups:a}),mainHeader:e.jsx("div",{className:"flex h-full items-center px-4",children:e.jsxs("div",{children:[e.jsxs("h1",{className:"text-sm font-semibold",children:["Settings · ",i.label]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i.description}),p==="node"?e.jsx("div",{className:"text-xs text-warning dark:text-warning",children:"Applies to every Pod on this machine."}):null]})}),main:e.jsx("section",{className:"min-h-full bg-background",children:e.jsx(x,{})}),className:"min-h-full"})}function z({groups:r}){const n=w();return e.jsx("aside",{className:"h-full border-r border-border bg-muted/20 py-2",children:e.jsx("nav",{"aria-label":"Settings sections","data-list-navigation":!0,children:r.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"px-4 pb-1 pt-3",children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s.label}),e.jsx("div",{className:"text-xs leading-4 text-muted-foreground",children:s.description})]}),s.items.map(a=>{const o=a.icon;return e.jsxs(y,{to:a.path,"aria-label":a.label,onKeyDown:b,onClick:()=>n.openMain(),className:({isActive:i})=>g(i,{compact:!1}),children:[e.jsx(o,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:a.label}),e.jsx("span",{className:"block text-xs leading-4 text-muted-foreground",children:a.description})]})]},a.id)})]},s.scope))})})}export{q as default};
@@ -0,0 +1,33 @@
1
+ import{x as ee,y as te,z as re,A as N,E as de,F,G as le,H,I as ue,J as he,K as fe,L as pe,u as ge,r as u,j as n,B as A,R as me,C as we,a as be,b as xe,d as ve,e as ye,M as Se,P as Ae}from"./dashboard-Dm_h60lA.js";import{d as Ce,e as Ie,b as Ne,c as je,h as _e,i as Ee,t as Re,u as Ue}from"./admin-C6qCRFiY.js";import{a as Pe}from"./settings-projection-CUkyprDQ.js";import{A as ke,a as X}from"./ai-connections-Dr4-rSzX.js";import{R as Oe}from"./rotate-ccw-8Vm0-INc.js";import{S as z}from"./skeleton-CY_602wn.js";import{E as Le}from"./external-link-BMrNvf3c.js";class x extends Error{code;constructor(t,r){super(r),this.name="AccountStorageBindingsError",this.code=t}}async function Te(e){const t=Fe(e.origin),r=e.controls?.account?.bindings;if(typeof r!="string"||r.trim()==="")throw new x("missing-control","Account storage bindings control is unavailable");const s=e.fetchImpl??fetch,a=Be(r,t),o=a.origin===t?a.href:await ee(a.href,s,e.trustedAccountIndex);if(!o)throw new x("cross-origin","Account storage bindings control is not hosted by this Xpod");const c=te({Accept:"application/json",...e.headers});let i;try{i=await s(o,{headers:c,credentials:"include"})}catch(l){throw new x("request-failed",l instanceof Error?l.message:"Failed to load Account storage bindings")}if(i.status===401||i.status===403)throw new x("forbidden","Account storage bindings require an authenticated Account");if(!i.ok)throw new x("request-failed",`Account storage bindings request failed (${i.status})`);let d;try{d=await i.json()}catch{throw new x("invalid-response","Account storage bindings response is not valid JSON")}return De(d,a.origin,$e(a,e.trustedAccountIndex,t))}function De(e,t,r=!1){if(!q(e)||!Array.isArray(e.bindings))throw new x("invalid-response","Account storage bindings response is malformed");const s=[],a=new Set;for(const o of e.bindings){if(!q(o)||typeof o.webId!="string"||typeof o.storageUrl!="string")throw new x("invalid-response","Account storage binding row is malformed");const c=We(o.webId),i=Me(o.storageUrl,r?void 0:t);if(!c||!i)throw new x("cross-origin","Account storage binding is outside the trusted storage scope");const d={webId:c,storageUrl:i,...typeof o.label=="string"?{label:o.label}:{}},l=`${d.webId}
2
+ ${d.storageUrl}`;a.has(l)||(a.add(l),s.push(d))}return s}function Fe(e){try{return new URL(e??(typeof window>"u"?"http://localhost":window.location.origin)).origin}catch{throw new x("cross-origin","Current Xpod origin is invalid")}}function Be(e,t){try{const r=new URL(e,t);if(!["http:","https:"].includes(r.protocol)||r.username||r.password||r.hash)throw new Error("unsafe control URL");return r}catch{throw new x("cross-origin","Account storage bindings control is not a valid URL")}}function We(e){if(!re(e))try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password?void 0:e}catch{return}}function Me(e,t){try{const r=new URL(e.trim());return t!==void 0&&r.origin!==t||!["http:","https:"].includes(r.protocol)||r.username||r.password||r.search||r.hash?void 0:(r.pathname=r.pathname.endsWith("/")?r.pathname:`${r.pathname}/`,r.href)}catch{return}}function $e(e,t,r){if(!t)return!1;try{const s=new URL(t,r);return s.pathname.startsWith("/.account/")&&e.origin===s.origin&&e.pathname.startsWith("/.account/")}catch{return!1}}function q(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}const V="co.undefineds.ai-connections",Ge={providerCredentials:"settings/credentials.ttl",providerDefinitions:"settings/providers/__service_access__.ttl",gatewayAccessKeys:".data/ai/gateway/access-keys.ttl",quotaSnapshots:".data/ai/gateway/quota.ttl"},He=new Set(ke);function K(e,t){if(!P(e))throw new Error("invalid_descriptor");if(e.appletId!==V)throw new Error("invalid_applet_id");const r=e.service;if(!P(r)||typeof r.webId!="string"||typeof r.label!="string"||!Ye(r.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const s=Je(t),a=new Set,o=e.resources.map(c=>Xe(c,s,a));return{appletId:V,service:{webId:r.webId,label:r.label},resources:o}}function Xe(e,t,r){if(!P(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!P(e.access))throw new Error("invalid_resource");const s=ze(e.id,t);if(!s||r.has(e.id))throw new Error("invalid_resource");qe(e.url);let a;try{a=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!Qe(a,t))throw new Error("invalid_resource");if(a.href!==s)throw new Error("invalid_resource");return r.add(e.id),{id:e.id,url:a.href,mediaType:"text/turtle",access:Ke(e.access)}}function ze(e,t){const r=Ge[e];if(r)return new URL(r,t).href;const s=e.startsWith("providerDocument:")?e.slice(17):void 0;if(s&&He.has(s))return new URL(`settings/providers/${s}.ttl`,t).href}function qe(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=Ve(e);if(J(t))throw new Error("invalid_resource");try{const r=decodeURIComponent(t);if(r.includes("\\")||J(r))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function Ve(e){const t=e.split("#",1)[0]??e;return(t.split("?",1)[0]??t).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/\\?#]*/i,"")}function J(e){return e.split("/").some(t=>t==="."||t==="..")}function Ke(e){if(Object.keys(e).some(r=>r!=="read"&&r!=="append"&&r!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function Je(e){const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("invalid_current_pod");return t.pathname.endsWith("/")||(t.pathname=`${t.pathname}/`),t}function Qe(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function Ye(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function P(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}const Ze=3,et=63,tt=/^[a-z0-9-]+$/;function B(e){return e.trim().toLowerCase()}function ne(e){const t=B(e);if(!t)return N.usernameRequired;if(t.length<Ze||t.length>et)return N.usernameLength;if(!tt.test(t))return N.usernameCharset;if(t.startsWith("-")||t.endsWith("-"))return N.usernameHyphen}const rt="已有 Pod 的身份绑定尚未确认。请重试读取绑定或返回账号,不需要重新创建 Pod。",nt="暂时无法确认已有 Pod,请重试读取或返回账号。";class y extends Error{code;constructor(t){super(t==="binding-missing"?rt:t==="inventory-unavailable"?nt:"账号已切换,请返回当前账号重新操作。"),this.name="FirstPodReadinessError",this.code=t}}function st(e){const t=H(),r=ue(t,{...e.headers}),s=new Headers(r).get("Authorization"),a=()=>{try{e.assertCurrentAccount?.()}catch{throw new y("account-changed")}if(H()!==t||s?.startsWith("CSS-Account-Token ")&&s!==(t?`CSS-Account-Token ${t}`:void 0))throw new y("account-changed")},o=e.fetchImpl??fetch;return{headers:r,assertCurrentAccount:a,fetch:async(i,d)=>{a();const l=await o(i,d);try{a()}catch(m){throw l.body?.cancel().catch(()=>{}),m}const f=async m=>{a();const v=await m();return a(),v},p=l.json.bind(l),g=l.text.bind(l);return l.json=()=>f(p),l.text=()=>f(g),l}}}async function at(e,t,r,s){s.assertCurrentAccount();let a;try{const i=await e(F(t),{headers:{...s.headers,Accept:"application/json"},credentials:"include"});if(!i.ok)throw new y("inventory-unavailable");a=await i.json()}catch{throw s.assertCurrentAccount(),new y("inventory-unavailable")}if(s.assertCurrentAccount(),!D(a)||!D(a.pods))throw new y("inventory-unavailable");const o=Object.entries(a.pods);if(o.some(([i,d])=>!oe(i)||typeof d!="string"||!d))throw new y("inventory-unavailable");const c=he(r);if(o.some(([i])=>!c||fe(i,c.storageRoot)))throw new y("binding-missing")}function ot(e){for(const t of e){if(!t)continue;const r=ft(t);if(!r)continue;const s=B(r).replace(/[^a-z0-9-]/gu,"-").replace(/-+/gu,"-").replace(/^-+|-+$/gu,"");if(s&&!ne(s))return s}return""}async function it(e){const t=st(e),r=t.fetch,s=B(e.username),a=ne(s);if(a)throw new Error(a);const o=await de(e.provisionCode),c=await ee(e.createPodUrl,r,e.trustedAccountIndex);if(!c)throw new Error("Pod creation control is not hosted by this Xpod");await at(r,c,o,t);const i=await ut(r,s,o);t.assertCurrentAccount(),e.onStage?.("submitting");const d=await r(F(c),{method:"POST",headers:{...t.headers,Accept:"application/json","Content-Type":"application/json"},credentials:"include",body:JSON.stringify(le(s,i?.provisionCode??o,i?.provisionReceipt))});if(t.assertCurrentAccount(),!d.ok){const g=await lt(d);throw d.status===409||se(g)?new Error(N.podNameTaken):new Error(g||"Failed to create Pod")}const l=await d.json().catch(k);t.assertCurrentAccount(),e.onStage?.("submitted");const f=ht(l);if(!e.pickWebIdUrl)return f;const p=await ct({fetchImpl:r,headers:t.headers,maxAttempts:e.maxAttempts,pickWebIdUrl:e.pickWebIdUrl,pollIntervalMs:e.pollIntervalMs});return t.assertCurrentAccount(),p.length>0?(e.onStage?.("binding-confirmed"),p):f}async function ct(e){const t=e.fetchImpl??fetch,r=Math.max(1,e.maxAttempts??30),s=Math.max(0,e.pollIntervalMs??500);for(let a=0;a<r;a+=1){const o=await dt(t,e.pickWebIdUrl,e.headers);if(o.length>0)return o;a<r-1&&s>0&&await new Promise(c=>setTimeout(c,s))}return[]}function k(e){if(e instanceof y)throw e}async function dt(e,t,r){const s=await e(F(t),{headers:r,credentials:"include"}).catch(k);if(!s?.ok)return[];const a=await s.json().catch(k);if(!Array.isArray(a?.entries))return[];const o=new Set,c=[];for(const i of a.entries){if(!D(i)||typeof i.webId!="string"||typeof i.storageUrl!="string")continue;const d=ae(i.webId,i.storageUrl);if(!d)continue;const l=`${d.webId}
3
+ ${d.storageUrl}`;o.has(l)||(o.add(l),c.push(d))}return c}async function lt(e){const t=await e.text?.().catch(k);if(t)try{const r=JSON.parse(t);return typeof r.message=="string"?r.message:typeof r.error=="string"?r.error:t}catch{return t}}function se(e){return e?/already (?:is )?(?:a )?resource/iu.test(e)||/already taken/iu.test(e)||/already exists/iu.test(e):!1}async function ut(e,t,r){try{return await pe(e,t,r)}catch(s){const a=s instanceof Error?s.message:String(s);throw se(a)?new Error(N.podNameTaken):s}}function ht(e){if(typeof e?.podUrl!="string")return[];const t=oe(e.podUrl);if(!t)return[];const r=new Set;if(typeof e.webId=="string"&&e.webId.length>0&&r.add(e.webId),Array.isArray(e.webIds))for(const s of e.webIds)typeof s=="string"&&s.length>0&&r.add(s);return Array.from(r).map(s=>ae(s,t)).filter(s=>!!s)}function ft(e){try{return new URL(e).pathname.split("/").filter(Boolean)[0]}catch{return e.includes("@")?e.split("@",1)[0]:e}}function ae(e,t){if(!re(e))try{const r=new URL(e),s=new URL(t);return!["http:","https:"].includes(r.protocol)||!["http:","https:"].includes(s.protocol)?void 0:(s.pathname=s.pathname.endsWith("/")?s.pathname:`${s.pathname}/`,{webId:e,storageUrl:s.href})}catch{return}}function oe(e){try{const t=new URL(e);return!["http:","https:"].includes(t.protocol)||t.username||t.password||t.hash||t.search?void 0:(t.pathname=t.pathname.endsWith("/")?t.pathname:`${t.pathname}/`,t.href)}catch{return}}function D(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function pt(e,t){if(e)try{return new URL(new URL(e).pathname,t).toString()}catch{return}}const gt="http://www.w3.org/ns/solid/acp#",mt="http://www.w3.org/ns/auth/acl#";function Q(e,{ownerWebId:t,serviceWebId:r},s=!0){const a=s?`
4
+ <#serviceAccess>
5
+ a acp:AccessControl;
6
+ acp:apply [
7
+ a acp:Policy;
8
+ acp:allow acl:Read, acl:Write;
9
+ acp:anyOf [
10
+ a acp:Matcher;
11
+ acp:agent <${r}>
12
+ ]
13
+ ].
14
+ `:"",o=s?"<#ownerAccess>, <#serviceAccess>":"<#ownerAccess>";return`@prefix acl: <${mt}>.
15
+ @prefix acp: <${gt}>.
16
+
17
+ <#managed>
18
+ a acp:AccessControlResource;
19
+ acp:resource <${e}>;
20
+ acp:accessControl ${o};
21
+ acp:memberAccessControl ${o}.
22
+
23
+ <#ownerAccess>
24
+ a acp:AccessControl;
25
+ acp:apply [
26
+ a acp:Policy;
27
+ acp:allow acl:Read, acl:Write, acl:Control;
28
+ acp:anyOf [
29
+ a acp:Matcher;
30
+ acp:agent <${t}>
31
+ ]
32
+ ].
33
+ ${a}`}function wt(e){const t=new URL(e);return t.pathname.endsWith("/")||(t.pathname=t.pathname.slice(0,t.pathname.lastIndexOf("/")+1)),t.toString()}function L(e){return new URL(".acr",e).toString()}function T(e){return[...new Set(e.resources.map(t=>wt(t.url)))]}async function Y(e,t,r){const s=await e(t,{method:"PUT",headers:{"content-type":"text/turtle"},body:r});if(!s.ok)throw await s.arrayBuffer().catch(()=>{}),new Error(`service_acr_write_failed:${s.status}`)}function U(e,t,r){return{status:t?"granted":"missing",resources:e.resources}}function Z(e){const t=()=>{if(!e.ownerWebId)throw new Error("service_acr_owner_missing");return e.ownerWebId};return{async ensureAgentAccess(r){const s=t();for(const a of T(r))await Y(e.authenticatedFetch,L(a),Q(a,{ownerWebId:s,serviceWebId:r.service.webId}));return{status:"granted",resources:r.resources}},async inspectAgentAccess(r){try{for(const s of T(r)){const a=await e.authenticatedFetch(L(s),{headers:{accept:"text/turtle"}});if(!a.ok)return await a.arrayBuffer().catch(()=>{}),U(r,!1);const o=await a.text();if(!o.includes(`<${r.service.webId}>`)||!o.includes("acp:AccessControlResource"))return U(r,!1)}return U(r,!0)}catch{return U(r,!1)}},async revokeAgentAccess(r){const s=t();for(const a of T(r))await Y(e.authenticatedFetch,L(a),Q(a,{ownerWebId:s,serviceWebId:r.service.webId},!1));return{status:"missing",resources:r.resources}}}}const bt={submitting:"正在提交创建请求…",submitted:"请求已提交,正在读取结果…","binding-confirmed":"身份绑定已确认…"};function xt(e){return e?bt[e]:"正在创建…"}function Dt({kind:e}){const t=ge(),[r,s]=u.useState(null),[a,o]=u.useState(null),[c,i]=u.useState(null),[d,l]=u.useState(null),[f,p]=u.useState(!0),[g,m]=u.useState(""),[v,R]=u.useState(""),C=u.useCallback(async()=>{p(!0),m("");try{const[h,w,O,I]=await Promise.all([Ce(),Ie(),Ne(),je()]);if(!h||!w)throw new Error("unavailable");s(h),o(w),i(O),l(await _e(Ee(w.env,I,h.env.CSS_BASE_URL??"")))}catch{m("Settings evidence could not be loaded.")}finally{p(!1)}},[]);u.useEffect(()=>{let h=!1;return queueMicrotask(()=>{h||C()}),()=>{h=!0}},[C]);const S=async h=>{if(m(""),!await Ue(h)){m("Configuration could not be saved.");return}o(w=>w&&{...w,env:{...w.env,...h}}),R("Saved · restart required")},_=_t[e];return n.jsxs("div",{className:"space-y-4 p-6",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs(A,{type:"button",size:"sm",variant:"outline",onClick:C,disabled:f,children:[n.jsx(me,{className:"mr-2 h-4 w-4"}),"Refresh"]})}),g?n.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:g}):null,v?n.jsxs("div",{role:"status",className:"flex flex-wrap items-center justify-between gap-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-sm text-warning dark:bg-warning/20 dark:text-warning",children:[n.jsx("span",{children:v}),n.jsxs(A,{type:"button",size:"sm",variant:"outline",onClick:()=>{Re()},children:[n.jsx(Oe,{className:"mr-2 h-4 w-4"}),"Restart Xpod"]})]}):null,n.jsxs(we,{children:[n.jsxs(be,{children:[n.jsx(xe,{children:_}),n.jsx(ve,{children:Et[e]})]}),n.jsx(ye,{className:"space-y-4",children:f&&!a?n.jsx("div",{role:"status","aria-label":"Loading settings",className:"grid gap-3 sm:grid-cols-2","aria-live":"polite",children:[0,1,2,3].map(h=>n.jsxs("div",{className:"rounded-lg border border-border p-3","aria-hidden":"true",children:[n.jsx(z,{className:"h-3 w-24"}),n.jsx(z,{className:"mt-2 h-5 w-36"})]},h))}):n.jsx(yt,{kind:e,runtime:t,admin:r,configuration:a,provision:c,publicRoute:d,save:S})})]})]})}function vt({runtime:e,publicRoute:t}){const r=Se(),[s,a]=u.useState(null),[o,c]=u.useState(""),[i,d]=u.useState(""),[l,f]=u.useState(!1),[p,g]=u.useState(null),[m,v]=u.useState(""),[R,C]=u.useState(""),S=r.controls,_=r.idpIndex,h=u.useCallback(async()=>{c("");try{a(await Te({controls:S,origin:window.location.origin,trustedAccountIndex:_}))}catch{a(null),c("暂时无法读取存储绑定,请重试。")}},[S,_]);u.useEffect(()=>{let b=!1;return queueMicrotask(()=>{b||h()}),()=>{b=!0}},[h]);const w=u.useMemo(()=>ot([e.webId,r.identity?.username,S?.account?.username]),[e.webId,r.identity?.username,S?.account?.username]),O=async b=>{b.preventDefault();const M=S?.account?.pod,$=(i.trim()||w||"").trim();if(!l){if(!M){v("当前部署没有公布创建存储空间的入口。");return}if(!$){v("无法从当前账号推断 Pod 名称,请手动填写。");return}f(!0),g(null),v(""),C("");try{await it({assertCurrentAccount:r.bindAccountCapability?.(),createPodUrl:M,headers:te(),provisionCode:await Ae(),trustedAccountIndex:_,username:$,onStage:g}),d(""),C("存储空间已创建。"),await h()}catch(G){v(G instanceof Error?G.message:"无法创建存储空间,请重试。")}finally{f(!1),g(null)}}},I=pt(e.podUrl,window.location.origin),ce=[{label:"Pod name",value:ie(e.podUrl)},{label:"Pod URL",value:I??"Not discovered"},{label:"Public route",value:jt(t),detail:t?.detail??"Not checked by this runtime"},{label:"Session",value:e.state.status}];return n.jsxs(n.Fragment,{children:[n.jsx(j,{rows:ce}),n.jsxs(A,{type:"button",variant:"outline",disabled:!I,onClick:()=>I&&window.open(I,"_blank","noopener,noreferrer"),children:[n.jsx(Le,{className:"mr-2 h-4 w-4"}),"Open Pod"]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsx("div",{className:"text-sm font-medium",children:"属于当前账号的存储空间"}),n.jsx("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:"/status/usage/storage",children:"查看用量"})]}),o?n.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-sm text-destructive",children:o}):null,s===null&&!o?n.jsx("div",{role:"status",className:"text-sm text-muted-foreground",children:"正在读取…"}):null,s?.length===0?n.jsx("div",{role:"status",className:"rounded-lg border border-border p-3 text-sm text-muted-foreground",children:"这个账号还没有任何存储空间。创建后即可用它授权应用访问。"}):null,s&&s.length>0?n.jsx("ul",{className:"space-y-2",children:s.map(b=>n.jsxs("li",{className:"rounded-lg border border-border p-3 text-sm",children:[n.jsx("div",{className:"break-all font-medium",children:b.storageUrl}),n.jsx("div",{className:"mt-1 break-all text-xs text-muted-foreground",children:b.webId})]},`${b.webId}|${b.storageUrl}`))}):null]}),n.jsxs("form",{onSubmit:O,className:"space-y-2 rounded-lg border border-border p-3",children:[n.jsx("label",{className:"block text-sm font-medium",htmlFor:"pod-management-name",children:"创建存储空间"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"创建是一次显式操作:不会因为登录或授权而自动发生。"}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx("input",{id:"pod-management-name",className:"h-10 min-w-48 flex-1 rounded-md border border-input bg-background px-3",value:i,placeholder:w||"my-pod",disabled:l,onChange:b=>d(b.currentTarget.value)}),n.jsx(A,{type:"submit",disabled:l,children:l?xt(p):"创建"})]}),m?n.jsx("div",{role:"alert",className:"text-sm text-destructive",children:m}):null,R?n.jsx("div",{role:"status",className:"text-sm text-muted-foreground",children:R}):null]})]})}function yt({kind:e,runtime:t,admin:r,configuration:s,provision:a,publicRoute:o,save:c}){const i=s?.env??{};return e==="pod"?n.jsx(vt,{runtime:t,publicRoute:o}):e==="identity-access"?n.jsx(At,{runtime:t}):e==="storage"?n.jsxs(n.Fragment,{children:[n.jsx(j,{rows:Pe(i,s?.secrets)}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Measured storage and bandwidth are intentionally shown in Status → Usage, not here. Storage migration is unavailable because this runtime does not report a migration capability."})]}):e==="runtime"?n.jsxs(n.Fragment,{children:[n.jsx(St,{admin:r,runtime:t,publicRoute:o}),n.jsx(Ct,{env:i,admin:r,save:c})]}):e==="cloud"?n.jsx(It,{env:i,provision:a,save:c}):n.jsx(Nt,{env:i,save:c})}function St({admin:e,runtime:t,publicRoute:r}){const s=e?`${e.status==="running"?"运行中":e.status} · 已运行 ${Math.round((e.uptime??0)/1e3)} 秒`:"状态无法确认",a=t.podUrl?t.podUrl:t.webId?"已登录,尚未确认存储地址":"尚未登录",o=r?`${r.publicIp??"公网地址未知"} · ${r.status==="pass"?"可达":"不可达或未确认"}`:"对外访问状态无法确认",c=[{id:"services",title:"服务与启动",state:s,detail:"启动设置就在本页下方;服务明细与日志可直达。",links:[{label:"服务明细",href:"/status/services/gateway"},{label:"日志",href:"/status/logs"}]},{id:"access",title:"访问与连接",state:a,detail:"本机、局域网与外部访问范围在连接页里检测。",links:[{label:"连接与地址",href:"/network"}]},{id:"public-access",title:"对外访问设置",state:o,detail:"域名、HTTPS 与隧道按实际支持的方式配置;切换只保留一条活动隧道。",links:[{label:"打开网络设置",href:"/network"}]},{id:"diagnostics",title:"诊断",state:"证据与专业维度",detail:"日志、索引与用量都在诊断上下文里,可带对象与筛选进入。",links:[{label:"索引诊断",href:"/status/index"},{label:"用量",href:"/status/usage/overview"}]}];return n.jsxs("section",{"data-testid":"services-access-sections",className:"space-y-3",children:[n.jsx("div",{className:"text-sm font-medium",children:"服务与访问"}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:c.map(i=>n.jsxs("div",{"data-testid":"services-access-section","data-section":i.id,className:"rounded-lg border border-border bg-card p-3",children:[n.jsx("div",{className:"text-sm font-medium",children:i.title}),n.jsx("div",{className:"mt-1 break-all text-sm text-muted-foreground",children:i.state}),n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.detail}),n.jsx("div",{className:"mt-2 flex flex-wrap gap-3",children:i.links.map(d=>n.jsx("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:d.href,children:d.label},d.href))})]},i.id))})]})}function At({runtime:e}){const[t,r]=u.useState("checking"),[s,a]=u.useState(!1),o=u.useCallback(async()=>{if(!e.webId||!e.podUrl||e.state.status!=="authenticated"){r("unavailable");return}r("checking");try{const d=X({webId:e.webId,podUrl:e.podUrl,authenticatedFetch:e.fetch}),l=K(await d.getServiceAccess(),e.podUrl),p=await Z({authenticatedFetch:e.fetch,ownerWebId:e.webId}).inspectAgentAccess(l);r(p.status==="granted"?"granted":"missing")}catch{r("error")}},[e.fetch,e.podUrl,e.state.status,e.webId]);u.useEffect(()=>{let d=!1;return queueMicrotask(()=>{d||o()}),()=>{d=!0}},[o]);const c=async()=>{if(!(!e.webId||!e.podUrl||!window.confirm("Revoke AI Gateway service access to Xpod settings resources? Provider credentials remain stored but the service can no longer use them."))){a(!0);try{const d=X({webId:e.webId,podUrl:e.podUrl,authenticatedFetch:e.fetch}),l=K(await d.getServiceAccess(),e.podUrl);await Z({authenticatedFetch:e.fetch,ownerWebId:e.webId}).revokeAgentAccess(l),r("missing")}catch{r("error")}finally{a(!1)}}},i=t==="granted"?"Granted":t==="missing"?"Not granted":t==="checking"?"Checking…":t==="unavailable"?"Unavailable while signed out":"Could not inspect";return n.jsxs(n.Fragment,{children:[n.jsx(j,{rows:[{label:"WebID",value:e.webId??"Signed out"},{label:"OIDC issuer",value:e.issuer??"Not reported"},{label:"Current account",value:e.webId?ie(e.webId):"Signed out"},{label:"Session",value:e.state.status},{label:"ACP / ACR",value:t==="error"?"Capability unavailable or permission denied":"Managed ACR capability available"},{label:"AI Gateway service access",value:i,detail:"Inspected from the managed ACRs for declared settings resources"}]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsx(A,{type:"button",variant:"outline",onClick:()=>{o()},disabled:t==="checking",children:"Recheck access"}),n.jsx(A,{type:"button",variant:"destructive",onClick:()=>{c()},disabled:t!=="granted"||s,children:s?"Revoking…":"Revoke service access"})]})]})}function Ct({env:e,admin:t,save:r}){const s=e.CSS_BASE_URL??t?.env.CSS_BASE_URL??"",[a,o]=u.useState(s),[c,i]=u.useState(e.CSS_ROOT_FILE_PATH??"");return u.useEffect(()=>{let d=!1;return queueMicrotask(()=>{d||(o(s),i(e.CSS_ROOT_FILE_PATH??""))}),()=>{d=!0}},[e,s]),n.jsxs("div",{className:"space-y-4",children:[n.jsx(j,{rows:[{label:"Edition",value:t?.env.XPOD_EDITION??e.XPOD_EDITION??"local"},{label:"Configuration source",value:".env.local / runtime bootstrap"},{label:"Service startup",value:"Gateway supervises Solid Server and API Server"},{label:"Automatic restart",value:"Enabled for managed child services"}]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[n.jsx(E,{label:"Base URL",value:a,onChange:o}),n.jsx(E,{label:"Data directory",value:c,onChange:i})]}),n.jsx(W,{onClick:()=>r({CSS_BASE_URL:a,CSS_ROOT_FILE_PATH:c})})]})}function It({env:e,provision:t,save:r}){const[s,a]=u.useState(e.XPOD_CLOUD_API_ENDPOINT??""),[o,c]=u.useState(e.XPOD_NODE_ID??""),[i,d]=u.useState(e.XPOD_SP_DOMAIN??"");return u.useEffect(()=>{let l=!1;return queueMicrotask(()=>{l||(a(e.XPOD_CLOUD_API_ENDPOINT??""),c(e.XPOD_NODE_ID??""),d(e.XPOD_SP_DOMAIN??""))}),()=>{l=!0}},[e]),n.jsxs("div",{className:"space-y-4",children:[n.jsx(j,{rows:[{label:"Node registration",value:t?.registered?"Registered":"Not registered",detail:t?.nodeId??"Node ID not reported"},{label:"Cluster coordination",value:t?.cloudUrl??"Not configured",detail:t?.managed?"This node is cluster-managed":"Not cluster-managed"},{label:"Service-provider domain",value:t?.serviceProviderDomain??"Not allocated"}]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[n.jsx(E,{label:"Cloud endpoint",value:s,onChange:a}),n.jsx(E,{label:"Node ID",value:o,onChange:c}),n.jsx(E,{label:"Service-provider domain",value:i,onChange:d})]}),n.jsx(W,{onClick:()=>r({XPOD_CLOUD_API_ENDPOINT:s,XPOD_NODE_ID:o,XPOD_SP_DOMAIN:i})})]})}function Nt({env:e,save:t}){const[r,s]=u.useState(e.CSS_LOGGING_LEVEL??"info"),[a,o]=u.useState(e.CSS_SHOW_STACK_TRACE==="true");return u.useEffect(()=>{let c=!1;return queueMicrotask(()=>{c||(s(e.CSS_LOGGING_LEVEL??"info"),o(e.CSS_SHOW_STACK_TRACE==="true"))}),()=>{c=!0}},[e]),n.jsxs("div",{className:"space-y-4",children:[n.jsx(j,{rows:[{label:"Log retention",value:"30 days",detail:"Runtime logging profile"},{label:"Configuration provenance",value:".env.local allowlist"},{label:"Restart requirement",value:"Required after save"}]}),n.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:["Logging level",n.jsxs("select",{value:r,onChange:c=>s(c.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3 sm:max-w-xs",children:[n.jsx("option",{children:"debug"}),n.jsx("option",{children:"info"}),n.jsx("option",{children:"warn"}),n.jsx("option",{children:"error"})]})]}),n.jsxs("label",{className:"flex items-center justify-between gap-3 rounded-md border border-border p-3 text-sm font-medium",children:["Show stack traces",n.jsx("input",{type:"checkbox",checked:a,onChange:c=>o(c.target.checked)})]}),n.jsx(W,{onClick:()=>t({CSS_LOGGING_LEVEL:r,CSS_SHOW_STACK_TRACE:String(a)})})]})}function j({rows:e}){return n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:e.map(t=>n.jsxs("div",{className:"rounded-lg border border-border p-3",children:[n.jsx("div",{className:"text-xs text-muted-foreground",children:t.label}),n.jsx("div",{className:"mt-1 break-all text-sm font-medium",children:t.value}),t.detail?n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:t.detail}):null]},t.label))})}function E({label:e,value:t,onChange:r}){return n.jsxs("label",{className:"block space-y-2 text-sm font-medium",children:[e,n.jsx("input",{value:t,onChange:s=>r(s.target.value),className:"block h-10 w-full rounded-md border border-input bg-background px-3"})]})}function W({onClick:e}){return n.jsx("div",{className:"flex justify-end",children:n.jsx(A,{type:"button",onClick:e,children:"Save configuration"})})}function ie(e){if(!e)return"Not discovered";try{return new URL(e).pathname.split("/").filter(Boolean).at(-1)||new URL(e).hostname}catch{return e}}function jt(e){return e?e.status==="pass"?"Reachable":e.status==="fail"?"Not reachable":"Not verified":"Not checked"}const _t={pod:"Pod","identity-access":"Identity & Access",storage:"Storage",runtime:"Runtime",cloud:"Cloud",advanced:"Advanced"},Et={pod:"Current Pod identity and authority boundary.","identity-access":"Session, account, and app/service access.",storage:"Authority storage backends and health configuration.",runtime:"Edition, startup, paths, and restart behavior.",cloud:"Node registration and cluster coordination.",advanced:"Bounded logging and runtime compatibility controls."};export{Dt as PodSettingsSubjectPanel};