jishushell 0.6.5 → 0.6.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 (998) hide show
  1. package/apps/anythingllm-container.yaml +15 -170
  2. package/apps/browserless-chromium-container.yaml +15 -10
  3. package/apps/filebrowser-container.yaml +14 -9
  4. package/apps/hermes-container.yaml +23 -2
  5. package/apps/jishu-kb-container.yaml +29 -161
  6. package/apps/ollama-binary.yaml +32 -28
  7. package/apps/ollama-cpu-container.yaml +5 -0
  8. package/apps/ollama-with-hollama-binary.yaml +33 -28
  9. package/apps/openclaw-binary.yaml +34 -10
  10. package/apps/openclaw-container.yaml +31 -7
  11. package/apps/openclaw-with-ollama-container.yaml +8 -2
  12. package/apps/openclaw-with-searxng-container.yaml +18 -6
  13. package/apps/searxng-container.yaml +11 -6
  14. package/apps/weknora-container.yaml +21 -21
  15. package/dependencies/jishushell-panel-0.6.18.tgz +0 -0
  16. package/dist/cli/app.js +244 -213
  17. package/dist/cli/app.js.map +1 -1
  18. package/dist/cli/backup.js +15 -12
  19. package/dist/cli/backup.js.map +1 -1
  20. package/dist/cli/core.d.ts +4 -3
  21. package/dist/cli/core.js +392 -227
  22. package/dist/cli/core.js.map +1 -1
  23. package/dist/cli/doctor.d.ts +1 -1
  24. package/dist/cli/doctor.js +17 -10
  25. package/dist/cli/doctor.js.map +1 -1
  26. package/dist/cli/job.js +62 -14
  27. package/dist/cli/job.js.map +1 -1
  28. package/dist/cli/llm.js +80 -11
  29. package/dist/cli/llm.js.map +1 -1
  30. package/dist/cli/managed-list.d.ts +1 -3
  31. package/dist/cli/managed-list.js +18 -16
  32. package/dist/cli/managed-list.js.map +1 -1
  33. package/dist/cli/migrate.d.ts +2 -0
  34. package/dist/cli/migrate.js +160 -0
  35. package/dist/cli/migrate.js.map +1 -0
  36. package/dist/cli.js +1 -0
  37. package/dist/cli.js.map +1 -1
  38. package/dist/config.d.ts +23 -19
  39. package/dist/config.js +60 -49
  40. package/dist/config.js.map +1 -1
  41. package/dist/control.d.ts +6 -6
  42. package/dist/control.js +31 -23
  43. package/dist/control.js.map +1 -1
  44. package/dist/core.d.ts +5 -5
  45. package/dist/core.js +5 -5
  46. package/dist/core.js.map +1 -1
  47. package/dist/install.d.ts +2 -2
  48. package/dist/install.js +18 -18
  49. package/dist/install.js.map +1 -1
  50. package/dist/routes/apps.d.ts +1 -1
  51. package/dist/routes/apps.js +101 -193
  52. package/dist/routes/apps.js.map +1 -1
  53. package/dist/routes/auth.js +1 -1
  54. package/dist/routes/auth.js.map +1 -1
  55. package/dist/routes/backup.js +1 -1
  56. package/dist/routes/backup.js.map +1 -1
  57. package/dist/routes/external-mounts.d.ts +1 -1
  58. package/dist/routes/external-mounts.js +1 -1
  59. package/dist/routes/external-mounts.js.map +1 -1
  60. package/dist/routes/file-mounts.d.ts +4 -3
  61. package/dist/routes/file-mounts.js +51 -30
  62. package/dist/routes/file-mounts.js.map +1 -1
  63. package/dist/routes/files-organize.d.ts +2 -2
  64. package/dist/routes/files-organize.js +5 -5
  65. package/dist/routes/files-organize.js.map +1 -1
  66. package/dist/routes/files.d.ts +1 -1
  67. package/dist/routes/files.js +1 -1
  68. package/dist/routes/files.js.map +1 -1
  69. package/dist/routes/instances.d.ts +10 -4
  70. package/dist/routes/instances.js +323 -541
  71. package/dist/routes/instances.js.map +1 -1
  72. package/dist/routes/integration-apps.d.ts +14 -0
  73. package/dist/routes/integration-apps.js +81 -0
  74. package/dist/routes/integration-apps.js.map +1 -0
  75. package/dist/routes/integrations.d.ts +9 -0
  76. package/dist/routes/integrations.js +12 -0
  77. package/dist/routes/integrations.js.map +1 -0
  78. package/dist/routes/llm-proxy.js +26 -3
  79. package/dist/routes/llm-proxy.js.map +1 -1
  80. package/dist/routes/setup.js +53 -38
  81. package/dist/routes/setup.js.map +1 -1
  82. package/dist/routes/system.js +108 -68
  83. package/dist/routes/system.js.map +1 -1
  84. package/dist/routes/webdav.d.ts +1 -1
  85. package/dist/routes/webdav.js +2 -2
  86. package/dist/routes/webdav.js.map +1 -1
  87. package/dist/server.js +315 -213
  88. package/dist/server.js.map +1 -1
  89. package/dist/services/app-common/app-compiler.js +186 -0
  90. package/dist/services/app-common/app-compiler.js.map +1 -0
  91. package/dist/services/app-common/app-shared.d.ts +15 -0
  92. package/dist/services/app-common/app-shared.js +64 -0
  93. package/dist/services/app-common/app-shared.js.map +1 -0
  94. package/dist/services/app-common/capability-service.d.ts +45 -0
  95. package/dist/services/app-common/capability-service.js +331 -0
  96. package/dist/services/app-common/capability-service.js.map +1 -0
  97. package/dist/services/app-common/catalog-service.d.ts +59 -0
  98. package/dist/services/app-common/catalog-service.js +308 -0
  99. package/dist/services/app-common/catalog-service.js.map +1 -0
  100. package/dist/services/app-common/create-pipeline.d.ts +26 -0
  101. package/dist/services/app-common/create-pipeline.js +298 -0
  102. package/dist/services/app-common/create-pipeline.js.map +1 -0
  103. package/dist/services/app-common/delete-service.d.ts +5 -0
  104. package/dist/services/app-common/delete-service.js +104 -0
  105. package/dist/services/app-common/delete-service.js.map +1 -0
  106. package/dist/services/app-common/execution-owner.d.ts +23 -0
  107. package/dist/services/app-common/execution-owner.js +124 -0
  108. package/dist/services/app-common/execution-owner.js.map +1 -0
  109. package/dist/services/app-common/execution-service.d.ts +23 -0
  110. package/dist/services/app-common/execution-service.js +105 -0
  111. package/dist/services/app-common/execution-service.js.map +1 -0
  112. package/dist/services/app-common/id-normalizer.d.ts +31 -0
  113. package/dist/services/app-common/id-normalizer.js +83 -0
  114. package/dist/services/app-common/id-normalizer.js.map +1 -0
  115. package/dist/services/app-common/install-store.d.ts +34 -0
  116. package/dist/services/app-common/install-store.js +261 -0
  117. package/dist/services/app-common/install-store.js.map +1 -0
  118. package/dist/services/app-common/instance-store.d.ts +78 -0
  119. package/dist/services/app-common/instance-store.js +495 -0
  120. package/dist/services/app-common/instance-store.js.map +1 -0
  121. package/dist/services/app-common/integration-refs.d.ts +17 -0
  122. package/dist/services/app-common/integration-refs.js +47 -0
  123. package/dist/services/app-common/integration-refs.js.map +1 -0
  124. package/dist/services/app-common/lifecycle-pipeline.d.ts +62 -0
  125. package/dist/services/app-common/lifecycle-pipeline.js +317 -0
  126. package/dist/services/app-common/lifecycle-pipeline.js.map +1 -0
  127. package/dist/services/app-common/lifecycle-scripts.d.ts +38 -0
  128. package/dist/services/app-common/lifecycle-scripts.js +935 -0
  129. package/dist/services/app-common/lifecycle-scripts.js.map +1 -0
  130. package/dist/services/app-common/lifecycle-service.d.ts +68 -0
  131. package/dist/services/app-common/lifecycle-service.js +467 -0
  132. package/dist/services/app-common/lifecycle-service.js.map +1 -0
  133. package/dist/services/app-common/paths.d.ts +29 -0
  134. package/dist/services/app-common/paths.js +34 -0
  135. package/dist/services/app-common/paths.js.map +1 -0
  136. package/dist/services/app-common/platform-transform.d.ts +32 -0
  137. package/dist/services/app-common/platform-transform.js +65 -0
  138. package/dist/services/app-common/platform-transform.js.map +1 -0
  139. package/dist/services/app-common/provide-resolver.d.ts +29 -0
  140. package/dist/services/app-common/provide-resolver.js +129 -0
  141. package/dist/services/app-common/provide-resolver.js.map +1 -0
  142. package/dist/services/app-common/remote-spec.d.ts +14 -0
  143. package/dist/services/app-common/remote-spec.js +58 -0
  144. package/dist/services/app-common/remote-spec.js.map +1 -0
  145. package/dist/services/app-common/runtime-builder.d.ts +1 -0
  146. package/dist/services/app-common/runtime-builder.js +2 -0
  147. package/dist/services/app-common/runtime-builder.js.map +1 -0
  148. package/dist/services/app-common/runtime-facts.d.ts +19 -0
  149. package/dist/services/app-common/runtime-facts.js +126 -0
  150. package/dist/services/app-common/runtime-facts.js.map +1 -0
  151. package/dist/services/app-common/service.d.ts +9 -0
  152. package/dist/services/app-common/service.js +10 -0
  153. package/dist/services/app-common/service.js.map +1 -0
  154. package/dist/services/app-common/spec-materializer.d.ts +9 -0
  155. package/dist/services/app-common/spec-materializer.js +361 -0
  156. package/dist/services/app-common/spec-materializer.js.map +1 -0
  157. package/dist/services/app-common/status-refresh.d.ts +33 -0
  158. package/dist/services/app-common/status-refresh.js +759 -0
  159. package/dist/services/app-common/status-refresh.js.map +1 -0
  160. package/dist/services/app-common/task-service.d.ts +29 -0
  161. package/dist/services/app-common/task-service.js +93 -0
  162. package/dist/services/app-common/task-service.js.map +1 -0
  163. package/dist/services/app-common/terminal-session-manager.js +157 -0
  164. package/dist/services/app-common/terminal-session-manager.js.map +1 -0
  165. package/dist/services/app-modules/browserless/routes.d.ts +9 -0
  166. package/dist/services/app-modules/browserless/routes.js +517 -0
  167. package/dist/services/app-modules/browserless/routes.js.map +1 -0
  168. package/dist/services/app-modules/routes.d.ts +2 -0
  169. package/dist/services/app-modules/routes.js +5 -0
  170. package/dist/services/app-modules/routes.js.map +1 -0
  171. package/dist/services/backup/backup-admin.d.ts +95 -0
  172. package/dist/services/backup/backup-admin.js +246 -0
  173. package/dist/services/backup/backup-admin.js.map +1 -0
  174. package/dist/services/backup/backup-manager.d.ts +264 -0
  175. package/dist/services/backup/backup-manager.js +2318 -0
  176. package/dist/services/backup/backup-manager.js.map +1 -0
  177. package/dist/services/backup/backup-verify.js +240 -0
  178. package/dist/services/backup/backup-verify.js.map +1 -0
  179. package/dist/services/capabilities/browser-policy.d.ts +14 -0
  180. package/dist/services/capabilities/browser-policy.js +141 -0
  181. package/dist/services/capabilities/browser-policy.js.map +1 -0
  182. package/dist/services/capabilities/contract.d.ts +50 -0
  183. package/dist/services/capabilities/contract.js +129 -0
  184. package/dist/services/capabilities/contract.js.map +1 -0
  185. package/dist/services/capabilities/endpoint-validator.d.ts +42 -0
  186. package/dist/services/capabilities/endpoint-validator.js +114 -0
  187. package/dist/services/capabilities/endpoint-validator.js.map +1 -0
  188. package/dist/services/capabilities/health.d.ts +16 -0
  189. package/dist/services/capabilities/health.js +121 -0
  190. package/dist/services/capabilities/health.js.map +1 -0
  191. package/dist/services/capabilities/registry.d.ts +56 -0
  192. package/dist/services/capabilities/registry.js +222 -0
  193. package/dist/services/capabilities/registry.js.map +1 -0
  194. package/dist/services/capabilities/sync.d.ts +7 -0
  195. package/dist/services/capabilities/sync.js +223 -0
  196. package/dist/services/capabilities/sync.js.map +1 -0
  197. package/dist/services/capability-proxy/html-rewriters/browserless.d.ts +1 -0
  198. package/dist/services/capability-proxy/html-rewriters/browserless.js +83 -0
  199. package/dist/services/capability-proxy/html-rewriters/browserless.js.map +1 -0
  200. package/dist/services/capability-proxy/html-rewriters/index.d.ts +12 -0
  201. package/dist/services/capability-proxy/html-rewriters/index.js +25 -0
  202. package/dist/services/capability-proxy/html-rewriters/index.js.map +1 -0
  203. package/dist/services/capability-proxy/html-rewriters/jishukb.d.ts +1 -0
  204. package/dist/services/capability-proxy/html-rewriters/jishukb.js +161 -0
  205. package/dist/services/capability-proxy/html-rewriters/jishukb.js.map +1 -0
  206. package/dist/services/connections/admin.d.ts +80 -0
  207. package/dist/services/connections/admin.js +327 -0
  208. package/dist/services/connections/admin.js.map +1 -0
  209. package/dist/services/connections/apply.d.ts +110 -0
  210. package/dist/services/connections/apply.js +444 -0
  211. package/dist/services/connections/apply.js.map +1 -0
  212. package/dist/services/connections/resolver.d.ts +82 -0
  213. package/dist/services/connections/resolver.js +289 -0
  214. package/dist/services/connections/resolver.js.map +1 -0
  215. package/dist/services/connections/suggestions.d.ts +27 -0
  216. package/dist/services/connections/suggestions.js +124 -0
  217. package/dist/services/connections/suggestions.js.map +1 -0
  218. package/dist/services/connections/transactor.d.ts +39 -0
  219. package/dist/services/connections/transactor.js +307 -0
  220. package/dist/services/connections/transactor.js.map +1 -0
  221. package/dist/services/files/external-mounts.js +187 -0
  222. package/dist/services/files/external-mounts.js.map +1 -0
  223. package/dist/services/files/files-manager.d.ts +265 -0
  224. package/dist/services/files/files-manager.js +1189 -0
  225. package/dist/services/files/files-manager.js.map +1 -0
  226. package/dist/services/files/files-mounts.d.ts +42 -0
  227. package/dist/services/files/files-mounts.js +207 -0
  228. package/dist/services/files/files-mounts.js.map +1 -0
  229. package/dist/services/files/organize/applier.js +218 -0
  230. package/dist/services/files/organize/applier.js.map +1 -0
  231. package/dist/services/files/organize/rules.js +286 -0
  232. package/dist/services/files/organize/rules.js.map +1 -0
  233. package/dist/services/files/organize/scanner.js +366 -0
  234. package/dist/services/files/organize/scanner.js.map +1 -0
  235. package/dist/services/files/organize/store.js +82 -0
  236. package/dist/services/files/organize/store.js.map +1 -0
  237. package/dist/services/files/webdav/server.d.ts +47 -0
  238. package/dist/services/files/webdav/server.js +329 -0
  239. package/dist/services/files/webdav/server.js.map +1 -0
  240. package/dist/services/files/webdav/xml-builder.js.map +1 -0
  241. package/dist/services/instances/admin.d.ts +23 -0
  242. package/dist/services/instances/admin.js +218 -0
  243. package/dist/services/instances/admin.js.map +1 -0
  244. package/dist/services/instances/clone.d.ts +26 -0
  245. package/dist/services/instances/clone.js +78 -0
  246. package/dist/services/instances/clone.js.map +1 -0
  247. package/dist/services/instances/config-admin.d.ts +17 -0
  248. package/dist/services/instances/config-admin.js +181 -0
  249. package/dist/services/instances/config-admin.js.map +1 -0
  250. package/dist/services/instances/manager.d.ts +231 -0
  251. package/dist/services/instances/manager.js +1348 -0
  252. package/dist/services/instances/manager.js.map +1 -0
  253. package/dist/services/instances/passwords.js +173 -0
  254. package/dist/services/instances/passwords.js.map +1 -0
  255. package/dist/services/instances/types.d.ts +21 -0
  256. package/dist/services/instances/types.js +2 -0
  257. package/dist/services/instances/types.js.map +1 -0
  258. package/dist/services/integrations/anythingllm/integration.d.ts +25 -0
  259. package/dist/services/integrations/anythingllm/integration.js +251 -0
  260. package/dist/services/integrations/anythingllm/integration.js.map +1 -0
  261. package/dist/services/integrations/catalog.d.ts +3 -0
  262. package/dist/services/integrations/catalog.js +73 -0
  263. package/dist/services/integrations/catalog.js.map +1 -0
  264. package/dist/services/integrations/custom/integration.d.ts +28 -0
  265. package/dist/services/integrations/custom/integration.js +179 -0
  266. package/dist/services/integrations/custom/integration.js.map +1 -0
  267. package/dist/services/integrations/hermes/integration.d.ts +194 -0
  268. package/dist/services/integrations/hermes/integration.js +1669 -0
  269. package/dist/services/integrations/hermes/integration.js.map +1 -0
  270. package/dist/services/integrations/index.d.ts +40 -0
  271. package/dist/services/integrations/index.js +59 -0
  272. package/dist/services/integrations/index.js.map +1 -0
  273. package/dist/services/integrations/installable/catalog.d.ts +33 -0
  274. package/dist/services/integrations/installable/catalog.js +88 -0
  275. package/dist/services/integrations/installable/catalog.js.map +1 -0
  276. package/dist/services/integrations/installable/index.d.ts +35 -0
  277. package/dist/services/integrations/installable/index.js +170 -0
  278. package/dist/services/integrations/installable/index.js.map +1 -0
  279. package/dist/services/integrations/installable/installers/integration-probes.d.ts +50 -0
  280. package/dist/services/integrations/installable/installers/integration-probes.js +231 -0
  281. package/dist/services/integrations/installable/installers/integration-probes.js.map +1 -0
  282. package/dist/services/integrations/installable/installers/integration.d.ts +30 -0
  283. package/dist/services/integrations/installable/installers/integration.js +177 -0
  284. package/dist/services/integrations/installable/installers/integration.js.map +1 -0
  285. package/dist/services/integrations/installable/installers/registry-probe.js.map +1 -0
  286. package/dist/services/integrations/installable/installers/shell-script.d.ts +46 -0
  287. package/dist/services/integrations/installable/installers/shell-script.js +487 -0
  288. package/dist/services/integrations/installable/installers/shell-script.js.map +1 -0
  289. package/dist/services/integrations/installable/types.d.ts +130 -0
  290. package/dist/services/integrations/installable/types.js +19 -0
  291. package/dist/services/integrations/installable/types.js.map +1 -0
  292. package/dist/services/integrations/jishukb/integration.d.ts +22 -0
  293. package/dist/services/integrations/jishukb/integration.js +189 -0
  294. package/dist/services/integrations/jishukb/integration.js.map +1 -0
  295. package/dist/services/integrations/openclaw/anythingllm-shim.d.ts +46 -0
  296. package/dist/services/integrations/openclaw/anythingllm-shim.js +281 -0
  297. package/dist/services/integrations/openclaw/anythingllm-shim.js.map +1 -0
  298. package/dist/services/integrations/openclaw/drive-shim.js +490 -0
  299. package/dist/services/integrations/openclaw/drive-shim.js.map +1 -0
  300. package/dist/services/integrations/openclaw/integration.d.ts +424 -0
  301. package/dist/services/integrations/openclaw/integration.js +4402 -0
  302. package/dist/services/integrations/openclaw/integration.js.map +1 -0
  303. package/dist/services/integrations/openclaw/jishukb-shim.d.ts +48 -0
  304. package/dist/services/integrations/openclaw/jishukb-shim.js +750 -0
  305. package/dist/services/integrations/openclaw/jishukb-shim.js.map +1 -0
  306. package/dist/services/integrations/openclaw/mcporter-lite.js +276 -0
  307. package/dist/services/integrations/openclaw/mcporter-lite.js.map +1 -0
  308. package/dist/services/integrations/openclaw/mcporter.d.ts +46 -0
  309. package/dist/services/integrations/openclaw/mcporter.js +112 -0
  310. package/dist/services/integrations/openclaw/mcporter.js.map +1 -0
  311. package/dist/services/integrations/openclaw/routes.d.ts +21 -0
  312. package/dist/services/integrations/openclaw/routes.js +1191 -0
  313. package/dist/services/integrations/openclaw/routes.js.map +1 -0
  314. package/dist/services/integrations/registry.d.ts +17 -0
  315. package/dist/services/integrations/registry.js +36 -0
  316. package/dist/services/integrations/registry.js.map +1 -0
  317. package/dist/services/integrations/routes.d.ts +2 -0
  318. package/dist/services/integrations/routes.js +9 -0
  319. package/dist/services/integrations/routes.js.map +1 -0
  320. package/dist/services/integrations/types.d.ts +469 -0
  321. package/dist/services/integrations/types.js +2 -0
  322. package/dist/services/integrations/types.js.map +1 -0
  323. package/dist/services/legacy-migrator/classifier.d.ts +44 -0
  324. package/dist/services/legacy-migrator/classifier.js +309 -0
  325. package/dist/services/legacy-migrator/classifier.js.map +1 -0
  326. package/dist/services/legacy-migrator/executor.d.ts +42 -0
  327. package/dist/services/legacy-migrator/executor.js +637 -0
  328. package/dist/services/legacy-migrator/executor.js.map +1 -0
  329. package/dist/services/legacy-migrator/index.d.ts +31 -0
  330. package/dist/services/legacy-migrator/index.js +34 -0
  331. package/dist/services/legacy-migrator/index.js.map +1 -0
  332. package/dist/services/legacy-migrator/planner.d.ts +8 -0
  333. package/dist/services/legacy-migrator/planner.js +154 -0
  334. package/dist/services/legacy-migrator/planner.js.map +1 -0
  335. package/dist/services/legacy-migrator/provider-settings.d.ts +6 -0
  336. package/dist/services/legacy-migrator/provider-settings.js +72 -0
  337. package/dist/services/legacy-migrator/provider-settings.js.map +1 -0
  338. package/dist/services/legacy-migrator/report.d.ts +9 -0
  339. package/dist/services/legacy-migrator/report.js +99 -0
  340. package/dist/services/legacy-migrator/report.js.map +1 -0
  341. package/dist/services/legacy-migrator/scanner.d.ts +13 -0
  342. package/dist/services/legacy-migrator/scanner.js +157 -0
  343. package/dist/services/legacy-migrator/scanner.js.map +1 -0
  344. package/dist/services/legacy-migrator/types.d.ts +97 -0
  345. package/dist/services/legacy-migrator/types.js +23 -0
  346. package/dist/services/legacy-migrator/types.js.map +1 -0
  347. package/dist/services/llm-proxy/instance-proxy.d.ts +17 -1
  348. package/dist/services/llm-proxy/instance-proxy.js +171 -44
  349. package/dist/services/llm-proxy/instance-proxy.js.map +1 -1
  350. package/dist/services/llm-proxy/probe.js +5 -14
  351. package/dist/services/llm-proxy/probe.js.map +1 -1
  352. package/dist/services/llm-proxy/providers.js +23 -31
  353. package/dist/services/llm-proxy/providers.js.map +1 -1
  354. package/dist/services/llm-proxy/ssrf.d.ts +11 -4
  355. package/dist/services/llm-proxy/ssrf.js +45 -7
  356. package/dist/services/llm-proxy/ssrf.js.map +1 -1
  357. package/dist/services/llm-proxy/validate-key.js +16 -37
  358. package/dist/services/llm-proxy/validate-key.js.map +1 -1
  359. package/dist/services/repair/runtime-repair.d.ts +22 -0
  360. package/dist/services/repair/runtime-repair.js +307 -0
  361. package/dist/services/repair/runtime-repair.js.map +1 -0
  362. package/dist/services/runtime/driver-registry.d.ts +21 -0
  363. package/dist/services/runtime/driver-registry.js +22 -0
  364. package/dist/services/runtime/driver-registry.js.map +1 -0
  365. package/dist/services/runtime/drivers/nomad.d.ts +260 -0
  366. package/dist/services/runtime/drivers/nomad.js +3092 -0
  367. package/dist/services/runtime/drivers/nomad.js.map +1 -0
  368. package/dist/services/runtime/errors.d.ts +3 -3
  369. package/dist/services/runtime/errors.js +3 -3
  370. package/dist/services/runtime/instance.d.ts +14 -16
  371. package/dist/services/runtime/instance.js +93 -123
  372. package/dist/services/runtime/instance.js.map +1 -1
  373. package/dist/services/runtime/job-id.d.ts +1 -1
  374. package/dist/services/runtime/job-id.js +1 -1
  375. package/dist/services/runtime/mcp-shims/firewall.d.ts +2 -2
  376. package/dist/services/runtime/mcp-shims/firewall.js +2 -2
  377. package/dist/services/runtime/mcp-shims/searxng-shim.d.ts +3 -5
  378. package/dist/services/runtime/mcp-shims/searxng-shim.js +3 -5
  379. package/dist/services/runtime/mcp-shims/searxng-shim.js.map +1 -1
  380. package/dist/services/runtime/mcp-shims/write-mcp-entry.d.ts +20 -20
  381. package/dist/services/runtime/mcp-shims/write-mcp-entry.js +16 -16
  382. package/dist/services/runtime/mcp-shims/write-mcp-entry.js.map +1 -1
  383. package/dist/services/runtime/ownership-marker.d.ts +83 -0
  384. package/dist/services/runtime/ownership-marker.js +109 -0
  385. package/dist/services/runtime/ownership-marker.js.map +1 -0
  386. package/dist/services/runtime/types.d.ts +22 -501
  387. package/dist/services/runtime/types.js +0 -12
  388. package/dist/services/runtime/types.js.map +1 -1
  389. package/dist/services/runtime/workload-compiler.d.ts +17 -0
  390. package/dist/services/runtime/workload-compiler.js +525 -0
  391. package/dist/services/runtime/workload-compiler.js.map +1 -0
  392. package/dist/services/runtime/workload-types.d.ts +11 -0
  393. package/dist/services/runtime/workload-types.js +2 -0
  394. package/dist/services/runtime/workload-types.js.map +1 -0
  395. package/dist/services/setup/core-manager.d.ts +50 -0
  396. package/dist/services/setup/core-manager.js +456 -0
  397. package/dist/services/setup/core-manager.js.map +1 -0
  398. package/dist/services/setup/plugin-installer.js +136 -0
  399. package/dist/services/setup/plugin-installer.js.map +1 -0
  400. package/dist/services/setup/setup-manager.d.ts +158 -0
  401. package/dist/services/setup/setup-manager.js +2768 -0
  402. package/dist/services/setup/setup-manager.js.map +1 -0
  403. package/dist/services/system/cli-command.d.ts +5 -0
  404. package/dist/services/system/cli-command.js +18 -0
  405. package/dist/services/system/cli-command.js.map +1 -0
  406. package/dist/services/system/macos-launchd.js +312 -0
  407. package/dist/services/system/macos-launchd.js.map +1 -0
  408. package/dist/services/system/repair-orchestrator.d.ts +71 -0
  409. package/dist/services/system/repair-orchestrator.js +412 -0
  410. package/dist/services/system/repair-orchestrator.js.map +1 -0
  411. package/dist/services/system/system-monitor.js +96 -0
  412. package/dist/services/system/system-monitor.js.map +1 -0
  413. package/dist/services/system/system-ollama-provider.d.ts +14 -0
  414. package/dist/services/system/system-ollama-provider.js +129 -0
  415. package/dist/services/system/system-ollama-provider.js.map +1 -0
  416. package/dist/services/system/system-reconciler.d.ts +59 -0
  417. package/dist/services/system/system-reconciler.js +710 -0
  418. package/dist/services/system/system-reconciler.js.map +1 -0
  419. package/dist/services/system/update-manager.d.ts +43 -0
  420. package/dist/services/system/update-manager.js +315 -0
  421. package/dist/services/system/update-manager.js.map +1 -0
  422. package/dist/services/system/upgrade-finalize.d.ts +80 -0
  423. package/dist/services/system/upgrade-finalize.js +507 -0
  424. package/dist/services/system/upgrade-finalize.js.map +1 -0
  425. package/dist/services/tasks/registry.d.ts +44 -0
  426. package/dist/services/tasks/registry.js +90 -0
  427. package/dist/services/tasks/registry.js.map +1 -0
  428. package/dist/services/telemetry/activation.d.ts +6 -2
  429. package/dist/services/telemetry/activation.js +6 -2
  430. package/dist/services/telemetry/activation.js.map +1 -1
  431. package/dist/services/telemetry/heartbeat.d.ts +6 -2
  432. package/dist/services/telemetry/heartbeat.js +6 -2
  433. package/dist/services/telemetry/heartbeat.js.map +1 -1
  434. package/dist/services/workspaces/builder.d.ts +29 -0
  435. package/dist/services/workspaces/builder.js +186 -0
  436. package/dist/services/workspaces/builder.js.map +1 -0
  437. package/dist/types.d.ts +331 -45
  438. package/dist/utils/instance-lock.d.ts +2 -2
  439. package/dist/utils/instance-lock.js +2 -2
  440. package/install/jishu-install.sh +107 -26
  441. package/install/jishu-uninstall.sh +8 -0
  442. package/install/post-install.sh +162 -185
  443. package/install/post-uninstall.sh +6 -0
  444. package/node_modules/@fastify/static/.github/workflows/ci.yml +1 -1
  445. package/node_modules/@fastify/static/.github/workflows/lock-threads.yml +19 -0
  446. package/node_modules/@fastify/static/LICENSE +1 -3
  447. package/node_modules/@fastify/static/example/server-benchmark.js +39 -0
  448. package/node_modules/@fastify/static/index.js +169 -23
  449. package/node_modules/@fastify/static/lib/dirList.js +20 -6
  450. package/node_modules/@fastify/static/package.json +10 -8
  451. package/node_modules/@fastify/static/test/dir-list.test.js +82 -0
  452. package/node_modules/@fastify/static/test/static.test.js +326 -4
  453. package/node_modules/@fastify/static/types/index.d.ts +0 -4
  454. package/node_modules/@fastify/static/types/index.test-d.ts +1 -1
  455. package/node_modules/content-disposition/README.md +21 -22
  456. package/node_modules/content-disposition/index.js +122 -44
  457. package/node_modules/content-disposition/package.json +16 -20
  458. package/node_modules/glob/README.md +39 -130
  459. package/node_modules/glob/dist/commonjs/glob.d.ts +8 -0
  460. package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -1
  461. package/node_modules/glob/dist/commonjs/glob.js +2 -1
  462. package/node_modules/glob/dist/commonjs/glob.js.map +1 -1
  463. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  464. package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
  465. package/node_modules/glob/dist/commonjs/pattern.d.ts +3 -0
  466. package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -1
  467. package/node_modules/glob/dist/commonjs/pattern.js +4 -0
  468. package/node_modules/glob/dist/commonjs/pattern.js.map +1 -1
  469. package/node_modules/glob/dist/esm/glob.d.ts +8 -0
  470. package/node_modules/glob/dist/esm/glob.d.ts.map +1 -1
  471. package/node_modules/glob/dist/esm/glob.js +2 -1
  472. package/node_modules/glob/dist/esm/glob.js.map +1 -1
  473. package/node_modules/glob/dist/esm/index.min.js +4 -0
  474. package/node_modules/glob/dist/esm/index.min.js.map +7 -0
  475. package/node_modules/glob/dist/esm/pattern.d.ts +3 -0
  476. package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -1
  477. package/node_modules/glob/dist/esm/pattern.js +4 -0
  478. package/node_modules/glob/dist/esm/pattern.js.map +1 -1
  479. package/node_modules/glob/package.json +38 -37
  480. package/node_modules/jishushell-panel/README.md +4 -4
  481. package/node_modules/jishushell-panel/output/dist/server.js +17 -6
  482. package/node_modules/jishushell-panel/output/dist/server.js.map +1 -1
  483. package/node_modules/jishushell-panel/output/public/assets/ApiKeyField-NKcbHjNz.js +1 -0
  484. package/node_modules/jishushell-panel/output/public/assets/Dashboard-Da1fL38t.js +1 -0
  485. package/node_modules/jishushell-panel/output/public/assets/HermesChatPanel-DZvmYsoh.js +1 -0
  486. package/node_modules/jishushell-panel/output/public/assets/HermesConfigForm-BLUWlKwm.js +4 -0
  487. package/node_modules/jishushell-panel/output/public/assets/InitPassword-BAKsshzk.js +1 -0
  488. package/node_modules/jishushell-panel/output/public/assets/InstanceDetail-Dgyc_TX5.js +14 -0
  489. package/node_modules/jishushell-panel/output/public/assets/Login-DHeOmwI8.js +1 -0
  490. package/node_modules/jishushell-panel/output/public/assets/NewInstance-CIy0cYtp.js +1 -0
  491. package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-H0ByEYF0.js +1 -0
  492. package/node_modules/jishushell-panel/output/public/assets/Settings-DAT-UMfP.js +1 -0
  493. package/node_modules/jishushell-panel/output/public/assets/Setup-g3uckFYR.js +1 -0
  494. package/node_modules/jishushell-panel/output/public/assets/WeixinLoginPanel-D-T6BxkQ.js +1 -0
  495. package/node_modules/jishushell-panel/output/public/assets/api-C70Gt678.js +4 -0
  496. package/node_modules/jishushell-panel/output/public/assets/index-DnnqTf7s.css +1 -0
  497. package/node_modules/jishushell-panel/output/public/assets/index-ERt6_ngA.js +23 -0
  498. package/node_modules/jishushell-panel/output/public/assets/registry-DF93EzIb.js +2 -0
  499. package/node_modules/jishushell-panel/output/public/assets/rolldown-runtime-QTnfLwEv.js +1 -0
  500. package/node_modules/jishushell-panel/output/public/assets/setup-task-q21GnI0E.js +1 -0
  501. package/node_modules/jishushell-panel/output/public/assets/usePolling-DeoThIQn.js +1 -0
  502. package/node_modules/jishushell-panel/output/public/assets/vendor-i18n-CS8DFbkQ.js +1 -0
  503. package/node_modules/jishushell-panel/output/public/assets/vendor-react-Cc84NArf.js +8 -0
  504. package/node_modules/jishushell-panel/output/public/index.html +6 -4
  505. package/node_modules/jishushell-panel/package.json +2 -2
  506. package/node_modules/semver/classes/range.js +11 -2
  507. package/node_modules/semver/package.json +2 -2
  508. package/package.json +12 -64
  509. package/scripts/check-app-path-boundaries.mjs +121 -0
  510. package/scripts/check-app-spec.mjs +127 -25
  511. package/scripts/check-colima-launchd.mjs +10 -8
  512. package/scripts/check-integration-isolation.ts +541 -0
  513. package/scripts/check-new-file-tests.mjs +11 -3
  514. package/scripts/check-open-core-boundaries.mjs +60 -10
  515. package/scripts/check-test-layering.sh +1 -1
  516. package/scripts/fixtures/instances/hermes-sample/instance.json +3 -2
  517. package/scripts/fixtures/instances/legacy-openclaw-sample/instance.json +1 -1
  518. package/scripts/local-web-upgrade-test.README +4 -3
  519. package/scripts/local-web-upgrade-test.example.env +2 -2
  520. package/scripts/local-web-upgrade-test.sh +14 -1
  521. package/scripts/pack-gui-and-send-pi.sh +41 -0
  522. package/scripts/perf/instances.js +1 -1
  523. package/scripts/prune-open-core-dist.mjs +89 -2
  524. package/scripts/smoke/hermes-bootstrap.sh +5 -5
  525. package/templates/hermes-entrypoint.sh +19 -29
  526. package/apps/openwebui-container.yaml +0 -97
  527. package/apps/playwright-container.yaml +0 -126
  528. package/dependencies/jishushell-panel-0.6.5.tgz +0 -0
  529. package/dist/crypto-shim.d.ts +0 -1
  530. package/dist/crypto-shim.js +0 -2
  531. package/dist/crypto-shim.js.map +0 -1
  532. package/dist/routes/agent-apps.d.ts +0 -14
  533. package/dist/routes/agent-apps.js +0 -77
  534. package/dist/routes/agent-apps.js.map +0 -1
  535. package/dist/routes/internal.d.ts +0 -2
  536. package/dist/routes/internal.js +0 -55
  537. package/dist/routes/internal.js.map +0 -1
  538. package/dist/routes/openclaw-routes.d.ts +0 -22
  539. package/dist/routes/openclaw-routes.js +0 -1020
  540. package/dist/routes/openclaw-routes.js.map +0 -1
  541. package/dist/routes/runtime.d.ts +0 -15
  542. package/dist/routes/runtime.js +0 -76
  543. package/dist/routes/runtime.js.map +0 -1
  544. package/dist/services/agent-apps/catalog.d.ts +0 -33
  545. package/dist/services/agent-apps/catalog.js +0 -88
  546. package/dist/services/agent-apps/catalog.js.map +0 -1
  547. package/dist/services/agent-apps/index.d.ts +0 -36
  548. package/dist/services/agent-apps/index.js +0 -171
  549. package/dist/services/agent-apps/index.js.map +0 -1
  550. package/dist/services/agent-apps/installers/adapter-probes.d.ts +0 -49
  551. package/dist/services/agent-apps/installers/adapter-probes.js +0 -230
  552. package/dist/services/agent-apps/installers/adapter-probes.js.map +0 -1
  553. package/dist/services/agent-apps/installers/adapter.d.ts +0 -30
  554. package/dist/services/agent-apps/installers/adapter.js +0 -171
  555. package/dist/services/agent-apps/installers/adapter.js.map +0 -1
  556. package/dist/services/agent-apps/installers/registry-probe.js.map +0 -1
  557. package/dist/services/agent-apps/installers/shell-script.d.ts +0 -47
  558. package/dist/services/agent-apps/installers/shell-script.js +0 -488
  559. package/dist/services/agent-apps/installers/shell-script.js.map +0 -1
  560. package/dist/services/agent-apps/types.d.ts +0 -128
  561. package/dist/services/agent-apps/types.js +0 -17
  562. package/dist/services/agent-apps/types.js.map +0 -1
  563. package/dist/services/app/app-compiler.js +0 -185
  564. package/dist/services/app/app-compiler.js.map +0 -1
  565. package/dist/services/app/app-manager.d.ts +0 -184
  566. package/dist/services/app/app-manager.js +0 -2933
  567. package/dist/services/app/app-manager.js.map +0 -1
  568. package/dist/services/app/custom-manager.d.ts +0 -27
  569. package/dist/services/app/custom-manager.js +0 -382
  570. package/dist/services/app/custom-manager.js.map +0 -1
  571. package/dist/services/app/hermes-agent-manager.d.ts +0 -20
  572. package/dist/services/app/hermes-agent-manager.js +0 -299
  573. package/dist/services/app/hermes-agent-manager.js.map +0 -1
  574. package/dist/services/app/id-normalizer.d.ts +0 -27
  575. package/dist/services/app/id-normalizer.js +0 -77
  576. package/dist/services/app/id-normalizer.js.map +0 -1
  577. package/dist/services/app/ollama-manager.d.ts +0 -18
  578. package/dist/services/app/ollama-manager.js +0 -224
  579. package/dist/services/app/ollama-manager.js.map +0 -1
  580. package/dist/services/app/openclaw-manager.d.ts +0 -63
  581. package/dist/services/app/openclaw-manager.js +0 -1215
  582. package/dist/services/app/openclaw-manager.js.map +0 -1
  583. package/dist/services/app/paths.d.ts +0 -27
  584. package/dist/services/app/paths.js +0 -40
  585. package/dist/services/app/paths.js.map +0 -1
  586. package/dist/services/app/platform-transform.d.ts +0 -32
  587. package/dist/services/app/platform-transform.js +0 -65
  588. package/dist/services/app/platform-transform.js.map +0 -1
  589. package/dist/services/app/provide-resolver.d.ts +0 -29
  590. package/dist/services/app/provide-resolver.js +0 -135
  591. package/dist/services/app/provide-resolver.js.map +0 -1
  592. package/dist/services/app/registry.d.ts +0 -17
  593. package/dist/services/app/registry.js +0 -31
  594. package/dist/services/app/registry.js.map +0 -1
  595. package/dist/services/app/remote-spec.d.ts +0 -14
  596. package/dist/services/app/remote-spec.js +0 -58
  597. package/dist/services/app/remote-spec.js.map +0 -1
  598. package/dist/services/app/terminal-session-manager.js +0 -157
  599. package/dist/services/app/terminal-session-manager.js.map +0 -1
  600. package/dist/services/app/types.d.ts +0 -74
  601. package/dist/services/app/types.js +0 -16
  602. package/dist/services/app/types.js.map +0 -1
  603. package/dist/services/app-config-admin.d.ts +0 -17
  604. package/dist/services/app-config-admin.js +0 -177
  605. package/dist/services/app-config-admin.js.map +0 -1
  606. package/dist/services/app-create-from-installed.d.ts +0 -23
  607. package/dist/services/app-create-from-installed.js +0 -75
  608. package/dist/services/app-create-from-installed.js.map +0 -1
  609. package/dist/services/app-passwords.js +0 -173
  610. package/dist/services/app-passwords.js.map +0 -1
  611. package/dist/services/backup-admin.d.ts +0 -101
  612. package/dist/services/backup-admin.js +0 -259
  613. package/dist/services/backup-admin.js.map +0 -1
  614. package/dist/services/backup-manager.d.ts +0 -264
  615. package/dist/services/backup-manager.js +0 -2263
  616. package/dist/services/backup-manager.js.map +0 -1
  617. package/dist/services/backup-verify.js +0 -240
  618. package/dist/services/backup-verify.js.map +0 -1
  619. package/dist/services/capability-endpoint-validator.d.ts +0 -41
  620. package/dist/services/capability-endpoint-validator.js +0 -114
  621. package/dist/services/capability-endpoint-validator.js.map +0 -1
  622. package/dist/services/capability-health.d.ts +0 -16
  623. package/dist/services/capability-health.js +0 -121
  624. package/dist/services/capability-health.js.map +0 -1
  625. package/dist/services/capability-registry.d.ts +0 -29
  626. package/dist/services/capability-registry.js +0 -176
  627. package/dist/services/capability-registry.js.map +0 -1
  628. package/dist/services/capability-sync.d.ts +0 -4
  629. package/dist/services/capability-sync.js +0 -220
  630. package/dist/services/capability-sync.js.map +0 -1
  631. package/dist/services/connection-admin.d.ts +0 -74
  632. package/dist/services/connection-admin.js +0 -287
  633. package/dist/services/connection-admin.js.map +0 -1
  634. package/dist/services/connection-apply.d.ts +0 -91
  635. package/dist/services/connection-apply.js +0 -471
  636. package/dist/services/connection-apply.js.map +0 -1
  637. package/dist/services/connection-resolver.d.ts +0 -65
  638. package/dist/services/connection-resolver.js +0 -281
  639. package/dist/services/connection-resolver.js.map +0 -1
  640. package/dist/services/connection-transactor.d.ts +0 -39
  641. package/dist/services/connection-transactor.js +0 -354
  642. package/dist/services/connection-transactor.js.map +0 -1
  643. package/dist/services/core-manager.d.ts +0 -50
  644. package/dist/services/core-manager.js +0 -411
  645. package/dist/services/core-manager.js.map +0 -1
  646. package/dist/services/external-mounts.js +0 -187
  647. package/dist/services/external-mounts.js.map +0 -1
  648. package/dist/services/files-manager.d.ts +0 -252
  649. package/dist/services/files-manager.js +0 -1156
  650. package/dist/services/files-manager.js.map +0 -1
  651. package/dist/services/files-mounts.d.ts +0 -42
  652. package/dist/services/files-mounts.js +0 -207
  653. package/dist/services/files-mounts.js.map +0 -1
  654. package/dist/services/instance-admin.d.ts +0 -26
  655. package/dist/services/instance-admin.js +0 -218
  656. package/dist/services/instance-admin.js.map +0 -1
  657. package/dist/services/instance-manager.d.ts +0 -192
  658. package/dist/services/instance-manager.js +0 -1289
  659. package/dist/services/instance-manager.js.map +0 -1
  660. package/dist/services/macos-launchd.js +0 -312
  661. package/dist/services/macos-launchd.js.map +0 -1
  662. package/dist/services/nomad-manager.d.ts +0 -307
  663. package/dist/services/nomad-manager.js +0 -3958
  664. package/dist/services/nomad-manager.js.map +0 -1
  665. package/dist/services/organize/applier.js +0 -218
  666. package/dist/services/organize/applier.js.map +0 -1
  667. package/dist/services/organize/rules.js +0 -286
  668. package/dist/services/organize/rules.js.map +0 -1
  669. package/dist/services/organize/scanner.js +0 -366
  670. package/dist/services/organize/scanner.js.map +0 -1
  671. package/dist/services/organize/store.js +0 -82
  672. package/dist/services/organize/store.js.map +0 -1
  673. package/dist/services/plugin-installer.js +0 -128
  674. package/dist/services/plugin-installer.js.map +0 -1
  675. package/dist/services/process-manager.d.ts +0 -25
  676. package/dist/services/process-manager.js +0 -568
  677. package/dist/services/process-manager.js.map +0 -1
  678. package/dist/services/runtime/adapters/custom.d.ts +0 -20
  679. package/dist/services/runtime/adapters/custom.js +0 -188
  680. package/dist/services/runtime/adapters/custom.js.map +0 -1
  681. package/dist/services/runtime/adapters/hermes.d.ts +0 -204
  682. package/dist/services/runtime/adapters/hermes.js +0 -1684
  683. package/dist/services/runtime/adapters/hermes.js.map +0 -1
  684. package/dist/services/runtime/adapters/openclaw-mcporter.d.ts +0 -45
  685. package/dist/services/runtime/adapters/openclaw-mcporter.js +0 -108
  686. package/dist/services/runtime/adapters/openclaw-mcporter.js.map +0 -1
  687. package/dist/services/runtime/adapters/openclaw.d.ts +0 -426
  688. package/dist/services/runtime/adapters/openclaw.js +0 -3975
  689. package/dist/services/runtime/adapters/openclaw.js.map +0 -1
  690. package/dist/services/runtime/index.d.ts +0 -34
  691. package/dist/services/runtime/index.js +0 -51
  692. package/dist/services/runtime/index.js.map +0 -1
  693. package/dist/services/runtime/mcp-shims/anythingllm-shim.d.ts +0 -46
  694. package/dist/services/runtime/mcp-shims/anythingllm-shim.js +0 -281
  695. package/dist/services/runtime/mcp-shims/anythingllm-shim.js.map +0 -1
  696. package/dist/services/runtime/mcp-shims/drive-shim.js +0 -490
  697. package/dist/services/runtime/mcp-shims/drive-shim.js.map +0 -1
  698. package/dist/services/runtime/mcp-shims/jishukb-shim.d.ts +0 -48
  699. package/dist/services/runtime/mcp-shims/jishukb-shim.js +0 -723
  700. package/dist/services/runtime/mcp-shims/jishukb-shim.js.map +0 -1
  701. package/dist/services/runtime/mcp-shims/mcporter-lite.js +0 -276
  702. package/dist/services/runtime/mcp-shims/mcporter-lite.js.map +0 -1
  703. package/dist/services/runtime/migrations.d.ts +0 -23
  704. package/dist/services/runtime/migrations.js +0 -125
  705. package/dist/services/runtime/migrations.js.map +0 -1
  706. package/dist/services/runtime/registry.d.ts +0 -13
  707. package/dist/services/runtime/registry.js +0 -32
  708. package/dist/services/runtime/registry.js.map +0 -1
  709. package/dist/services/runtime-identity.d.ts +0 -13
  710. package/dist/services/runtime-identity.js +0 -166
  711. package/dist/services/runtime-identity.js.map +0 -1
  712. package/dist/services/runtime-repair.d.ts +0 -52
  713. package/dist/services/runtime-repair.js +0 -352
  714. package/dist/services/runtime-repair.js.map +0 -1
  715. package/dist/services/setup-manager.d.ts +0 -158
  716. package/dist/services/setup-manager.js +0 -2740
  717. package/dist/services/setup-manager.js.map +0 -1
  718. package/dist/services/suggestions.d.ts +0 -27
  719. package/dist/services/suggestions.js +0 -133
  720. package/dist/services/suggestions.js.map +0 -1
  721. package/dist/services/system-monitor.js +0 -79
  722. package/dist/services/system-monitor.js.map +0 -1
  723. package/dist/services/system-ollama-provider.d.ts +0 -14
  724. package/dist/services/system-ollama-provider.js +0 -125
  725. package/dist/services/system-ollama-provider.js.map +0 -1
  726. package/dist/services/system-reconciler.d.ts +0 -72
  727. package/dist/services/system-reconciler.js +0 -600
  728. package/dist/services/system-reconciler.js.map +0 -1
  729. package/dist/services/task-registry.d.ts +0 -44
  730. package/dist/services/task-registry.js +0 -76
  731. package/dist/services/task-registry.js.map +0 -1
  732. package/dist/services/types-shim.d.ts +0 -16
  733. package/dist/services/types-shim.js +0 -2
  734. package/dist/services/types-shim.js.map +0 -1
  735. package/dist/services/update-manager.d.ts +0 -47
  736. package/dist/services/update-manager.js +0 -351
  737. package/dist/services/update-manager.js.map +0 -1
  738. package/dist/services/webdav/server.d.ts +0 -24
  739. package/dist/services/webdav/server.js +0 -420
  740. package/dist/services/webdav/server.js.map +0 -1
  741. package/dist/services/webdav/xml-builder.js.map +0 -1
  742. package/dist/services/workspace-builder.d.ts +0 -29
  743. package/dist/services/workspace-builder.js +0 -188
  744. package/dist/services/workspace-builder.js.map +0 -1
  745. package/node_modules/@fastify/static/.github/stale.yml +0 -21
  746. package/node_modules/@isaacs/cliui/LICENSE.md +0 -63
  747. package/node_modules/@isaacs/cliui/README.md +0 -151
  748. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts +0 -4
  749. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts.map +0 -1
  750. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js +0 -16
  751. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js.map +0 -1
  752. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts +0 -34
  753. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts.map +0 -1
  754. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js +0 -170
  755. package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js.map +0 -1
  756. package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts +0 -6
  757. package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts.map +0 -1
  758. package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js +0 -307
  759. package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js.map +0 -1
  760. package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts +0 -2
  761. package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts.map +0 -1
  762. package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js +0 -7
  763. package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js.map +0 -1
  764. package/node_modules/@isaacs/cliui/dist/commonjs/index.d.ts +0 -41
  765. package/node_modules/@isaacs/cliui/dist/commonjs/index.d.ts.map +0 -1
  766. package/node_modules/@isaacs/cliui/dist/commonjs/index.js +0 -322
  767. package/node_modules/@isaacs/cliui/dist/commonjs/index.js.map +0 -1
  768. package/node_modules/@isaacs/cliui/dist/commonjs/index.min.js +0 -12
  769. package/node_modules/@isaacs/cliui/dist/commonjs/index.min.js.map +0 -7
  770. package/node_modules/@isaacs/cliui/dist/commonjs/package.json +0 -3
  771. package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts +0 -5
  772. package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts.map +0 -1
  773. package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js +0 -49
  774. package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js.map +0 -1
  775. package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts +0 -2
  776. package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts.map +0 -1
  777. package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js +0 -8
  778. package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js.map +0 -1
  779. package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts +0 -7
  780. package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts.map +0 -1
  781. package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js +0 -176
  782. package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js.map +0 -1
  783. package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts +0 -4
  784. package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts.map +0 -1
  785. package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js +0 -12
  786. package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js.map +0 -1
  787. package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts +0 -34
  788. package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts.map +0 -1
  789. package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js +0 -167
  790. package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js.map +0 -1
  791. package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts +0 -6
  792. package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts.map +0 -1
  793. package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js +0 -299
  794. package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js.map +0 -1
  795. package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts +0 -2
  796. package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts.map +0 -1
  797. package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js +0 -3
  798. package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js.map +0 -1
  799. package/node_modules/@isaacs/cliui/dist/esm/index.d.ts +0 -41
  800. package/node_modules/@isaacs/cliui/dist/esm/index.d.ts.map +0 -1
  801. package/node_modules/@isaacs/cliui/dist/esm/index.js +0 -317
  802. package/node_modules/@isaacs/cliui/dist/esm/index.js.map +0 -1
  803. package/node_modules/@isaacs/cliui/dist/esm/index.min.js +0 -12
  804. package/node_modules/@isaacs/cliui/dist/esm/index.min.js.map +0 -7
  805. package/node_modules/@isaacs/cliui/dist/esm/package.json +0 -3
  806. package/node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts +0 -5
  807. package/node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts.map +0 -1
  808. package/node_modules/@isaacs/cliui/dist/esm/string-width/index.js +0 -46
  809. package/node_modules/@isaacs/cliui/dist/esm/string-width/index.js.map +0 -1
  810. package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts +0 -2
  811. package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts.map +0 -1
  812. package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js +0 -4
  813. package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js.map +0 -1
  814. package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts +0 -7
  815. package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts.map +0 -1
  816. package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js +0 -172
  817. package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js.map +0 -1
  818. package/node_modules/@isaacs/cliui/package.json +0 -163
  819. package/node_modules/content-disposition/HISTORY.md +0 -60
  820. package/node_modules/cross-spawn/LICENSE +0 -21
  821. package/node_modules/cross-spawn/README.md +0 -89
  822. package/node_modules/cross-spawn/index.js +0 -39
  823. package/node_modules/cross-spawn/lib/enoent.js +0 -59
  824. package/node_modules/cross-spawn/lib/parse.js +0 -91
  825. package/node_modules/cross-spawn/lib/util/escape.js +0 -47
  826. package/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
  827. package/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
  828. package/node_modules/cross-spawn/package.json +0 -73
  829. package/node_modules/foreground-child/LICENSE +0 -15
  830. package/node_modules/foreground-child/README.md +0 -128
  831. package/node_modules/foreground-child/dist/commonjs/all-signals.d.ts +0 -2
  832. package/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map +0 -1
  833. package/node_modules/foreground-child/dist/commonjs/all-signals.js +0 -58
  834. package/node_modules/foreground-child/dist/commonjs/all-signals.js.map +0 -1
  835. package/node_modules/foreground-child/dist/commonjs/index.d.ts +0 -58
  836. package/node_modules/foreground-child/dist/commonjs/index.d.ts.map +0 -1
  837. package/node_modules/foreground-child/dist/commonjs/index.js +0 -123
  838. package/node_modules/foreground-child/dist/commonjs/index.js.map +0 -1
  839. package/node_modules/foreground-child/dist/commonjs/package.json +0 -3
  840. package/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts +0 -6
  841. package/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map +0 -1
  842. package/node_modules/foreground-child/dist/commonjs/proxy-signals.js +0 -38
  843. package/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map +0 -1
  844. package/node_modules/foreground-child/dist/commonjs/watchdog.d.ts +0 -10
  845. package/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map +0 -1
  846. package/node_modules/foreground-child/dist/commonjs/watchdog.js +0 -50
  847. package/node_modules/foreground-child/dist/commonjs/watchdog.js.map +0 -1
  848. package/node_modules/foreground-child/dist/esm/all-signals.d.ts +0 -2
  849. package/node_modules/foreground-child/dist/esm/all-signals.d.ts.map +0 -1
  850. package/node_modules/foreground-child/dist/esm/all-signals.js +0 -52
  851. package/node_modules/foreground-child/dist/esm/all-signals.js.map +0 -1
  852. package/node_modules/foreground-child/dist/esm/index.d.ts +0 -58
  853. package/node_modules/foreground-child/dist/esm/index.d.ts.map +0 -1
  854. package/node_modules/foreground-child/dist/esm/index.js +0 -115
  855. package/node_modules/foreground-child/dist/esm/index.js.map +0 -1
  856. package/node_modules/foreground-child/dist/esm/package.json +0 -3
  857. package/node_modules/foreground-child/dist/esm/proxy-signals.d.ts +0 -6
  858. package/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map +0 -1
  859. package/node_modules/foreground-child/dist/esm/proxy-signals.js +0 -34
  860. package/node_modules/foreground-child/dist/esm/proxy-signals.js.map +0 -1
  861. package/node_modules/foreground-child/dist/esm/watchdog.d.ts +0 -10
  862. package/node_modules/foreground-child/dist/esm/watchdog.d.ts.map +0 -1
  863. package/node_modules/foreground-child/dist/esm/watchdog.js +0 -46
  864. package/node_modules/foreground-child/dist/esm/watchdog.js.map +0 -1
  865. package/node_modules/foreground-child/package.json +0 -106
  866. package/node_modules/glob/dist/esm/bin.d.mts +0 -3
  867. package/node_modules/glob/dist/esm/bin.d.mts.map +0 -1
  868. package/node_modules/glob/dist/esm/bin.mjs +0 -346
  869. package/node_modules/glob/dist/esm/bin.mjs.map +0 -1
  870. package/node_modules/isexe/.npmignore +0 -2
  871. package/node_modules/isexe/LICENSE +0 -15
  872. package/node_modules/isexe/README.md +0 -51
  873. package/node_modules/isexe/index.js +0 -57
  874. package/node_modules/isexe/mode.js +0 -41
  875. package/node_modules/isexe/package.json +0 -31
  876. package/node_modules/isexe/test/basic.js +0 -221
  877. package/node_modules/isexe/windows.js +0 -42
  878. package/node_modules/jackspeak/LICENSE.md +0 -55
  879. package/node_modules/jackspeak/README.md +0 -394
  880. package/node_modules/jackspeak/dist/commonjs/index.d.ts +0 -323
  881. package/node_modules/jackspeak/dist/commonjs/index.d.ts.map +0 -1
  882. package/node_modules/jackspeak/dist/commonjs/index.js +0 -944
  883. package/node_modules/jackspeak/dist/commonjs/index.js.map +0 -1
  884. package/node_modules/jackspeak/dist/commonjs/index.min.js +0 -33
  885. package/node_modules/jackspeak/dist/commonjs/index.min.js.map +0 -7
  886. package/node_modules/jackspeak/dist/commonjs/package.json +0 -3
  887. package/node_modules/jackspeak/dist/esm/index.d.ts +0 -323
  888. package/node_modules/jackspeak/dist/esm/index.d.ts.map +0 -1
  889. package/node_modules/jackspeak/dist/esm/index.js +0 -936
  890. package/node_modules/jackspeak/dist/esm/index.js.map +0 -1
  891. package/node_modules/jackspeak/dist/esm/index.min.js +0 -33
  892. package/node_modules/jackspeak/dist/esm/index.min.js.map +0 -7
  893. package/node_modules/jackspeak/dist/esm/package.json +0 -3
  894. package/node_modules/jackspeak/package.json +0 -115
  895. package/node_modules/jishushell-panel/output/public/assets/ApiKeyField-D1i7zWXR.js +0 -1
  896. package/node_modules/jishushell-panel/output/public/assets/Dashboard-sWIvL43F.js +0 -1
  897. package/node_modules/jishushell-panel/output/public/assets/HermesChatPanel-DQ8RyvQY.js +0 -1
  898. package/node_modules/jishushell-panel/output/public/assets/HermesConfigForm-tIbPP1sB.js +0 -4
  899. package/node_modules/jishushell-panel/output/public/assets/InitPassword-C3Slq3Dd.js +0 -1
  900. package/node_modules/jishushell-panel/output/public/assets/InstanceDetail-7JqY9tq4.js +0 -92
  901. package/node_modules/jishushell-panel/output/public/assets/Login-BXLDJlQN.js +0 -1
  902. package/node_modules/jishushell-panel/output/public/assets/NewInstance-dLc5Xrpx.js +0 -1
  903. package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-DIAXxesl.js +0 -1
  904. package/node_modules/jishushell-panel/output/public/assets/Settings-Bd5utbBh.js +0 -1
  905. package/node_modules/jishushell-panel/output/public/assets/Setup-Yn9_20FL.js +0 -1
  906. package/node_modules/jishushell-panel/output/public/assets/WeixinLoginPanel-C21doQTJ.js +0 -9
  907. package/node_modules/jishushell-panel/output/public/assets/index-CCkaIEjn.js +0 -20
  908. package/node_modules/jishushell-panel/output/public/assets/index-D7qxy-Vh.css +0 -1
  909. package/node_modules/jishushell-panel/output/public/assets/registry-B2ZQZXWL.js +0 -2
  910. package/node_modules/jishushell-panel/output/public/assets/usePolling-BFZm4do_.js +0 -1
  911. package/node_modules/jishushell-panel/output/public/assets/vendor-i18n-DqPtOicc.js +0 -9
  912. package/node_modules/jishushell-panel/output/public/assets/vendor-react-DW5juQin.js +0 -59
  913. package/node_modules/package-json-from-dist/LICENSE.md +0 -63
  914. package/node_modules/package-json-from-dist/README.md +0 -110
  915. package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts +0 -89
  916. package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map +0 -1
  917. package/node_modules/package-json-from-dist/dist/commonjs/index.js +0 -134
  918. package/node_modules/package-json-from-dist/dist/commonjs/index.js.map +0 -1
  919. package/node_modules/package-json-from-dist/dist/commonjs/package.json +0 -3
  920. package/node_modules/package-json-from-dist/dist/esm/index.d.ts +0 -89
  921. package/node_modules/package-json-from-dist/dist/esm/index.d.ts.map +0 -1
  922. package/node_modules/package-json-from-dist/dist/esm/index.js +0 -129
  923. package/node_modules/package-json-from-dist/dist/esm/index.js.map +0 -1
  924. package/node_modules/package-json-from-dist/dist/esm/package.json +0 -3
  925. package/node_modules/package-json-from-dist/package.json +0 -68
  926. package/node_modules/path-key/index.d.ts +0 -40
  927. package/node_modules/path-key/index.js +0 -16
  928. package/node_modules/path-key/license +0 -9
  929. package/node_modules/path-key/package.json +0 -39
  930. package/node_modules/path-key/readme.md +0 -61
  931. package/node_modules/safe-buffer/LICENSE +0 -21
  932. package/node_modules/safe-buffer/README.md +0 -584
  933. package/node_modules/safe-buffer/index.d.ts +0 -187
  934. package/node_modules/safe-buffer/index.js +0 -65
  935. package/node_modules/safe-buffer/package.json +0 -51
  936. package/node_modules/shebang-command/index.js +0 -19
  937. package/node_modules/shebang-command/license +0 -9
  938. package/node_modules/shebang-command/package.json +0 -34
  939. package/node_modules/shebang-command/readme.md +0 -34
  940. package/node_modules/shebang-regex/index.d.ts +0 -22
  941. package/node_modules/shebang-regex/index.js +0 -2
  942. package/node_modules/shebang-regex/license +0 -9
  943. package/node_modules/shebang-regex/package.json +0 -35
  944. package/node_modules/shebang-regex/readme.md +0 -33
  945. package/node_modules/signal-exit/LICENSE.txt +0 -16
  946. package/node_modules/signal-exit/README.md +0 -74
  947. package/node_modules/signal-exit/dist/cjs/browser.d.ts +0 -12
  948. package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +0 -1
  949. package/node_modules/signal-exit/dist/cjs/browser.js +0 -10
  950. package/node_modules/signal-exit/dist/cjs/browser.js.map +0 -1
  951. package/node_modules/signal-exit/dist/cjs/index.d.ts +0 -48
  952. package/node_modules/signal-exit/dist/cjs/index.d.ts.map +0 -1
  953. package/node_modules/signal-exit/dist/cjs/index.js +0 -279
  954. package/node_modules/signal-exit/dist/cjs/index.js.map +0 -1
  955. package/node_modules/signal-exit/dist/cjs/package.json +0 -3
  956. package/node_modules/signal-exit/dist/cjs/signals.d.ts +0 -29
  957. package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +0 -1
  958. package/node_modules/signal-exit/dist/cjs/signals.js +0 -42
  959. package/node_modules/signal-exit/dist/cjs/signals.js.map +0 -1
  960. package/node_modules/signal-exit/dist/mjs/browser.d.ts +0 -12
  961. package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +0 -1
  962. package/node_modules/signal-exit/dist/mjs/browser.js +0 -4
  963. package/node_modules/signal-exit/dist/mjs/browser.js.map +0 -1
  964. package/node_modules/signal-exit/dist/mjs/index.d.ts +0 -48
  965. package/node_modules/signal-exit/dist/mjs/index.d.ts.map +0 -1
  966. package/node_modules/signal-exit/dist/mjs/index.js +0 -275
  967. package/node_modules/signal-exit/dist/mjs/index.js.map +0 -1
  968. package/node_modules/signal-exit/dist/mjs/package.json +0 -3
  969. package/node_modules/signal-exit/dist/mjs/signals.d.ts +0 -29
  970. package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +0 -1
  971. package/node_modules/signal-exit/dist/mjs/signals.js +0 -39
  972. package/node_modules/signal-exit/dist/mjs/signals.js.map +0 -1
  973. package/node_modules/signal-exit/package.json +0 -106
  974. package/node_modules/which/CHANGELOG.md +0 -166
  975. package/node_modules/which/LICENSE +0 -15
  976. package/node_modules/which/README.md +0 -54
  977. package/node_modules/which/bin/node-which +0 -52
  978. package/node_modules/which/package.json +0 -43
  979. package/node_modules/which/which.js +0 -125
  980. package/scripts/check-adapter-isolation.ts +0 -293
  981. /package/dist/services/{app → app-common}/app-compiler.d.ts +0 -0
  982. /package/dist/services/{app → app-common}/terminal-session-manager.d.ts +0 -0
  983. /package/dist/services/{backup-verify.d.ts → backup/backup-verify.d.ts} +0 -0
  984. /package/dist/services/{external-mounts.d.ts → files/external-mounts.d.ts} +0 -0
  985. /package/dist/services/{organize → files/organize}/applier.d.ts +0 -0
  986. /package/dist/services/{organize → files/organize}/rules.d.ts +0 -0
  987. /package/dist/services/{organize → files/organize}/scanner.d.ts +0 -0
  988. /package/dist/services/{organize → files/organize}/store.d.ts +0 -0
  989. /package/dist/services/{webdav → files/webdav}/xml-builder.d.ts +0 -0
  990. /package/dist/services/{webdav → files/webdav}/xml-builder.js +0 -0
  991. /package/dist/services/{app-passwords.d.ts → instances/passwords.d.ts} +0 -0
  992. /package/dist/services/{agent-apps → integrations/installable}/installers/registry-probe.d.ts +0 -0
  993. /package/dist/services/{agent-apps → integrations/installable}/installers/registry-probe.js +0 -0
  994. /package/dist/services/{runtime/mcp-shims → integrations/openclaw}/drive-shim.d.ts +0 -0
  995. /package/dist/services/{runtime/mcp-shims → integrations/openclaw}/mcporter-lite.d.ts +0 -0
  996. /package/dist/services/{plugin-installer.d.ts → setup/plugin-installer.d.ts} +0 -0
  997. /package/dist/services/{macos-launchd.d.ts → system/macos-launchd.d.ts} +0 -0
  998. /package/dist/services/{system-monitor.d.ts → system/system-monitor.d.ts} +0 -0
@@ -1 +0,0 @@
1
- import{j as r,aE as J}from"./index-CCkaIEjn.js";import{r as a}from"./vendor-react-DW5juQin.js";import"./vendor-i18n-DqPtOicc.js";const h="hermes-chat:",I="hermes-chat-epoch:",Y=500,u=10,L=10;function q(s,l){if(!l)return null;try{const t=localStorage.getItem(I+s),c=localStorage.getItem(h+s)!=null;(t!==null&&t!==l||t===null&&c)&&localStorage.removeItem(h+s),t!==l&&localStorage.setItem(I+s,l)}catch{}return l}function P(s,l){q(s,l);try{const t=localStorage.getItem(h+s);if(!t)return[];const c=JSON.parse(t);return Array.isArray(c)?c.filter(n=>n&&(n.role==="user"||n.role==="assistant"||n.role==="system")).map(n=>({role:n.role,content:String(n.content??""),error:!!n.error})):[]}catch{return[]}}function X({instanceId:s,instanceEpoch:l=null}){const[t,c]=a.useState(()=>P(s,l)),[n,m]=a.useState(()=>Math.min(u,t.length||u)),[v,S]=a.useState(""),[d,N]=a.useState(!1),[g,w]=a.useState(!1),x=a.useRef(null),M=a.useRef(t.length),f=a.useRef(null),F=t.slice(-n),j=n<t.length;a.useEffect(()=>{try{const e=t.filter(i=>!i.pending).slice(-Y);e.length===0?localStorage.removeItem(h+s):localStorage.setItem(h+s,JSON.stringify(e))}catch{}},[s,t]),a.useEffect(()=>{const e=P(s,l);c(e),m(Math.min(u,e.length||u))},[s,l]),a.useEffect(()=>{const e=x.current;if(e){if(f.current){const i=f.current.prevScrollHeight;e.scrollTop=e.scrollHeight-i,f.current=null;return}t.length>=M.current&&(e.scrollTop=e.scrollHeight),M.current=t.length}},[t,n]);const C=()=>{if(!j||g)return;w(!0);const e=x.current;e&&(f.current={prevScrollHeight:e.scrollHeight}),m(i=>Math.min(i+L,t.length)),requestAnimationFrame(()=>w(!1))},T=()=>{const e=x.current;!e||!j||g||e.scrollTop<40&&C()},E=async()=>{var H,R,k,A;const e=v.trim();if(!e||d)return;S(""),N(!0);const i={role:"user",content:e},K={role:"assistant",content:"",pending:!0},_=[...t,i,K];c(_);const $=_.slice(0,-1).slice(-20).map(o=>({role:o.role,content:o.content}));try{const o=await J(s,{model:"hermes-agent",messages:$,max_tokens:512}),p=((k=(R=(H=o==null?void 0:o.choices)==null?void 0:H[0])==null?void 0:R.message)==null?void 0:k.content)??((A=o==null?void 0:o.error)==null?void 0:A.message)??"(empty response)";c(b=>b.map((y,B)=>B===b.length-1?{role:"assistant",content:String(p)}:y))}catch(o){c(p=>p.map((b,y)=>y===p.length-1?{role:"assistant",content:(o==null?void 0:o.message)||"(request failed)",error:!0}:b))}finally{N(!1)}},O=e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),E())};return r.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-[var(--border)] bg-[var(--card)] shadow-[0_18px_48px_rgba(15,23,42,0.06)] flex flex-col",style:{height:"calc(100vh - 160px)",minHeight:"500px"},children:[r.jsxs("div",{className:"px-5 py-3 border-b border-[var(--border)] flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500 shadow-[0_0_6px_rgba(16,185,129,0.7)]"}),r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"}),r.jsx("span",{className:"text-[10px] text-muted font-mono",children:"inline → /v1/chat/completions"})]}),t.length>0&&r.jsx("button",{onClick:()=>{c([]),m(u)},className:"text-xs text-muted hover:text-foreground transition-colors",disabled:d,children:"清空对话"})]}),r.jsxs("div",{ref:x,onScroll:T,className:"flex-1 overflow-y-auto p-5 space-y-3",children:[j&&r.jsx("div",{className:"flex justify-center py-1",children:r.jsx("button",{onClick:C,disabled:g,className:"text-xs text-muted hover:text-foreground transition-colors",children:g?"加载中...":`向上滚动或点击加载更早的 ${Math.min(L,t.length-n)} 条 (共 ${t.length} 条)`})}),t.length===0?r.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center",children:[r.jsx("div",{className:"text-4xl mb-3 opacity-40",children:"⚕"}),r.jsx("div",{className:"text-sm text-foreground/70 font-medium mb-1",children:"和 Hermes agent 开始对话"}),r.jsx("div",{className:"text-xs text-muted max-w-md",children:"消息会走完整的 agent loop(skills + tools + memory), 经 JishuShell LLM 代理转发到上游模型。首次请求因冷启动约 20-30 秒。"})]}):F.map((e,i)=>r.jsx("div",{className:`flex ${e.role==="user"?"justify-end":"justify-start"}`,children:r.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2.5 text-sm whitespace-pre-wrap break-words ${e.role==="user"?"bg-[#0066FF] text-white":e.error?"bg-red-500/10 border border-red-500/20 text-red-400":"bg-[var(--input-bg)] border border-[var(--border)] text-foreground"}`,children:e.pending?r.jsxs("span",{className:"inline-flex items-center gap-2 text-muted",children:[r.jsx("span",{className:"w-3 h-3 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin"}),"agent 正在思考..."]}):e.content})},t.length-F.length+i))]}),r.jsx("div",{className:"p-4 border-t border-[var(--border)]",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("textarea",{value:v,onChange:e=>S(e.target.value),onKeyDown:O,placeholder:"输入消息 (Enter 发送,Shift+Enter 换行)",rows:2,disabled:d,className:"flex-1 bg-[var(--input-bg)] border border-[var(--border)] rounded-lg px-3 py-2 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 resize-none"}),r.jsx("button",{onClick:E,disabled:!v.trim()||d,className:"self-end px-4 py-2 bg-[#0066FF] text-white rounded-lg text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:d?r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx("span",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"发送中"]}):"发送"})]})})]})}export{X as HermesChatPanel};
@@ -1,4 +0,0 @@
1
- import{aF as ve,j as s,p as fe,a1 as ge}from"./index-CCkaIEjn.js";import{r as u,L as oe}from"./vendor-react-DW5juQin.js";import{P as b,S as U,F as f,a as H,A as be,I as F,b as ye}from"./ApiKeyField-D1i7zWXR.js";import{F as je,W as Ne}from"./WeixinLoginPanel-C21doQTJ.js";import{u as Se}from"./vendor-i18n-DqPtOicc.js";const Ae=new Set(["feishu","weixin"]),K={telegram:{label:"Telegram",fields:[{key:"token",envKey:"TELEGRAM_BOT_TOKEN",label:"Bot Token",secret:!0,hint:"从 @BotFather 获取"},{key:"allowed",envKey:"TELEGRAM_ALLOWED_USERS",label:"Allowed Users",hint:"逗号分隔 user id,留空=所有人"}]},discord:{label:"Discord",fields:[{key:"token",envKey:"DISCORD_BOT_TOKEN",label:"Bot Token",secret:!0,hint:"从 Discord Developer Portal"}]},slack:{label:"Slack",fields:[{key:"bot",envKey:"SLACK_BOT_TOKEN",label:"Bot Token (xoxb-…)",secret:!0,placeholder:"xoxb-..."},{key:"app",envKey:"SLACK_APP_TOKEN",label:"App Token (xapp-…)",secret:!0,placeholder:"xapp-..."}]},whatsapp:{label:"WhatsApp",fields:[{key:"token",envKey:"WHATSAPP_TOKEN",label:"Access Token",secret:!0}]},signal:{label:"Signal",fields:[{key:"account",envKey:"SIGNAL_ACCOUNT",label:"Phone (E.164)",placeholder:"+8613800138000"}]},email:{label:"Email (SMTP)",fields:[{key:"host",envKey:"SMTP_HOST",label:"SMTP Host",placeholder:"smtp.gmail.com"},{key:"port",envKey:"SMTP_PORT",label:"SMTP Port",placeholder:"587"},{key:"user",envKey:"SMTP_USER",label:"SMTP User"},{key:"pass",envKey:"SMTP_PASSWORD",label:"SMTP Password",secret:!0}]}};function Fe(l){const x=new Map;for(const g of l.split(`
2
- `)){const h=g.trim();if(!h||h.startsWith("#"))continue;const t=h.indexOf("=");if(t<0)continue;const c=h.slice(0,t).trim();let r=h.slice(t+1).trim();(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1)),x.set(c,r)}return x}function te(l,x){const g=l.split(`
3
- `),h=new Set,t=[];for(const c of g){const r=c.trim();if(!r||r.startsWith("#")){t.push(c);continue}const y=r.indexOf("=");if(y<0){t.push(c);continue}const S=r.slice(0,y).trim();if(S in x){h.add(S);const C=x[S];if(C==="")continue;t.push(`${S}=${C}`)}else t.push(c)}for(const[c,r]of Object.entries(x))!h.has(c)&&r!==""&&t.push(`${c}=${r}`);return t.join(`
4
- `)}function Pe({config:l,onChange:x,instanceId:g,capabilities:h}){var X,Z,ee,se;const{t}=Se(["instance","common"]),c=String((l==null?void 0:l.yaml)||""),r=String((l==null?void 0:l.env)||""),y=u.useMemo(()=>Fe(r),[r]),a=(((l==null?void 0:l["x-jishushell"])||{}).proxy||{}).upstream||{},m=a.providerId||"",P=b.find(e=>e.id===m),E=a.models||[],M=P?P.models.map(e=>({id:e.id,name:e.name,contextWindow:e.contextWindow})):E.map(e=>({id:e.id,name:e.name||e.id,contextWindow:e.contextWindow||0})),v=a.selectedModelId||((X=M[0])==null?void 0:X.id)||"",w=E.find(e=>e.id===v)||M.find(e=>e.id===v)||{id:"",name:"",contextWindow:0},[N,ne]=u.useState(null),[T,re]=u.useState(!1),[I,le]=u.useState(!(a.hasApiKey&&m)),[R,D]=u.useState([]),[ae,B]=u.useState([]),[V,$]=u.useState(!1);u.useEffect(()=>{ve().then(ne).catch(()=>{})},[]);const k=e=>{var n;const o=JSON.parse(JSON.stringify(l));o["x-jishushell"]||(o["x-jishushell"]={}),(n=o["x-jishushell"]).proxy||(n.proxy={}),o["x-jishushell"].proxy.upstream={...o["x-jishushell"].proxy.upstream||{},...e},x(o)},O=(e,o)=>k({[e]:o}),ie=e=>{var d,i;const o=b.find(p=>p.id===e);if(!o){k({providerId:""});return}if(a.apiKey&&!window.confirm(t("configForm.switchProviderConfirm",{defaultValue:"切换 provider 会清空当前 API key,确定继续?"})))return;const n=JSON.parse(JSON.stringify(l));n["x-jishushell"]||(n["x-jishushell"]={}),(d=n["x-jishushell"]).proxy||(d.proxy={}),n["x-jishushell"].proxy.upstream={providerId:o.id,baseUrl:o.baseUrl,api:o.api,authHeader:o.authHeader===!0,headers:o.headers||{},models:o.models.map(p=>({id:p.id,name:p.name,contextWindow:p.contextWindow})),selectedModelId:((i=o.models[0])==null?void 0:i.id)||"",apiKey:"",hasApiKey:!1,clearApiKey:!1},x(n)},W=e=>O("selectedModelId",e),_=e=>{var p;const o=[...E],n=o.findIndex(j=>j.id===v),d={...w,...e};n>=0?o[n]=d:o.push(d);const i=JSON.parse(JSON.stringify(l));i["x-jishushell"]||(i["x-jishushell"]={}),(p=i["x-jishushell"]).proxy||(p.proxy={}),i["x-jishushell"].proxy.upstream={...i["x-jishushell"].proxy.upstream||{},models:o,selectedModelId:typeof e.id=="string"&&e.id?e.id:v},x(i)},de=async e=>{if(!m)return;const o=b.find(j=>j.id===m);if(!o)return;const d=["ollama","vllm","sglang"].includes(m)&&a.baseUrl?String(a.baseUrl):o.baseUrl,i=o.authHeader?"x-api-key":"Authorization",p=a.apiKey||"";$(!0);try{const{models:j}=await fe(d,p,i,o.id,o.api);B(j),j.length&&!v&&W(j[0].id)}catch{}finally{$(!1)}},A=Array.isArray(h==null?void 0:h.messagingPlatforms)?h.messagingPlatforms:[],L=u.useMemo(()=>A.filter(e=>!Ae.has(e)),[A]),J=u.useMemo(()=>{const e=[];for(const o of L){const n=K[o];n&&n.fields.some(d=>(y.get(d.envKey)||"").trim()!=="")&&e.push(o)}return e},[L,y]),G=u.useMemo(()=>Array.from(new Set([...J,...R])),[J,R]),z=L.filter(e=>!G.includes(e)&&K[e]),Y=y.get("FEISHU_APP_ID")||"",ce=u.useMemo(()=>{const e=c.match(/platforms:\s*[\s\S]*?feishu:\s*[\s\S]*?domain_name:\s*["']?(\w+)["']?/);return(e==null?void 0:e[1])==="lark"?"lark":"feishu"},[c]),q=()=>{g&&ge(g).then(e=>{e&&x(e)}).catch(()=>{})},Q=(e,o)=>{x({...l,format:"yaml+env",yaml:c,env:te(r,{[e]:o})})},me=e=>{D(o=>o.includes(e)?o:[...o,e])},xe=e=>{const o=K[e];if(!o)return;const n={};o.fields.forEach(d=>{n[d.envKey]=""}),x({...l,format:"yaml+env",yaml:c,env:te(r,n)}),D(d=>d.filter(i=>i!==e))},he=e=>x({...l,format:"yaml+env",yaml:e,env:r}),ue=e=>x({...l,format:"yaml+env",yaml:c,env:e}),pe=[...new Set(b.map(e=>e.group))];return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(U,{title:t("configForm.modelConfig"),children:[s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-lg p-3 text-sm text-muted",children:[s.jsx("div",{className:"font-medium text-foreground mb-1",children:t("configForm.proxyChain")}),s.jsx("p",{children:t("configForm.proxyChainDesc")}),s.jsxs("div",{className:"mt-2 text-xs text-muted opacity-60 space-y-1",children:[s.jsxs("div",{children:["面板全局 provider:"," ",N!=null&&N.configured?s.jsxs("span",{className:"font-mono",children:[N.providerId,N.selectedModelId?` · ${N.selectedModelId}`:""]}):s.jsx(oe,{to:"/settings",className:"text-amber-400 underline hover:text-amber-300",children:"未配置"})," ",s.jsx(oe,{to:"/settings",className:"text-[#0066FF] hover:text-[#0066FF]/80",children:"(修改)"})]}),s.jsx("div",{className:"opacity-70",children:"本实例 API key 留空 → 自动回退全局 key (src/services/llm-proxy/index.ts:137)"})]})]}),!I&&s.jsx("button",{type:"button",onClick:()=>le(!0),className:"text-xs text-[#0066FF] hover:text-[#0066FF]/80 transition-colors",children:t("configForm.editModelConfig")}),I&&s.jsx(f,{label:t("configForm.upstreamProvider"),hint:t("configForm.upstreamProviderHint"),children:s.jsxs(H,{value:m,onChange:ie,children:[s.jsx("option",{value:"",children:t("configForm.selectProvider")}),!P&&m&&s.jsxs("option",{value:m,children:[m," ",t("configForm.custom")]}),pe.map(e=>s.jsx("optgroup",{label:t(`configForm.providerGroup.${e}`,{defaultValue:e}),children:b.filter(o=>o.group===e).map(o=>s.jsx("option",{value:o.id,children:t(`configForm.providerLabel.${o.id}`,{defaultValue:o.label})},o.id))},e))]})}),I&&!["ollama","vllm","sglang"].includes(m)&&m&&s.jsxs(s.Fragment,{children:[s.jsxs(f,{label:t("configForm.upstreamApiKey"),hint:a.hasApiKey&&!a.clearApiKey?t("configForm.apiKeyHintSaved"):t("configForm.apiKeyHintNew"),children:[s.jsx(be,{value:a.apiKey||"",saved:a.hasApiKey&&!a.clearApiKey,onChange:e=>k({apiKey:e,clearApiKey:!1}),baseUrl:a.baseUrl||((Z=b.find(e=>e.id===m))==null?void 0:Z.baseUrl)||"",api:((ee=b.find(e=>e.id===m))==null?void 0:ee.api)||"",authHeader:(se=b.find(e=>e.id===m))!=null&&se.authHeader?"x-api-key":void 0,providerId:m,placeholder:t("configForm.enterApiKey"),onModels:e=>{B(e),e.length>0&&!v&&W(e[0].id)},selectedModelId:v}),a.hasApiKey&&s.jsx("button",{type:"button",onClick:()=>k({apiKey:"",clearApiKey:!a.clearApiKey}),className:"text-xs text-muted hover:text-foreground transition-colors mt-2",children:a.clearApiKey?t("configForm.restoreApiKey"):t("configForm.clearApiKey")})]}),s.jsx(f,{label:t("configForm.selectedModel"),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsxs(H,{value:v,onChange:W,children:[s.jsx("option",{value:"",children:t("configForm.selectModel")}),M.map(e=>s.jsxs("option",{value:e.id,children:[e.name||e.id,e.contextWindow?` (${Math.round(e.contextWindow/1e3)}K)`:""]},e.id)),ae.filter(e=>!M.some(o=>o.id===e.id)).map(e=>s.jsx("option",{value:e.id,children:e.name||e.id},e.id))]})}),s.jsx("button",{type:"button",onClick:()=>{de()},disabled:V||!m,className:"px-3 py-2 border border-[var(--border)] text-muted rounded-md text-xs hover:bg-[var(--card-hover)] hover:text-foreground disabled:opacity-40 transition-colors",children:V?t("common:label.loading",{defaultValue:"加载中"}):t("configForm.fetchModels",{defaultValue:"拉取模型"})})]})}),s.jsx("button",{type:"button",onClick:()=>re(!T),className:"text-xs text-muted hover:text-foreground transition-colors",children:t(T?"configForm.collapseAdvanced":"configForm.advancedOptions")}),T&&s.jsxs("div",{className:"space-y-4 border-t border-[var(--border)] pt-4",children:[s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsx(f,{label:t("configForm.upstreamBaseUrl"),children:s.jsx(F,{value:a.baseUrl||"",onChange:e=>O("baseUrl",e),placeholder:t("configForm.baseUrlPlaceholder"),mono:!0})}),s.jsx(f,{label:t("configForm.upstreamApiProtocol"),children:s.jsxs(H,{value:a.api||"openai-completions",onChange:e=>O("api",e),children:[s.jsx("option",{value:"openai-completions",children:"OpenAI Compatible"}),s.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),s.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"}),s.jsx("option",{value:"google-generative-ai",children:"Google Generative AI"}),s.jsx("option",{value:"ollama",children:"Ollama"})]})})]}),v&&s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[s.jsx(f,{label:t("configForm.modelId"),children:s.jsx(F,{value:w.id||"",onChange:e=>_({id:e}),placeholder:"model-id",mono:!0})}),s.jsx(f,{label:t("configForm.modelName"),children:s.jsx(F,{value:w.name||"",onChange:e=>_({name:e}),placeholder:"Model Name"})}),s.jsx(f,{label:t("configForm.contextWindow"),children:s.jsx(F,{value:String(w.contextWindow||""),onChange:e=>_({contextWindow:parseInt(e,10)||0}),placeholder:"200000",mono:!0})})]}),s.jsx("div",{className:"text-xs text-muted bg-[var(--card)] border border-[var(--border)] rounded-md p-3",children:t("configForm.proxyNote")})]})]})]}),A.length>0&&s.jsxs(U,{title:t("configForm.imChannelConfig"),children:[s.jsxs("p",{className:"text-xs text-muted",children:["Hermes 通过 ",s.jsx("code",{className:"font-mono text-[11px]",children:".env"})," 环境变量读取消息平台凭证。 保存后重启实例生效。"]}),A.includes("feishu")&&s.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:t("configForm.channel.feishu",{defaultValue:"飞书 / Lark"})}),s.jsx("span",{className:"text-[11px] text-muted font-mono",children:"feishu"})]}),s.jsx(je,{instanceId:g,channelKey:"feishu",existingAppId:Y||void 0,existingDomain:Y?ce:void 0,onConfigured:q})]}),A.includes("weixin")&&s.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:t("configForm.channel.weixin",{defaultValue:"个人微信"})}),s.jsx("span",{className:"text-[11px] text-muted font-mono",children:"weixin"})]}),s.jsx(Ne,{instanceId:g,onConfigured:q})]}),s.jsx("div",{className:"space-y-3",children:G.map(e=>{const o=K[e];return o?s.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:o.label}),s.jsx("span",{className:"text-[11px] text-muted font-mono",children:e})]}),s.jsx("button",{onClick:()=>xe(e),className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:t("configForm.remove")})]}),s.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:o.fields.map(n=>{const d=y.get(n.envKey)||"";return s.jsx(f,{label:n.label,hint:n.hint||`.env: ${n.envKey}`,children:n.secret?s.jsx(ye,{value:d,saved:!!d,onChange:i=>Q(n.envKey,i),placeholder:n.placeholder}):s.jsx(F,{value:d,onChange:i=>Q(n.envKey,i),placeholder:n.placeholder,mono:!0})},n.key)})})]},e):null})}),z.length>0&&s.jsxs("div",{className:"pt-2",children:[s.jsx("p",{className:"text-xs text-muted mb-2",children:t("configForm.addImChannel")}),s.jsx("div",{className:"flex flex-wrap gap-2",children:z.map(e=>{var o;return s.jsxs("button",{onClick:()=>me(e),className:"px-3 py-1.5 text-xs border border-dashed rounded-md transition-colors duration-150 border-[var(--border)] text-muted hover:border-[var(--border-hover)] hover:text-foreground",children:["+ ",((o=K[e])==null?void 0:o.label)||e]},e)})})]})]}),s.jsxs(U,{title:"高级 (原始 YAML + .env)",defaultOpen:!1,children:[s.jsx("p",{className:"text-xs text-muted",children:"直接编辑 YAML / .env。上方 Channels 字段与此处同步 — 任一侧修改都会反映到另一侧。"}),s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[s.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2",children:s.jsx("span",{className:"text-xs font-medium text-muted",children:"config.yaml"})}),s.jsx("textarea",{value:c,onChange:e=>he(e.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[240px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]}),s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[s.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2",children:s.jsx("span",{className:"text-xs font-medium text-muted",children:".env"})}),s.jsx("textarea",{value:r,onChange:e=>ue(e.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[220px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]})]})]})}export{Pe as HermesConfigForm};
@@ -1 +0,0 @@
1
- import{j as e,L as j,T as v,I as w,a as N,c as y,s as F}from"./index-CCkaIEjn.js";import{r}from"./vendor-react-DW5juQin.js";import{u as S}from"./vendor-i18n-DqPtOicc.js";const x="w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200";function C({onDone:b}){const{t}=S("auth"),[s,p]=r.useState(""),[o,h]=r.useState(""),[n,f]=r.useState(!1),[l,d]=r.useState(""),[c,m]=r.useState(!1),u=s.length>=8&&s===o,g=async a=>{if(a.preventDefault(),!!u){d(""),m(!0);try{const i=await y(s);F(i.token),b()}catch(i){d(i.message||t("init.failed"))}finally{m(!1)}}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background relative overflow-hidden",children:[e.jsx("div",{className:"grid-bg absolute inset-0 pointer-events-none"}),e.jsx("div",{className:"absolute top-1/3 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[500px] h-[300px] rounded-full bg-[#0066FF]/[0.07] blur-[90px] pointer-events-none"}),e.jsx("div",{className:"absolute left-4 bottom-4 z-20",children:e.jsx(j,{className:"bg-card/80 backdrop-blur-sm"})}),e.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(v,{className:"w-40 h-40 mx-auto mb-4 object-contain"}),e.jsx("p",{className:"text-sm text-muted mt-1",children:t("init.title")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-3 py-2.5",children:l}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("init.password")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:n?"text":"password",value:s,onChange:a=>p(a.target.value),placeholder:t("init.passwordPlaceholder"),className:`${x} pr-10`,autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>f(!n),"aria-label":t("common:action.togglePassword"),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors duration-200",children:n?e.jsx(w,{}):e.jsx(N,{})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("init.confirm")}),e.jsx("input",{type:n?"text":"password",value:o,onChange:a=>h(a.target.value),placeholder:t("init.confirmPlaceholder"),className:x}),s&&o&&s!==o&&e.jsx("p",{className:"text-red-400 text-xs mt-1.5",children:t("init.mismatch")})]}),e.jsx("button",{type:"submit",disabled:c||!u,className:"w-full bg-[#0066FF] text-white rounded-md py-2.5 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200 shadow-[0_0_20px_rgba(0,102,255,0.3)] hover:shadow-[0_0_28px_rgba(0,102,255,0.45)]",children:c?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),t("init.loading")]}):t("init.submit")})]})]})]})}export{C as default};
@@ -1,92 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CCkaIEjn.js","assets/vendor-react-DW5juQin.js","assets/vendor-i18n-DqPtOicc.js","assets/index-D7qxy-Vh.css"])))=>i.map(i=>d[i]);
2
- import{j as e,_ as ys,y as js,z as Zs,A as ea,B as ta,C as sa,D as aa,l as Os,E as ra,F as ks,G as na,H as Ls,J as la,K as oa,M as ws,N as ia,O as ca,P as da,Q as ua,R as ma,S as xa,U as pa,V as fa,k as ha,W as st,X as Tt,Y as ba,Z as ga,$ as Ns,a0 as Cs,a1 as Ss,a2 as Fs,a3 as va,a4 as ya,a5 as ja,a6 as ka,a7 as Is,a8 as Es,a9 as wa,aa as Na,ab as Ca,ac as Sa,v as Fa,w as Ia,x as Ps,ad as Ea,ae as Pa,af as Aa,ag as _a,ah as Ma,ai as $a,aj as Ta}from"./index-CCkaIEjn.js";import{r as d,u as gt,d as Da}from"./vendor-react-DW5juQin.js";import{F as Va,W as Oa,Q as La}from"./WeixinLoginPanel-C21doQTJ.js";import{u as Ra}from"./usePolling-BFZm4do_.js";import{P as ft,S as As,F as ie,a as at,A as Ka,d as Le,I as Me,C as rt,T as _s}from"./ApiKeyField-D1i7zWXR.js";import{u as me,i as qa,T as Ua}from"./vendor-i18n-DqPtOicc.js";import{R as Ba}from"./registry-B2ZQZXWL.js";const Dt=["feishu","openclaw-weixin"],Wa={feishu:"feishu",lark:"feishu","openclaw-weixin":"openclaw-weixin"};function Ha({config:t,onChange:n,instanceId:o,isRunning:u=!1,pluginStatuses:s={},onInstallPlugin:i}){var G,ae,de;const{t:x}=me(["instance","common"]),y=(c,f)=>n(Le(t,c,f)),r=((G=t==null?void 0:t["x-jishushell"])==null?void 0:G.proxy)||{},g=r.upstream||{},b=g.providerId||"",F=ft.find(c=>c.id===b),P=g.models||[],I=F?F.models.map(c=>({id:c.id,name:c.name,contextWindow:c.contextWindow})):P.map(c=>({id:c.id,name:c.name||c.id,contextWindow:c.contextWindow})),L=g.selectedModelId||((ae=I[0])==null?void 0:ae.id)||"",R=I.find(c=>c.id===L)||I[0]||{},M=P.find(c=>c.id===L)||(R.id?R:{id:"",name:"",contextWindow:0}),Y=r.proxy||{},ue=c=>{var _;const f=ft.find(K=>K.id===c);if(!f||g.apiKey&&!window.confirm(x("configForm.switchProviderConfirm")))return;const w=JSON.parse(JSON.stringify(t));w["x-jishushell"]||(w["x-jishushell"]={}),w["x-jishushell"].proxy||(w["x-jishushell"].proxy={}),w["x-jishushell"].proxy.upstream={providerId:f.id,baseUrl:f.baseUrl,api:f.api,authHeader:f.authHeader===!0,headers:f.headers||{},models:f.models.map(K=>({id:K.id,name:K.name,contextWindow:K.contextWindow})),selectedModelId:((_=f.models[0])==null?void 0:_.id)||"",apiKey:"",hasApiKey:!1,clearApiKey:!1},n(w)},J=c=>{y("x-jishushell.proxy.upstream.selectedModelId",c)},X=(c,f)=>{y(`x-jishushell.proxy.upstream.${c}`,f)},k=(t==null?void 0:t.channels)||{},E=Object.keys(k),W=(c,f,w)=>y(`channels.${c}.${f}`,w),q={},H=c=>{const f=rt.find(K=>K.id===c),w=JSON.parse(JSON.stringify(t));w.channels||(w.channels={});const _=q[c]||c;if(f){const K={enabled:!0,...f.defaults};f.fields.forEach(oe=>{K[oe.key]=""}),w.channels[_]=K}else w.channels[_]={enabled:!0};n(w)},ce=c=>{const f=JSON.parse(JSON.stringify(t));delete f.channels[c],n(f)},[le,v]=d.useState(!1),[C,V]=d.useState(!(g.hasApiKey&&b)),Z={"moonshot-coding":"configForm.hint.moonshot-coding",volcengine:"configForm.hint.volcengine",byteplus:"configForm.hint.byteplus",openrouter:"configForm.hint.openrouter",ollama:"configForm.hint.ollama",vllm:"configForm.hint.vllm",sglang:"configForm.hint.sglang"},z=Z[b]?x(Z[b]):void 0,D=[...new Set(ft.map(c=>c.group))];return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(As,{title:x("configForm.modelConfig"),children:[e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-lg p-3 text-sm text-muted",children:[e.jsx("div",{className:"font-medium text-foreground mb-1",children:x("configForm.proxyChain")}),e.jsx("p",{children:x("configForm.proxyChainDesc")}),e.jsxs("div",{className:"mt-2 text-xs text-muted opacity-60 space-y-1",children:[e.jsxs("div",{children:[x("configForm.proxyAddress")," ",e.jsx("span",{className:"font-mono",children:Y.coreProxyBaseUrl||x("configForm.notConfigured")})]}),e.jsxs("div",{children:[x("configForm.proxyStatus")," ",Y.running?x("configForm.running"):x("configForm.notRunning"),x("configForm.virtualKeyLabel")," ",Y.hasVirtualKey?x("configForm.generated"):x("configForm.notGenerated")]})]})]}),!C&&e.jsx("button",{type:"button",onClick:()=>V(!0),className:"text-xs text-[#0066FF] hover:text-[#0066FF]/80 transition-colors",children:x("configForm.editModelConfig")}),C&&e.jsx(ie,{label:x("configForm.upstreamProvider"),hint:x("configForm.upstreamProviderHint"),children:e.jsxs(at,{value:b,onChange:ue,children:[e.jsx("option",{value:"",children:x("configForm.selectProvider")}),!F&&b&&e.jsxs("option",{value:b,children:[b," ",x("configForm.custom")]}),D.map(c=>e.jsx("optgroup",{label:x(`configForm.providerGroup.${c}`,{defaultValue:c}),children:ft.filter(f=>f.group===c).map(f=>e.jsx("option",{value:f.id,children:x(`configForm.providerLabel.${f.id}`,{defaultValue:f.label})},f.id))},c))]})}),C&&z&&e.jsxs("div",{className:"flex items-start gap-2 bg-amber-500/10 border border-amber-500/20 rounded-lg px-3 py-2.5 text-xs text-amber-400",children:[e.jsx("span",{className:"shrink-0 mt-0.5",children:"⚠"}),e.jsx("span",{children:z})]}),C&&!["ollama","vllm","sglang"].includes(b)&&b&&e.jsxs(e.Fragment,{children:[e.jsxs(ie,{label:x("configForm.upstreamApiKey"),hint:g.hasApiKey&&!g.clearApiKey?x("configForm.apiKeyHintSaved"):x("configForm.apiKeyHintNew"),children:[e.jsx(Ka,{value:g.apiKey||"",saved:g.hasApiKey&&!g.clearApiKey,onChange:c=>{let f=Le(t,"x-jishushell.proxy.upstream.apiKey",c);c&&(f=Le(f,"x-jishushell.proxy.upstream.clearApiKey",!1)),n(f)},baseUrl:g.baseUrl||(F==null?void 0:F.baseUrl)||"",api:g.api||(F==null?void 0:F.api)||"",authHeader:typeof g.authHeader=="string"?g.authHeader:void 0,providerId:b,placeholder:x("configForm.enterApiKey"),selectedModelId:L}),g.hasApiKey&&e.jsx("button",{type:"button",onClick:()=>{let c=Le(t,"x-jishushell.proxy.upstream.apiKey","");c=Le(c,"x-jishushell.proxy.upstream.clearApiKey",!g.clearApiKey),n(c)},className:`mt-2 text-xs ${g.clearApiKey?"text-red-400":"text-muted hover:text-foreground"} transition-colors`,children:g.clearApiKey?x("configForm.markedForClear"):x("configForm.clearSavedApiKey")})]}),I.length>0&&e.jsx(ie,{label:x("configForm.upstreamModel"),hint:x("configForm.upstreamModelHint"),children:e.jsx(at,{value:L,onChange:J,children:I.map(c=>e.jsxs("option",{value:c.id,children:[c.name," (",Math.round(c.contextWindow/1e3),"K)"]},c.id))})})]}),C&&["ollama","vllm","sglang"].includes(b)&&e.jsxs("div",{className:"space-y-4 border-t border-[var(--border)] pt-4",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsx(ie,{label:"Base URL",hint:x("configForm.localServiceAddress"),children:e.jsx(Me,{value:g.baseUrl||"",onChange:c=>X("baseUrl",c),placeholder:"http://127.0.0.1:11434",mono:!0})}),e.jsx(ie,{label:x("configForm.apiProtocol"),children:e.jsxs(at,{value:g.api||"openai-completions",onChange:c=>X("api",c),children:[e.jsx("option",{value:"openai-completions",children:"OpenAI Compatible"}),e.jsx("option",{value:"ollama",children:"Ollama"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(ie,{label:x("configForm.modelId"),hint:x("configForm.modelIdHint"),children:e.jsx(Me,{value:M.id==="default"?"":M.id,onChange:c=>{const f=[...P],w=f.findIndex(K=>K.id===L);w>=0?f[w]={...M,id:c||"default"}:f.push({id:c||"default",name:c||"default",contextWindow:M.contextWindow||0});let _=Le(t,"x-jishushell.proxy.upstream.models",f);_=Le(_,"x-jishushell.proxy.upstream.selectedModelId",c||"default"),n(_)},placeholder:"llama3",mono:!0})}),e.jsx(ie,{label:x("configForm.modelName"),children:e.jsx(Me,{value:M.name==="default"?"":M.name||"",onChange:c=>{const f=[...P],w=f.findIndex(_=>_.id===L);w>=0?f[w]={...M,name:c||M.id}:f.push({id:M.id||"default",name:c||"default",contextWindow:M.contextWindow||0}),X("models",f)},placeholder:x("configForm.modelNamePlaceholder")})}),e.jsx(ie,{label:x("configForm.contextWindow"),children:e.jsx(Me,{value:String(M.contextWindow||""),onChange:c=>{const f=[...P],w=f.findIndex(_=>_.id===L);w>=0?f[w]={...M,contextWindow:parseInt(c,10)||0}:f.push({id:M.id||"default",name:M.name||"default",contextWindow:parseInt(c,10)||0}),X("models",f)},placeholder:"128000",mono:!0})})]})]}),C&&!["ollama","vllm","sglang"].includes(b)&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>v(!le),className:"text-xs text-muted hover:text-foreground transition-colors",children:x(le?"configForm.collapseAdvanced":"configForm.advancedOptions")}),le&&e.jsxs("div",{className:"space-y-4 border-t border-[var(--border)] pt-4",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsx(ie,{label:x("configForm.upstreamBaseUrl"),children:e.jsx(Me,{value:g.baseUrl||"",onChange:c=>X("baseUrl",c),placeholder:x("configForm.baseUrlPlaceholder"),mono:!0})}),e.jsx(ie,{label:x("configForm.upstreamApiProtocol"),children:e.jsxs(at,{value:g.api||"openai-completions",onChange:c=>X("api",c),children:[e.jsx("option",{value:"openai-completions",children:"OpenAI Compatible"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"}),e.jsx("option",{value:"google-generative-ai",children:"Google Generative AI"}),e.jsx("option",{value:"ollama",children:"Ollama"})]})})]}),b&&e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(ie,{label:x("configForm.modelId"),children:e.jsx(Me,{value:M.id,onChange:c=>{const f=[...P],w=f.findIndex(K=>K.id===L);w>=0?f[w]={...M,id:c}:f.push({...M,id:c});let _=Le(t,"x-jishushell.proxy.upstream.models",f);_=Le(_,"x-jishushell.proxy.upstream.selectedModelId",c),n(_)},placeholder:"model-id",mono:!0})}),e.jsx(ie,{label:x("configForm.modelName"),children:e.jsx(Me,{value:M.name||"",onChange:c=>{const f=[...P],w=f.findIndex(_=>_.id===L);w>=0?f[w]={...M,name:c}:f.push({...M,name:c}),X("models",f)},placeholder:"Model Name"})}),e.jsx(ie,{label:x("configForm.contextWindow"),children:e.jsx(Me,{value:String(M.contextWindow||""),onChange:c=>{const f=[...P],w=f.findIndex(_=>_.id===L);w>=0?f[w]={...M,contextWindow:parseInt(c,10)||0}:f.push({...M,contextWindow:parseInt(c,10)||0}),X("models",f)},placeholder:"200000",mono:!0})})]}),e.jsx("div",{className:"text-xs text-muted bg-[var(--card)] border border-[var(--border)] rounded-md p-3",children:x("configForm.proxyNote")})]})]})]}),e.jsxs(As,{title:x("configForm.imChannelConfig"),id:"im-channel-section",children:[e.jsx(ie,{label:x("configForm.sessionIsolation"),hint:x("configForm.sessionIsolationHint"),children:e.jsxs(at,{value:((de=t==null?void 0:t.session)==null?void 0:de.dmScope)||"main",onChange:c=>y("session.dmScope",c),children:[e.jsx("option",{value:"main",children:x("configForm.sessionMain")}),e.jsx("option",{value:"per-peer",children:x("configForm.sessionPerPeer")}),e.jsx("option",{value:"per-channel-peer",children:x("configForm.sessionPerChannelPeer")}),e.jsx("option",{value:"per-account-channel-peer",children:x("configForm.sessionPerAccountChannelPeer")})]})}),Dt.map(c=>{rt.find(Q=>Q.id===c);const f=x(`configForm.channel.${c}`,{defaultValue:c}),w=k[c]||{enabled:!0},_=w.enabled!==!1,K=Wa[c]||c,oe=s[K],T=c==="openclaw-weixin"?"#07C160":"#3370FF";return e.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:f}),e.jsx("span",{className:"text-[11px] text-muted font-mono",children:c})]}),e.jsx(_s,{checked:_,onChange:Q=>{k[c]||H(c),W(c,"enabled",Q)},label:x(_?"common:label.enabled":"common:label.disabled")})]}),_&&(oe==="installing"?e.jsx("div",{className:"rounded-md px-4 py-3",style:{background:`${T}10`,borderColor:`${T}30`,borderWidth:1,borderStyle:"solid"},children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:T},children:[e.jsx("div",{className:"w-4 h-4 border-2 rounded-full animate-spin",style:{borderColor:`${T}30`,borderTopColor:T}}),e.jsx("span",{children:x("configForm.pluginInstalling",{label:f})})]})}):oe!=="installed"?e.jsxs("div",{className:"rounded-md px-4 py-3",style:{background:`${T}08`,borderColor:`${T}30`,borderWidth:1,borderStyle:"dashed"},children:[e.jsx("button",{onClick:()=>i==null?void 0:i(K),className:"px-4 py-2 text-white rounded-md text-xs font-medium hover:opacity-90 transition-opacity",style:{background:T},children:x("configForm.installPlugin",{label:f})}),e.jsx("p",{className:"text-xs text-muted mt-2",children:x("configForm.installPluginHint",{label:f})})]}):e.jsxs(e.Fragment,{children:[(c==="feishu"||c==="lark")&&e.jsx(Va,{instanceId:o,channelKey:c,existingAppId:w.appId,existingDomain:w.domain||c,onConfigured:()=>{o&&ys(async()=>{const{getConfig:Q}=await import("./index-CCkaIEjn.js").then(se=>se.aJ);return{getConfig:Q}},__vite__mapDeps([0,1,2,3])).then(({getConfig:Q})=>{Q(o).then(se=>{se&&n(se)})})}}),c==="openclaw-weixin"&&e.jsx(Oa,{instanceId:o,onConfigured:()=>{o&&ys(async()=>{const{getConfig:Q}=await import("./index-CCkaIEjn.js").then(se=>se.aJ);return{getConfig:Q}},__vite__mapDeps([0,1,2,3])).then(({getConfig:Q})=>{Q(o).then(se=>{se&&n(se)})})}})]}))]},c)}),E.filter(c=>!Dt.includes(c)).map(c=>{const f=k[c],w=rt.find(T=>T.id===c),_=x(`configForm.channel.${c}`,{defaultValue:c}),K=(w==null?void 0:w.fields)||[],oe=w?[]:Object.keys(f).filter(T=>T!=="enabled"&&typeof f[T]=="string");return e.jsxs("div",{className:"border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:_}),w&&e.jsx("span",{className:"text-[11px] text-muted font-mono",children:c})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(_s,{checked:f.enabled!==!1,onChange:T=>W(c,"enabled",T),label:f.enabled!==!1?x("common:label.enabled"):x("common:label.disabled")}),e.jsx("button",{onClick:()=>ce(c),className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:x("configForm.remove")})]})]}),f.enabled!==!1&&K.length>0&&e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:K.map(T=>e.jsx(ie,{label:T.label,children:e.jsx(Me,{value:f[T.key]||"",onChange:Q=>W(c,T.key,Q),placeholder:T.placeholder,type:T.type||"text",mono:!0})},T.key))}),f.enabled!==!1&&oe.length>0&&e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:oe.map(T=>e.jsx(ie,{label:T,children:e.jsx(Me,{value:f[T]||"",onChange:Q=>W(c,T,Q),placeholder:T,type:T.toLowerCase().includes("secret")||T.toLowerCase().includes("token")||T.toLowerCase().includes("password")?"password":"text",mono:!0})},T))}),f.enabled!==!1&&c==="whatsapp"&&K.length===0&&e.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-md px-3 py-2 text-xs text-amber-400",children:[e.jsx("p",{className:"font-medium mb-1",children:x("configForm.whatsappTitle")}),e.jsx("p",{children:x("configForm.whatsappHint")})]})]},c)}),e.jsxs("div",{className:"pt-2",children:[e.jsx("p",{className:"text-xs text-muted mb-2",children:x("configForm.addImChannel")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:rt.filter(c=>{if(Dt.includes(c.id))return!1;const f=q[c.id]||c.id;return!E.includes(f)&&!E.includes(c.id)}).map(c=>e.jsxs("button",{onClick:()=>H(c.id),className:"px-3 py-1.5 text-xs border border-dashed rounded-md transition-colors duration-150 border-[var(--border)] text-muted hover:border-[var(--border-hover)] hover:text-foreground",children:["+ ",x(c.labelKey,{defaultValue:c.id})]},c.id))})]})]})]})}const Ja="im",za="即时通讯",Ga="💬",Qa=[{id:"feishu",label:"飞书 / Lark",desc:"飞书机器人(WebSocket 模式)"},{id:"openclaw-weixin",label:"微信",desc:"微信扫码接入"}],Ya={id:Ja,label:za,emoji:Ga,items:Qa},Xa="skills",Za="常用 Skill",er="⚡",tr=[{id:"hubs",label:"热门Hub",emoji:"🌐",skills:[{id:"clawhub",type:"hub",label:"ClawHub",desc:"OpenClaw 官方 Skill 市场",url:"https://clawhub.ai/",installMsg:""},{id:"skillhub-tencent",type:"hub",label:"腾讯 SkillHub",desc:"腾讯技能中心,官方出品",url:"https://skillhub.tencent.com/",installMsg:""},{id:"skills-sh",type:"hub",label:"Skills.sh",desc:"第三方 Skill 聚合社区",url:"https://skills.sh/",installMsg:""},{id:"lobehub-skills",type:"hub",label:"LobeHub Skills",desc:"LobeHub 社区 Skill 市场",url:"https://lobehub.com/skills",installMsg:""},{id:"findskills",type:"hub",label:"FindSkills.org",desc:"开源 Skill 搜索与聚合平台",url:"https://www.findskills.org/",installMsg:""},{id:"playbooks-skills",type:"hub",label:"Playbooks Skills",desc:"Playbooks 社区 Skill 目录",url:"https://playbooks.com/skills",installMsg:""}]},{id:"general",label:"通用基础",emoji:"🧠",skills:[{id:"skill-vetter",label:"Skill Vetter",desc:"安全审计 Skill,安装前建议先审查",installMsg:"根据以下链接安装skill:https://clawhub.ai/spclaudehome/skill-vetter",autoInstall:!0,slashCmd:"/skill-vetter",checkDirs:["skill-vetter","Skill Vetter","SkillVetter","vetter"]},{id:"self-improving-agent-cn",label:"Self-Improving CN Agent",desc:"自我优化的 Agent,持续改进任务执行",installMsg:"根据以下链接安装skill:https://clawhub.ai/zhengxinjipai/self-improving-agent-cn",autoInstall:!0,slashCmd:"/self-improving-agent-cn",checkDirs:["self-improving-agent-cn","SelfImprovingAgentCn","self_improving_agent_cn"]},{id:"proactive-agent",label:"Proactive Agent",desc:"主动式 Agent,自动感知并提前完成任务",installMsg:"根据以下链接安装skill:https://clawhub.ai/bestrocky/proactive-agent-lite",autoInstall:!0,slashCmd:"/proactive-agent",checkDirs:["proactive-agent-lite","proactive-agent","ProactiveAgent","proactive_agent"]},{id:"multi-search-engine",label:"Multi Search Engine",desc:"多搜索引擎聚合搜索",installMsg:"根据以下链接安装skill:https://clawhub.ai/gpyangyoujun/multi-search-engine",autoInstall:!0,slashCmd:"/multi-search-engine",checkDirs:["multi-search-engine","MultiSearchEngine","multi_search_engine"]},{id:"exa-web-search-free",label:"Exa Web Search Free",desc:"免费 Exa 网页语义搜索",installMsg:"根据以下链接安装skill:https://clawhub.ai/whiteknight07/exa-web-search-free",autoInstall:!0,slashCmd:"/exa-web-search-free",checkDirs:["exa-web-search-free","ExaWebSearchFree","exa_web_search_free"]},{id:"filesystem",label:"Filesystem",desc:"本地文件系统读写与管理",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/filesystem",autoInstall:!0,slashCmd:"/filesystem",checkDirs:["filesystem","steipete-filesystem"]},{id:"summarize",label:"Summarize",desc:"内容摘要与总结提炼",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/summarize",autoInstall:!0,slashCmd:"/summarize",checkDirs:["summarize","steipete-summarize"]},{id:"baidu-search",label:"百度搜索",desc:"百度搜索引擎集成",installMsg:"根据以下链接安装skill:https://clawhub.ai/ide-rea/baidu-search",autoInstall:!0,slashCmd:"/baidu-search",checkDirs:["baidu-search","BaiduSearch"]},{id:"agent-browser-clawdbot",label:"Agent Browser",desc:"AI 驱动的网页浏览与自动化操作",installMsg:"根据以下链接安装skill:https://clawhub.ai/matrixy/agent-browser-clawdbot",autoInstall:!0,slashCmd:"/agent-browser-clawdbot",checkDirs:["agent-browser-clawdbot","agent-browser","AgentBrowser"]},{id:"automation-workflows",label:"Automation Workflows",desc:"自动化工作流编排与执行",installMsg:"根据以下链接安装skill:https://clawhub.ai/jk-0001/automation-workflows",autoInstall:!0,slashCmd:"/automation-workflows",checkDirs:["automation-workflows","AutomationWorkflows"]},{id:"evolver",label:"Evolver",desc:"Agent 自动进化与能力迭代",installMsg:"根据以下链接安装skill:https://clawhub.ai/autogame-17/evolver",autoInstall:!0,slashCmd:"/evolver",checkDirs:["evolver","autogame-evolver"]}]},{id:"productivity",label:"工作效率",emoji:"💼",skills:[{id:"pdf-reader",label:"PDF Reader",desc:"PDF 文档读取与分析",installMsg:"根据以下链接安装skill:https://clawhub.ai/awspace/pdf",autoInstall:!0,slashCmd:"/pdf",checkDirs:["pdf","pdf-reader","awspace-pdf"]},{id:"powerpoint-pptx",label:"PowerPoint / PPTX",desc:"PPT 演示文稿生成与编辑",installMsg:"根据以下链接安装skill:https://clawhub.ai/ivangdavila/powerpoint-pptx",autoInstall:!0,slashCmd:"/powerpoint-pptx",checkDirs:["powerpoint-pptx","powerpoint","pptx"]},{id:"word-docx",label:"Word / DOCX",desc:"Word 文档生成与编辑",installMsg:"根据以下链接安装skill:https://clawhub.ai/ivangdavila/word-docx",autoInstall:!0,slashCmd:"/word-docx",checkDirs:["word-docx","word","docx"]},{id:"excel-xlsx",label:"Excel / XLSX",desc:"Excel 表格生成与数据处理",installMsg:"根据以下链接安装skill:https://clawhub.ai/ivangdavila/excel-xlsx",autoInstall:!0,slashCmd:"/excel-xlsx",checkDirs:["excel-xlsx","excel","xlsx"]},{id:"ai-ppt-generator",label:"AI PPT Generator",desc:"AI 自动生成 PPT 演示文稿",installMsg:"根据以下链接安装skill:https://clawhub.ai/ide-rea/ai-ppt-generator",autoInstall:!0,slashCmd:"/ai-ppt-generator",checkDirs:["ai-ppt-generator","AiPptGenerator"]},{id:"nano-banana-pro",label:"Nano Banana Pro",desc:"轻量高效的任务执行与流程优化",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/nano-banana-pro",autoInstall:!0,slashCmd:"/nano-banana-pro",checkDirs:["nano-banana-pro","NanoBananaPro"]},{id:"ppt-generator",label:"PPT Generator",desc:"PPT 演示文稿智能生成",installMsg:"根据以下链接安装skill:https://clawhub.ai/wwlyzzyorg/ppt-generator",autoInstall:!0,slashCmd:"/ppt-generator",checkDirs:["ppt-generator","PptGenerator"]},{id:"marketing-mode",label:"Marketing Mode",desc:"营销文案与推广内容创作",installMsg:"根据以下链接安装skill:https://clawhub.ai/thesethrose/marketing-mode",autoInstall:!0,slashCmd:"/marketing-mode",checkDirs:["marketing-mode","MarketingMode"]},{id:"data-analysis",label:"Data Analysis",desc:"数据分析与可视化报告生成",installMsg:"根据以下链接安装skill:https://clawhub.ai/ivangdavila/data-analysis",autoInstall:!0,slashCmd:"/data-analysis",checkDirs:["data-analysis","DataAnalysis"]}]},{id:"life",label:"生活辅助",emoji:"🏠",skills:[{id:"todo-manager",label:"Todo Manager",desc:"任务与待办事项管理",installMsg:"根据以下链接安装skill:https://clawhub.ai/aeoleader/todo-manager",autoInstall:!0,slashCmd:"/todo-manager",checkDirs:["todo-manager","todo","TodoManager"]},{id:"12306",label:"12306 火车票",desc:"查询与购买 12306 火车票",installMsg:"根据以下链接安装skill:https://clawhub.ai/kirorab/12306",autoInstall:!0,slashCmd:"/12306",checkDirs:["12306","kirorab-12306"]},{id:"youtube-watcher",label:"YouTube Watcher",desc:"YouTube 视频摘要与内容分析",installMsg:"根据以下链接安装skill:https://clawhub.ai/michaelgathara/youtube-watcher",autoInstall:!0,slashCmd:"/youtube-watcher",checkDirs:["youtube-watcher","youtube","YoutubeWatcher"]},{id:"xiaohongshu-cn",label:"小红书助手",desc:"小红书内容创作与运营辅助",installMsg:"根据以下链接安装skill:https://clawhub.ai/guohongbin-git/xiaohongshu-cn",autoInstall:!0,slashCmd:"/xiaohongshu-cn",checkDirs:["xiaohongshu-cn","xiaohongshu","XiaohongshuCn"]},{id:"wechat-mp-cn",label:"微信公众号助手",desc:"微信公众号内容创作与发布辅助",installMsg:"根据以下链接安装skill:https://clawhub.ai/guohongbin-git/wechat-mp-cn",autoInstall:!0,slashCmd:"/wechat-mp-cn",checkDirs:["wechat-mp-cn","wechat-mp","WechatMpCn"]},{id:"weather",label:"Weather",desc:"实时天气查询与预报",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/weather",autoInstall:!0,slashCmd:"/weather",checkDirs:["weather","steipete-weather"]},{id:"stock-analysis",label:"Stock Analysis",desc:"股票行情分析与投资参考",installMsg:"根据以下链接安装skill:https://clawhub.ai/udiedrichsen/stock-analysis",autoInstall:!0,slashCmd:"/stock-analysis",checkDirs:["stock-analysis","StockAnalysis"]},{id:"news-summary",label:"News Summary",desc:"新闻资讯聚合与摘要生成",installMsg:"根据以下链接安装skill:https://clawhub.ai/joargp/news-summary",autoInstall:!0,slashCmd:"/news-summary",checkDirs:["news-summary","NewsSummary"]}]},{id:"dev",label:"开发工具",emoji:"🛠️",skills:[{id:"github",label:"GitHub",desc:"GitHub 仓库管理与代码协作",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/github",autoInstall:!0,slashCmd:"/github",checkDirs:["github","GitHub","steipete-github"]},{id:"gemini",label:"Gemini",desc:"Google Gemini 模型接入与调用",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/gemini",autoInstall:!0,slashCmd:"/gemini",checkDirs:["gemini","Gemini","steipete-gemini"]},{id:"api-gateway",label:"API Gateway",desc:"API 接口管理与请求代理",installMsg:"根据以下链接安装skill:https://clawhub.ai/byungkyu/api-gateway",autoInstall:!0,slashCmd:"/api-gateway",checkDirs:["api-gateway","ApiGateway"]},{id:"mcporter",label:"MCPorter",desc:"MCP 服务器管理工具",installMsg:"根据以下链接安装skill:https://clawhub.ai/steipete/mcporter",autoInstall:!0,slashCmd:"/mcporter",checkDirs:["mcporter","MCPorter","steipete-mcporter"]},{id:"session-logs",label:"Session Logs",desc:"会话日志记录与回放分析",installMsg:"根据以下链接安装skill:https://clawhub.ai/guogang1024/session-logs",autoInstall:!0,slashCmd:"/session-logs",checkDirs:["session-logs","SessionLogs"]}]}],ht={id:Xa,label:Za,emoji:er,groups:tr},sr="mcp",ar="常用 MCP",rr="🔌",nr=[{id:"12306-mcp",label:"12306-MCP车票查询工具",desc:"12306-MCP车票查询工具",mcpJson:{"12306-mcp":{command:"npx",args:["-y","12306-mcp"]}}},{id:"bing-search",label:"Bing 搜索",desc:"必应搜索引擎 MCP 接入",mcpJson:{"bing-search":{command:"npx",args:["-y","bing-cn-mcp"]}}},{id:"fxbaogao-mcp",label:"发现报告",desc:"发现报告研究报告检索与阅读",mcpJson:{"fxbaogao-mcp":{command:"uvx",args:["fxbaogao-mcp@latest"]}}}],lr={id:sr,label:ar,emoji:rr,items:nr},or="slash",ir="常用 /命令",cr="/",dr=[{label:"会话",items:[{id:"slash-new",label:"/new",desc:"开启新会话",cmd:"/new",send:!0},{id:"slash-reset",label:"/reset",desc:"重置当前会话",cmd:"/reset",send:!0},{id:"slash-compact",label:"/compact",desc:"压缩会话上下文",cmd:"/compact",send:!0},{id:"slash-stop",label:"/stop",desc:"停止当前运行",cmd:"/stop",send:!0},{id:"slash-clear",label:"/clear",desc:"清空聊天记录",cmd:"/clear",send:!0},{id:"slash-focus",label:"/focus",desc:"切换专注模式",cmd:"/focus",send:!0}]},{label:"模型",items:[{id:"slash-model",label:"/model <name>",desc:"查看或切换模型",cmd:"/model ",send:!1},{id:"slash-think",label:"/think <level>",desc:"设置思考深度",cmd:"/think ",send:!1},{id:"slash-verbose",label:"/verbose <on|off|full>",desc:"切换详细输出模式",cmd:"/verbose ",send:!1},{id:"slash-fast",label:"/fast <status|on|off>",desc:"切换快速模式",cmd:"/fast ",send:!1}]},{label:"工具",items:[{id:"slash-help",label:"/help",desc:"查看可用命令",cmd:"/help",send:!0},{id:"slash-status",label:"/status",desc:"显示会话状态(agent)",cmd:"/status",send:!0},{id:"slash-export",label:"/export",desc:"导出会话为 Markdown",cmd:"/export",send:!0},{id:"slash-usage",label:"/usage",desc:"显示 Token 用量",cmd:"/usage",send:!0}]}],ur={id:or,label:ir,emoji:cr,groups:dr};function mr({gatewayLaunchUrl:t,gatewayReady:n,isRunning:o,isPending:u,iframeLoaded:s,actionLoading:i,onAction:x,onReload:y,onIframeLoad:r}){const{t:g}=me("instance");return e.jsx("div",{className:"overflow-hidden rounded-[22px] border border-[var(--border)] bg-[var(--card)] shadow-[0_18px_48px_rgba(15,23,42,0.06)]",children:e.jsxs("div",{className:"relative",style:{height:"calc(100vh - 160px)",minHeight:"500px"},children:[(!o||!n||!s)&&e.jsx("div",{className:`absolute inset-0 w-full h-full bg-[var(--card)] flex flex-col items-center justify-center z-10 transition-opacity duration-300 ${s?"opacity-0 pointer-events-none":"opacity-100"}`,children:o?n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin mb-3"}),e.jsx("div",{className:"text-sm text-foreground/60",children:g("chat.loadingChat")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-5 h-5 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin mb-3"}),e.jsx("div",{className:"text-sm text-foreground/60",children:g("chat.waitingGateway")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-4xl mb-4 opacity-40",children:"💬"}),e.jsx("div",{className:"text-sm text-foreground/60 font-medium mb-1",children:g("chat.notReady")}),e.jsx("div",{className:"text-xs text-muted mb-4",children:g("chat.startHint")}),e.jsx("button",{onClick:()=>x("start"),disabled:!!i||u,className:"px-4 py-2 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:g(i==="start"||u?"action.starting":"chat.startInstance")})]})}),n&&t&&e.jsx("iframe",{id:"gateway-iframe",src:t,className:"w-full h-full",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-downloads allow-modals",allow:"microphone; camera; clipboard-write",onLoad:r})]})})}function xr(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([n,o])=>({group:n,items:Array.isArray(o)?o.map(u=>typeof u=="string"?{cmd:u,label:u}:!u||typeof u!="object"||typeof u.cmd!="string"||!u.cmd.trim()?null:{cmd:u.cmd.trim(),label:typeof u.label=="string"&&u.label.trim()?u.label.trim():u.cmd.trim(),description:typeof u.description=="string"&&u.description.trim()?u.description.trim():void 0}).filter(u=>!!u):[]})).filter(n=>n.items.length>0)}function pr({instanceId:t,provide:n,isRunning:o}){var H,ce,le;const[u,s]=d.useState(""),[i,x]=d.useState(((ce=(H=n.terminal)==null?void 0:H.prompt)==null?void 0:ce.trim())||"shell"),[y,r]=d.useState(null),[g,b]=d.useState(!1),[F,P]=d.useState(()=>{var V,Z;const v=[],C=(Z=(V=n.terminal)==null?void 0:V.welcome)==null?void 0:Z.trim();return C&&v.push({id:1,kind:"status",text:C}),v}),I=d.useRef(null),L=d.useRef(null),R=d.useRef(F.length+1),M=d.useRef(0),Y=d.useRef(null),ue=d.useMemo(()=>{var v;return xr((v=n.terminal)==null?void 0:v.commands)},[(le=n.terminal)==null?void 0:le.commands]),J=(v,C,V=!1)=>{const Z=C.trimEnd();Z.trim()&&P(z=>{if(V&&z.length>0){const D=z[z.length-1];if(D.kind===v){const G=[...z];return G[G.length-1]={...D,text:Z},G}}return[...z,{id:R.current++,kind:v,text:Z}]})},X=()=>{var v;(v=I.current)==null||v.close(),I.current=null},k=v=>{X();const C=ta(`/api/instances/${encodeURIComponent(t)}/provides/${encodeURIComponent(n.capability)}/terminal/session/${encodeURIComponent(v)}/stream?since=${M.current}`),V=new EventSource(C,{withCredentials:sa()});I.current=V;const Z=z=>D=>{try{const G=JSON.parse(D.data);typeof(G==null?void 0:G.seq)=="number"&&(M.current=Math.max(M.current,G.seq)),typeof(G==null?void 0:G.text)=="string"&&G.text&&J(z,G.text,(G==null?void 0:G.replace)===!0)}catch{typeof D.data=="string"&&D.data&&J(z,D.data)}};V.addEventListener("stdout",Z("stdout")),V.addEventListener("stderr",Z("stderr")),V.addEventListener("error",z=>{const D=z instanceof MessageEvent?z.data:"";typeof D=="string"&&D&&J("stderr",D),r(null),L.current=null,X()}),V.addEventListener("exit",z=>{try{const D=JSON.parse(z.data);typeof(D==null?void 0:D.seq)=="number"&&(M.current=Math.max(M.current,D.seq)),J("status",`process exited with code ${(D==null?void 0:D.exitCode)??"unknown"}`)}catch{J("status","process exited")}r(null),L.current=null,X()}),V.addEventListener("done",()=>{r(null),L.current=null,X()})},E=async v=>{const C=v.trim();if(!(!C||g||!o)){b(!0);try{J("cmd",`${i}> ${C}`);const V=await Zs(t,n.capability,{input:C});x(V.prompt||i),r(V.sessionId),L.current=V.sessionId,M.current=0,k(V.sessionId),s("")}catch(V){J("stderr",(V==null?void 0:V.message)||"failed to start terminal session")}finally{b(!1)}}},W=async()=>{const v=u.trim();if(!(g||!o)){if(!y){await E(v);return}b(!0);try{J("cmd",`${i}> ${v}`),await ea(t,n.capability,y,{input:v}),s("")}catch(C){J("stderr",(C==null?void 0:C.message)||"failed to send terminal input")}finally{b(!1)}}},q=async()=>{if(!(!y||g)){b(!0);try{await js(t,n.capability,y),J("status","session stopped")}catch(v){J("stderr",(v==null?void 0:v.message)||"failed to stop terminal session")}finally{b(!1)}}};return d.useEffect(()=>{const v=Y.current;if(v){if(typeof v.scrollTo=="function"){v.scrollTo({top:v.scrollHeight});return}v.scrollTop=v.scrollHeight}},[F]),d.useEffect(()=>()=>{const v=L.current;X(),v&&js(t,n.capability,v).catch(()=>{})},[t,n.capability]),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[280px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-4",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Ollama Commands"}),e.jsx("div",{className:"mt-1 text-xs text-muted",children:"点击左侧命令会自动写入终端并执行。"})]}),e.jsx("div",{className:"space-y-4",children:ue.map(v=>e.jsxs("section",{children:[e.jsx("div",{className:"mb-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-foreground/55",children:v.group}),e.jsx("div",{className:"space-y-2",children:v.items.map(C=>e.jsxs("button",{type:"button",disabled:!o||!!y||g,onClick:()=>{s(C.cmd),E(C.cmd)},className:"w-full rounded-2xl border border-[var(--border)] bg-black/[0.03] px-3 py-2 text-left transition hover:border-[#0066FF]/35 hover:bg-[#0066FF]/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("div",{className:"font-mono text-xs text-foreground",children:C.label}),C.description&&e.jsx("div",{className:"mt-1 text-[11px] leading-5 text-muted",children:C.description})]},`${v.group}:${C.cmd}`))})]},v.group))})]}),e.jsxs("section",{className:"rounded-[22px] border border-[var(--border)] bg-[#09111f] text-[#d7e3ff] shadow-[0_18px_60px_rgba(4,12,24,0.28)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-white/10 px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold text-white",children:n.description||"Ollama Terminal"}),e.jsx("div",{className:"mt-1 text-xs text-[#9cb3d9]",children:"支持直接输入 `ollama` 子命令;输入 `ollama list` 或 `list` 都可以。"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#9cb3d9]",children:[e.jsx("span",{className:`inline-flex h-2.5 w-2.5 rounded-full ${o?"bg-[#39d98a]":"bg-[#ff6b6b]"}`}),e.jsx("span",{children:o?y?"session running":"ready":"service stopped"}),e.jsx("button",{type:"button",onClick:()=>void q(),disabled:!y||g,className:"rounded-full border border-white/15 px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-white transition hover:border-white/35 disabled:cursor-not-allowed disabled:opacity-45",children:"Stop"})]})]}),e.jsx("div",{ref:Y,className:"h-[520px] overflow-y-auto px-4 py-4 font-mono text-sm leading-6",children:F.length===0?e.jsxs("div",{className:"text-[#9cb3d9]",children:[i,"> 输入 `list`、`ps`、`pull gemma4:e4b` 或 `run gemma4:e2b` 开始。"]}):F.map(v=>e.jsx("div",{className:v.kind==="stderr"?"whitespace-pre-wrap text-[#ff9c9c]":v.kind==="cmd"?"whitespace-pre-wrap text-[#7fd0ff]":v.kind==="status"?"whitespace-pre-wrap text-[#9cb3d9]":"whitespace-pre-wrap text-[#d7e3ff]",children:v.text},v.id))}),e.jsxs("div",{className:"border-t border-white/10 px-4 py-4",children:[!o&&e.jsx("div",{className:"mb-3 rounded-2xl border border-[#ff6b6b]/25 bg-[#ff6b6b]/10 px-3 py-2 text-sm text-[#ffc2c2]",children:"当前实例未运行,先启动 Ollama 服务后才能执行命令。"}),e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 rounded-2xl border border-white/10 bg-black/20 px-3 py-2",children:[e.jsx("div",{className:"mb-1 text-[11px] uppercase tracking-[0.18em] text-[#7f97c2]",children:y?"stdin":"command"}),e.jsx("textarea",{value:u,onChange:v=>s(v.target.value),onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),W())},rows:y?2:1,disabled:!o||g,placeholder:y?"向当前 ollama 会话发送一行输入":"例如:list / pull qwen3.6:35b / run gemma4:e2b",className:"w-full resize-none border-0 bg-transparent p-0 font-mono text-sm text-[#e8f0ff] outline-none placeholder:text-[#7188b2]"})]}),e.jsx("button",{type:"button",onClick:()=>void W(),disabled:!o||g||!u.trim(),className:"rounded-2xl bg-[#0066FF] px-4 py-3 text-sm font-semibold text-white transition hover:bg-[#0052cc] disabled:cursor-not-allowed disabled:opacity-50",children:y?"Send":"Run"})]})]})]})]})}function fr({logs:t,logSearch:n,logType:o,logsEndRef:u,onSearchChange:s,onLogTypeChange:i,onRefresh:x,onCopy:y}){const{t:r}=me("instance"),g=n?t.filter(b=>b.toLowerCase().includes(n.toLowerCase())):t;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(aa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted"}),e.jsx("input",{type:"text",value:n,onChange:b=>s(b.target.value),placeholder:r("logs.searchPlaceholder"),className:"w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md pl-9 pr-3 py-1.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors"})]}),e.jsx("div",{className:"flex items-center gap-1",children:["stderr","stdout"].map(b=>e.jsx("button",{onClick:()=>i(b),className:`px-2.5 py-1.5 text-xs rounded-md transition-colors duration-150 ${o===b?"bg-[#0066FF] text-white":"text-muted hover:bg-[var(--card-hover)]"}`,children:b},b))}),e.jsx("button",{onClick:x,className:"p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-colors",title:r("common:action.refresh"),children:e.jsx(Os,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:y,className:"p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-colors",title:r("common:action.copyAll"),children:e.jsx(ra,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{className:"bg-black/60 border border-[var(--border)] rounded-xl font-mono text-[13px] p-4 min-h-[400px] lg:min-h-[500px] overflow-auto max-h-[70vh]",children:[g.length===0?e.jsx("p",{className:"text-muted",children:r("logs.empty")}):g.map((b,F)=>{const P=/error|ERR|panic|fatal/i.test(b),I=/warn|WARN/i.test(b);return e.jsx("div",{className:`whitespace-pre-wrap break-all leading-5 ${P?"text-red-400 bg-red-950/20":I?"text-amber-400":"text-foreground opacity-70"}`,children:b},`${F}-${b.slice(0,32)}`)}),e.jsx("div",{ref:u})]})]})}function hr({usage:t,onRefresh:n}){const{t:o}=me("instance");if(!t)return e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[1,2,3].map(s=>e.jsx("div",{className:"h-20 bg-[var(--card)] rounded-lg"},s))}),e.jsx("div",{className:"h-60 bg-[var(--card)] rounded-lg"})]})});const u=qa.language==="zh"?"zh-CN":"en-US";return e.jsxs("div",{className:"space-y-4",children:[t.totals.totalTokens===0&&t.totals.messages>0&&e.jsx("div",{className:"bg-[var(--card)] border border-[var(--border)] text-muted text-sm rounded-lg px-4 py-3",children:o("usage.noTokenData")}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-3",children:[{label:o("usage.messages"),value:t.totals.messages.toLocaleString()},{label:o("usage.totalTokens"),value:t.totals.totalTokens.toLocaleString()},{label:o("usage.totalCost"),value:`$${t.totals.costTotal.toFixed(4)}`}].map(s=>e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-4 hover:border-[var(--border-hover)] transition-colors",children:[e.jsx("div",{className:"text-xs text-muted mb-1",children:s.label}),e.jsx("div",{className:"text-2xl font-semibold text-foreground",children:s.value})]},s.label))}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-[var(--border)] flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o("usage.sessions")," (",t.sessions.length,")"]}),e.jsx("button",{onClick:n,className:"text-xs text-muted hover:text-foreground transition-colors",children:o("common:action.refresh")})]}),t.sessions.length===0?e.jsx("p",{className:"text-muted text-sm p-4",children:o("usage.noSessions")}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-xs text-muted border-b border-[var(--border)]",children:[e.jsx("th",{className:"text-left font-medium px-4 py-2",children:o("usage.time")}),e.jsx("th",{className:"text-left font-medium px-4 py-2",children:o("usage.model")}),e.jsx("th",{className:"text-left font-medium px-4 py-2",children:o("usage.source")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:o("usage.messagesShort")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:o("usage.input")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:o("usage.output")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:o("usage.tokens")}),e.jsx("th",{className:"text-right font-medium px-4 py-2",children:o("usage.cost")})]})}),e.jsx("tbody",{className:"divide-y divide-[var(--border)]",children:t.sessions.map(s=>e.jsxs("tr",{className:"hover:bg-[var(--card-hover)] transition-colors",children:[e.jsx("td",{className:"px-4 py-2 text-muted whitespace-nowrap",children:s.lastMessage?new Date(s.lastMessage).toLocaleString(u,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"}),e.jsx("td",{className:"px-4 py-2 font-mono text-xs text-muted",children:s.model||"-"}),e.jsxs("td",{className:"px-4 py-2 text-muted",children:[s.channel&&e.jsx("span",{className:"inline-block bg-[var(--card-hover)] text-muted text-[11px] px-1.5 py-0.5 rounded mr-1 font-medium",children:s.channel}),e.jsx("span",{className:"text-xs text-muted opacity-60",children:s.origin?s.origin.length>20?s.origin.slice(0,20)+"...":s.origin:""})]}),e.jsx("td",{className:"px-4 py-2 text-right tabular-nums text-muted",children:s.usage.messages}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-xs tabular-nums text-muted",children:s.usage.input.toLocaleString()}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-xs tabular-nums text-muted",children:s.usage.output.toLocaleString()}),e.jsx("td",{className:"px-4 py-2 text-right font-mono text-xs tabular-nums text-muted",children:s.usage.totalTokens.toLocaleString()}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs tabular-nums text-muted",children:["$",s.usage.costTotal.toFixed(4)]})]},s.key))})]})})]})]})}const br={llm:{iconEmoji:"🤖",labelKey:"connections.category.llm.label",descriptionKey:"connections.category.llm.description",leaveBlankKey:"connections.category.llm.leaveBlank",emptyMode:"installCta",presetApps:[{specId:"ollama",labelKey:"connections.preset.ollama"}]},search:{iconEmoji:"🔍",labelKey:"connections.category.search.label",descriptionKey:"connections.category.search.description",leaveBlankKey:"connections.category.search.leaveBlank",emptyMode:"installCta",presetApps:[{specId:"searxng-container",labelKey:"connections.preset.searxng"}]},browser:{iconEmoji:"🌐",labelKey:"connections.category.browser.label",descriptionKey:"connections.category.browser.description",leaveBlankKey:"connections.category.browser.leaveBlank",emptyMode:"installCta",presetApps:[{specId:"browserless-chromium-container",labelKey:"connections.preset.browserless"}]},mcp:{iconEmoji:"🧰",labelKey:"connections.category.mcp.label",descriptionKey:"connections.category.mcp.description",leaveBlankKey:"connections.category.mcp.leaveBlank",emptyMode:"mcpAddCta",presetApps:[],hidden:!0},files:{iconEmoji:"📁",labelKey:"connections.category.files.label",descriptionKey:"connections.category.files.description",leaveBlankKey:"connections.category.files.leaveBlank",emptyMode:"installCta",presetApps:[{specId:"filebrowser-container",labelKey:"connections.preset.filebrowser"}]},knowledge:{iconEmoji:"📚",labelKey:"connections.category.knowledge.label",descriptionKey:"connections.category.knowledge.description",leaveBlankKey:"connections.category.knowledge.leaveBlank",emptyMode:"installCta",presetApps:[{specId:"anythingllm-container",labelKey:"connections.preset.anythingllm"},{specId:"jishu-kb-container",labelKey:"connections.preset.jishu-kb"}]}},gr={iconEmoji:"⚙️",labelKey:"connections.category.default.label",descriptionKey:"connections.category.default.description",leaveBlankKey:"connections.category.default.leaveBlank",emptyMode:"noCta",presetApps:[]};function Lt(t){return br[t]??gr}function vr(t){return t.unboundRequired.length>0?"required":t.unboundOptional.length>0?"optional":"ok"}function yr(t){const{t:n}=me("instance");if(t.totalSlots===0)return null;const o=vr(t),u=o==="required"?"border-red-300 bg-red-50 dark:border-red-700 dark:bg-red-900/20":o==="optional"?"border-amber-300 bg-amber-50 dark:border-amber-700 dark:bg-amber-900/20":"border-green-300 bg-green-50 dark:border-green-700 dark:bg-green-900/20",s=o==="required"?"⚠":o==="optional"?"⚡":"●";if(o==="required"){const x=n("connections.healthBar.required",{slots:""}).replace(/\s*$/,"");return e.jsxs("div",{className:`mb-5 flex items-center justify-between gap-3 rounded-lg border px-4 py-2.5 text-sm ${u}`,"data-testid":"connections-health-bar","data-state":o,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":!0,children:s}),e.jsxs("span",{className:"font-medium",children:[x," ",t.unboundRequired.map((y,r)=>{var g;return e.jsxs("span",{title:((g=t.pendingReasons)==null?void 0:g[y])??void 0,children:[y,r<t.unboundRequired.length-1?", ":""]},y)})]})]}),e.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:["ⓘ ",n("connections.healthBar.restartHint")]})]})}let i;return o==="ok"?i=n("connections.healthBar.allOk",{bound:t.boundSlots,total:t.totalSlots}):i=n("connections.healthBar.optional",{bound:t.boundSlots,optional:t.unboundOptional.length}),e.jsxs("div",{className:`mb-5 flex items-center justify-between gap-3 rounded-lg border px-4 py-2.5 text-sm ${u}`,"data-testid":"connections-health-bar","data-state":o,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":!0,children:s}),e.jsx("span",{className:"font-medium",children:i})]}),e.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:["ⓘ ",n("connections.healthBar.restartHint")]})]})}const Ms="inline-block w-2 h-2 rounded-full bg-green-500 mr-1.5 align-middle",$s="inline-block w-2 h-2 rounded-full bg-gray-400 mr-1.5 align-middle";function jr({slot:t,value:n,onPick:o,onToggleMany:u}){const{t:s}=me("instance");if(t.cardinality==="many")return e.jsx("div",{className:"space-y-1.5",children:t.candidates.map(r=>{const g=(n==null?void 0:n.kind)==="many"&&n.providers.some(b=>b.providerId===r.providerId&&b.capability===r.capability);return e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:!!g,onChange:b=>u(t,r.providerId,r.capability,b.target.checked)}),e.jsx("span",{className:r.status==="running"?Ms:$s}),e.jsx("span",{className:"font-medium",children:r.name??r.providerId}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.capability," · ",r.status==="running"?s("connections.statusRunning"):s("connections.statusStopped")]})]},`${r.providerId}::${r.capability}`)})});const i=(r,g)=>`${r}|${g}`,x=(n==null?void 0:n.kind)==="single"?i(n.providerId,n.capability):"",y=(n==null?void 0:n.kind)==="single"?t.candidates.find(r=>r.providerId===n.providerId&&r.capability===n.capability):void 0;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:(y==null?void 0:y.status)==="running"?Ms:$s,"aria-hidden":!0}),e.jsxs("select",{className:"flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 rounded text-sm font-medium",value:x,onChange:r=>{const g=r.target.value;if(!g){o(t,"","");return}const b=g.indexOf("|");if(b<0)return;const F=g.slice(0,b),P=g.slice(b+1),I=t.candidates.find(L=>L.providerId===F&&L.capability===P);I&&o(t,I.providerId,I.capability)},children:[e.jsx("option",{value:"",children:s("connections.unbound")}),t.candidates.map(r=>e.jsxs("option",{value:i(r.providerId,r.capability),children:[r.name??r.providerId," (",r.capability,") ·"," ",r.status==="running"?s("connections.statusRunning"):s("connections.statusStopped")]},i(r.providerId,r.capability)))]})]})}const Vt="rounded border border-dashed border-gray-300 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-4 text-center";function kr({category:t}){const{t:n}=me("instance"),o=gt(),u=Lt(t);return u.emptyMode==="noCta"?e.jsx("div",{className:Vt,children:e.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:n("connections.emptyEmpty",{categoryLabel:n(u.labelKey)})})}):u.emptyMode==="mcpAddCta"?e.jsxs("div",{className:Vt,children:[e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 mb-1",children:n("connections.emptyMcp")}),e.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mb-3",children:n(u.descriptionKey)}),e.jsx("button",{type:"button",className:"inline-flex items-center gap-1 px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium",onClick:()=>o("/instances/new"),children:n("connections.mcpAddCta")})]}):e.jsxs("div",{className:Vt,children:[e.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-200 mb-1",children:n("connections.emptyEmpty",{categoryLabel:n(u.labelKey)})}),e.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400 mb-3",children:[n(u.leaveBlankKey)," ",n("connections.installCtaHint")]}),e.jsx("div",{className:"flex justify-center gap-2 flex-wrap",children:u.presetApps.map(s=>e.jsx("button",{type:"button",className:"inline-flex items-center gap-1 px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium",onClick:()=>o(`/instances/new?app=${encodeURIComponent(s.specId)}`),children:n("connections.installCta",{label:n(s.labelKey)})},s.specId))})]})}function wr({slot:t}){const{t:n}=me("instance"),[o,u]=d.useState(!1);return e.jsxs("div",{className:"mt-2",children:[e.jsx("button",{type:"button",className:"text-xs text-gray-500 hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>u(s=>!s),children:o?`▾ ${n("connections.techDetailsHide")}`:`▸ ${n("connections.techDetails")}`}),o&&e.jsxs("div",{className:"mt-1.5 ml-2 text-xs font-mono text-gray-500 dark:text-gray-400 space-y-0.5",children:[e.jsxs("div",{children:["inject_as: ",e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t.inject_as})]}),e.jsxs("div",{children:["capability: ",e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t.capability})]}),t.apply&&e.jsxs("div",{children:["apply: ",e.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:t.apply})]})]})]})}function Nr({slot:t,value:n,duplicateCategory:o,onPick:u,onToggleMany:s}){const{t:i}=me("instance"),x=Lt(t.category),y=t.category==="default"?t.inject_as:i(x.labelKey),r=o&&t.category!=="default"?`${y} · ${t.inject_as}`:y,g="inline-block px-2 py-0.5 rounded-full text-[10.5px] font-medium";return e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-xl p-4 mb-3 bg-white dark:bg-gray-800/40",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex w-7 h-7 rounded-md items-center justify-center bg-gray-100 dark:bg-gray-700 text-base",children:x.iconEmoji}),e.jsx("span",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:r})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx("span",{className:`${g} ${t.required?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-200":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"}`,children:t.required?i("connections.tagRequired"):i("connections.tagOptional")}),t.cardinality==="many"&&e.jsx("span",{className:`${g} bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-200`,children:i("connections.tagMulti")})]})]}),t.category!=="default"&&e.jsx("p",{className:"ml-9 mt-1 mb-3 text-xs text-gray-600 dark:text-gray-400 leading-relaxed",children:i(x.descriptionKey)}),e.jsxs("div",{className:"ml-9",children:[t.candidates.length===0?e.jsx(kr,{category:t.category}):e.jsx(jr,{slot:t,value:n,onPick:u,onToggleMany:s}),e.jsx(wr,{slot:t})]})]})}function Cr({hasUnsaved:t,saving:n,onSave:o}){const{t:u}=me("instance");return e.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:o,disabled:n||!t,className:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed text-white px-4 py-2 rounded text-sm font-medium",children:u(n?"connections.saving":"connections.save")}),t&&!n&&e.jsx("span",{className:"text-sm text-amber-700 dark:text-amber-400",children:u("connections.unsaved")})]})}function Sr(t){return t?t.kind==="single"?!!t.providerId:t.kind==="many"?t.providers.length>0:!1:!1}const Fr=new Set(["MISSING_REQUIRED_CONNECTION","AMBIGUOUS_CONNECTION","USER_SELECTION_REQUIRED","PROVIDER_NOT_RUNNING","INVALID_BINDING","INVALID_PROVIDER_ID","INVALID_CAPABILITY_ENDPOINT","CONNECTION_APPLY_FAILED","CONNECTION_PERSIST_FAILED"]);function Ir(t,n){const o=(n==null?void 0:n.message)??String(n),u=n==null?void 0:n.code;return u&&Fr.has(u)?t(`connections.error.${u}`,{detail:o}):t("connections.error.generic",{detail:o})}function Er({instanceId:t,onSaved:n}){const{t:o}=me("instance"),[u,s]=d.useState(null),[i,x]=d.useState({}),[y,r]=d.useState({}),[g,b]=d.useState(!1),[F,P]=d.useState(null);d.useEffect(()=>{let k=!1;return ks(t).then(E=>{k||(s(E),x(E.connections??{}),r(E.connections??{}))}).catch(E=>!k&&P((E==null?void 0:E.message)??String(E))),()=>{k=!0}},[t]);const I=(k,E,W)=>{r(q=>E?k.cardinality==="one"?{...q,[k.inject_as]:{kind:"single",providerId:E,capability:W}}:q:{...q,[k.inject_as]:null})},L=(k,E,W,q)=>{r(H=>{const ce=H[k.inject_as],le=ce&&ce.kind==="many"?[...ce.providers]:[],v=le.findIndex(C=>C.providerId===E&&C.capability===W);return q&&v<0&&le.push({providerId:E,capability:W}),!q&&v>=0&&le.splice(v,1),le.length===0?{...H,[k.inject_as]:null}:{...H,[k.inject_as]:{kind:"many",providers:le}}})},R=d.useMemo(()=>u?u.requires.filter(k=>!Lt(k.category).hidden):[],[u]),M=async()=>{b(!0),P(null);try{await na(t,{connections:y}),n==null||n();const k=await ks(t);s(k),x(k.connections??{}),r(k.connections??{})}catch(k){P(Ir(o,k))}finally{b(!1)}},Y=d.useMemo(()=>{if(R.length===0)return{totalSlots:0,boundSlots:0,unboundOptional:[],unboundRequired:[]};const k=R.length;let E=0;const W=[],q=[];for(const H of R)Sr(y[H.inject_as])?E+=1:H.required?q.push(H.inject_as):W.push(H.inject_as);return{totalSlots:k,boundSlots:E,unboundOptional:W,unboundRequired:q}},[R,y]),ue=d.useMemo(()=>{if(R.length===0)return new Set;const k={};for(const W of R)k[W.category]=(k[W.category]??0)+1;const E=new Set;for(const[W,q]of Object.entries(k))q>1&&E.add(W);return E},[R]),J=d.useMemo(()=>{if(!u)return{};const k={};for(const E of u.pending)k[E.slot]=E.reason;return k},[u]),X=d.useMemo(()=>JSON.stringify(i)!==JSON.stringify(y),[i,y]);return F?e.jsx("div",{className:"p-4 text-red-600",children:F}):u?R.length===0?e.jsx("div",{className:"p-4 text-gray-500",children:o("connections.empty")}):e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-semibold mb-1 flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":!0,children:"🔗"})," ",o("connections.title")]}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4 leading-relaxed",children:o("connections.subtitle")}),e.jsx(yr,{totalSlots:Y.totalSlots,boundSlots:Y.boundSlots,unboundOptional:Y.unboundOptional,unboundRequired:Y.unboundRequired,pendingReasons:J}),e.jsx("div",{children:R.map(k=>e.jsx(Nr,{slot:k,value:y[k.inject_as]??null,duplicateCategory:ue.has(k.category),onPick:I,onToggleMany:L},k.inject_as))}),e.jsx(Cr,{hasUnsaved:X,saving:g,onSave:M})]}):e.jsx("div",{className:"p-4 text-gray-500",children:o("connections.loading")})}function Pr({instanceId:t}){const{t:n}=me(),[o,u]=d.useState(null),s=gt();if(d.useEffect(()=>{let r=!1,g;const b=()=>{Ls(t).then(F=>!r&&u(F)).catch(()=>{}).finally(()=>{r||(g=setTimeout(b,3e4))})};return b(),()=>{r=!0,g&&clearTimeout(g)}},[t]),!o||o.state==="empty"||o.state==="ok")return null;const i=o.state==="warn"?"⚡":"⚠",x=o.state==="warn"?"text-amber-400":"text-red-400",y=o.state==="warn"?n("instance:connections.badgeWarn",{count:o.bindable??o.unboundOptional.length}):n("instance:connections.badgeError");return e.jsxs("button",{onClick:()=>s(`/instances/${t}/connections`),title:y,className:`text-xs ${x} hover:underline cursor-pointer`,children:[i," ",y]})}function Ar({instanceId:t,instanceName:n,showToast:o,onRestoreComplete:u,openBackup:s,openManage:i,openExport:x,onDialogClose:y}){var Se;const{t:r}=me("instance"),g=gt(),[b,F]=d.useState(!1),[P,I]=d.useState(!1),[L,R]=d.useState(null),[M,Y]=d.useState(null),[ue,J]=d.useState(!1),[X,k]=d.useState(!1),[E,W]=d.useState(null),[q,H]=d.useState(null),[ce,le]=d.useState([]),[v,C]=d.useState(!1),[V,Z]=d.useState(!1),[z,D]=d.useState("home"),[G,ae]=d.useState(""),[de,c]=d.useState(""),[f,w]=d.useState(""),[_,K]=d.useState(null),[oe,T]=d.useState(!1);d.useEffect(()=>{s&&F(!0)},[s]),d.useEffect(()=>{i&&(he(),I(!0))},[i]),d.useEffect(()=>{x&&J(!0)},[x]);const[Q,se]=d.useState(null),[nt,$e]=d.useState(""),[lt,Te]=d.useState("");d.useEffect(()=>{!b&&!P&&!ue&&!L&&!M&&!q&&!E&&!Q&&(y==null||y())},[b,P,ue,L,M,q,E,Q]);const[ke,qe]=d.useState({enabled:!1}),[Ce,He]=d.useState(!1),he=d.useCallback(async()=>{try{const[h,B]=await Promise.all([la(t),oa(t).catch(()=>({enabled:!1}))]);le(Array.isArray(h)?h:[]),qe(B)}catch{}},[t]);d.useEffect(()=>{he()},[he]),d.useEffect(()=>{if(!Q)return;let h=!1;return(async()=>{var ee,te,Fe;for(;!h;)try{const ne=await da(Q);if(h)break;if(Te(ne.progress||""),ne.status==="completed"){if(se(null),$e(""),C(!1),ne.operation==="manual-backup")H({type:"success",title:r("backup.created",{defaultValue:"备份完成"}),detail:(ee=ne.result)!=null&&ee.filename?`${ne.result.filename} (${xe(ne.result.size||0)})`:""}),he();else if(ne.operation==="export")W(ne.result);else if(ne.operation==="restore"){const pe=ne.result||{};pe.ok?H({type:"success",title:r("backup.restoreSuccess",{defaultValue:"恢复完成"}),detail:pe.api_key_status==="lost"?r("backup.apiKeyLost",{defaultValue:"备份来自不同平台/架构,请确认 API Key 配置是否仍然适用。"}):((te=pe.warnings)==null?void 0:te.join(`
3
- `))||"",actions:pe.api_key_status==="lost"?[{label:r("backup.configApiKey",{defaultValue:"配置 API Key"}),onClick:()=>{H(null),g(`/instances/${t}/config`)}}]:void 0}):H({type:"error",title:pe.rolled_back?r("backup.restoreFailedRolledBack",{defaultValue:"恢复失败 — 已自动回滚"}):r("backup.restoreFailed",{defaultValue:"恢复失败"}),detail:((Fe=pe.warnings)==null?void 0:Fe.join(`
4
- `))||""}),he(),u==null||u()}break}else if(ne.status==="failed"){se(null),$e(""),C(!1),o(ne.error||"Operation failed","error");break}await new Promise(pe=>setTimeout(pe,1500))}catch{break}})(),()=>{h=!0}},[Q]);const Je=async()=>{C(!0),F(!1);try{const h=await ua(t,{include_sessions:V,scope:z});h.job_id?(se(h.job_id),$e("manual-backup"),Te("Queued...")):(H({type:"success",title:r("backup.created",{defaultValue:"备份完成"}),detail:`${h.filename} (${xe(h.size)})`}),C(!1),he())}catch(h){o(h.message||r("backup.failed",{defaultValue:"备份失败"}),"error"),C(!1)}finally{Z(!1),D("home")}},ot=async h=>{var B,ee;C(!0),R(null),ae("");try{const te=await ma(t,h);if(te.job_id)se(te.job_id),$e("restore"),Te("Queued...");else{if(te.ok){const Fe=(B=te.warnings)!=null&&B.length?te.warnings.join(`
5
- `):"";H({type:"success",title:r("backup.restoreSuccess",{defaultValue:"恢复完成"}),detail:te.api_key_status==="lost"?r("backup.apiKeyLost",{defaultValue:"备份来自不同平台/架构,请确认 API Key 配置是否仍然适用。"}):Fe||r("backup.restoreOk",{defaultValue:"实例已恢复。"}),actions:te.api_key_status==="lost"?[{label:r("backup.configApiKey",{defaultValue:"配置 API Key"}),onClick:()=>{H(null),g(`/instances/${t}/config`)}}]:void 0}),u==null||u()}else H({type:"error",title:te.rolled_back?r("backup.restoreFailedRolledBack",{defaultValue:"恢复失败 — 已自动回滚"}):r("backup.restoreFailed",{defaultValue:"恢复失败"}),detail:((ee=te.warnings)==null?void 0:ee.join(`
6
- `))||""});he(),C(!1)}}catch(te){o(te.message||"Restore failed","error"),C(!1)}},De=async h=>{var B;if(!(!de.trim()||!f.trim())){C(!0);try{const ee=await xa({source_id:t,backup_file:h,new_id:de,new_name:f});Y(null),ee.ok?(o(r("backup.createFromBackupOk",{defaultValue:"新实例创建成功"}),"success"),(B=ee.warnings)!=null&&B.length&&ee.warnings.forEach(te=>o(te,"info")),g(`/instances/${ee.instance_id}/config`)):o(ee.detail||r("backup.createFromBackupFail",{defaultValue:"创建失败"}),"error")}catch(ee){o(ee.message||"Failed","error")}finally{C(!1),c(""),w("")}}};d.useEffect(()=>{if(!_)return;const h=setTimeout(()=>K(null),5e3);return()=>clearTimeout(h)},[_]);const Qe=async h=>{if(!oe){T(!0);try{await pa(t,h),o(r("backup.deleted",{defaultValue:"已删除"}),"info"),he()}catch(B){o(B.message||"Delete failed","error")}finally{T(!1),K(null)}}},Ye=async()=>{C(!0),J(!1);try{const h=await fa(t,{include_sessions:X});h.job_id?(se(h.job_id),$e("export"),Te("Queued...")):(W(h),C(!1))}catch(h){o(h.message||"Export failed","error"),C(!1)}finally{k(!1)}};function xe(h){return h<1024?`${h}B`:h<1024*1024?`${(h/1024).toFixed(1)}KB`:`${(h/(1024*1024)).toFixed(1)}MB`}function be(h){const B=new Date(h),ee=B.getFullYear(),te=B.getMonth()+1,Fe=B.getDate(),ne=String(B.getHours()).padStart(2,"0"),pe=String(B.getMinutes()).padStart(2,"0"),Oe=String(B.getSeconds()).padStart(2,"0");return`${ee}/${te}/${Fe} ${ne}:${pe}:${Oe}`}function Ve(h){return h==="auto-backup"?r("backup.typeAuto",{defaultValue:"自动"}):h==="pre-restore"?r("backup.typePreRestore",{defaultValue:"恢复前"}):r("backup.typeManual",{defaultValue:"手动"})}const Xe="w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200",ge="px-4 py-2 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-150",ve="px-4 py-2 border border-[var(--border)] text-muted rounded-md text-sm font-medium hover:bg-[var(--card-hover)] hover:text-foreground transition-all duration-150";return e.jsxs(e.Fragment,{children:[Q&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 max-w-sm w-full mx-4 space-y-4 shadow-2xl text-center",children:[e.jsx("div",{className:"flex justify-center",children:e.jsx("span",{className:"w-8 h-8 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin"})}),e.jsx("p",{className:"text-sm text-foreground",children:lt||r("backup.processing",{defaultValue:"处理中..."})}),e.jsx("p",{className:"text-xs text-muted",children:r("backup.queueNote",{defaultValue:"任务将按顺序执行"})})]})}),b&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>{F(!1),Z(!1),D("home")},children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl",onClick:h=>h.stopPropagation(),children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-2",children:r("backup.createTitle",{defaultValue:"创建备份"})}),e.jsx("p",{className:"text-sm text-muted mb-4",children:r("backup.createDesc",{defaultValue:"备份当前实例的配置、插件和数据。"})}),e.jsxs("div",{className:"space-y-2 mb-4",children:[e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"backup-scope",value:"home",checked:z==="home",onChange:()=>D("home"),className:"mt-1"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:r("backup.scopeFull",{defaultValue:"完整备份(含运行时)"})}),e.jsx("div",{className:"text-xs text-[var(--muted)]",children:r("backup.scopeFullDesc",{defaultValue:"包含升级后的 OpenClaw 运行时——恢复后保持当前版本"})})]})]}),e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"backup-scope",value:"state",checked:z==="state",onChange:()=>D("state"),className:"mt-1"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:r("backup.scopeState",{defaultValue:"仅数据(更小、可移植)"})}),e.jsx("div",{className:"text-xs text-[var(--muted)]",children:r("backup.scopeStateDesc",{defaultValue:"仅 .openclaw/ 数据——体积小,兼容官方 OpenClaw 格式"})})]})]})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted cursor-pointer mb-5",children:[e.jsx("input",{type:"checkbox",checked:V,onChange:h=>Z(h.target.checked),className:"rounded border-[var(--border)] bg-[var(--input-bg)]"}),r("backup.includeSessions",{defaultValue:"包含对话历史(体积较大)"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:`flex-1 ${ve}`,onClick:()=>{F(!1),Z(!1),D("home")},children:r("common:action.cancel",{defaultValue:"取消"})}),e.jsx("button",{className:`flex-1 ${ge}`,onClick:Je,disabled:v,children:v?r("backup.creating",{defaultValue:"备份中..."}):r("backup.create",{defaultValue:"备份"})})]})]})}),P&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>I(!1),children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-2xl shadow-2xl flex flex-col max-h-[80vh]",onClick:h=>h.stopPropagation(),children:[e.jsxs("h3",{className:"text-base font-semibold text-foreground mb-3 flex-shrink-0",children:[r("backup.manageTitle",{defaultValue:"备份管理"}),e.jsxs("span",{className:"text-muted font-normal",children:[" — ",n]})]}),e.jsx("div",{className:"bg-[var(--input-bg)] border border-[var(--border)] rounded-lg px-4 py-3 mb-3 flex-shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-muted",children:r("backup.autoBackup",{defaultValue:"自动备份"})}),ke.enabled&&e.jsxs("span",{className:"text-muted opacity-70",children:[r("backup.interval",{defaultValue:"每{{h}}小时备份",h:ke.interval_hours||24})," | ",r("backup.keep",{defaultValue:"保留{{n}}份",n:ke.keep_count||7})]}),ke.enabled&&ke.last_backup_ok===!1&&e.jsxs("span",{className:"text-red-400 text-xs",children:["(",r("backup.failed",{defaultValue:"失败"}),")"]})]}),e.jsx("button",{disabled:Ce,onClick:async h=>{h.stopPropagation(),He(!0);try{ke.enabled?await ws(t,{enabled:!1}):(await ws(t,{enabled:!0,interval_hours:24,keep_count:7}),o(r("backup.autoEnabled",{defaultValue:"自动备份已开启"}),"success")),await he()}catch(B){o(B.message||"Failed","error")}finally{He(!1)}},className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${Ce?"opacity-40":""} ${ke.enabled?"bg-green-500":"bg-[var(--border)]"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${ke.enabled?"translate-x-4":"translate-x-0.5"}`})})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto min-h-0",children:ce.length===0?e.jsx("p",{className:"text-sm text-muted py-6 text-center",children:r("backup.noBackups",{defaultValue:"暂无备份"})}):e.jsx("div",{className:"space-y-2",children:ce.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-[var(--card)] border border-[var(--border)] rounded-lg px-4 py-3 hover:border-[var(--border-hover)] transition-colors duration-150",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--input-bg)] border border-[var(--border)] text-muted font-medium flex-shrink-0",children:Ve(h.type)}),e.jsx("span",{className:"text-sm text-foreground truncate",children:be(h.created_at)}),e.jsx("span",{className:"text-xs text-muted flex-shrink-0",children:xe(h.size)})]})}),e.jsxs("div",{className:"flex items-center gap-1 ml-3 flex-shrink-0",children:[e.jsx("button",{title:r("backup.restore",{defaultValue:"恢复"}),className:"p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-base",onClick:()=>{ae(""),R(h.filename)},children:"↩"}),e.jsx("button",{title:r("backup.createNew",{defaultValue:"创建新实例"}),className:"p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-base",onClick:()=>{c(""),w(""),Y(h.filename)},children:"⊕"}),h.type!=="pre-restore"&&e.jsx("a",{href:ia(t,h.filename),download:!0,title:r("backup.download",{defaultValue:"下载"}),className:"p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-base underline decoration-current underline-offset-2",children:"⬇"}),e.jsx("button",{title:r("backup.delete",{defaultValue:"删除"}),className:`p-2 rounded-md transition-colors duration-150 text-base ${_===h.filename?"bg-red-500/20 text-red-400":"hover:bg-red-500/10 text-muted hover:text-red-400"}`,disabled:oe,onClick:()=>{_===h.filename?Qe(h.filename):K(h.filename)},children:oe&&_===h.filename?e.jsx("span",{className:"text-xs",children:r("backup.deleting",{defaultValue:"Deleting..."})}):_===h.filename?r("backup.confirmDelete",{defaultValue:"Confirm?"}):e.jsx(e.Fragment,{children:"🗑"})}),_===h.filename&&e.jsx("button",{className:"p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-xs",onClick:()=>K(null),children:r("common:action.cancel",{defaultValue:"Cancel"})})]})]},h.filename))})}),e.jsxs("div",{className:"flex justify-between items-center pt-4 mt-4 border-t border-[var(--border)] flex-shrink-0",children:[e.jsx("button",{className:ve,onClick:()=>I(!1),children:r("common:action.close",{defaultValue:"关闭"})}),e.jsx("button",{className:ge,onClick:()=>{I(!1),F(!0)},children:r("backup.createNew2",{defaultValue:"创建新备份"})})]})]})}),L&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>{R(null),ae("")},children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl",onClick:h=>h.stopPropagation(),children:[e.jsx("h3",{className:"text-base font-semibold text-amber-400 mb-2",children:r("backup.restoreTitle",{defaultValue:"恢复将覆盖当前数据"})}),e.jsx("p",{className:"text-sm text-muted mb-4",children:r("backup.restoreDesc",{defaultValue:"已自动创建恢复前备份,如有问题可回滚。"})}),e.jsx("p",{className:"text-sm text-muted mb-2",children:r("backup.restoreConfirmLabel",{defaultValue:"输入实例名确认恢复:"})}),e.jsx("input",{type:"text",value:G,onChange:h=>ae(h.target.value),placeholder:n,className:`${Xe} mb-4 focus:ring-amber-500/60 focus:border-amber-500/60`,autoFocus:!0}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:`flex-1 ${ve}`,onClick:()=>{R(null),ae("")},children:r("common:action.cancel",{defaultValue:"取消"})}),e.jsx("button",{className:"flex-1 px-4 py-2 bg-red-600 text-white rounded-md text-sm font-medium hover:bg-red-700 disabled:opacity-40 transition-colors duration-150",onClick:()=>ot(L),disabled:v||G!==n,children:v?r("backup.restoring",{defaultValue:"恢复中..."}):r("backup.confirmRestore",{defaultValue:"确认恢复"})})]})]})}),M&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>{Y(null),c(""),w("")},children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl",onClick:h=>h.stopPropagation(),children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-4",children:r("backup.createFromTitle",{defaultValue:"从备份创建新实例"})}),e.jsxs("div",{className:"space-y-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:r("backup.newName",{defaultValue:"新实例名称"})}),e.jsx("input",{type:"text",value:f,onChange:h=>w(h.target.value),placeholder:r("backup.newNamePlaceholder",{defaultValue:"我的 Agent 副本"}),className:Xe,autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:r("backup.newId",{defaultValue:"新实例 ID"})}),e.jsx("input",{type:"text",value:de,onChange:h=>c(h.target.value),placeholder:r("backup.newIdPlaceholder",{defaultValue:"my-agent-copy"}),className:`${Xe} font-mono text-[13px]`})]})]}),e.jsx("p",{className:"text-xs text-muted opacity-70 mb-4",children:r("backup.createFromNote",{defaultValue:"API Key 和 IM 凭证不会复制,需自行配置。"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{className:`flex-1 ${ve}`,onClick:()=>{Y(null),c(""),w("")},children:r("common:action.cancel",{defaultValue:"取消"})}),e.jsx("button",{className:`flex-1 ${ge}`,onClick:()=>De(M),disabled:v||!de.trim()||!f.trim(),children:v?r("backup.creatingInstance",{defaultValue:"创建中..."}):r("backup.createInstance",{defaultValue:"创建"})})]})]})}),ue&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",onClick:()=>J(!1),children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 max-w-md w-full mx-4 space-y-4 shadow-2xl",onClick:h=>h.stopPropagation(),children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:r("backup.exportTitle",{defaultValue:"导出(分享)"})}),e.jsx("p",{className:"text-sm text-muted",children:r("backup.exportDesc",{defaultValue:"生成可分享的导出包,API Key 和凭证将自动移除。"})}),e.jsxs("div",{className:"bg-[var(--input-bg)] border border-[var(--border)] rounded-lg p-3 space-y-1.5 text-sm text-muted",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-400",children:"✓"}),r("backup.exportConfig",{defaultValue:"配置 (openclaw.json, 已清洗)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-400",children:"✓"}),r("backup.exportPlugins",{defaultValue:"插件 (extensions)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-green-400",children:"✓"}),r("backup.exportWorkspace",{defaultValue:"工作区 / Skills"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-red-400",children:"✗"}),r("backup.exportNoKeys",{defaultValue:"API Key / 凭证 — 已移除"})]})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:X,onChange:h=>k(h.target.checked),className:"rounded border-[var(--border)] bg-[var(--input-bg)]"}),r("backup.exportIncludeSessions",{defaultValue:"包含对话历史"})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{className:ve,onClick:()=>J(!1),children:r("common:action.cancel",{defaultValue:"取消"})}),e.jsx("button",{className:ge,onClick:Ye,disabled:v,children:v?r("backup.exporting",{defaultValue:"导出中..."}):r("backup.exportBtn",{defaultValue:"导出"})})]})]})}),E&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 max-w-md w-full mx-4 space-y-4 shadow-2xl",children:[e.jsx("h3",{className:"text-lg font-semibold text-green-400",children:r("backup.exportDone",{defaultValue:"导出完成"})}),e.jsxs("p",{className:"text-sm text-muted",children:[E.filename," (",xe(E.size),")"]}),E.warnings&&E.warnings.length>0&&e.jsx("div",{className:"space-y-1",children:E.warnings.map((h,B)=>e.jsx("p",{className:"text-xs text-amber-400",children:h},B))}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("a",{href:ca(t,E.filename),download:!0,className:ge+" inline-block text-center no-underline",children:r("backup.downloadExport",{defaultValue:"下载"})}),e.jsx("button",{className:ve,onClick:()=>W(null),children:r("common:action.close",{defaultValue:"关闭"})})]})]})}),q&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl",children:[e.jsx("h3",{className:`text-base font-semibold mb-2 ${q.type==="success"?"text-green-400":"text-red-400"}`,children:q.title}),q.detail&&e.jsx("p",{className:"text-sm text-muted mb-4 whitespace-pre-wrap",children:q.detail}),e.jsxs("div",{className:"flex justify-end gap-2",children:[(Se=q.actions)==null?void 0:Se.map((h,B)=>e.jsx("button",{className:ge,onClick:h.onClick,children:h.label},B)),e.jsx("button",{className:ve,onClick:()=>H(null),children:r("common:action.close",{defaultValue:"关闭"})})]})]})})]})}function _r({yaml:t,env:n,onYamlChange:o,onEnvChange:u}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 flex items-center justify-between",children:e.jsx("span",{className:"text-xs font-medium text-muted",children:"config.yaml"})}),e.jsx("textarea",{value:t,onChange:s=>o(s.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[320px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 flex items-center justify-between",children:e.jsx("span",{className:"text-xs font-medium text-muted",children:".env"})}),e.jsx("textarea",{value:n,onChange:s=>u(s.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[220px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]})]})}const Rs={id:"openclaw",label:"tab.openclaw",icon:"🦞",description:"appDesc.openclaw",image:"ghcr.io/x-aijishu/openclaw-runtime:latest",features:{chat:!0,configEditor:!0,quickConfig:!0,logs:!0,usage:!0,cloneable:!0,connections:!0},configFields:[],defaultPort:18789,generateSpec:(t,n)=>`id: ${t}
7
- jishushell:
8
- min_version: "0.5.28"
9
- tasks:
10
- - name: gateway
11
- runtime: container
12
- image: "ghcr.io/x-aijishu/openclaw-runtime:latest"
13
- args: ["gateway", "run", "--allow-unconfigured"]
14
- resources: {cpu: "500m", memory: "512Mi"}
15
- ports: [{name: http, port: 18789}]
16
- health: {http: {path: /health, port: 18789}}
17
- provides:
18
- - capability: "openai-compatible-api"
19
- port: 18789
20
- openclaw:
21
- config_defaults:
22
- agents.defaults.model: "minimax/MiniMax-M2.7"
23
- `},Mr={id:"hermes-agent",label:"tab.hermes",icon:"🧠",description:"appDesc.hermes",image:"jishushell-hermes:latest",features:{chat:!1,configEditor:!0,quickConfig:!1,logs:!0,usage:!0,cloneable:!1,webUrl:t=>`http://localhost:${t}`,connections:!0},configFields:[{key:"hermes_api_key",label:"hermes.apiKey",type:"password",placeholder:"hermes.apiKeyPlaceholder",defaultValue:""}],defaultPort:8080,generateSpec:(t,n)=>{const o=n.hermes_api_key||"${HERMES_API_KEY}";return`id: ${t}
24
- jishushell:
25
- min_version: "0.5.28"
26
- name: "Hermes Agent + Open WebUI"
27
- tasks:
28
- - name: hermes
29
- role: service
30
- runtime: container
31
- image: "jishushell-hermes:latest"
32
- env:
33
- HERMES_API_KEY: "${o}"
34
- resources: {cpu: "1500m", memory: "3072Mi"}
35
- volumes:
36
- - {source: hermes-data, target: /data}
37
- ports:
38
- - {name: webui, port: 8080, visibility: external}
39
- - {name: api, port: 8642, visibility: internal}
40
- health:
41
- http: {path: /health, port: 8080}
42
- interval: "20s"
43
- timeout: "10s"
44
- retries: 10
45
- start_period: "180s"
46
- provides:
47
- - capability: "openai-compatible-api"
48
- port: 8642
49
- description: "Hermes Agent OpenAI-compatible API"
50
- - capability: "web-ui"
51
- port: 8080
52
- description: "Open WebUI chat frontend"
53
- `}},$r={id:"ollama",label:"tab.ollama",icon:"🦙",description:"appDesc.ollama",image:"ollama/ollama:latest",features:{chat:!1,configEditor:!1,quickConfig:!1,logs:!0,usage:!0,cloneable:!1,webUrl:t=>""},configFields:[{key:"model",label:"ollama.model",type:"text",placeholder:"ollama.modelPlaceholder",defaultValue:"llama3.2"},{key:"gpu",label:"ollama.gpu",type:"select",options:[{value:"auto",label:"Auto"},{value:"none",label:"CPU Only"},{value:"nvidia",label:"NVIDIA GPU"}],defaultValue:"auto"}],defaultPort:11434,generateSpec:(t,n)=>{const o=n.model||"llama3.2";return`id: ${t}
54
- jishushell:
55
- min_version: "0.5.28"
56
- name: "Ollama"
57
- tasks:
58
- - name: ollama-server
59
- role: service
60
- runtime: container
61
- image: "ollama/ollama:latest"
62
- resources: {cpu: "2000m", memory: "4096Mi"}
63
- ports:
64
- - {name: api, port: 11434, visibility: external}
65
- health:
66
- http: {path: /, port: 11434}
67
- interval: "15s"
68
- timeout: "5s"
69
- retries: 5
70
- start_period: "120s"
71
- - name: pull-model
72
- role: init
73
- runtime: container
74
- image: "ollama/ollama:latest"
75
- command: "ollama"
76
- args: ["pull", "${o}"]
77
- env:
78
- OLLAMA_HOST: "http://localhost:11434"
79
- provides:
80
- - capability: "openai-compatible-api"
81
- port: 11434
82
- description: "Ollama OpenAI-compatible API"
83
- `}},Tr={id:"openwebui",label:"tab.openwebui",icon:"🌐",description:"appDesc.openwebui",image:"ghcr.io/open-webui/open-webui:main",features:{chat:!1,configEditor:!1,quickConfig:!1,logs:!0,usage:!0,cloneable:!1,webUrl:t=>`http://localhost:${t}`,connections:!0},configFields:[],defaultPort:3e3,generateSpec:t=>`id: ${t}
84
- `},Dr={id:"custom",label:"tab.custom",icon:"📝",description:"appDesc.custom",image:"",features:{chat:!1,configEditor:!1,quickConfig:!1,logs:!0,usage:!0,cloneable:!1,connections:!0},configFields:[],defaultPort:0,generateSpec:()=>""},Vr=[Rs,Mr,$r,Tr,Dr];function Or(t){return Vr.find(n=>n.id===t)??Rs}function Lr(t){const n=typeof(t==null?void 0:t.agentType)=="string"?t.agentType.trim():"";if(n){if(n==="openclaw")return"openclaw";if(n==="hermes"||n==="hermes-agent")return"hermes-agent";if(n==="ollama")return"ollama";if(n==="openwebui")return"openwebui"}if(t!=null&&t.app_type)return t.app_type;if(t!=null&&t.app_id){if(t.app_id.startsWith("hermes"))return"hermes-agent";if(t.app_id.startsWith("ollama"))return"ollama";if(t.app_id.startsWith("openwebui"))return"openwebui"}return"openclaw"}function Rr(t,n){if(t==null)return"-";const o=Math.floor(t/86400),u=Math.floor(t%86400/3600),s=Math.floor(t%3600/60);return o>0?n("instance:uptime.days",{d:o,h:u}):u>0?n("instance:uptime.hours",{h:u,m:s}):n("instance:uptime.minutes",{m:s})}const bt=[Ya,ht,lr,ur];function Kr(t){for(const n of bt){const o=s=>(s==null?void 0:s.find(i=>i.id===t))??null;if(n.groups)for(const s of n.groups){const i=o(s.items);if(i)return i}const u=o(n.items);if(u)return u}return null}function Ts(t,n){const o=JSON.parse(JSON.stringify(t??{})),u=rt.find(x=>x.id===n);if(u){if(o.channels||(o.channels={}),o.plugins||(o.plugins={}),o.plugins.entries||(o.plugins.entries={}),o.channels[n])o.channels[n].enabled=!0;else{const x={enabled:!0,...u.defaults??{}};u.fields.forEach(y=>{y.key in x||(x[y.key]="")}),o.channels[n]=x}return o.plugins.entries[n]||(o.plugins.entries[n]={enabled:!0}),o}const s={"skill-vetter":{"skill-vetter":{enabled:!0}},"skill-finder":{"skill-finder":{enabled:!0}},"skill-browser":{"skill-browser":{enabled:!0}}};if(n in s)return o.skills||(o.skills={}),Object.assign(o.skills,s[n]),o;const i={};return n in i&&(o.mcp||(o.mcp={}),o.mcp.servers||(o.mcp.servers={}),Object.assign(o.mcp.servers,i[n])),o}function Ds(t){return t.replace(/^(https?:\/\/)(localhost|127\.0\.0\.1)(?=[:/]|$)/i,(n,o)=>`${o}${window.location.hostname}`)}function Vs(t){var r,g,b,F,P;const n=(r=t==null?void 0:t.embeddedUi)==null?void 0:r.port;if(n)return String(n);const u=(Array.isArray(t==null?void 0:t.provides)?t.provides:[]).find(I=>I==null?void 0:I.port);if(u!=null&&u.port)return String(u.port);const s=(b=(g=t==null?void 0:t.runtime)==null?void 0:g.env)==null?void 0:b.OPENCLAW_GATEWAY_PORT;if(s)return String(s);const x=(Array.isArray((F=t==null?void 0:t.runtime)==null?void 0:F.ports)?t.runtime.ports:[]).find(I=>(I==null?void 0:I.name)==="gateway"&&(I==null?void 0:I.hostPort));if(x!=null&&x.hostPort)return String(x.hostPort);const y=((P=t==null?void 0:t.runtime)==null?void 0:P.args)||[];for(let I=0;I<y.length;I++){if(y[I]==="--port"&&I+1<y.length)return String(y[I+1]);if(typeof y[I]=="string"&&y[I].startsWith("--port="))return String(y[I].slice(7))}return"-"}function Ks(t=[]){return new Set(t.filter(n=>n.startsWith("env.")).map(n=>n.slice(4)))}function Ot(t,n=[]){const o=Ks(n);return o.size?t.split(`
85
- `).map(u=>{const s=u.trim();if(!s||s.startsWith("#")||!s.includes("="))return u;const i=u.indexOf("="),x=u.slice(0,i).replace(/^export\s+/,"").trim();return o.has(x)?`${u.slice(0,i)}=***`:u}).join(`
86
- `):t}function qr(t,n,o=[]){const u=Ks(o);if(!u.size)return t;const s=new Map;for(const i of n.split(`
87
- `)){const x=i.trim();if(!x||x.startsWith("#")||!x.includes("="))continue;const y=i.indexOf("="),r=i.slice(0,y).replace(/^export\s+/,"").trim(),g=i.slice(y+1);s.set(r,g)}return t.split(`
88
- `).map(i=>{const x=i.trim();if(!x||x.startsWith("#")||!x.includes("="))return i;const y=i.indexOf("="),r=i.slice(0,y).replace(/^export\s+/,"").trim(),g=i.slice(y+1).trim();if(!u.has(r)||g!=="***")return i;const b=s.get(r);return b==null?i:`${i.slice(0,y)}=${b}`}).join(`
89
- `)}function Qr(){var as,rs,ns,ls,os,is,cs,ds,us,ms,xs,ps,fs,hs,bs,gs;const{id:t,tab:n}=Da(),o=gt(),{showToast:u}=ha(),{t:s}=me(["instance","common","data"]),[i,x]=d.useState(null),y=d.useRef(0),[r,g]=d.useState(n==="overview"?"chat":n||"chat"),[b,F]=d.useState(null),[P,I]=d.useState(null),[L,R]=d.useState(!1),[M,Y]=d.useState(""),[ue,J]=d.useState(!1),[X,k]=d.useState(""),[E,W]=d.useState([]),[q,H]=d.useState("stderr"),[ce,le]=d.useState(""),[v,C]=d.useState(null),[V,Z]=d.useState(""),[z,D]=d.useState(!1),[G,ae]=d.useState(!1),[de,c]=d.useState(""),[f,w]=d.useState(null),[_,K]=d.useState(null),[oe,T]=d.useState(!1),[Q,se]=d.useState(!1),[nt,$e]=d.useState(""),[lt,Te]=d.useState(""),[ke,qe]=d.useState(""),[Ce,He]=d.useState(!1),[he,Je]=d.useState(!1),[ot,De]=d.useState(!1),[Qe,Ye]=d.useState(null),[xe,be]=d.useState(!1),[Ve,Xe]=d.useState("im"),[ge,ve]=d.useState("general"),[O,Se]=d.useState(null),[h,B]=d.useState({}),[ee,te]=d.useState(""),[Fe,ne]=d.useState(""),[pe,Oe]=d.useState(""),[Ue,Ie]=d.useState({servers:[],installed:!1,loading:!1}),[re,ye]=d.useState(null),Ee=d.useRef(!1),Pe=d.useRef(!1),[je,Rt]=d.useState(!1),vt=d.useRef(null),yt=d.useRef(null),[Kt,qt]=d.useState(!1),Ze=d.useRef(null),[Ut,jt]=d.useState(null),[Bt,kt]=d.useState(null),qs=Lr(i),we=Or(qs).features,Be=we.configEditor?"config":we.logs?"logs":"usage";d.useEffect(()=>{const a=i==null?void 0:i.agentType;if(!a){jt(null),kt(null);return}const l=Ba[a];let m=!1;return l!=null&&l.chatComponent?l.chatComponent().then(p=>{m||jt(()=>p.default)}).catch(p=>{console.warn(`[runtime] failed to load chat component for ${a}:`,p)}):jt(null),l!=null&&l.configPanel?l.configPanel().then(p=>{m||kt(()=>p.default)}).catch(p=>{console.warn(`[runtime] failed to load config panel for ${a}:`,p)}):kt(null),()=>{m=!0}},[i==null?void 0:i.agentType]);const Wt=d.useRef(t),wt=d.useRef(je);Wt.current=t,wt.current=je,d.useEffect(()=>{xe&&t&&st(t).then(Se).catch(()=>{})},[xe,t]),d.useEffect(()=>{if(!t||!we.connections){w(null);return}let a=!1,l;const m=()=>{Ls(t).then(p=>{a||w(p)}).catch(()=>{}).finally(()=>{a||(l=setTimeout(m,3e4))})};return m(),()=>{a=!0,l&&clearTimeout(l)}},[t,we.connections]);const Ht=we.connections&&(f==null?void 0:f.state)!=="empty";d.useEffect(()=>{xe&&Ve==="mcp"&&t&&(Ie(a=>({...a,loading:!0})),Tt(t).then(a=>Ie({servers:a.servers,installed:a.installed,loading:!1})).catch(()=>Ie(a=>({...a,loading:!1}))))},[xe,Ve,t]),d.useEffect(()=>{n&&g(n==="overview"?"chat":n)},[n]),d.useEffect(()=>{Kt&&r==="config"&&b&&(qt(!1),J(!1),setTimeout(()=>{const a=document.getElementById("im-channel-section");a?a.scrollIntoView({behavior:"smooth",block:"start"}):window.scrollTo({top:document.body.scrollHeight,behavior:"smooth"})},200))},[Kt,r,b]);const Re=d.useCallback(()=>{const a=Wt.current;a&&!wt.current&&ba(a).then(l=>{x(l),l.llmError&&l.llmError.timestamp>y.current&&Date.now()-l.llmError.timestamp<6e4&&(u(`LLM ${s("common:error")} (${l.llmError.code}): ${l.llmError.message}`,"error"),y.current=l.llmError.timestamp)}).catch(()=>{})},[u,s]);d.useEffect(()=>{Re();const a=setInterval(Re,5e3);return()=>clearInterval(a)},[t,Re]);const it=(rs=(as=i==null?void 0:i.capabilities)==null?void 0:as.gateway)==null?void 0:rs.chatPanel,Nt=Array.isArray(i==null?void 0:i.provides)?i.provides.find(a=>String((a==null?void 0:a.protocol)||"").toLowerCase()==="terminal"&&(a==null?void 0:a.terminal)):null,et=typeof((ns=i==null?void 0:i.embeddedUi)==null?void 0:ns.url)=="string"?Ds(i.embeddedUi.url.trim()):"",Ae=!!et,Jt=typeof((ls=i==null?void 0:i.embeddedUi)==null?void 0:ls.port)=="number"?i.embeddedUi.port:0,Us=typeof((os=i==null?void 0:i.embeddedUi)==null?void 0:os.protocol)=="string"&&i.embeddedUi.protocol==="https"?"https":"http",Ct=Jt>0?`${Us}://${window.location.hostname}:${Jt}/`:et,ct=!!Nt||Ae||it==="iframe"||it==="inline",St=((is=i==null?void 0:i.service)==null?void 0:is.status)==="running",zt=we.webUrl?Ds(we.webUrl(parseInt(Vs(i),10)||0).trim()):"";d.useEffect(()=>{if(!(!t||!i)){if(Ae){Z(a=>(a!==et&&ae(!1),et));return}if(it!=="iframe"){Z(""),D(!1),ae(!1);return}ga(t).then(a=>{const l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";if(!l)throw new Error("No gateway launch URL returned");Z(m=>(m!==l&&ae(!1),l))}).catch(a=>{Z(""),u((a==null?void 0:a.message)||s("gatewayLaunchFailed"),"error")})}},[et,Ae,t,it,St,u,s]),d.useEffect(()=>{!t||!i||!ct&&r==="chat"&&(g(Be),o(`/instances/${t}/${Be}`,{replace:!0}))},[r,Be,ct,t,i,o]);const Gt=d.useRef(!1);Gt.current=z,d.useEffect(()=>{if(!V||!St){D(!1),ae(!1);return}if(Ae){D(!0),ae(!0);return}if(Gt.current)return;let a=!1,l=0;const m=60,p=()=>{a||l>=m||(l++,fetch(V,{method:"HEAD",credentials:"include"}).then(j=>{!a&&j.ok&&D(!0)}).catch(()=>{}))};p();const N=setInterval(p,3e3);return()=>{a=!0,clearInterval(N)}},[V,Ae,St]);const[Ne,Ft]=d.useState({}),Qt=Object.values(Ne).includes("installing"),dt=d.useRef(new Set),It=d.useRef(u);It.current=u;const Et=d.useRef(s);Et.current=s,d.useEffect(()=>{var N;if(!t||!(((N=i==null?void 0:i.capabilities)==null?void 0:N.pluginInstall)===!0&&(r==="config"||Qt)))return;let l=!1;const m=()=>{l||Ns(t).then(j=>{var $;if(l)return;const A={};for(const[S,U]of Object.entries(j.plugins))A[S]=U.status;for(const S of dt.current){const U=A[S];if(U==="installed")It.current(Et.current(S==="feishu"?"feishu.pluginInstalled":"weixin.pluginInstalled"),"success"),dt.current.delete(S);else if(U==="failed"||U==="not_installed"){const fe=($=j.plugins[S])==null?void 0:$.error;It.current(Et.current(S==="feishu"?"feishu.pluginFailed":"weixin.pluginFailed")+(fe?": "+fe:""),"error"),dt.current.delete(S)}}Ft(A)}).catch(()=>{})};m();const p=setInterval(m,3e3);return()=>{l=!0,clearInterval(p)}},[t,r,Qt]),d.useEffect(()=>{var a;xe&&t&&((a=i==null?void 0:i.capabilities)==null?void 0:a.pluginInstall)===!0&&Ns(t).then(l=>{const m={};for(const[p,N]of Object.entries(l.plugins))m[p]=N.status;Ft(m)}).catch(()=>{})},[xe,t]);const Yt=a=>{t&&(Ca(t,a).catch(()=>{}),Ft(l=>({...l,[a]:"installing"})),dt.current.add(a),u(s(a==="feishu"?"feishu.installing":"weixin.installing"),"info"))};d.useEffect(()=>{if(!L)return;const a=l=>{l.preventDefault()};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[L]),d.useEffect(()=>{r==="config"&&t&&Promise.all([Cs(t),Ss(t)]).then(([a,l])=>{I(a);const m=yt.current;if(yt.current=null,a.format==="yaml+env"){const N=l;Ze.current=N;const j={...N,env:Ot(N.env,a.secretFields)};F(j),k(""),J(!1),R(!1);return}Ze.current=null;const p=m?Ts(l,m):l;F(p),k(JSON.stringify(p,null,2)),R(!!m)}).catch(()=>{}),r==="usage"&&t&&Fs(t).then(C).catch(()=>{})},[r,t]);const Pt=()=>{t&&Sa(t,200,q).then(a=>{var m;W(a.lines);const l=(m=vt.current)==null?void 0:m.parentElement;l&&l.scrollHeight-l.scrollTop-l.clientHeight<80&&setTimeout(()=>{var N;return(N=vt.current)==null?void 0:N.scrollIntoView({behavior:"smooth"})},100)}).catch(()=>{})};Ra(Pt,3e3,r==="logs"&&!!t),d.useEffect(()=>{r==="logs"&&Pt()},[q]);const Xt=()=>{K(Date.now()+2e4),D(!1),ae(!1)};d.useEffect(()=>{if(!_)return;const a=_-Date.now();if(a<=0){K(null);return}const l=setTimeout(()=>{K(null),Re()},a);return()=>clearTimeout(l)},[_,Re]);const ut=async a=>{if(t){c(a);try{let l=null;a==="start"&&(l=await Fa(t)),a==="stop"&&(l=await Ia(t)),a==="restart"&&(l=await Ps(t),Xt()),u(s(a==="start"?"action.startHint":a==="stop"?"action.stopDone":"action.restartHint"),a==="stop"?"success":"info");const m=l==null?void 0:l.port_allocation;m&&typeof m.from=="number"&&typeof m.to=="number"&&m.from!==m.to&&u(s("common:toast.portReallocated",{defaultValue:"端口 {{from}} 被占用,已自动切换到 {{to}}",from:m.from,to:m.to}),"info"),(a==="start"||a==="restart")&&o(`/instances/${t}`),setTimeout(Re,1e3)}catch(l){u(l.message||s("common:error.operationFailed"),"error")}finally{c("")}}},Zt=async a=>{if(!t)return;be(!1),Ee.current=!1;const l=a==="feishu"?"feishu":"openclaw-weixin",m=Ne[l];if(m==="installing"){u(s(a==="feishu"?"feishu.waitingInstall":"weixin.waitingInstall"),"info");return}if(m!=="installed"){Yt(l);return}Pe.current=!1,ye({type:a,qrUrl:"",sessionKey:"",status:"loading",message:s("qr.gettingQr")});try{let p=null;for(let $=0;$<3;$++){if(Pe.current)return;try{if(p=a==="feishu"?await Ea(t):await Pa(t),p!=null&&p.qrcodeUrl)break}catch{$<2&&await new Promise(S=>setTimeout(S,1500))}}if(Pe.current)return;if(!(p!=null&&p.qrcodeUrl)){ye($=>$?{...$,status:"error",message:s("qr.getFailed")}:null);return}ye({type:a,qrUrl:p.qrcodeUrl,sessionKey:p.sessionKey,status:"waiting",message:s(a==="feishu"?"qr.scanFeishu":"qr.scanWeixin")}),Ee.current=!0;let N=0;const j=6,A=async $=>{if(!(!Ee.current||Pe.current))try{const S=a==="feishu"?await Aa(t,$):await _a(t,$);if(Pe.current)return;if(N=0,S.connected){Ee.current=!1,ye(U=>U?{...U,qrUrl:"",status:"confirmed",message:S.message||s("qr.loginSuccess")}:null);return}if(S.status==="expired"){Ee.current=!1,ye(U=>U?{...U,status:"error",message:S.message||s("qr.expired")}:null);return}S.status==="refreshed"&&S.qrcodeUrl?ye(U=>U?{...U,qrUrl:S.qrcodeUrl,message:s("qr.refreshed")}:null):S.status==="scaned"&&ye(U=>U?{...U,status:"scaned",message:S.message||s("qr.scaned")}:null),setTimeout(()=>A($),2e3)}catch{if(!Ee.current||Pe.current)return;if(N+=1,N>=j){Ee.current=!1,ye(S=>S?{...S,status:"error",message:s("qr.pollFailed",{defaultValue:"轮询失败,请刷新后重试"})}:null);return}setTimeout(()=>A($),3e3)}};setTimeout(()=>A(p.sessionKey),2e3)}catch{Pe.current||ye(p=>p?{...p,status:"error",message:s("qr.getFailed")}:null)}},We=(a,l)=>{let m=0;const p=()=>{var N;try{const j=document.getElementById("gateway-iframe");if(!j){++m<50&&setTimeout(p,200);return}const A=j.contentDocument;if(!A||A.readyState==="loading"){++m<50&&setTimeout(p,200);return}const $=A.querySelector("openclaw-app");if(!$){++m<50&&setTimeout(p,200);return}if(l){if(!$.connected&&++m<50){setTimeout(p,200);return}$.handleSendChat(a)}else $.chatMessage=a}catch{const j=document.getElementById("gateway-iframe");(N=j==null?void 0:j.contentWindow)==null||N.postMessage({type:"jishu:inject-cmd",cmd:a,send:l},"*")}};r!=="chat"?(_e("chat"),setTimeout(p,800)):setTimeout(p,100)},mt=a=>{if(be(!1),a==="feishu"||a==="openclaw-weixin"){Zt(a==="feishu"?"feishu":"weixin");return}const l=Kr(a);if(l&&l.cmd!==void 0){We(l.cmd,l.send!==!1);return}if(b!==null&&r==="config"){const m=Ts(b,a);F(m),k(JSON.stringify(m,null,2)),R(!0),u(s("config.presetAdded"),"info")}else yt.current=a,_e("config"),u(s("config.navigatingToConfig"),"info")},es=a=>{F(a),(P==null?void 0:P.format)==="json"&&k(JSON.stringify(a,null,2)),R(!0)},Bs=a=>{F(l=>({...l||{format:"yaml+env",env:""},format:"yaml+env",yaml:a})),R(!0)},Ws=a=>{F(l=>({...l||{format:"yaml+env",yaml:""},format:"yaml+env",env:a})),R(!0)},Hs=a=>{k(a),R(!0);try{F(JSON.parse(a)),Y("")}catch{Y(s("config.jsonError"))}},Js=a=>{var N,j,A;if(!a)return"{}";const l=JSON.parse(JSON.stringify(a)),m=(N=l==null?void 0:l.models)==null?void 0:N.providers;if(m&&typeof m=="object")for(const[$,S]of Object.entries(m))$.startsWith("js-")&&(S!=null&&S.apiKey)&&(S.apiKey="(proxy token, auto-managed)");const p=(A=(j=l==null?void 0:l["x-jishushell"])==null?void 0:j.proxy)==null?void 0:A.upstream;return p&&p.apiKey===""&&p.hasApiKey&&(p.apiKey="(saved, leave empty to keep, enter new value to update)"),JSON.stringify(l,null,2)},ts=a=>{var N,j,A;const l=JSON.parse(a),m=(j=(N=l==null?void 0:l["x-jishushell"])==null?void 0:N.proxy)==null?void 0:j.upstream;(m==null?void 0:m.apiKey)==="(saved, leave empty to keep, enter new value to update)"&&delete m.apiKey;const p=(A=l==null?void 0:l.models)==null?void 0:A.providers;if(p&&typeof p=="object")for(const[$,S]of Object.entries(p))$.startsWith("js-")&&(S==null?void 0:S.apiKey)==="(proxy token, auto-managed)"&&delete S.apiKey;return l},ss=async a=>{var l;if(!(!t||!b||!P)){Y(""),T(!0);try{const m=P.format==="yaml+env"?{format:"yaml+env",yaml:String(b.yaml||""),env:qr(String(b.env||""),((l=Ze.current)==null?void 0:l.env)||"",P.secretFields)}:ts(ue?X:JSON.stringify(b)),p=await Ma(t,m);if(p!=null&&p.config&&(P.format==="yaml+env"?(Ze.current=p.config,F({...p.config,env:Ot(p.config.env,P.secretFields)}),k("")):(F(p.config),k(JSON.stringify(p.config,null,2)))),R(!1),a)try{await Ps(t),Xt(),u(s("config.savedAndRestarted"),"success"),g("chat"),o(`/instances/${t}`,{replace:!0})}catch(N){u(s("config.savedButRestartFailed",{error:N.message||""}),"error"),Y(s("config.restartFailed",{error:N.message||""}))}else u(s("config.saved"),"success");setTimeout(Re,1e3)}catch(m){Y(m instanceof SyntaxError?s("config.jsonParseError",{error:m.message}):m.message||s("common:error.saveFailed"))}finally{T(!1)}}},zs=async()=>{var l;if(!t||nt.trim()!==((l=i==null?void 0:i.name)==null?void 0:l.trim())||je||Ce)return;const a=lt.trim();if(qe(""),a){He(!0);try{await $a({sudoPassword:a})}catch(m){qe((m==null?void 0:m.message)||s("newInstance:sudoDialog.passwordInvalid",{defaultValue:"sudo 密码错误,请重新输入。"})),Te(""),He(!1);return}He(!1)}wt.current=!0,Rt(!0);try{await Ta(t,he,a?{sudoPassword:a}:void 0),o("/",{replace:!0})}catch(m){u(m.message||s("common:error.deleteFailed"),"error"),Rt(!1)}},_e=a=>{if(L&&r==="config"&&a!=="config"){if(!window.confirm(s("config.unsavedWarning")))return;R(!1)}g(a),o(`/instances/${t}/${a}`,{replace:!0})};if(!i)return e.jsx("div",{className:"p-6 2xl:px-6 2xl:py-4 max-w-5xl xl:max-w-6xl 2xl:max-w-none mx-auto",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-6 w-48 bg-[var(--card)] rounded"}),e.jsx("div",{className:"h-10 w-full bg-[var(--card)] rounded"}),e.jsx("div",{className:"h-40 bg-[var(--card)] rounded-lg"})]})});const ze=((cs=i.service)==null?void 0:cs.status)||"stopped",Ge=ze==="running",xt=ze==="pending",pt=ze==="failed"||ze==="dead",At=((ds=i==null?void 0:i.capabilities)==null?void 0:ds.backupRestore)!==!1,_t=(xt||_!=null&&Date.now()<_)&&!pt,tt=Ge,Gs=s(_t?"common:status.starting":Ge?"common:status.running":ze==="failed"?"common:status.failed":ze==="dead"?"common:status.crashed":"common:status.stopped"),Qs=_t?"text-amber-400":Ge?"text-emerald-400":pt?"text-red-400":"text-muted",Ys=_t?"bg-amber-400 animate-pulse shadow-[0_0_6px_rgba(251,191,36,0.5)]":Ge?"bg-emerald-500 shadow-[0_0_6px_rgba(16,185,129,0.6)]":pt?"bg-red-500 shadow-[0_0_6px_rgba(239,68,68,0.6)]":"bg-[var(--muted)] opacity-40";return e.jsxs("div",{className:"p-6 2xl:px-6 2xl:py-4 max-w-5xl xl:max-w-6xl 2xl:max-w-none mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:i.name}),e.jsx("span",{className:"px-2 py-0.5 rounded-full border border-[var(--border)] text-[11px] text-muted uppercase tracking-[0.08em]",children:i.agentType||"openclaw"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${Ys}`}),e.jsx("span",{className:`text-xs font-medium ${Qs}`,children:Gs}),Ge&&!z&&(((ms=(us=i==null?void 0:i.capabilities)==null?void 0:us.gateway)==null?void 0:ms.chatPanel)==="iframe"||Ae)&&e.jsx("span",{className:"text-[11px] text-amber-400/90",children:s("status.gatewayPending")}),Ht&&t&&e.jsx(Pr,{instanceId:t})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r==="chat"&&e.jsxs(e.Fragment,{children:[e.jsx("a",{href:(Ae?Ct:V)||void 0,target:"_blank",rel:"noopener noreferrer","aria-disabled":!(Ae?Ct:V),title:s("openInWindow"),className:`p-1.5 border border-[var(--border)] rounded-md transition-all duration-150 ${(Ae?Ct:V)?"text-muted hover:text-foreground hover:bg-[var(--card-hover)] cursor-pointer":"pointer-events-none text-muted opacity-30"}`,children:e.jsx(va,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>{D(!1),ae(!1)},disabled:!V,title:s("reload"),className:"p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] disabled:opacity-30 transition-all duration-150",children:e.jsx(Os,{className:"w-4 h-4"})})]}),we.configEditor&&e.jsxs("button",{onClick:()=>_e("config"),title:s("tab.config"),className:"p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-all duration-150 relative",children:[e.jsx(ya,{className:"w-4 h-4"}),L&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-amber-400"})]}),Ht&&e.jsx("button",{onClick:()=>_e("connections"),title:s("tab.connections"),"aria-label":s("tab.connections"),className:`p-1.5 border rounded-md transition-all duration-150 ${r==="connections"?"border-[#0066FF]/50 bg-[#0066FF]/10 text-[#0066FF]":"border-[var(--border)] text-muted hover:text-foreground hover:bg-[var(--card-hover)]"}`,children:e.jsx(ja,{className:"w-4 h-4"})}),we.quickConfig&&((xs=i==null?void 0:i.capabilities)==null?void 0:xs.pluginInstall)===!0&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>be(a=>!a),title:s("quickSkill"),className:"flex items-center gap-1 px-2.5 py-1.5 border border-[#0066FF]/30 rounded-md text-xs font-medium text-[#0066FF] bg-[#0066FF]/5 hover:bg-[#0066FF]/10 transition-all duration-150",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})}),e.jsx("span",{className:"hidden sm:inline",children:s("quickSkill")}),e.jsx(ka,{className:`w-3 h-3 transition-transform duration-150 ${xe?"rotate-180":""}`})]}),xe&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>be(!1)}),e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-80 bg-background border border-[var(--border)] rounded-lg shadow-2xl z-20 overflow-hidden",children:[e.jsx("div",{className:"flex border-b border-[var(--border)]",children:["im","skills","mcp","slash"].map(a=>{const l={im:{emoji:"💬",label:s("quickSkill.im")},skills:{emoji:"⚡",label:s("quickSkill.skills")},mcp:{emoji:"🔌",label:s("quickSkill.mcp")},slash:{emoji:"/",label:s("quickSkill.slash")}}[a];return e.jsxs("button",{onClick:m=>{m.stopPropagation(),Xe(a)},className:`flex-1 py-2 flex flex-col items-center gap-0.5 text-[10px] font-medium transition-colors border-b-2 ${Ve===a?"text-[#0066FF] border-[#0066FF] bg-[#0066FF]/5":"text-muted border-transparent hover:text-foreground hover:bg-[var(--card-hover)]"}`,children:[e.jsx("span",{className:"text-sm leading-none",children:l.emoji}),e.jsx("span",{children:l.label})]},a)})}),e.jsxs("div",{className:"max-h-[480px] overflow-y-auto",children:[Ve==="im"&&e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsxs("button",{onClick:()=>mt("feishu"),className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-[#3370FF]/30 bg-[#3370FF]/5 hover:bg-[#3370FF]/10 transition-all duration-150",children:[e.jsx("img",{src:"https://s1.aigei.com/src/img/png/5a/5ad236651e0c4a6b940d2e1d2bf29749.png?imageMogr2/auto-orient/thumbnail/!282x282r/gravity/Center/crop/282x282/quality/85/%7CimageView2/2/w/282&e=2051020800&token=P7S2Xpzfz11vAkASLTkfHN7Fw-oOZBecqeJaxypL:bcW1ujPdX64WlxeEm9SpuJ5H2KY=",alt:s("channel.feishu"),className:"w-8 h-8 rounded-md flex-shrink-0",onError:a=>{a.target.style.display="none"}}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"text-sm font-semibold text-[#3370FF]",children:s("channel.feishu")}),e.jsx("div",{className:"text-[11px] text-muted mt-0.5",children:Ne.feishu==="installing"?s("quickSkill.pluginInstalling"):Ne.feishu!=="installed"?s("quickSkill.clickToInstall"):O!=null&&O.im.feishu?`✓ ${s("quickSkill.bound")}`:s("quickSkill.scanToBind")})]}),Ne.feishu==="installing"&&e.jsx("div",{className:"w-4 h-4 border-2 border-[#3370FF]/30 border-t-[#3370FF] rounded-full animate-spin flex-shrink-0"}),Ne.feishu==="installed"&&(O==null?void 0:O.im.feishu)&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-500/15 text-emerald-400 font-medium flex-shrink-0",children:s("quickSkill.bound")})]}),e.jsxs("button",{onClick:()=>mt("openclaw-weixin"),className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-[#07C160]/30 bg-[#07C160]/5 hover:bg-[#07C160]/10 transition-all duration-150",children:[e.jsx("img",{src:"https://sgnewres.wechat.com/t/ofs-wechat/newsroom-web/res/_next/static/media/wechat-with-color.7a890de8.svg",alt:s("channel.weixin"),className:"w-8 h-8 rounded-md flex-shrink-0",onError:a=>{a.target.style.display="none"}}),e.jsxs("div",{className:"text-left flex-1",children:[e.jsx("div",{className:"text-sm font-semibold text-[#07C160]",children:s("channel.weixin")}),e.jsx("div",{className:"text-[11px] text-muted mt-0.5",children:Ne["openclaw-weixin"]==="installing"?s("quickSkill.pluginInstalling"):Ne["openclaw-weixin"]!=="installed"?s("quickSkill.clickToInstall"):O!=null&&O.im.weixin?`✓ ${s("quickSkill.bound")}`:s("quickSkill.scanToBind")})]}),Ne["openclaw-weixin"]==="installing"&&e.jsx("div",{className:"w-4 h-4 border-2 border-[#07C160]/30 border-t-[#07C160] rounded-full animate-spin flex-shrink-0"}),Ne["openclaw-weixin"]==="installed"&&(O==null?void 0:O.im.weixin)&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-500/15 text-emerald-400 font-medium flex-shrink-0",children:s("quickSkill.bound")})]}),e.jsxs("button",{onClick:()=>{be(!1),_e("config"),qt(!0)},className:"w-full flex items-center justify-center gap-1.5 px-4 py-2 rounded-lg text-[11px] text-muted hover:text-foreground hover:bg-[var(--card-hover)] border border-dashed border-[var(--border)] transition-all duration-150",children:[e.jsx("span",{children:s("quickSkill.moreImConfig")}),e.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{d:"M9 18l6-6-6-6"})})]})]}),Ve==="skills"&&e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-[var(--border)]/60 flex gap-1.5 flex-shrink-0",children:[e.jsx("input",{type:"text",value:ee,onChange:a=>te(a.target.value),onKeyDown:a=>{a.key==="Enter"&&ee.trim()&&(be(!1),We(`安装 ${ee.trim()}`,!0),te(""))},placeholder:s("quickSkill.customSkillPlaceholder"),className:"flex-1 min-w-0 text-[11px] bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1 text-foreground placeholder:text-muted outline-none focus:border-[#0066FF]/60"}),e.jsx("button",{disabled:!ee.trim(),onClick:()=>{ee.trim()&&(be(!1),We(`安装 ${ee.trim()}`,!0),te(""))},className:"flex-shrink-0 text-[11px] px-2 py-1 rounded bg-[#0066FF]/10 text-[#0066FF] hover:bg-[#0066FF]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("quickSkill.install")})]}),e.jsxs("div",{className:"flex",style:{height:"380px"},children:[e.jsxs("div",{className:"flex flex-col border-r border-[var(--border)]/60 bg-[var(--card)] flex-shrink-0",style:{width:"72px"},children:[ht.groups.map(a=>e.jsxs("button",{onMouseEnter:l=>{l.stopPropagation(),ve(a.id)},onClick:l=>{l.stopPropagation(),ve(a.id)},className:`flex flex-col items-center justify-center gap-0.5 py-3 px-1 text-center transition-colors border-l-2 flex-shrink-0 ${ge===a.id?"border-[#0066FF] bg-[#0066FF]/5 text-foreground":"border-transparent text-muted hover:text-foreground hover:bg-[var(--card-hover)]"}`,children:[e.jsx("span",{className:"text-base leading-none",children:a.emoji}),e.jsx("span",{className:"text-[9px] font-medium leading-tight mt-0.5 whitespace-pre-wrap break-all",children:s(`data:skills.group.${a.id}`,{defaultValue:a.label})})]},a.id)),e.jsxs("button",{onMouseEnter:a=>{a.stopPropagation(),ve("installed")},onClick:a=>{a.stopPropagation(),ve("installed")},className:`flex flex-col items-center justify-center gap-0.5 py-3 px-1 text-center transition-colors border-l-2 flex-shrink-0 ${ge==="installed"?"border-[#0066FF] bg-[#0066FF]/5 text-foreground":"border-transparent text-muted hover:text-foreground hover:bg-[var(--card-hover)]"}`,children:[e.jsx("span",{className:"text-base leading-none",children:"📦"}),e.jsx("span",{className:"text-[9px] font-medium leading-tight mt-0.5 whitespace-pre-wrap break-all",children:s("quickSkill.allInstalled")})]})]}),e.jsxs("div",{className:"flex-1 min-w-0 overflow-y-auto",children:[ge==="installed"&&(()=>{if(O===null)return e.jsx("div",{className:"px-3 py-6 text-center text-[11px] text-muted",children:s("quickSkill.loading")});const a=O.installedSkillDirs??[],l={};return ht.groups.forEach(m=>{m.skills.forEach(p=>{var N;(N=p.checkDirs)==null||N.forEach(j=>{l[j.toLowerCase()]=m.label})})}),a.length===0?e.jsx("div",{className:"px-3 py-6 text-center text-[11px] text-muted",children:s("quickSkill.noInstalled")}):e.jsx(e.Fragment,{children:a.map(m=>{const p=l[m.toLowerCase()];return e.jsxs("div",{className:"w-full px-3 py-2 flex items-center gap-2 border-b border-[var(--border)]/30",children:[e.jsxs("button",{className:"flex-1 min-w-0 text-left",onClick:()=>{be(!1),We(`/skill ${m} `,!1)},children:[e.jsx("div",{className:"text-xs font-semibold text-foreground font-mono truncate",children:m}),p&&e.jsx("div",{className:"text-[10px] text-muted mt-0.5",children:p})]}),e.jsx("span",{className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-emerald-500/15 text-emerald-400",children:s("quickSkill.installed")}),e.jsx("button",{onClick:async()=>{if(!(!t||!window.confirm(s("delete.skillConfirm",{name:m}))))try{await Is(t,m);const N=await st(t);Se(N)}catch(N){u(N.message||s("common:error.deleteFailed"),"error")}},className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",children:s("common:action.delete")})]},m)})})})(),ge!=="installed"&&(()=>{const a=ht.groups.find(p=>p.id===ge),l=(a==null?void 0:a.skills)??[];if(l.length===0)return e.jsx("div",{className:"px-3 py-6 text-center text-[11px] text-muted",children:s("quickSkill.noSkills")});const m=((O==null?void 0:O.installedSkillDirs)??[]).map(p=>p.toLowerCase());return e.jsx(e.Fragment,{children:l.map(p=>{var $;if(p.type==="hub")return e.jsxs("div",{className:"w-full px-3 py-2 flex items-center gap-2 border-b border-[var(--border)]/30",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground break-words",children:s(`data:skills.${p.id}.label`,{defaultValue:p.label})}),e.jsx("div",{className:"text-[10px] text-muted leading-tight mt-0.5 break-words",children:s(`data:skills.${p.id}.desc`,{defaultValue:p.desc})}),e.jsx("div",{className:"text-[9px] text-muted/60 leading-tight mt-0.5 break-all",children:p.url})]}),e.jsx("a",{href:p.url,target:"_blank",rel:"noopener noreferrer",onClick:S=>S.stopPropagation(),title:"在新标签页打开",className:"flex-shrink-0 text-[11px] px-1.5 py-0.5 rounded-full font-medium bg-[var(--border)] text-muted hover:bg-[#0066FF]/15 hover:text-[#0066FF] transition-colors no-underline",children:"🔗"})]},p.id);const N=O!==null&&p.checkDirs.some(S=>m.includes(S.toLowerCase())),j=h[p.id]??!1,A=(($=O==null?void 0:O.installedSkillDirs)==null?void 0:$.find(S=>p.checkDirs.some(U=>U.toLowerCase()===S.toLowerCase())))??p.id;return e.jsxs("button",{disabled:j,onClick:()=>{if(be(!1),N)We(`/skill ${A} `,!1);else{B(fe=>({...fe,[p.id]:!0})),We(p.installMsg,p.autoInstall!==!1);let S=0;const U=setInterval(async()=>{S+=5e3;try{const fe=await st(t);Se(fe);const Mt=((fe==null?void 0:fe.installedSkillDirs)??[]).map(Ke=>Ke.toLowerCase());p.checkDirs.some(Ke=>Mt.includes(Ke.toLowerCase()))&&(clearInterval(U),B(Ke=>({...Ke,[p.id]:!1})))}catch{}S>=6e4&&(clearInterval(U),B(fe=>({...fe,[p.id]:!1})))},5e3)}},className:"w-full text-left px-3 py-2 hover:bg-[var(--card-hover)] transition-colors flex items-center gap-2 disabled:opacity-60 border-b border-[var(--border)]/30",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground break-words",children:s(`data:skills.${p.id}.label`,{defaultValue:p.label})}),e.jsx("div",{className:"text-[10px] text-muted leading-tight mt-0.5 break-words",children:s(`data:skills.${p.id}.desc`,{defaultValue:p.desc})})]}),e.jsx("span",{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${j?"bg-amber-500/15 text-amber-400":O===null?"bg-[var(--border)] text-muted":N?"bg-emerald-500/15 text-emerald-400":"bg-[#0066FF]/10 text-[#0066FF]"}`,children:j?s("quickSkill.installing"):O===null?"…":s(N?"quickSkill.installed":"quickSkill.install")}),N&&!j&&e.jsx("button",{onClick:async S=>{if(S.stopPropagation(),!(!t||!window.confirm(s("delete.skillConfirm",{name:A}))))try{await Is(t,A);const U=await st(t);Se(U)}catch(U){u(U.message||s("common:error.deleteFailed"),"error")}},className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",children:s("common:action.delete")})]},p.id)})})})()]})]})]}),Ve==="mcp"&&e.jsxs("div",{className:"py-1",children:[(()=>{const a=!!(O!=null&&O.mcporterInstalled||Ue.installed),l=O===null&&Ue.loading;return e.jsxs("button",{onClick:()=>{a||(be(!1),We("安装 https://clawhub.ai/steipete/mcporter",!0))},className:"w-full text-left px-3 py-2.5 hover:bg-[var(--card-hover)] transition-colors flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:"MCPorter"}),e.jsx("div",{className:"text-[11px] text-muted leading-tight mt-0.5",children:s("quickSkill.mcporterDesc")})]}),e.jsx("span",{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${l?"bg-[var(--border)] text-muted":a?"bg-emerald-500/15 text-emerald-400":"bg-[#0066FF]/10 text-[#0066FF]"}`,children:l?"…":s(a?"quickSkill.installed":"quickSkill.install")})]})})(),e.jsxs("div",{className:"px-3 py-2 border-t border-[var(--border)]/40",children:[e.jsx("div",{className:"text-[10px] text-muted mb-1.5",children:s("quickSkill.mcpJsonLabel")}),e.jsx("textarea",{rows:3,value:Fe,onChange:a=>{ne(a.target.value),Oe("")},placeholder:`{
90
- "serverName": { "command": "npx", "args": [...] }
91
- }`,className:"w-full text-[11px] font-mono bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1.5 text-foreground placeholder:text-muted/50 outline-none focus:border-[#0066FF]/60 resize-none"}),pe&&e.jsx("div",{className:"text-[10px] text-red-400 mt-1",children:pe}),e.jsx("button",{disabled:!Fe.trim()||!t,onClick:async()=>{let a;try{const l=JSON.parse(Fe.trim());if(typeof l!="object"||Array.isArray(l)||l===null)throw new Error("not-object");if(l.mcpServers&&typeof l.mcpServers=="object"&&!Array.isArray(l.mcpServers)?a=l.mcpServers:l.servers&&typeof l.servers=="object"&&!Array.isArray(l.servers)?a=l.servers:a=l,Object.keys(a).length===0)throw new Error("empty");for(const[m,p]of Object.entries(a)){if(typeof p!="object"||Array.isArray(p)||p===null)throw new Error(s("quickSkill.mcpJsonValueNotObject",{name:m}));const N=p;if(!N.command&&!N.baseUrl&&!N.url)throw new Error(s("quickSkill.mcpJsonMissingField",{name:m}))}}catch(l){const m=l==null?void 0:l.message;m==="not-object"?Oe(s("quickSkill.mcpJsonNotObject")):m==="empty"?Oe(s("quickSkill.mcpJsonEmpty")):m!=null&&m.startsWith('"')?Oe(m):Oe(s("quickSkill.mcpJsonParseFailed",{error:m||""}));return}try{const l=await Es(t,a);ne(""),Oe(""),u(s("quickSkill.mcpWritten"),"success"),Se(m=>m&&{...m,mcporterServers:l.mcpServers}),Ie(m=>({...m,loading:!0})),Tt(t).then(m=>Ie({servers:m.servers,installed:m.installed,loading:!1})).catch(()=>Ie(m=>({...m,loading:!1})))}catch(l){Oe(l.message||s("quickSkill.mcpWriteFailed"))}},className:"mt-1.5 w-full text-[11px] px-2 py-1 rounded bg-[#0066FF]/10 text-[#0066FF] hover:bg-[#0066FF]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("quickSkill.addToConfig")})]}),(((ps=bt.find(a=>a.id==="mcp"))==null?void 0:ps.items)??[]).map(a=>{const l=Object.keys((O==null?void 0:O.mcporterServers)??{}),m=Ue.servers.map(j=>j.name),p=a.mcpJson?Object.keys(a.mcpJson):[],N=p.length>0&&p.some(j=>l.includes(j)||m.includes(j));return e.jsxs("button",{onClick:async()=>{if(a.mcpJson&&t)try{const j=await Es(t,a.mcpJson);u(s("quickSkill.mcpAdded",{label:a.label}),"success"),Se(A=>A&&{...A,mcporterServers:j.mcpServers}),Ie(A=>({...A,loading:!0})),Tt(t).then(A=>Ie({servers:A.servers,installed:A.installed,loading:!1})).catch(()=>Ie(A=>({...A,loading:!1})))}catch(j){u(j.message||s("quickSkill.mcpAddFailed"),"error")}else mt(a.id)},className:"w-full text-left px-3 py-2.5 hover:bg-[var(--card-hover)] transition-colors border-t border-[var(--border)]/40 flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:s(`data:mcp.${a.id}.label`,{defaultValue:a.label})}),e.jsx("div",{className:"text-[11px] text-muted leading-tight mt-0.5",children:s(`data:mcp.${a.id}.desc`,{defaultValue:a.desc})})]}),a.mcpJson&&e.jsx("span",{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${N?"bg-emerald-500/15 text-emerald-400":"bg-[#0066FF]/10 text-[#0066FF]"}`,children:s(N?"quickSkill.configured":"quickSkill.oneClickConfig")})]},a.id)}),(()=>{var N;const a=(O==null?void 0:O.mcporterServers)??{},l=new Set((((N=bt.find(j=>j.id==="mcp"))==null?void 0:N.items)??[]).flatMap(j=>j.mcpJson?Object.keys(j.mcpJson):[])),m=Object.keys(a).filter(j=>!l.has(j));if(m.length===0)return null;const p={};for(const j of Ue.servers)p[j.name]=j;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 pt-2 pb-0.5 text-[9px] font-semibold text-muted/60 uppercase tracking-widest border-t border-[var(--border)]/40 mt-1",children:s("quickSkill.mcporterConfigured")}),m.map(j=>{var Ke;const A=a[j],$=p[j],S=($==null?void 0:$.transport)??(A!=null&&A.baseUrl?`HTTP ${A.baseUrl}`:A!=null&&A.command?`${A.command} ${(A.args??[]).join(" ")}`.trim():""),U=($==null?void 0:$.status)==="ok",fe=$?U?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400":(Ue.loading,"bg-[var(--border)] text-muted"),Mt=Ue.loading&&!$?s("quickSkill.detecting"):$?U?(Ke=$.tools)!=null&&Ke.length?s("quickSkill.statusNormalWithTools",{count:$.tools.length}):s("quickSkill.statusNormal"):$.status:s("quickSkill.configured");return e.jsxs("div",{className:"w-full px-3 py-2 flex items-center gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground font-mono",children:j}),S&&e.jsx("div",{className:"text-[11px] text-muted leading-tight mt-0.5 truncate",children:S})]}),e.jsxs("span",{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${fe} flex items-center gap-1`,children:[Ue.loading&&!$&&e.jsx("span",{className:"w-2 h-2 border border-muted/40 border-t-muted rounded-full animate-spin"}),Mt]}),e.jsx("button",{onClick:async()=>{if(!(!t||!window.confirm(s("delete.mcpConfirm",{name:j}))))try{await wa(t,j);const $t=await st(t);Se($t),Ie(vs=>({...vs,servers:vs.servers.filter(Xs=>Xs.name!==j)}))}catch($t){u($t.message||s("common:error.deleteFailed"),"error")}},className:"flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors",children:s("common:action.delete")})]},j)})]})})()]}),Ve==="slash"&&e.jsx("div",{className:"py-1",children:(((fs=bt.find(a=>a.id==="slash"))==null?void 0:fs.groups)??[]).map((a,l)=>e.jsxs("div",{children:[l>0&&e.jsx("div",{className:"border-t border-[var(--border)]/40 mx-3 my-0.5"}),e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-[9px] font-semibold text-muted/60 uppercase tracking-widest",children:s(`data:slash.group.${a.label}`,{defaultValue:a.label})}),a.items.map(m=>e.jsxs("button",{onClick:()=>mt(m.id),className:"w-full text-left px-3 py-1 hover:bg-[var(--card-hover)] transition-colors",children:[e.jsx("div",{className:"text-xs font-medium text-foreground font-mono",children:m.label}),e.jsx("div",{className:"text-[11px] text-muted leading-tight",children:s(`data:slash.${m.id}.desc`,{defaultValue:m.desc})})]},m.id))]},a.label))})]})]})]})]}),Ge||xt?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>ut("restart"),disabled:!!de||xt,className:"px-3 py-1.5 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:s(de==="restart"?"action.restarting":"common:action.restart")}),e.jsx("button",{onClick:()=>ut("stop"),disabled:!!de,className:"px-3 py-1.5 bg-red-600 text-white rounded-md text-xs font-medium hover:bg-red-700 disabled:opacity-40 transition-all duration-200",children:s(de==="stop"?"action.stopping":"common:action.stop")})]}):e.jsx("button",{onClick:()=>ut("start"),disabled:!!de,className:"px-3 py-1.5 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:s(de==="start"?"action.starting":"common:action.start")}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{type:"button",onClick:()=>De(!ot),"aria-label":s("common:action.moreActions"),className:"p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-all duration-150",children:e.jsx(Na,{className:"w-4 h-4"})}),ot&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>De(!1)}),e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-40 bg-background border border-[var(--border)] rounded-lg shadow-2xl py-1 z-20",children:[e.jsx("button",{onClick:()=>{De(!1),_e("logs")},className:"w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors",children:s("tab.logs")}),e.jsx("button",{onClick:()=>{De(!1),_e("usage")},className:"w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors",children:s("tab.usage")}),At&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-[var(--border)] my-1"}),e.jsx("button",{onClick:()=>{De(!1),Ye("manage")},className:"w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors",children:s("backup.manageMenu",{defaultValue:"备份管理"})}),e.jsx("button",{onClick:()=>{De(!1),Ye("export")},className:"w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors",children:s("backup.export",{defaultValue:"导出(分享)"})}),e.jsx("div",{className:"border-t border-[var(--border)] my-1"})]}),e.jsx("button",{onClick:()=>{De(!1),se(!0),Je(!1)},className:"w-full text-left px-3 py-2 text-sm text-red-400 hover:bg-red-500/10 transition-colors",children:s("delete.title")})]})]})]})]})]}),t&&At&&e.jsx(Ar,{instanceId:t,instanceName:(i==null?void 0:i.name)||t,showToast:u,onRestoreComplete:Re,openBackup:Qe==="backup",openManage:Qe==="manage",openExport:Qe==="export",onDialogClose:()=>Ye(null)}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted mb-3",children:[e.jsx("button",{onClick:()=>o("/"),className:"hover:text-foreground transition-colors",children:s("backToOverview")}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("span",{children:["📊 ",((hs=i.service)==null?void 0:hs.memory_mb)!=null?`${i.service.memory_mb} MB`:"-"]}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("span",{children:["⏱ ",Rr((bs=i.service)==null?void 0:bs.uptime,s)]}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("span",{children:["🔌 ",s("port",{port:Vs(i)})]})]}),pt&&e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-4 py-3 flex items-center justify-between mb-3",children:[e.jsx("span",{children:s("failedHint")}),e.jsx("button",{onClick:()=>_e("logs"),className:"text-red-400 underline text-sm font-medium",children:s("viewLogs")})]}),r!=="chat"&&ct&&e.jsx("button",{onClick:()=>_e("chat"),className:"flex items-center gap-1 text-xs text-[#0066FF] hover:text-[#0066FF]/80 mb-3 transition-colors",children:s("backToChat")}),r==="chat"&&(()=>{var l,m;const a=(m=(l=i==null?void 0:i.capabilities)==null?void 0:l.gateway)==null?void 0:m.chatPanel;return Ut&&t?e.jsx(Ut,{instanceId:t,instanceEpoch:(i==null?void 0:i.created_at)??null}):Nt&&t?e.jsx(pr,{instanceId:t,provide:Nt,isRunning:tt}):a==="iframe"||Ae?e.jsx(mr,{gatewayLaunchUrl:V,gatewayReady:z,isRunning:tt,isPending:xt,iframeLoaded:G,actionLoading:de,onAction:ut,onReload:()=>{D(!1),ae(!1)},onIframeLoad:()=>ae(!0)}):a==="inline"?e.jsxs("div",{className:"rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-8 text-center",children:[e.jsx("div",{className:"w-5 h-5 mx-auto border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin mb-3"}),e.jsx("div",{className:"text-sm text-foreground/70",children:"正在加载 Chat 组件..."})]}):e.jsxs("div",{className:"rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-8 text-center",children:[e.jsx("div",{className:"text-4xl mb-3 opacity-40",children:"🔌"}),e.jsxs("div",{className:"text-sm text-foreground/70 font-medium mb-1",children:["此应用 (",i==null?void 0:i.agentType,") 没有内置应用界面"]}),e.jsx("div",{className:"text-xs text-muted mb-4",children:Be==="config"?"请切换到 Config tab 配置消息平台凭证,通过 IM 与应用交互。":"此应用没有可嵌入的应用界面,请改用日志或用量页确认运行状态。"}),e.jsx("button",{onClick:()=>_e(Be),className:"px-4 py-2 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 transition-all duration-200",children:Be==="config"?"打开 Config":Be==="logs"?"打开 Logs":"打开 Usage"})]})})(),r==="chat"&&!we.chat&&!ct&&zt&&e.jsx("div",{className:"bg-card border border-[var(--border)] rounded-xl p-6 text-center space-y-3",children:tt?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-foreground",children:s("webui.ready")}),e.jsx("a",{href:zt,target:"_blank",rel:"noopener noreferrer",className:"inline-block px-4 py-2 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 transition-all",children:s("webui.open")})]}):e.jsx("p",{className:"text-sm text-muted",children:s("webui.notRunning")})}),r==="config"&&b&&we.configEditor&&e.jsxs("div",{className:"space-y-4",children:[L&&e.jsxs("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-lg px-4 py-2.5 flex items-center justify-between",children:[e.jsx("span",{children:s("config.modified")}),e.jsx("button",{onClick:()=>{F(null),Promise.all([Cs(t),Ss(t)]).then(([a,l])=>{I(a),a.format==="yaml+env"?(Ze.current=l,F({...l,env:Ot(l.env,a.secretFields)}),k("")):(F(l),k(JSON.stringify(l,null,2))),R(!1)})},className:"text-xs text-amber-400 hover:underline",children:s("config.discard")})]}),M&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-4 py-2.5",children:M}),(P==null?void 0:P.format)==="json"&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>J(!1),className:`px-3 py-1.5 text-xs rounded-md transition-colors duration-150 ${ue?"text-muted hover:bg-[var(--card-hover)]":"bg-[#0066FF] text-white"}`,children:s("config.form")}),e.jsx("button",{onClick:()=>{k(Js(b)),J(!0)},className:`px-3 py-1.5 text-xs rounded-md transition-colors duration-150 ${ue?"bg-[#0066FF] text-white":"text-muted hover:bg-[var(--card-hover)]"}`,children:s("config.json")})]}),(P==null?void 0:P.format)==="json"&&ue?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"bg-[#0066FF]/10 border border-[#0066FF]/20 rounded-lg px-3 py-2 text-xs text-[#0066FF]/80 space-y-1",children:[e.jsx("div",{className:"font-medium text-[#0066FF]/90",children:s("config.jsonHelp")}),e.jsxs("ul",{className:"list-disc list-inside space-y-0.5",children:[e.jsx("li",{dangerouslySetInnerHTML:{__html:s("config.jsonHelp1")}}),e.jsx("li",{dangerouslySetInnerHTML:{__html:s("config.jsonHelp2")}}),e.jsx("li",{dangerouslySetInnerHTML:{__html:s("config.jsonHelp3")}})]})]}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-4 py-2 flex items-center justify-between",children:e.jsx("span",{className:"text-xs font-medium text-muted",children:"openclaw.json"})}),e.jsx("textarea",{value:X,onChange:a=>Hs(a.target.value),className:"w-full font-mono text-[13px] p-4 min-h-[400px] lg:min-h-[500px] focus:outline-none resize-y text-foreground bg-transparent",spellCheck:!1})]})]}):Bt&&t?e.jsx(Bt,{config:b,onChange:es,instanceId:t,capabilities:i==null?void 0:i.capabilities,isRunning:tt}):(P==null?void 0:P.format)==="yaml+env"?e.jsx(_r,{yaml:String((b==null?void 0:b.yaml)||""),env:String((b==null?void 0:b.env)||""),onYamlChange:Bs,onEnvChange:Ws}):e.jsx(Ha,{config:b,onChange:es,instanceId:t,isRunning:tt,pluginStatuses:Ne,onInstallPlugin:Yt}),e.jsxs("div",{className:"flex gap-2 sticky bottom-0 backdrop-blur-sm py-3 -mx-6 px-6 border-t border-[var(--border)] mt-4",style:{background:"color-mix(in srgb, var(--background) 85%, transparent)"},children:[e.jsx("button",{onClick:()=>ss(!1),disabled:!L||oe,className:"px-4 py-2 border border-[var(--border)] text-muted rounded-md text-sm font-medium hover:bg-[var(--card-hover)] hover:text-foreground disabled:opacity-40 transition-all duration-200",children:s(oe?"config.saving":"config.save")}),e.jsx("button",{onClick:()=>ss(!0),disabled:oe,className:"px-4 py-2 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:s(oe?"config.processing":"config.saveAndRestart")})]})]}),r==="logs"&&e.jsx(fr,{logs:E,logSearch:ce,logType:q,logsEndRef:vt,onSearchChange:le,onLogTypeChange:H,onRefresh:Pt,onCopy:()=>{const a=ce?E.filter(l=>l.toLowerCase().includes(ce.toLowerCase())):E;navigator.clipboard.writeText(a.join(`
92
- `)).then(()=>u(s("logs.copied"),"success")).catch(()=>u(s("logs.copyFailed"),"error"))}}),r==="usage"&&e.jsx(hr,{usage:v,onRefresh:()=>Fs(t).then(C).catch(()=>{})}),r==="connections"&&t&&e.jsx(Er,{instanceId:t}),re&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>{Pe.current=!0,Ee.current=!1,ye(null)},children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-xs shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:s(re.type==="feishu"?"qr.feishuTitle":"qr.weixinTitle")}),e.jsx("button",{onClick:()=>{Pe.current=!0,Ee.current=!1,ye(null)},className:"text-muted hover:text-foreground transition-colors text-lg leading-none",children:"✕"})]}),e.jsx("div",{className:"flex flex-col items-center gap-3",children:re.status==="confirmed"?e.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/20 rounded-md px-4 py-5 text-center w-full",children:[e.jsx("div",{className:"text-3xl mb-2",children:"✓"}),e.jsx("div",{className:"text-emerald-400 font-medium text-sm",children:re.message}),e.jsx("p",{className:"text-xs text-muted mt-1",children:s("qr.credSaved")})]}):re.status==="loading"?e.jsx("div",{className:"w-48 h-48 flex items-center justify-center",children:e.jsx("div",{className:`w-8 h-8 border-2 rounded-full animate-spin ${re.type==="feishu"?"border-[#3370FF]/30 border-t-[#3370FF]":"border-[#07C160]/30 border-t-[#07C160]"}`})}):re.status==="error"?e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-md px-4 py-4 text-center w-full",children:[e.jsx("div",{className:"text-red-400 text-sm",children:re.message}),e.jsx("button",{onClick:a=>{a.stopPropagation(),Zt(re.type)},className:`mt-3 px-4 py-1.5 text-white rounded-md text-xs font-medium transition-colors ${re.type==="feishu"?"bg-[#3370FF] hover:bg-[#3370FF]/90":"bg-[#07C160] hover:bg-[#07C160]/90"}`,children:s("qr.retry")})]}):e.jsxs(e.Fragment,{children:[re.qrUrl?e.jsx(La,{value:re.qrUrl,size:192,className:"rounded-lg"}):e.jsx("div",{className:"w-48 h-48 flex items-center justify-center",children:e.jsx("div",{className:`w-8 h-8 border-2 rounded-full animate-spin ${re.type==="feishu"?"border-[#3370FF]/30 border-t-[#3370FF]":"border-[#07C160]/30 border-t-[#07C160]"}`})}),e.jsx("div",{className:"flex items-center gap-2 text-sm",children:re.status==="scaned"?e.jsxs("span",{className:`font-medium ${re.type==="weixin"?"text-[#07C160]":"text-[#3370FF]"}`,children:["👀 ",re.message]}):e.jsx("span",{className:"text-muted",children:re.message})})]})}),re.status==="confirmed"&&e.jsx("button",{onClick:()=>{Pe.current=!0,Ee.current=!1,ye(null)},className:"mt-4 w-full py-2 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 transition-colors",children:s("common:action.close")})]})}),Q&&e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>{je||Ce||(se(!1),$e(""),Te(""),qe(""),Je(!1))},children:e.jsxs("div",{className:"bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsx("h3",{className:"text-base font-semibold text-foreground mb-2",children:s("delete.title")}),e.jsx("p",{className:"text-sm text-muted mb-4",children:e.jsx(Ua,{ns:"instance",i18nKey:"delete.warning",values:{name:i.name},components:{strong:e.jsx("strong",{className:"text-foreground"})}})}),e.jsx("p",{className:"text-sm text-muted mb-3",children:s("delete.confirmHint")}),e.jsx("input",{type:"text",value:nt,onChange:a=>$e(a.target.value),disabled:je,className:"w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground mb-4 focus:outline-none focus:ring-1 focus:ring-red-500/60 focus:border-red-500/60 transition-colors disabled:opacity-60",placeholder:i.name}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm text-muted mb-2",children:s("delete.sudoPassword",{defaultValue:"sudo 密码(如本次删除涉及系统卸载)"})}),e.jsx("input",{type:"password",value:lt,onChange:a=>{Te(a.target.value),qe("")},disabled:je||Ce,className:"w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-red-500/60 focus:border-red-500/60 transition-colors disabled:opacity-60",placeholder:s("delete.sudoPasswordPlaceholder",{defaultValue:"需要提权时请输入"}),autoComplete:"current-password"}),ke&&e.jsx("p",{className:"mt-2 text-xs text-red-400",children:ke}),e.jsx("p",{className:"mt-2 text-xs text-muted",children:s("delete.sudoPasswordHint",{defaultValue:"实例删除若会触发底层应用卸载,将使用这里提供的密码执行 sudo。"})})]}),At&&e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted cursor-pointer mb-4",children:[e.jsx("input",{type:"checkbox",checked:he,onChange:a=>Je(a.target.checked),disabled:je,className:"rounded border-[var(--border)] bg-[var(--input-bg)]"}),s("delete.purgeBackups",{defaultValue:"同时删除备份"})]}),je&&e.jsx("p",{className:"text-xs text-muted mb-3",children:s("delete.inProgressHint",{defaultValue:"正在删除,大实例可能需要 30 秒到 1 分钟,请勿关闭窗口。"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{se(!1),$e(""),Te(""),qe(""),Je(!1)},disabled:je||Ce,className:"flex-1 py-2 border border-[var(--border)] text-muted rounded-md text-sm font-medium hover:bg-[var(--card-hover)] hover:text-foreground transition-all duration-150 disabled:opacity-40 disabled:cursor-not-allowed",children:s("common:action.cancel")}),e.jsxs("button",{onClick:zs,disabled:nt.trim()!==((gs=i.name)==null?void 0:gs.trim())||je||Ce,className:"flex-1 py-2 bg-red-600 text-white rounded-md text-sm font-medium hover:bg-red-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors inline-flex items-center justify-center gap-2",children:[(je||Ce)&&e.jsx("span",{className:"w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin","aria-hidden":"true"}),je?s("delete.deleting",{defaultValue:"删除中..."}):Ce?s("newInstance:sudoDialog.verifying",{defaultValue:"验证中..."}):s("delete.confirm")]})]})]})})]})}export{Qr as default};
@@ -1 +0,0 @@
1
- import{j as e,T as h,I as g,a as f,b as j,s as v}from"./index-CCkaIEjn.js";import{r as t,u as w}from"./vendor-react-DW5juQin.js";import{u as N}from"./vendor-i18n-DqPtOicc.js";function k({onLogin:a}={}){const{t:s}=N("auth"),[r,m]=t.useState(""),[o,x]=t.useState(!1),[d,i]=t.useState(""),[c,u]=t.useState(!1),b=w(),p=async l=>{l.preventDefault(),i(""),u(!0);try{const n=await j(r);v(n.token),a==null||a(),b("/",{replace:!0})}catch(n){i(n.message||s("login.failed"))}finally{u(!1)}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 grid-bg"}),e.jsx("div",{className:"absolute inset-0 pointer-events-none",children:e.jsx("div",{className:"absolute top-1/4 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] rounded-full bg-[radial-gradient(circle,rgba(0,102,255,0.08)_0%,transparent_70%)]"})}),e.jsxs("div",{className:"w-full max-w-sm relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(h,{className:"w-40 h-40 mx-auto mb-4 object-contain"}),e.jsx("p",{className:"text-sm text-muted mt-1",children:s("login.title")})]}),e.jsx("div",{className:"bg-card border border-[var(--border)] rounded-xl backdrop-blur-xl p-6 shadow-2xl",children:e.jsxs("form",{onSubmit:p,className:"space-y-4",children:[d&&e.jsx("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-3 py-2.5",children:d}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:s("login.password")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:o?"text":"password",value:r,onChange:l=>m(l.target.value),placeholder:s("login.placeholder"),className:"w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 pr-10 transition-colors duration-200",autoFocus:!0}),e.jsx("button",{type:"button",onClick:()=>x(!o),"aria-label":s("common:action.togglePassword"),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors",children:o?e.jsx(g,{}):e.jsx(f,{})})]})]}),e.jsx("button",{type:"submit",disabled:c||!r,className:"w-full bg-[#0066FF] text-white rounded-md py-2.5 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200 shadow-[0_0_20px_rgba(0,102,255,0.3)]",children:c?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),s("login.loading")]}):s("login.submit")})]})}),e.jsxs("p",{className:"text-xs text-muted mt-6 text-center",children:[s("login.forgotPassword")," ",e.jsx("code",{className:"text-foreground bg-card px-1 py-0.5 rounded text-[11px]",children:"jishushell onboard --force"})]})]})]})}export{k as default};