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 s,ak as xs,al as bs,am as hs,d as ys,k as ws,g as vs,an as Is,o as Ns,ao as js,ap as Ss,aq as Cs,ar as Es,v as _s,ai as Fs,as as ks}from"./index-CCkaIEjn.js";import{u as Mt,r as l,f as As}from"./vendor-react-DW5juQin.js";import{u as Pt}from"./vendor-i18n-DqPtOicc.js";import{u as Vs,F as kt,i as Ks}from"./registry-B2ZQZXWL.js";function Ls({onClose:t,showToast:i}){const{t:n}=Pt("newInstance"),m=Mt(),[y,j]=l.useState("upload"),[P,C]=l.useState(!1),[r,E]=l.useState(""),[f,$]=l.useState(null),_=l.useRef(null),[me,$e]=l.useState(""),[K,Ie]=l.useState(null),[Ne,je]=l.useState([]),[Se,Ce]=l.useState(0),[W,T]=l.useState(""),[Q,ie]=l.useState(""),[O,Qe]=l.useState(!1);function V(g){return g.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,63)}function Xe(g){return g<1024?`${g}B`:g<1024*1024?`${(g/1024).toFixed(1)}KB`:`${(g/(1024*1024)).toFixed(1)}MB`}const pe=async()=>{var g;if(f){C(!0),E("");try{const d=await xs(f);$e(d.temp_id);const b=await bs(d.temp_id);Ie(b.manifest),je(b.warnings||[]),Ce(b.estimated_size||0),(g=b.manifest)!=null&&g.name&&(ie(b.manifest.name),O||T(V(b.manifest.name))),j("preview")}catch(d){E(d.message||"Upload failed")}finally{C(!1)}}},Te=async()=>{var g;if(!(!W||!Q||!me)){C(!0),E(""),j("creating");try{const d=await hs({temp_id:me,id:W,name:Q});d.ok?(i(n("import.success",{defaultValue:"导入成功"}),"success"),(g=d.warnings)!=null&&g.length&&d.warnings.forEach(b=>i(b,"info")),m(`/instances/${d.instance_id}/config`)):(E(d.detail||n("import.failed",{defaultValue:"导入失败"})),j("preview"))}catch(d){E(d.message||"Import failed"),j("preview")}finally{C(!1)}}},Ee="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";return s.jsxs("div",{className:"space-y-4",children:[r&&s.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:r}),y==="upload"&&s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-5 space-y-4",children:[s.jsx("div",{className:"text-xs text-muted bg-card border border-[var(--border)] rounded-md p-3",children:n("import.uploadDesc",{defaultValue:"上传 .tar.gz 文件(支持 JishuShell 导出包、备份包、OpenClaw 官方备份)"})}),s.jsx("input",{ref:_,type:"file",accept:".tar.gz,.tgz",onChange:g=>{var d;return $(((d=g.target.files)==null?void 0:d[0])||null)},className:"hidden"}),s.jsx("button",{type:"button",onClick:()=>{var g;return(g=_.current)==null?void 0:g.click()},className:"w-full flex items-center justify-center gap-2 px-4 py-3 border border-dashed border-[var(--border)] rounded-lg text-sm text-muted hover:text-foreground hover:border-[#0066FF]/40 hover:bg-[var(--input-bg)] transition-colors cursor-pointer",children:f?s.jsxs("span",{className:"text-foreground truncate",children:[f.name," (",(f.size/1024/1024).toFixed(1),"MB)"]}):n("import.selectFile",{defaultValue:"点击选择 .tar.gz 文件"})})]}),y==="preview"&&K&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-5 space-y-4",children:[s.jsxs("div",{className:"bg-[var(--input-bg)] border border-[var(--border)] rounded-lg p-4 space-y-2 text-sm",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted",children:n("import.name",{defaultValue:"名称"})}),s.jsx("span",{className:"text-foreground",children:K.name||"-"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted",children:n("import.type",{defaultValue:"类型"})}),s.jsx("span",{className:"text-foreground",children:K.type||"unknown"})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted",children:n("import.size",{defaultValue:"大小"})}),s.jsx("span",{className:"text-foreground",children:Xe(Se)})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-muted",children:n("import.platform",{defaultValue:"平台"})}),s.jsxs("span",{className:"text-foreground",children:[K.platform||"-"," / ",K.arch||"-"]})]}),K.has_sessions===!1&&s.jsx("div",{className:"text-amber-400 text-xs",children:n("import.noSessions",{defaultValue:"不含对话历史"})})]}),Ne.length>0&&s.jsx("div",{className:"space-y-1",children:Ne.map((g,d)=>s.jsx("p",{className:"text-xs text-amber-400",children:g},d))}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:n("name.label",{defaultValue:"应用名称"})}),s.jsx("input",{type:"text",value:Q,onChange:g=>{ie(g.target.value),O||T(V(g.target.value))},className:Ee})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:n("id.label",{defaultValue:"应用 ID"})}),s.jsx("input",{type:"text",value:W,onChange:g=>{T(g.target.value),Qe(!0)},className:`${Ee} font-mono text-[13px]`})]})]}),s.jsx("button",{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)]",onClick:Te,disabled:!W||!Q||P,children:n("import.create",{defaultValue:"创建应用"})})]}),y==="upload"&&s.jsx("button",{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)]",onClick:pe,disabled:!f||P,children:P?s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),n("import.uploading",{defaultValue:"上传中..."})]}):n("import.upload",{defaultValue:"上传并预览"})}),y==="creating"&&s.jsxs("div",{className:"flex items-center justify-center py-8 gap-3",children:[s.jsx("span",{className:"w-4 h-4 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin"}),s.jsx("span",{className:"text-sm text-muted",children:n("import.creating",{defaultValue:"正在创建应用..."})})]})]})}function Ds(t){return t.type==="done"?"success":t.type==="error"?"error":t.type==="progress"?"progress":"info"}async function He(t,i={}){var r;const n=i.maxDurationMs??18e5,m=Math.max(200,i.pollIntervalMs??500);let y=Math.max(0,i.initialSeenCount??0),j=0,P="task completed";const C=Date.now()+n;for(;Date.now()<C;){let E=null;try{const f=await ys(t);j=0;const $=f.events.slice(y);y=f.events.length;for(const _ of $)(r=i.onEvent)==null||r.call(i,{message:_.message,progress:_.progress,tone:Ds(_)},{seenCount:y}),_.message&&(P=_.message);if(f.status==="done")return P;f.status==="error"&&(E=new Error(P))}catch(f){const $=(f==null?void 0:f.message)||`task ${t} polling failed`;if((f==null?void 0:f.code)==="TASK_NOT_FOUND"||/task not found/i.test($))throw new Error($);if(j+=1,j>=5)throw new Error($)}if(E)throw E;await new Promise(f=>setTimeout(f,m))}throw new Error(`task ${t} timeout`)}const Rs="ollama-binary.yaml",At=new Set(["ollama-binary","ollama-with-hollama-binary"]),Ms=["searxng-container.yaml","browserless-chromium-container.yaml","filebrowser-container.yaml","anythingllm-container.yaml","weknora-container.yaml","jishu-kb-container.yaml"],Me=40,Pe="jishushell:new-instance:create-flow",Vt={action:null,kind:null,sourceKey:"",status:"idle",taskId:"",expectedSpecId:"",seenEventCount:0,progress:null,logs:[],lastError:""},Ps={openclaw:!1,hermes:!1,ollama:!1,custom:!1};function $s(){var t,i;if(typeof window>"u")return null;try{const n=window.sessionStorage.getItem(Pe);if(!n)return null;const m=JSON.parse(n);return!m||typeof m!="object"?null:((t=m.templateInstall)==null?void 0:t.status)==="running"&&!!((i=m.templateInstall)!=null&&i.taskId)&&!!m.pendingCreate?m:(window.sessionStorage.removeItem(Pe),null)}catch{return null}}function Ts(t){return(t==null?void 0:t.code)==="INSTANCE_ALREADY_RUNNING"?!0:/already running|已在运行/i.test((t==null?void 0:t.message)||"")}function qs(t){return(t==null?void 0:t.code)==="TASK_NOT_FOUND"?!0:/task not found|未找到.*任务/i.test((t==null?void 0:t.message)||"")}function zs(t){return(t==null?void 0:t.code)==="INVALID_SUDO_PASSWORD"?!0:/sudo 密码无效|invalid sudo password|provided sudo password invalid|sudo 密码错误/i.test((t==null?void 0:t.message)||"")}const Bs=[{id:"openclaw",icon:"🦞",labelKey:"tab.openclaw",descKey:"appDesc.openclaw"},{id:"hermes",icon:"🧠",iconImage:"/logos/hermes.png",labelKey:"tab.hermes",descKey:"appDesc.hermes"},{id:"ollama",icon:"🦙",iconImage:"/logos/ollama.png",labelKey:"tab.ollama",descKey:"appDesc.ollama"},{id:"custom",icon:"🧩",labelKey:"tab.custom",descKey:"appDesc.custom"}];function Us(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,63)}function ce(t){return t.trim().toLowerCase()}function Kt(t){return`${typeof t.progress=="number"&&t.progress>0?`[${t.progress}%] `:""}${t.message}`}function Lt(t){var i;for(let n=t.length-1;n>=0;n-=1){const m=((i=t[n])==null?void 0:i.trim())??"";if(/^(curl|sudo|su)\b/.test(m))return m}return""}function Os(t,i){return t?typeof t.seenEventCount=="number"&&t.seenEventCount>0?t.seenEventCount:t.logs.filter(n=>!!n&&n!==i).length:0}function De(t,i,n){return[...t.length===1&&t[0]===n?[]:t,i].slice(-Me)}function We(t){var n;const i=t.match(/^\s*id:\s*["']?([^"'\s#]+)["']?\s*$/m);return((n=i==null?void 0:i[1])==null?void 0:n.trim())??""}function Ys(t){var n;const i=t.match(/^\s*name:\s*["']?([^"'\n#][^\n#]*?)["']?\s*$/m);return((n=i==null?void 0:i[1])==null?void 0:n.trim())??""}function Gs(t,i){const n=t.trim().toLowerCase();if(!n)return"";if(!i.has(n))return n;for(let m=1;m<1e4;m+=1){const y=`${n}-${m}`.slice(0,63);if(!i.has(y))return y}return n}function Hs(t,i){const n=t.trim();if(!n)return"";const m=ce(n);if(!i.has(m))return n;for(let y=1;y<1e4;y+=1){const j=`${n}-${y}`;if(!i.has(ce(j)))return j}return n}function Js(t){return[...t].sort((i,n)=>new Date(n.installed_at).getTime()-new Date(i.installed_at).getTime())}function Dt(t,i){return Js(t).find(i)??null}function Ws(t,i,n,m){return t==="builtin"?`builtin:${(i==null?void 0:i.id)??""}`:t==="url"?`url:${n.trim()}`:`yaml:${We(m)||"inline"}`}function Rt(t,i,n,m){if(i.kind===n&&i.sourceKey===m){if(i.status==="running")return"installing";if(i.status==="error")return(t==null?void 0:t.status)==="installed"?"installed":"missing"}return(t==null?void 0:t.status)==="installing"?"installing":t?"installed":"missing"}const Re="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",Je={openclaw:"openclaw","hermes-agent":"hermes",ollama:"ollama"};function aa(){var bt,ht,yt,wt,vt,It,Nt,jt,St,Ct,Et,_t,Ft;const{t}=Pt("newInstance"),[i]=As(),n=l.useRef($s()),m=i.get("app")??"",y=m&&Je[m]?Je[m]:m?"custom":null,j=m&&!Je[m]?`${m}.yaml`:"",P=y??((bt=n.current)==null?void 0:bt.createKind)??"openclaw",{runtimes:C}=Vs(),[r,E]=l.useState(P),[f,$]=l.useState(null),[_,me]=l.useState(null),[$e,K]=l.useState({}),[Ie,Ne]=l.useState([]),[je,Se]=l.useState(!1),[Ce,W]=l.useState(""),[T,Q]=l.useState(j||((ht=n.current)==null?void 0:ht.selectedBuiltinTemplate)||""),[ie]=l.useState(j?"builtin":((yt=n.current)==null?void 0:yt.customSourceMode)??"builtin"),[O,Qe]=l.useState(((wt=n.current)==null?void 0:wt.appSpecUrl)??""),[V,Xe]=l.useState(((vt=n.current)==null?void 0:vt.appSpecYaml)??""),[pe,Te]=l.useState([]),[Ee,g]=l.useState({}),[d,b]=l.useState(((It=n.current)==null?void 0:It.templateInstall)??Vt),[L,X]=l.useState(((Nt=n.current)==null?void 0:Nt.pendingCreate)??null),[Z,fe]=l.useState(null),[_e,ee]=l.useState(""),[Ze,q]=l.useState(""),[Y,qe]=l.useState(!1),[k,et]=l.useState(((jt=n.current)==null?void 0:jt.name)??""),[Fe,tt]=l.useState(((St=n.current)==null?void 0:St.nameEdited)??!1),[D,ze]=l.useState(((Ct=n.current)==null?void 0:Ct.id)??""),[ge,st]=l.useState(((Et=n.current)==null?void 0:Et.idEdited)??!1),[de,Qs]=l.useState(((_t=n.current)==null?void 0:_t.description)??""),[at,$t]=l.useState(""),[ke,Tt]=l.useState([]),[qt,Xs]=l.useState(!0),[zt,Bt]=l.useState(!1),[Ut,S]=l.useState(""),[Be,Ot]=l.useState(()=>({...Ps})),Yt=i.get("import")==="true",Ae=Mt(),{showToast:G}=ws(),nt=l.useRef({name:"",id:""}),Ue=l.useRef(""),Oe=l.useCallback(()=>{vs().then($).catch(()=>{})},[]),R=l.useCallback(async()=>{try{const e=await Is();return Te(e),e}catch{return[]}},[]),z=l.useCallback((e,o)=>{Ot(a=>a[e]===o?a:{...a,[e]:o})},[]),Ye=l.useCallback(async(e,o,a={})=>{const v=(await R()).filter(u=>u.install_mode==="app-dir"&&(a.allowInstalling||u.status!=="installing"));return e.kind==="ollama"?Dt(v,u=>u.id===e.appId||!!o&&u.spec_id===o||u.spec_id===e.appId):v.find(u=>u.id===e.appId)??null},[R]);l.useEffect(()=>{Ns().then(Tt).catch(()=>{}),Oe(),R(),Se(!0),js().then(e=>{Ne(e),W("")}).catch(e=>{W((e==null?void 0:e.message)||t("template.loadFailed"))}).finally(()=>{Se(!1)})},[R,Oe]);const lt=l.useRef(!1),xe=r==="hermes"?"hermes":"openclaw",Gt=Ie.filter(e=>e.instanceCompatible),rt=Bs,p=Gt.find(e=>e.fileName===Rs)??null,Ht=(p==null?void 0:p.id)??"ollama-binary",Jt=new Map(Ie.map(e=>[e.fileName,e])),te=Ms.map(e=>Jt.get(e)).filter(e=>!!e&&e.suggestedAppType==="custom"),h=te.find(e=>e.fileName===T)??te[0]??null,se=[...pe].filter(e=>e.install_mode==="app-dir").sort((e,o)=>new Date(o.installed_at).getTime()-new Date(e.installed_at).getTime()),ae=Dt(se,e=>At.has(e.id)||At.has(e.spec_id)),ne=d.kind==="custom"&&d.status==="running"?ie:"builtin",Ve=ne==="builtin"?(h==null?void 0:h.id)??"":ne==="yaml"?We(V):"",ot=ne==="builtin"?(h==null?void 0:h.name)??(h==null?void 0:h.id)??"":ne==="yaml"?Ys(V)||We(V):"",le=Ws(ne,h,O,V),be=`ollama:${Ht}`,B=Rt(ae,d,"ollama",be),H=(ae==null?void 0:ae.status)==="installing"?"":(ae==null?void 0:ae.id)??"",U=D.trim(),it=Ee[le]??"",Wt=it?se.find(e=>e.id===it)??null:null,Qt=U?se.find(e=>e.id===U&&(!Ve||e.spec_id===Ve))??null:null,re=Wt??Qt,Xt=new Set([...se.map(e=>e.id),...ke.map(e=>typeof(e==null?void 0:e.id)=="string"?e.id:"")].filter(Boolean)),Zt=new Set([...se.map(e=>typeof(e==null?void 0:e.name)=="string"&&e.name.trim()?e.name:e.id),...ke.map(e=>typeof(e==null?void 0:e.name)=="string"?e.name:"")].filter(Boolean).map(e=>ce(e))),he=Ve?Gs(Ve,Xt):"",ye=ot?Hs(ot,Zt):"",es=Rt(re,d,"custom",le),Ge=(re==null?void 0:re.status)==="installing"?"":(re==null?void 0:re.id)??"";l.useEffect(()=>{if(d.status!=="running"&&!pe.some(o=>o.status==="installing"))return;const e=setInterval(()=>{R()},1e3);return()=>clearInterval(e)},[pe,R,d.status]),l.useEffect(()=>{if(lt.current||!f||C.length===0||r==="custom"||r==="ollama")return;lt.current=!0;const e=C.find(a=>a.agentType===xe);if(e!=null&&e.isInstalled(f))return;const o=C.find(a=>(a.agentType==="openclaw"||a.agentType==="hermes")&&a.isInstalled(f));o&&E(o.agentType==="hermes"?"hermes":"openclaw")},[r,C,xe,f]),l.useEffect(()=>{if(te.length&&!T){const e=te[0];e&&Q(e.fileName)}},[te,T]),l.useEffect(()=>{if(!(typeof window>"u")){if(d.status==="running"&&d.taskId&&L){const e={createKind:r,customSourceMode:ie,selectedBuiltinTemplate:T,appSpecUrl:O,appSpecYaml:V,name:k,nameEdited:Fe,id:D,idEdited:ge,description:de,templateInstall:d,pendingCreate:L};window.sessionStorage.setItem(Pe,JSON.stringify(e));return}window.sessionStorage.removeItem(Pe)}},[O,V,r,ie,de,D,ge,k,Fe,L,T,d]),l.useEffect(()=>{if(r!=="custom"||!he||!ye)return;const e=nt.current,o=!k.trim()||!Fe||k===e.name,a=!D.trim()||!ge||D===e.id;o&&k!==ye&&(et(ye),tt(!1)),a&&D!==he&&(ze(he),st(!1)),nt.current={name:ye,id:he}},[r,D,ge,k,Fe,he,ye]);const A=C.find(e=>e.agentType===xe)||kt.find(e=>e.agentType===xe)||C[0]||kt[0],Ke=ce(k),dt=Ke?ke.find(e=>typeof(e==null?void 0:e.name)=="string"&&ce(e.name)===Ke):null,ts=U?ke.find(e=>(e==null?void 0:e.id)===U):null,ss=U?se.find(e=>e.id===U):null,ut=Ke?se.find(e=>ce(typeof(e==null?void 0:e.name)=="string"&&e.name.trim()?e.name:e.id)===Ke):null,Le=dt?t("name.duplicate",{name:k.trim(),id:dt.id,defaultValue:"应用名称“{{name}}”已存在(ID: {{id}})"}):ut?t("name.duplicate",{name:k.trim(),id:ut.id,defaultValue:"应用名称“{{name}}”已存在(ID: {{id}})"}):ts?t("id.duplicate",{id:U,defaultValue:"应用 ID“{{id}}”已存在"}):ss?t("id.duplicate",{id:U,defaultValue:"应用 ID“{{id}}”已存在"}):"",as=r==="ollama"||r==="custom",ct=r==="ollama"?B:r==="custom"?es:"missing",oe=r==="ollama"?(p==null?void 0:p.name)??(p==null?void 0:p.id)??"Ollama":k.trim(),M=r==="ollama"?H||(p==null?void 0:p.id)||"":U,ns=r==="ollama"?be:r==="custom"?le:"",ls=(r==="ollama"||r==="custom")&&d.status==="running"&&d.kind===r&&d.sourceKey===ns,rs=(r==="ollama"||r==="custom")&&(ls||ct==="installing"),mt=Be[r]||rs,ue=as&&ct==="installing"?t("install.waitingCompletion",{defaultValue:"当前模板正在安装中,请等待安装完成"}):"",pt=Le||Ut,os=async e=>{if(!_){S(""),me(e.agentType),K(o=>({...o,[e.agentType]:{message:"准备安装...",tone:"progress"}}));try{const o=await Ks(e);o!=null&&o.taskId&&await He(o.taskId,{onEvent:a=>{K(c=>({...c,[e.agentType]:a}))}}),Oe(),G(`${e.displayName} 安装完成`,"success"),E(e.agentType==="hermes"?"hermes":"openclaw")}catch(o){const a=(o==null?void 0:o.message)||`${e.displayName} 安装失败`;S(a),G(a,"error")}finally{me(null),setTimeout(()=>{K(o=>({...o,[e.agentType]:null}))},3e3)}}},is=e=>{S(""),et(e),r==="custom"&&tt(!0),ge||ze(Us(e))},ds=e=>{E(e),S(""),e!=="openclaw"&&($t(""),Bt(!1))},us=()=>{if(r==="ollama"){if(!(p!=null&&p.yaml))throw new Error(t("template.ollamaRequired"));return{flow:{kind:"ollama",sourceKey:be,appId:p.id,name:p.name??p.id,description:p.description??""},payload:{yaml:p.yaml},existingInstalledAppId:H}}if(r!=="custom")throw new Error(t("failed"));if(!M||!oe)throw new Error(t("install.identityRequired",{defaultValue:"请先确认应用名称和应用 ID"}));if(ne==="builtin"){if(!(h!=null&&h.yaml))throw new Error(t("template.none"));return{flow:{kind:"custom",sourceKey:le,appId:M,name:oe,description:de},payload:{yaml:h.yaml,requestedAppId:M},existingInstalledAppId:Ge}}if(ne==="url"){if(!O.trim())throw new Error(t("custom.urlRequired"));return{flow:{kind:"custom",sourceKey:le,appId:M,name:oe,description:de},payload:{url:O.trim(),requestedAppId:M},existingInstalledAppId:Ge}}if(!V.trim())throw new Error(t("custom.yamlRequired"));return{flow:{kind:"custom",sourceKey:le,appId:M,name:oe,description:de},payload:{yaml:V.trim(),requestedAppId:M},existingInstalledAppId:Ge}},we=l.useCallback(async(e,o,a)=>{const c=t("install.waitingLogs"),v=Os(a,c);b(N=>{var x;return{...N,action:"install",kind:e.kind,sourceKey:e.sourceKey,status:"running",taskId:(a==null?void 0:a.taskId)??N.taskId,expectedSpecId:(a==null?void 0:a.expectedSpecId)??N.expectedSpecId,seenEventCount:v,progress:(a==null?void 0:a.progress)??N.progress??null,logs:(x=a==null?void 0:a.logs)!=null&&x.length?a.logs:[c],lastError:""}});let u=(a==null?void 0:a.taskId)??"",w=(a==null?void 0:a.expectedSpecId)??"",I=null;try{if(!u){if(!o)throw new Error(t("install.missingTask",{defaultValue:"未找到可恢复的安装任务,请重新点击创建应用"}));const x=await Ss(o);u=x.taskId,w=x.expectedSpecId??"",b(F=>({...F,action:"install",kind:e.kind,sourceKey:e.sourceKey,taskId:u,expectedSpecId:w,logs:x.reused?[...F.logs,t("install.reusedTask")].slice(-Me):F.logs}))}try{await He(u,{pollIntervalMs:400,initialSeenCount:v,onEvent:(x,F)=>{b(J=>({...J,progress:typeof x.progress=="number"&&x.progress>0?x.progress:J.progress,seenEventCount:Math.max(J.seenEventCount,(F==null?void 0:F.seenCount)??J.seenEventCount),logs:De(J.logs,Kt(x),c)}))}})}catch(x){if(!qs(x))throw x;if(I=await Ye(e,w,{allowInstalling:!0}),!(I!=null&&I.id))throw new Error(t("install.taskStateLost"));if(I.status==="installing")throw new Error(t("install.taskStateLostInstalling"));b(F=>({...F,logs:[...F.logs,t("install.taskRecovered")].slice(-Me)}))}if(I=I??await Ye(e,w),!(I!=null&&I.id))throw new Error(t("install.notFoundAfterInstall"));const N=I.id;return e.kind==="custom"&&g(x=>({...x,[e.sourceKey]:N})),b(x=>({...x,action:"install",kind:e.kind,sourceKey:e.sourceKey,status:"done",progress:100})),N}catch(N){const x=(N==null?void 0:N.message)||t("install.failed",{defaultValue:"模板安装失败"});throw b(F=>{const J=De(F.logs,x,c),gs=Lt(J);return{...F,action:"install",kind:e.kind,sourceKey:e.sourceKey,status:"error",lastError:gs?t("install.manualRequired"):x,logs:J}}),R(),new Error(x)}},[R,Ye,t]),ft=l.useCallback(async(e,o,a)=>{b({action:"uninstall",kind:e.kind,sourceKey:e.sourceKey,status:"running",taskId:"",expectedSpecId:"",seenEventCount:0,progress:null,logs:[t("uninstall.waitingLogs")],lastError:""});try{const c=await Cs(o,{sudoPassword:a}),v=c.taskId;b(u=>({...u,taskId:v,logs:c.reused?[...u.logs,t("uninstall.reusedTask")].slice(-Me):u.logs})),await He(v,{pollIntervalMs:400,onEvent:u=>{const w=t("uninstall.waitingLogs");b(I=>({...I,progress:typeof u.progress=="number"&&u.progress>0?u.progress:I.progress,logs:De(I.logs,Kt(u),w)}))}}),await R(),X(null),b(u=>({...u,status:"done",progress:100})),G(t("uninstall.success",{defaultValue:"Ollama 已卸载"}),"success")}catch(c){const v=(c==null?void 0:c.message)||t("uninstall.failed",{defaultValue:"卸载失败"}),u=t("uninstall.waitingLogs");throw b(w=>({...w,status:"error",lastError:v,logs:De(w.logs,v,u)})),new Error(v)}},[R,G,t]),gt=l.useCallback(()=>{Y||(fe(null),ee(""),q(""))},[Y]),ve=l.useCallback(async(e,o)=>{e.kind==="custom"&&await Es(o,{name:e.name,description:e.description});try{await _s(o)}catch(c){if(!Ts(c))throw c}const a=t("create.startedSuccess",{name:e.name||o,defaultValue:"应用 {{name}} 创建成功并已启动"});X(null),b(Vt),G(a,"success"),Ae(`/instances/${o}/chat`)},[Ae,G,t]),cs=l.useCallback(async()=>{if(!Z||Y)return;if(!_e){q(t("sudoDialog.passwordRequired",{defaultValue:"请输入 sudo 密码。"}));return}S(""),q("");const e=Z,o=_e.trim();qe(!0);try{await Fs({sudoPassword:o})}catch(a){const c=(a==null?void 0:a.message)||t("sudoDialog.passwordInvalid",{defaultValue:"sudo 密码错误,请重新输入。"});q(c),ee(""),qe(!1);return}fe(null),ee(""),q(""),z(e.flow.kind,!0),qe(!1);try{if(e.action==="uninstall"){await ft(e.flow,e.appId||e.flow.appId,o);return}X(e.flow);const a=e.existingInstalledAppId||await we(e.flow,{...e.payload,sudoPassword:o});await ve(e.flow,a)}catch(a){X(null);const c=(a==null?void 0:a.message)||t("failed");zs(a)?(ee(""),fe(e),q(c),S("")):S(c)}finally{z(e.flow.kind,!1)}},[we,z,ve,_e,Z,Y,t,ft]);l.useEffect(()=>{L&&(Be[L.kind]||d.status!=="running"||!d.taskId||Ue.current!==d.taskId&&(Ue.current=d.taskId,(async()=>{S(""),z(L.kind,!0);try{const e=await we(L,void 0,d);await ve(L,e)}catch(e){X(null),S((e==null?void 0:e.message)||t("failed"))}finally{Ue.current="",z(L.kind,!1)}})()))},[Be,we,L,z,ve,t,d]);const ms=async e=>{if(e.preventDefault(),r!=="ollama"&&(!M||!oe))return;if(Le){S(Le);return}if(ue){S(ue);return}S("");let o=null;try{if(r==="ollama"&&B==="installed"&&H){const w={kind:"ollama",sourceKey:be,appId:H,name:(p==null?void 0:p.name)??H,description:(p==null?void 0:p.description)??""};ee(""),q(""),fe({action:"uninstall",flow:w,appId:H});return}if(r==="ollama"||r==="custom"){const{flow:w,payload:I,existingInstalledAppId:N}=us();if(!N&&(r==="ollama"||r==="custom")){ee(""),q(""),fe({action:"install",flow:w,payload:I,existingInstalledAppId:N});return}o=w.kind,z(w.kind,!0),X(w);const x=N||await we(w,I);await ve(w,x);return}o=r,z(r,!0);const a={id:M,name:oe,description:de};if(r==="openclaw"||r==="hermes"){if(!A.isInstalled(f))throw new Error(t("runtime.installFirst",{name:A.displayName}));a.agentType=xe}r==="openclaw"&&A.supportsClone&&at&&(a.clone_from=at,a.clone_options={include_sessions:zt,include_memory:qt});const c=await ks(a),v=typeof(c==null?void 0:c.id)=="string"&&c.id?c.id:D,u=c==null?void 0:c.port_allocation;u&&typeof u.assigned=="number"&&typeof u.requested=="number"&&u.assigned!==u.requested&&G(t("portReallocated",{defaultValue:"默认端口 {{requested}} 被占用,已自动使用 {{assigned}}",requested:u.requested,assigned:u.assigned}),"info"),Ae(c!=null&&c.autoStarted?`/instances/${v}`:`/instances/${v}/config`)}catch(a){X(null),S(a.message||t("failed"))}finally{o&&z(o,!1)}},ps=()=>{const e=A.isInstalled(f),o=_===A.agentType,a=$e[A.agentType];return s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("runtime.label")}),s.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[A.displayName,!e&&s.jsx("span",{className:"text-[10px] text-amber-400 font-normal px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20",children:t("runtime.notInstalled")})]}),s.jsx("p",{className:"text-xs text-muted mt-1",children:t(A.description)}),A.installHint&&!e&&s.jsx("p",{className:"text-xs text-muted mt-2",children:t(A.installHint)})]}),e&&s.jsx("span",{className:"text-xs text-emerald-400 font-medium",children:t("runtime.ready")})]}),!e&&s.jsx("button",{type:"button",onClick:()=>os(A),disabled:!!_,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:o?s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsx("span",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),t("runtime.installing")]}):_?t("runtime.waitingOtherInstall"):t("runtime.install",{name:A.displayName})}),(a==null?void 0:a.message)&&s.jsxs("div",{className:"text-[11px] font-mono text-muted truncate",title:a.message,children:[typeof a.progress=="number"&&a.progress>0?`[${a.progress}%] `:"",a.message]})]})]})},xt=(e,o)=>{if(!(d.kind===e&&d.sourceKey===o&&(d.status!=="idle"||d.logs.length>0)))return null;const v=Lt(d.logs);return s.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-background/60 px-3 py-3 space-y-2",children:[s.jsx("div",{className:"text-xs",children:s.jsx("span",{className:"text-muted",children:d.action==="uninstall"?t("uninstall.logs",{defaultValue:"卸载日志"}):t("install.logs",{defaultValue:"安装日志"})})}),s.jsx("div",{className:"max-h-52 overflow-y-auto rounded-md border border-[var(--border)] bg-black/30 px-3 py-2 font-mono text-[11px] leading-5 text-muted space-y-1",children:d.logs.map((u,w)=>s.jsx("div",{children:u},`${w}-${u}`))}),d.lastError&&s.jsx("p",{className:"text-xs text-red-400",children:d.lastError}),v&&s.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 space-y-1",children:[s.jsx("p",{className:"text-[11px] text-amber-200",children:t("install.manualCommandLabel",{defaultValue:"请在终端执行以下命令后,再重新点击创建应用:"})}),s.jsx("pre",{className:"font-mono text-[11px] text-amber-50 whitespace-pre-wrap break-all",children:v})]})]})},fs=()=>{if(r==="ollama"){const e=B==="installed"?"text-emerald-400 border-emerald-500/20 bg-emerald-500/10":B==="installing"?"text-amber-400 border-amber-500/20 bg-amber-500/10":"text-muted border-[var(--border)] bg-background/40",o=B==="installed"?t("install.installedShort",{defaultValue:"已安装"}):B==="installing"?t("install.installingShort",{defaultValue:"安装中"}):t("install.notInstalledShort",{defaultValue:"未安装"});return s.jsx("div",{className:"space-y-3",children:je?s.jsx("div",{className:"rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] text-sm text-muted",children:t("template.loading")}):p?s.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-foreground",children:p.name}),p.description&&s.jsx("p",{className:"text-xs text-muted mt-1 leading-5",children:p.description})]}),s.jsx("span",{className:`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium ${e}`,children:o})]}),B==="installed"&&H&&s.jsx("p",{className:"text-xs text-muted",children:t("install.installedAppId",{id:H,defaultValue:"已安装应用 ID: {{id}}"})}),B==="installed"&&s.jsx("p",{className:"text-xs text-muted leading-5",children:t("uninstall.requiresSudo",{defaultValue:"卸载 Ollama 时会再次弹出 sudo 密码输入框。"})})]}):s.jsx("div",{className:"rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] text-sm text-amber-400",children:Ce||t("template.ollamaRequired")})})}return r!=="custom"?null:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("source.label")}),s.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--input-bg)] p-4 space-y-2",children:[s.jsx("div",{className:"inline-flex items-center rounded-full border border-[#0066FF]/25 bg-[#0066FF]/8 px-2.5 py-1 text-xs font-medium text-foreground",children:t("source.builtin")}),s.jsx("p",{className:"text-xs text-muted leading-5",children:t("source.experimentalHint")})]})]}),s.jsxs("div",{className:"rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] space-y-3",children:[s.jsx("p",{className:"text-xs text-muted",children:t("template.compatibilityHint")}),je?s.jsx("div",{className:"text-sm text-muted",children:t("template.loading")}):te.length===0?s.jsx("div",{className:"text-sm text-amber-400",children:Ce||t("template.none")}):s.jsxs(s.Fragment,{children:[s.jsx("select",{value:(h==null?void 0:h.fileName)??"",onChange:e=>Q(e.target.value),className:`${Re} appearance-none`,children:te.map(e=>s.jsx("option",{value:e.fileName,className:"bg-background text-foreground",children:e.name},e.fileName))}),(h==null?void 0:h.description)&&s.jsx("p",{className:"text-xs text-muted leading-5",children:h.description})]})]})]})};return Yt?s.jsxs("div",{className:"p-6 max-w-lg mx-auto",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:t("import.title",{defaultValue:"导入实例"})}),s.jsx("p",{className:"text-sm text-muted mt-0.5",children:t("import.subtitle",{defaultValue:"从文件导入 OpenClaw 实例"})})]}),s.jsx(Ls,{onClose:()=>Ae("/instances/new"),showToast:G})]}):s.jsxs("div",{className:"p-6 2xl:px-6 2xl:py-4 max-w-4xl xl:max-w-5xl 2xl:max-w-none mx-auto",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:t("title")}),s.jsx("p",{className:"text-sm text-muted mt-0.5",children:t("subtitle")})]}),s.jsxs("form",{onSubmit:ms,className:"space-y-5",children:[pt&&s.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:pt}),s.jsxs("div",{className:"bg-card border border-[var(--border)] rounded-xl p-6 space-y-5",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("kind.label")}),s.jsx("div",{className:"overflow-x-auto pb-1",children:s.jsx("div",{className:"inline-flex min-w-full rounded-xl border border-[var(--border)] bg-[var(--input-bg)] p-1 gap-1 flex-nowrap",children:rt.map(e=>{const o=r===e.id;return s.jsxs("button",{type:"button",onClick:()=>ds(e.id),className:`flex min-w-[140px] flex-1 items-center justify-center gap-2 rounded-lg px-4 py-2.5 text-sm font-medium transition-all ${o?"bg-[#0066FF] text-white shadow-[0_8px_24px_rgba(0,102,255,0.24)]":"text-muted hover:bg-[var(--card-hover)] hover:text-foreground"}`,children:[e.iconImage?s.jsx("img",{src:e.iconImage,alt:"","aria-hidden":"true",className:"h-5 w-5 object-contain"}):s.jsx("span",{className:"text-base leading-none",children:e.icon}),s.jsx("span",{children:t(e.labelKey)})]},e.id)})})}),s.jsx("p",{className:"text-xs text-muted mt-2 leading-5",children:t(((Ft=rt.find(e=>e.id===r))==null?void 0:Ft.descKey)||"appDesc.openclaw")})]}),(r==="openclaw"||r==="hermes")&&ps(),(r==="ollama"||r==="custom")&&fs(),r!=="ollama"&&s.jsx(s.Fragment,{children:s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[1.1fr_0.9fr]",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("name.label")}),s.jsx("input",{type:"text",value:k,onChange:e=>is(e.target.value),placeholder:t("name.placeholder"),className:Re,autoFocus:!0})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("id.label")}),s.jsx("input",{type:"text",value:D,onChange:e=>{S(""),ze(e.target.value),st(!0)},placeholder:t("id.placeholder"),className:`${Re} font-mono text-[13px]`}),s.jsx("p",{className:"text-xs text-muted mt-1",children:k&&!D?s.jsx("span",{className:"text-amber-400",children:t("id.invalid")}):t("id.hint")})]})]})})]}),ue&&s.jsx("p",{className:"text-xs text-amber-400",children:ue}),s.jsx("div",{className:"flex flex-col gap-3",children:s.jsx("button",{type:"submit",disabled:mt||r!=="ollama"&&(!M||!oe)||!!Le||!!ue||r==="ollama"&&!p,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:ue?t("install.installing",{defaultValue:"安装中..."}):mt?s.jsxs("span",{className:"inline-flex items-center gap-2",children:[s.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}),d.action==="uninstall"?t("uninstall.loading",{defaultValue:"卸载中"}):t("loading")]}):r==="ollama"&&B==="installed"?t("uninstall.submit",{defaultValue:"卸载 Ollama"}):t("submit")})}),r==="ollama"&&xt("ollama",be),r==="custom"&&xt("custom",le)]}),Z&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",onClick:gt,children:s.jsxs("div",{className:"w-full max-w-md rounded-xl border border-[var(--border)] bg-background p-6 shadow-2xl space-y-4",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-base font-semibold text-foreground",children:Z.action==="uninstall"?t("sudoDialog.uninstallTitle",{defaultValue:"输入 sudo 密码以继续卸载 Ollama"}):t("sudoDialog.title",{defaultValue:"输入 sudo 密码以继续安装应用"})}),s.jsx("p",{className:"mt-1 text-xs text-muted leading-relaxed",children:Z.action==="uninstall"?t("sudoDialog.uninstallBody",{defaultValue:"当前卸载步骤需要 sudo 提权。密码只会用于这次卸载请求,不会写入应用配置或任务日志。"}):t("sudoDialog.body",{defaultValue:"当前安装步骤需要 sudo 提权。密码只会用于这次安装请求,不会写入应用配置或任务日志。"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("sudoDialog.passwordLabel",{defaultValue:"sudo 密码"})}),s.jsx("input",{type:"password",value:_e,onChange:e=>{ee(e.target.value),q("")},placeholder:t("sudoDialog.passwordPlaceholder",{defaultValue:"输入当前用户的 sudo 密码"}),className:Re,disabled:Y,autoFocus:!0}),Ze&&s.jsx("p",{className:"mt-2 text-xs text-red-400",children:Ze})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:gt,disabled:Y,className:"px-3 py-1.5 text-xs rounded-md border border-[var(--border)] text-muted hover:bg-[var(--card-hover)] hover:text-foreground transition-colors",children:t("sudoDialog.cancel",{defaultValue:"取消"})}),s.jsx("button",{type:"button",onClick:cs,disabled:Y,className:"px-3 py-1.5 text-xs rounded-md bg-[#0066FF] text-white hover:bg-[#0066FF]/90 transition-colors",children:Y?t("sudoDialog.verifying",{defaultValue:"验证中..."}):Z.action==="uninstall"?t("sudoDialog.uninstallConfirm",{defaultValue:"继续卸载"}):t("sudoDialog.confirm",{defaultValue:"继续安装"})})]})]})})]})}export{aa as default};
@@ -1 +0,0 @@
1
- import{j as e,a3 as m,aD as c}from"./index-CCkaIEjn.js";import{R as x}from"./ApiKeyField-D1i7zWXR.js";import{u as p}from"./vendor-i18n-DqPtOicc.js";function h({title:s,description:t,apiKeyHint:o,selectedProviderId:d,onSelectProvider:n}){const{t:i}=p("instance"),l=(r,a)=>{n(r),window.open(a,"_blank","noopener,noreferrer")};return e.jsxs("div",{className:"rounded-lg border border-[var(--border)] bg-[var(--input-bg)]/40 p-3",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-[#0066FF]",children:s}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted",children:t}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:x.map(r=>{const a=r.providerId===d;return e.jsxs("button",{type:"button","aria-pressed":a,onClick:()=>l(r.providerId,r.purchaseUrl),className:["inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-all",a?"border-[#0066FF]/50 bg-[#0066FF]/12 text-[#0066FF]":"border-[var(--border)] bg-background text-foreground hover:border-[#0066FF]/40 hover:bg-[#0066FF]/5"].join(" "),children:[e.jsx("span",{children:i(`recommendedProviderLabel.${r.providerId}`,{defaultValue:r.label})}),e.jsx(m,{className:"h-3 w-3"})]},r.providerId)})}),e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-md border border-amber-500/20 bg-amber-500/10 px-3 py-2.5",children:[e.jsx(c,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-400"}),e.jsx("p",{className:"text-[11px] leading-5 text-muted",children:o})]})]})}export{h as P};
@@ -1 +0,0 @@
1
- import{au as ye,av as Ne,o as Fe,K as we,j as e,I as Me,a as ke,aw as Se,s as Ae,ax as Ce,p as Ie,ay as Ke,az as Ue,aA as $e,aB as Pe,aC as Le}from"./index-CCkaIEjn.js";import{r as d}from"./vendor-react-DW5juQin.js";import{P as He}from"./ProviderRecommendations-DIAXxesl.js";import{P as I,A as te}from"./ApiKeyField-D1i7zWXR.js";import{u as q}from"./vendor-i18n-DqPtOicc.js";function Ee({showToast:t}){var se;const{t:s}=q("settings"),{t:F}=q("instance"),{t:w}=q("common"),[b,M]=d.useState([]),[E,f]=d.useState(!0),[x,B]=d.useState(null),[K,_]=d.useState(!1),[j,U]=d.useState(!1),[D,z]=d.useState(null),[y,N]=d.useState([]),[n,r]=d.useState(""),[m,$]=d.useState(""),[c,V]=d.useState(""),[W,k]=d.useState(""),[O,Y]=d.useState(""),[Z,T]=d.useState(!1),[S,P]=d.useState([]),[de,re]=d.useState("idle"),ne={name:"",baseUrl:"",api:"openai-completions",apiKey:"",authHeader:"",selectedModelId:""},[i,v]=d.useState(ne),[ie,oe]=d.useState("idle"),A=d.useCallback(()=>{f(!0),Ce().then(M).catch(()=>M([])).finally(()=>f(!1))},[]);d.useEffect(()=>{A()},[A]);const C="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",R="w-full bg-background border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors duration-200 appearance-none",ce=()=>{B(null),r(""),$(""),V(""),k(""),Y(""),P([]),N([]),_(!0)},me=l=>{_(!1),N([]),v({name:l.name||l.id,baseUrl:l.baseUrl,api:l.api,apiKey:"",authHeader:l.authHeader||"",selectedModelId:l.selectedModelId||""}),B(l.id)},G=()=>{_(!1),B(null),N([]),r(""),$(""),V(""),k(""),Y(""),P([])},ee=d.useCallback(l=>{const a=I.find(h=>h.id===l);r(l),V((a==null?void 0:a.baseUrl)||""),k(""),P([])},[]),ue=async()=>{var ae;if(!n){t(s("llm.presetRequired"),"error");return}const l=I.find(u=>u.id===n),a=l.local===!0;if(!a&&!m.trim()){t(s("llm.apiKeyRequired"),"error");return}if(a&&!c.trim()&&!l.baseUrl){t(s("llm.baseUrlRequired"),"error");return}const h=b.map(u=>u.id),L=O.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");let H=L?`${n}-${L}`:n;if(h.includes(H)){if(L){t(s("llm.aliasConflict"),"error");return}let u=2;for(;h.includes(`${n}-${u}`);)u++;H=`${n}-${u}`}const Q=O.trim()?`${l.label} (${O.trim()})`:l.label,p=S.length>0?S.map(u=>({id:u.id,name:u.id,contextWindow:0})):l.models,X=W||((ae=p[0])==null?void 0:ae.id)||"";!a&&m.trim()&&de!=="valid"&&t(w("llm.saveWithoutValidation"),"error"),U(!0);try{await Ke({id:H,name:Q,baseUrl:(a?c.trim():void 0)||l.baseUrl,api:l.api,apiKey:m||void 0,authHeader:l.authHeader?"x-api-key":void 0,models:p,selectedModelId:X}),t(s("llm.added"),"success"),G(),A()}catch(u){t(u.message||s("llm.saveFailed"),"error")}finally{U(!1)}},xe=async(l,a={})=>{if(!n)return;const h=I.find(p=>p.id===n),L=h.authHeader?"x-api-key":"Authorization",H=h.local===!0&&c.trim()?c.trim():h.baseUrl,Q=m;T(!0);try{const{models:p}=await Ie(H,Q,L,h.id,h.api);P(p),p.length>0&&k(X=>X||p[0].id),a.silentSuccess||t(s("llm.modelsFetched",{count:p.length}),"success")}catch(p){t(p.message||s("llm.modelsFetchFailed"),"error")}finally{T(!1)}},pe=async()=>{if(x){if(!i.baseUrl.trim()){t(s("llm.baseUrlRequired"),"error");return}i.apiKey.trim()&&ie!=="valid"&&t(w("llm.saveWithoutValidation"),"error"),U(!0);try{await Ue(x,{name:i.name||x,baseUrl:i.baseUrl.trim(),api:i.api,apiKey:i.apiKey||void 0,authHeader:i.authHeader||void 0,selectedModelId:i.selectedModelId||void 0}),t(s("llm.updated"),"success"),G(),A()}catch(l){t(l.message||s("llm.saveFailed"),"error")}finally{U(!1)}}},he=async l=>{if(window.confirm(s("llm.confirmDelete",{id:l})))try{await Le(l),t(s("llm.deleted"),"success"),A()}catch(a){t(a.message||s("llm.deleteFailed"),"error")}},be=async l=>{try{await $e(l),t(s("llm.defaultSet",{id:l}),"success"),A()}catch(a){t(a.message,"error")}},ve=async l=>{z(l);try{const{models:a}=await Pe(l);N(a),t(s("llm.modelsFetched",{count:a.length}),"success")}catch(a){t(a.message||s("llm.modelsFetchFailed"),"error")}finally{z(null)}},ge=[...new Set(I.map(l=>l.group))],o=I.find(l=>l.id===n),le=(o==null?void 0:o.local)===!0,J=S.length>0?S.map(l=>({id:l.id,label:l.id})):((o==null?void 0:o.models)||[]).map(l=>({id:l.id,label:`${l.name} (${Math.round(l.contextWindow/1e3)}K)`})),fe=e.jsxs("div",{className:"mt-3 border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--input-bg)]/40",children:[e.jsx("h3",{className:"text-sm font-medium",children:s("llm.addTitle")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(He,{title:s("llm.recommendedTitle"),description:s("llm.recommendedDescription"),apiKeyHint:s("llm.apiKeyHint"),selectedProviderId:n,onSelectProvider:ee}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.presetLabel")}),e.jsxs("select",{value:n,onChange:l=>ee(l.target.value),className:R,children:[e.jsx("option",{value:"",children:s("llm.presetPlaceholder")}),ge.map(l=>e.jsx("optgroup",{label:F(`configForm.providerGroup.${l}`,{defaultValue:l}),children:I.filter(a=>a.group===l).map(a=>e.jsx("option",{value:a.id,children:F(`configForm.providerLabel.${a.id}`,{defaultValue:a.label})},a.id))},l))]})]}),n&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.alias")}),e.jsx("input",{value:O,onChange:l=>Y(l.target.value),placeholder:s("llm.aliasPlaceholder"),className:C}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:s("llm.aliasHint")})]}),n&&!le&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.fieldApiKey")}),e.jsx(te,{value:m,saved:!1,onChange:l=>$(l),baseUrl:(o==null?void 0:o.local)===!0&&c.trim()?c.trim():(o==null?void 0:o.baseUrl)||"",api:(o==null?void 0:o.api)||"",authHeader:o!=null&&o.authHeader?"x-api-key":void 0,providerId:n,placeholder:s("llm.apiKeyPlaceholder"),onModels:l=>{P(l),l.length>0&&k(a=>a||l[0].id)},onStateChange:re,selectedModelId:W})]}),n&&le&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.fieldBaseUrl")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:c,onChange:l=>V(l.target.value),className:`${C} flex-1`}),e.jsx("button",{type:"button",onClick:()=>{xe()},disabled:Z,className:"px-3 py-1.5 text-xs border border-[var(--border)] rounded-md hover:bg-[var(--input-bg)] disabled:opacity-40 transition-all whitespace-nowrap",children:s(Z?"llm.fetchingModels":"llm.fetchModels")})]})]}),n&&J.length>0&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs text-muted mb-1",children:[s("llm.fieldModel"),S.length>0&&e.jsxs("span",{className:"ml-1 text-green-500 text-[10px]",children:["(",S.length," ",s("llm.liveModels"),")"]})]}),e.jsx("select",{value:W||((se=J[0])==null?void 0:se.id)||"",onChange:l=>k(l.target.value),className:R,children:J.map(l=>e.jsx("option",{value:l.id,children:l.label},l.id))})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{onClick:ue,disabled:j,className:"px-4 py-1.5 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all",children:s(j?"llm.saving":"llm.save")}),e.jsx("button",{onClick:G,className:"px-4 py-1.5 border border-[var(--border)] rounded-md text-sm hover:bg-[var(--input-bg)] transition-all",children:s("llm.cancel")})]})]}),g=b.find(l=>l.id===x),je=e.jsxs("div",{className:"mt-3 border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--input-bg)]/40",children:[e.jsx("h3",{className:"text-sm font-medium",children:s("llm.editTitle",{id:x})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.fieldName")}),e.jsx("input",{value:i.name,onChange:l=>v(a=>({...a,name:l.target.value})),placeholder:s("llm.fieldNamePlaceholder"),className:C})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsxs("label",{className:"block text-xs text-muted mb-1",children:[s("llm.fieldBaseUrl")," *"]}),e.jsx("input",{value:i.baseUrl,onChange:l=>v(a=>({...a,baseUrl:l.target.value})),placeholder:"https://api.openai.com",className:C})]}),e.jsxs("div",{className:"col-span-2 sm:col-span-1",children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.fieldApi")}),e.jsxs("select",{value:i.api,onChange:l=>v(a=>({...a,api:l.target.value})),className:R,children:[e.jsx("option",{value:"openai-completions",children:"OpenAI Completions"}),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"})]})]}),e.jsxs("div",{className:"col-span-2 sm:col-span-1",children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.fieldAuthHeader")}),e.jsx("input",{value:i.authHeader,onChange:l=>v(a=>({...a,authHeader:l.target.value})),placeholder:"Authorization",className:C})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsxs("label",{className:"block text-xs text-muted mb-1",children:[s("llm.fieldApiKey"),g!=null&&g.hasApiKey?` (${s("llm.apiKeyConfigured")})`:""]}),e.jsx(te,{value:i.apiKey,saved:!!(g!=null&&g.hasApiKey),onChange:l=>v(a=>({...a,apiKey:l})),baseUrl:i.baseUrl.trim(),api:i.api,authHeader:i.authHeader||void 0,providerId:x||void 0,placeholder:g!=null&&g.hasApiKey?s("llm.apiKeyLeaveBlank"):s("llm.apiKeyPlaceholder"),onModels:l=>{N(l),l.length>0&&v(a=>({...a,selectedModelId:a.selectedModelId||l[0].id}))},onStateChange:oe,selectedModelId:i.selectedModelId})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"block text-xs text-muted mb-1",children:s("llm.fieldModel")}),y.length>0?e.jsxs("select",{value:i.selectedModelId,onChange:l=>v(a=>({...a,selectedModelId:l.target.value})),className:R,children:[e.jsx("option",{value:"",children:s("llm.noModel")}),y.map(l=>e.jsx("option",{value:l.id,children:l.id},l.id))]}):e.jsx("input",{value:i.selectedModelId,onChange:l=>v(a=>({...a,selectedModelId:l.target.value})),placeholder:"gpt-4o",className:C})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{onClick:pe,disabled:j,className:"px-4 py-1.5 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all",children:s(j?"llm.saving":"llm.save")}),e.jsx("button",{onClick:G,className:"px-4 py-1.5 border border-[var(--border)] rounded-md text-sm hover:bg-[var(--input-bg)] transition-all",children:s("llm.cancel")})]})]});return e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-foreground",children:s("llm.title")}),e.jsx("p",{className:"text-xs text-muted mt-0.5",children:s("llm.desc")})]}),!K&&!x&&e.jsxs("button",{onClick:ce,className:"px-3 py-1.5 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 transition-all",children:["+ ",s("llm.add")]})]}),K&&fe,E?e.jsx("p",{className:"text-sm text-muted py-3",children:s("llm.loading")}):b.length===0&&!K?e.jsx("p",{className:"text-sm text-muted py-3",children:s("llm.empty")}):e.jsx("div",{className:"space-y-2 mt-2",children:b.map(l=>e.jsxs("div",{className:`border rounded-lg p-3 transition-all ${l.isDefault?"border-[#0066FF]/40 bg-[#0066FF]/5":"border-[var(--border)]"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium truncate",children:l.name||l.id}),l.isDefault&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-[#0066FF]/15 text-[#0066FF] rounded font-medium",children:s("llm.default")}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-[var(--input-bg)] text-muted rounded",children:l.api}),l.hasApiKey&&e.jsx("span",{className:"text-[10px] text-green-500",children:"🔑"})]}),e.jsx("p",{className:"text-xs text-muted truncate mt-0.5",children:l.baseUrl}),l.selectedModelId&&e.jsxs("p",{className:"text-xs text-muted mt-0.5",children:[s("llm.model"),": ",e.jsx("span",{className:"font-mono",children:l.selectedModelId})]})]}),e.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[!l.isDefault&&e.jsx("button",{onClick:()=>be(l.id),className:"px-2 py-1 text-xs border border-[var(--border)] rounded hover:bg-[var(--input-bg)] transition-all",children:s("llm.setDefault")}),e.jsx("button",{onClick:()=>{me(l),ve(l.id)},disabled:D===l.id,className:"px-2 py-1 text-xs border border-[var(--border)] rounded hover:bg-[var(--input-bg)] transition-all disabled:opacity-40",children:D===l.id?"...":s("llm.edit")}),e.jsx("button",{onClick:()=>he(l.id),disabled:b.length<=1,title:b.length<=1?s("llm.deleteLastForbidden"):void 0,className:"px-2 py-1 text-xs border border-red-500/30 text-red-400 rounded hover:bg-red-500/10 transition-all disabled:opacity-30 disabled:cursor-not-allowed disabled:pointer-events-none",children:s("llm.delete")})]})]}),x===l.id&&je,D===null&&y.length>0&&x!==l.id&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-[var(--border)]",children:[e.jsxs("p",{className:"text-xs text-muted mb-1",children:[s("llm.availableModels")," (",y.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1 max-h-20 overflow-y-auto",children:y.map(a=>e.jsx("span",{className:"text-[11px] font-mono px-1.5 py-0.5 bg-[var(--input-bg)] rounded",children:a.id},a.id))})]})]},l.id))})]})}function Re(){const{t}=q("settings"),{system:s,showToast:F}=ye(),[w,b]=d.useState(""),[M,E]=d.useState(""),[f,x]=d.useState(!1),[B,K]=d.useState([]),[_,j]=d.useState(!1),[U,D]=d.useState(!1),[z,y]=d.useState(!1);d.useEffect(()=>{j(!0),Ne().then(K).catch(()=>{}).finally(()=>j(!1)),Fe().then(async r=>{try{const m=await Promise.all(r.map(c=>we(c.id).catch(()=>({enabled:!1})))),$=r.length>0&&m.every(c=>c==null?void 0:c.enabled);y($)}catch{}}).catch(()=>{})},[]);const N=async r=>{r.preventDefault();try{const m=await Se(w,M);m.token&&Ae(m.token),F(t("password.updated"),"success"),b(""),E("")}catch(m){F(m.message||t("password.failed"),"error")}},n="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";return e.jsxs("div",{className:"p-6 2xl:px-6 2xl:py-4 max-w-4xl xl:max-w-5xl 2xl:max-w-none mx-auto",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:t("title")}),e.jsx("p",{className:"text-sm text-muted mt-0.5",children:t("subtitle")})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-medium text-foreground",children:t("proxy.title")}),e.jsx("p",{className:"text-sm text-muted mt-1",children:t("proxy.desc")})]}),e.jsx("div",{className:"mt-3 bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-4 py-3",children:t("proxy.status")})]}),e.jsx(Ee,{showToast:F}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-4",children:[e.jsx("h2",{className:"text-sm font-medium text-foreground mb-3",children:t("password.title")}),e.jsxs("form",{onSubmit:N,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted mb-1.5",children:t("password.current")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:f?"text":"password",value:w,onChange:r=>b(r.target.value),placeholder:t("password.currentPlaceholder"),className:`${n} pr-9`}),e.jsx("button",{type:"button",onClick:()=>x(!f),"aria-label":t("common:action.togglePassword"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors",children:f?e.jsx(Me,{className:"w-3.5 h-3.5"}):e.jsx(ke,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-muted mb-1.5",children:t("password.new")}),e.jsx("input",{type:f?"text":"password",value:M,onChange:r=>E(r.target.value),placeholder:t("password.newPlaceholder"),className:n})]}),e.jsx("button",{type:"submit",disabled:!w||M.length<8,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:t("password.submit")})]})]}),s&&e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-4",children:[e.jsx("h2",{className:"text-sm font-medium text-foreground mb-3",children:t("system.title")}),e.jsxs("div",{className:"space-y-3",children:[[{label:t("system.cpuUsage"),value:`${s.cpu_percent}%`,percent:s.cpu_percent,warn:s.cpu_percent>90,color:"bg-[#0066FF]"},{label:t("system.memory"),value:`${s.memory.used_mb}MB / ${s.memory.total_mb}MB (${s.memory.percent}%)`,percent:s.memory.percent,warn:!1,color:"bg-[#00D4AA]"},{label:t("system.disk"),value:`${s.disk.used_gb}GB / ${s.disk.total_gb}GB (${s.disk.percent}%)`,percent:s.disk.percent,warn:s.disk.percent>90,color:"bg-[#0066FF]"}].map(r=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1.5",children:[e.jsx("span",{className:"text-muted",children:r.label}),e.jsx("span",{className:`font-medium font-mono text-[13px] ${r.warn?"text-red-400":"text-foreground"}`,children:r.value})]}),e.jsx("div",{className:"w-full bg-[var(--input-bg)] rounded-full h-1.5",children:e.jsx("div",{className:`h-1.5 rounded-full transition-all duration-500 ${r.warn?"bg-red-500":r.color}`,style:{width:`${r.percent}%`}})})]},r.label)),s.temperature&&e.jsxs("div",{className:"flex justify-between text-sm pt-2 border-t border-[var(--border)]",children:[e.jsx("span",{className:"text-muted",children:t("system.cpuTemp")}),e.jsxs("span",{className:"font-medium font-mono text-[13px] text-foreground",children:[s.temperature,"°C"]})]})]})]}),e.jsxs("div",{className:"bg-[var(--card)] border border-[var(--border)] rounded-xl p-4",children:[e.jsx("h2",{className:"text-sm font-medium text-foreground mb-2",children:t("about.title")}),e.jsxs("div",{className:"text-sm text-muted space-y-1",children:[e.jsxs("p",{children:[t("about.coreVersion"),": ",e.jsx("span",{className:"font-mono",children:(s==null?void 0:s.core_version)||"-"})]}),e.jsxs("p",{children:[t("about.panelVersion"),": ",e.jsx("span",{className:"font-mono",children:"0.6.5"})]})]})]})]})]})}export{Re as default};
@@ -1 +0,0 @@
1
- import{g as re,d as we,p as Fe,j as e,L as Se,T as _e,e as ne,i as E,f as Ce,r as Ie,h as Me,u as Te}from"./index-CCkaIEjn.js";import{r as c}from"./vendor-react-DW5juQin.js";import{P as y,A as Le}from"./ApiKeyField-D1i7zWXR.js";import{u as Pe}from"./registry-B2ZQZXWL.js";import{P as Re}from"./ProviderRecommendations-DIAXxesl.js";import{u as oe}from"./vendor-i18n-DqPtOicc.js";function ie(i,p){var n,j;if(!i)return!1;const t=(n=i.runtimes)==null?void 0:n[p];return t?!!t.installed&&!!t.imageReady:p==="openclaw"?!!((j=i.openclaw)!=null&&j.installed)&&!!i.runtimeImageReady:!1}function Ae(i,p){var n;const t=(n=i==null?void 0:i.runtimes)==null?void 0:n[p];return t&&typeof t.required=="boolean"?t.required:p==="openclaw"}function ae(i,p){if(!i)return!1;const t=p.filter(n=>Ae(i,n.agentType));return t.length===0?!0:t.every(n=>ie(i,n.agentType))}const C=[{id:"check",label:"环境检测"},{id:"node",label:"Node.js"},{id:"docker",label:"Docker"},{id:"nomad",label:"Nomad"},{id:"openclaw",label:"OpenClaw"},{id:"provider",label:"模型配置"},{id:"done",label:"完成"}];function Ue({ok:i}){return i?e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500 shadow-[0_0_6px_rgba(16,185,129,0.7)]"}):e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-[var(--border)]"})}function A({dep:i,label:p,required:t,extra:n}){const{t:j}=oe("setup"),x=i.needsUpgrade;return e.jsxs("div",{className:"flex items-center justify-between py-2.5 border-b border-[var(--border)] last:border-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[x?e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-amber-400 shadow-[0_0_6px_rgba(251,191,36,0.6)]"}):e.jsx(Ue,{ok:i.installed}),e.jsx("span",{className:"text-sm text-foreground",children:p||i.name}),x&&e.jsx("span",{className:"text-xs text-amber-400",children:j("versionTooOld")}),t&&!i.installed&&!x&&e.jsx("span",{className:"text-xs text-red-400",children:j("required")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[n,e.jsx("span",{className:"text-xs text-muted font-mono",children:i.installed?i.version||"installed":"not installed"})]})]})}function I(){return e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"})}function de(i){return/失败|error|denied|forbidden|unauthorized/i.test(i)?"error":/完成|已就绪|已启动|已存在|成功|built|installed/i.test(i)?"success":/正在|等待|下载|安装|构建|启动|升级|progress|exporting|transferring/i.test(i)?"progress":"info"}function De(i){switch(i){case"progress":return{dot:"bg-sky-400 shadow-[0_0_8px_rgba(56,189,248,0.55)]",text:"text-sky-100"};case"success":return{dot:"bg-emerald-400 shadow-[0_0_8px_rgba(52,211,153,0.55)]",text:"text-emerald-100"};case"error":return{dot:"bg-red-400 shadow-[0_0_8px_rgba(248,113,113,0.55)]",text:"text-red-200"};default:return{dot:"bg-slate-500 shadow-[0_0_8px_rgba(148,163,184,0.35)]",text:"text-slate-200/90"}}}function Ve({onDone:i}){var Z,ee,te,se;const{runtimes:p}=Pe(),{t}=oe(["setup","common","instance"]),[n,j]=c.useState(null),[x,U]=c.useState("check"),[f,k]=c.useState(null),[q,$]=c.useState([]),[M,v]=c.useState(""),[H,K]=c.useState(!1),[b,le]=c.useState(""),[w,ce]=c.useState(""),[D,T]=c.useState(""),[B,V]=c.useState(!1),[F,_]=c.useState([]),[z,O]=c.useState(!1),[S,W]=c.useState(""),[ue,me]=c.useState("idle"),G=c.useRef(new Set),J=c.useCallback((r,s)=>{if(G.current.has(r))return;G.current.add(r);const a=s==="openclaw-docker"?t("setup:dockerImageBuild"):s==="docker"?t("setup:dockerInstall"):s==="openclaw"?t("setup:openclawInstall"):s;k(s),g(t("setup:resumeTask",{label:a}),"progress"),Q(r,a).then(()=>{h(!0)}).catch(o=>{v(o.message||t("setup:taskFailed"))}).finally(()=>{k(null)})},[]),h=c.useCallback((r=!1)=>{re().then(s=>{var a;if(j(s),(a=s.runningTasks)!=null&&a.length)for(const o of s.runningTasks)J(o.id,o.name);if(!r&&s.ready){U("provider");return}}).catch(()=>{})},[i,J]);c.useEffect(()=>{h()},[h]),c.useEffect(()=>{var s,a;if(x!=="nomad"||!((s=n==null?void 0:n.nomad)!=null&&s.installed)||(a=n==null?void 0:n.nomad)!=null&&a.running)return;const r=setInterval(()=>{h(!0)},3e3);return()=>clearInterval(r)},[x,(Z=n==null?void 0:n.nomad)==null?void 0:Z.installed,(ee=n==null?void 0:n.nomad)==null?void 0:ee.running,h]);const g=(r,s=de(r))=>$(a=>[...a,{message:r,tone:s}].slice(-200)),xe=(r,s)=>s.type==="progress"&&typeof s.progress=="number"?`${r}: ${s.message} [${s.progress}%]`:s.type==="done"?`${r}: ${s.message}`:s.type==="error"?t("setup:taskErrorPrefix",{label:r,message:s.message}):s.message,Q=async(r,s)=>{let a=0,o=0,u=t("setup:taskCompleted",{label:s});const d=Date.now()+30*60*1e3;for(;Date.now()<d;){try{const m=await we(r);o=0;const ye=m.events.slice(a);a=m.events.length;for(const N of ye){const ke=N.type==="done"?"success":N.type==="error"?"error":N.type==="progress"?"progress":de(N.message);g(xe(s,N),ke),N.message&&(u=N.message)}if(m.status==="done")return u;if(m.status==="error")throw new Error(u)}catch(m){if(o+=1,o>=5)throw new Error((m==null?void 0:m.message)||t("setup:taskStatusFailed",{label:s}))}const l=Math.min(1e3+a*200,3e3);await new Promise(m=>setTimeout(m,l))}throw new Error(t("setup:taskTimeout",{label:s}))},L=async(r,s,a)=>{k(r),v(""),g(t("setup:installing",{label:s}),"progress");try{const o=await a();let u=o.message||t("setup:taskStarted",{label:s});return o!=null&&o.taskId?u=await Q(o.taskId,s):g(`${s}: ${u}`,"success"),h(!0),!0}catch(o){const u=o.message||t("setup:defaultInstallFailed");return g(t("setup:installFailed",{label:s,error:u}),"error"),v(u),!1}finally{k(null)}},X=async()=>{await L("node","Node.js",()=>Te())},pe=async()=>{await L("docker","Docker",()=>E("docker"))},[be,he]=c.useState(!1),ge=async r=>{const s=p.find(o=>o.agentType===r);if(!s)return;s.installHint&&g(t(s.installHint),"info");const a=await L(`runtime-${r}`,t(s.installLabel),()=>Me(r));r==="openclaw"&&a&&he(!0),h(!0)},fe=async()=>{var s;if(await L("nomad","Nomad",()=>E("nomad"))){g(t("setup:configuringNomadSystemd"),"progress"),k("nomad-systemd");try{await E("nomad-systemd"),g(t("setup:nomadServiceStarted"),"success")}catch{try{await Ce("nomad"),g(t("setup:nomadStarted"),"success")}catch(a){g(t("setup:nomadStartFailed",{error:a.message}),"error"),v(a.message)}}k(null),g(t("setup:waitingNomad"),"progress");for(let a=0;a<10;a++){await new Promise(u=>setTimeout(u,2e3));const o=await re();if((s=o.nomad)!=null&&s.running){j(o),g(t("setup:nomadReady"),"success");return}}h(!0)}},P=!!((te=n==null?void 0:n.node)!=null&&te.installed)&&!((se=n==null?void 0:n.node)!=null&&se.needsUpgrade),R=async()=>{var o,u,d,l;const r=C.findIndex(m=>m.id===x);if(r>=C.length-1)return;let s=r+1;for(;s<C.length-1;){const m=C[s].id;if(m==="node"&&P){s++;continue}if(m==="docker"&&((o=n==null?void 0:n.docker)!=null&&o.installed)&&((u=n==null?void 0:n.docker)!=null&&u.running)){s++;continue}if(m==="nomad"&&((d=n==null?void 0:n.nomad)!=null&&d.installed)&&((l=n==null?void 0:n.nomad)!=null&&l.running)){s++;continue}if(m==="openclaw"&&ae(n,p)){s++;continue}break}const a=C[s].id;if(v(""),$([]),a==="done"){U("done"),K(!0);try{await Ie({installNomad:!1,buildDockerImage:!1})}catch(m){v(m.message||t("setup:configWriteFailed"))}finally{K(!1)}}else U(a)},ve=r=>{if(!n)return!1;switch(r){case"check":return P;case"node":return P;case"docker":return n.docker.installed&&n.docker.running;case"nomad":return n.nomad.installed&&n.nomad.running;case"openclaw":return ae(n,p)||be&&n.openclaw.installed&&p.length===1;case"provider":return!0;case"done":return!0;default:return!1}},Y=c.useCallback(r=>{le(r),T(""),_([]);const s=y.find(a=>a.id===r);W((s==null?void 0:s.baseUrl)||"")},[]),je=c.useCallback(async r=>{if(!b)return;const s=y.find(l=>l.id===b);if(!s)return;const o=s.local===!0&&S.trim()?S.trim():s.baseUrl,u=s.authHeader?"x-api-key":"Authorization",d=r??w;O(!0),v("");try{const{models:l}=await Fe(o,d,u,s.id,s.api);_(l),l.length>0&&T(l[0].id)}catch(l){v(l.message||t("setup:provider.fetchModelsFailed"))}finally{O(!1)}},[w,S,b,t]),Ne=async()=>{var d;if(!b)return!1;const r=y.find(l=>l.id===b);if(!r)return!1;const s=r.local===!0,a=s&&S.trim()?S.trim():r.baseUrl;if(s&&!a)return v(t("setup:provider.baseUrlRequired",{defaultValue:"Base URL is required"})),!1;const o=F.length>0?F.map(l=>({id:l.id,name:l.name||l.id,contextWindow:128e3})):r.models,u=D||((d=o[0])==null?void 0:d.id)||"";V(!0),!s&&w.trim()&&ue!=="valid"&&v(t("common:llm.saveWithoutValidation"));try{return await ne({providerId:r.id,baseUrl:a,api:r.api,authHeader:r.authHeader?"x-api-key":void 0,models:o,selectedModelId:u,apiKey:w||""}),!0}catch(l){return v(l.message||t("setup:provider.saveFailed")),!1}finally{V(!1)}};return n?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-[600px] h-[400px] rounded-full bg-[#0066FF]/[0.06] blur-[100px] pointer-events-none"}),e.jsx("div",{className:"absolute left-4 bottom-4 z-20",children:e.jsx(Se,{className:"bg-card/80 backdrop-blur-sm"})}),e.jsxs("div",{className:"w-full max-w-lg relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx(_e,{className:"w-48 h-48 mx-auto mb-4 object-contain"}),e.jsx("p",{className:"text-sm text-muted mt-1",children:t("setup:title")})]}),e.jsxs("div",{className:"bg-card border border-[var(--border)] rounded-xl p-6 backdrop-blur-sm",children:[x==="check"&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:check.title")}),e.jsx("p",{className:"text-sm text-muted mb-4",children:t("setup:check.desc")}),e.jsx("p",{className:"text-xs text-muted mb-1.5 font-medium",children:t("setup:check.requiredComponents")}),e.jsxs("div",{className:"bg-card rounded-md border border-[var(--border)] px-4",children:[e.jsx(A,{dep:n.node,label:"Node.js",required:!0,extra:n.node.needsUpgrade?e.jsx("button",{onClick:X,disabled:!!f,className:"text-xs bg-amber-500/20 text-amber-400 border border-amber-500/30 rounded px-2 py-0.5 hover:bg-amber-500/30 disabled:opacity-40 transition-colors duration-200",children:t(f==="node"?"setup:check.upgrading":"setup:check.upgrade")}):void 0}),e.jsx(A,{dep:n.docker,label:"Docker",required:!0}),e.jsx(A,{dep:n.nomad,label:"Nomad",required:!0}),e.jsx(A,{dep:n.openclaw,label:"OpenClaw",required:!0})]})]}),x==="node"&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:node.title")}),e.jsx("p",{className:"text-sm text-muted mb-4",children:t("setup:node.desc")}),P?e.jsx("div",{className:"bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-sm rounded-md px-3 py-2.5",children:t("setup:node.ready",{version:n.node.version})}):n.hasSudo?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-md px-3 py-2.5",children:t("setup:node.currentVersion",{version:n.node.version})}),e.jsx("button",{onClick:X,disabled:!!f,className:"bg-[#0066FF] text-white rounded-md px-4 py-2 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:f?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{}),t("setup:node.upgrading")]}):t("setup:node.upgradeBtn")}),e.jsx("p",{className:"text-xs text-muted",children:t("setup:node.sudoRequired")})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-md px-3 py-2.5",children:t("setup:node.noSudo",{version:n.node.version})}),e.jsxs("div",{className:"bg-card border border-[var(--border)] rounded-md p-3",children:[e.jsx("p",{className:"text-xs text-muted mb-1.5",children:t("setup:node.contactAdmin")}),e.jsx("code",{className:"text-xs text-foreground font-mono block whitespace-pre-wrap",children:"curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs"})]}),e.jsx("button",{onClick:()=>h(!0),className:"text-xs text-muted hover:text-foreground underline transition-colors duration-200",children:t("setup:node.refreshAfterInstall")})]})]}),x==="docker"&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:docker.title")}),e.jsx("p",{className:"text-sm text-muted mb-4",children:t("setup:docker.desc")}),n.docker.installed&&n.docker.running?e.jsx("div",{className:"bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-sm rounded-md px-3 py-2.5",children:t("setup:docker.running",{version:n.docker.version})}):n.docker.installed&&!n.docker.running?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-md px-3 py-2.5",children:t("setup:docker.notRunning")}),e.jsx("div",{className:"bg-card border border-[var(--border)] rounded-md p-3",children:e.jsx("code",{className:"text-xs text-foreground font-mono block",children:/Mac|iPhone|iPad/i.test(navigator.userAgent)?"jishushell doctor --fix":"sudo systemctl start docker"})}),e.jsx("button",{onClick:()=>h(!0),className:"text-xs text-muted hover:text-foreground underline transition-colors duration-200",children:t("setup:docker.refreshAfterStart")})]}):/Mac|iPhone|iPad/i.test(navigator.userAgent)?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-muted",children:t("setup:docker.macosColima")}),e.jsx("div",{className:"bg-card border border-[var(--border)] rounded-md p-3",children:e.jsx("code",{className:"text-xs text-foreground font-mono block",children:"jishushell doctor --fix"})}),e.jsx("button",{onClick:()=>h(!0),className:"text-xs text-muted hover:text-foreground underline transition-colors duration-200",children:t("setup:docker.refreshAfterInstall")})]}):n.hasSudo?e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{onClick:pe,disabled:!!f,className:"bg-[#0066FF] text-white rounded-md px-4 py-2 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:f?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{}),t("setup:docker.installing")]}):t("setup:docker.installBtn")}),e.jsx("p",{className:"text-xs text-muted",children:t("setup:docker.sudoRequired")})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-md px-3 py-2.5",children:t("setup:docker.noSudo")}),e.jsxs("div",{className:"bg-card border border-[var(--border)] rounded-md p-3",children:[e.jsx("p",{className:"text-xs text-muted mb-1.5",children:t("setup:docker.contactAdmin")}),e.jsx("code",{className:"text-xs text-foreground font-mono block",children:"curl -fsSL https://get.docker.com | sh"})]}),e.jsx("button",{onClick:()=>h(!0),className:"text-xs text-muted hover:text-foreground underline transition-colors duration-200",children:t("setup:docker.refreshAfterInstall")})]})]}),x==="nomad"&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:nomad.title")}),e.jsx("p",{className:"text-sm text-muted mb-4",children:t("setup:nomad.desc")}),n.nomad.installed&&n.nomad.running?e.jsx("div",{className:"bg-emerald-500/10 border border-emerald-500/20 text-emerald-400 text-sm rounded-md px-3 py-2.5",children:t("setup:nomad.running",{version:n.nomad.version})}):n.nomad.installed?e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{className:"flex items-center gap-2 bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-md px-3 py-2.5",children:[e.jsx(I,{}),e.jsx("span",{children:t("setup:nomad.starting")})]})}):e.jsx("button",{onClick:fe,disabled:!!f,className:"bg-[#0066FF] text-white rounded-md px-4 py-2 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:f?e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx(I,{}),t("setup:nomad.installing")]}):t("setup:nomad.installBtn")})]}),x==="openclaw"&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:"Agent 运行时"}),e.jsx("p",{className:"text-sm text-muted mb-4",children:"安装所有已注册的 Agent 运行时 (Docker 镜像 / shim)。每次添加新 Agent 时,这里会自动出现一行。"}),e.jsx("div",{className:"space-y-4",children:p.map(r=>{const s=ie(n,r.agentType),a=f===`runtime-${r.agentType}`;return e.jsxs("div",{className:"rounded-md border border-[var(--border)] bg-[var(--card)] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:r.displayName}),e.jsx("div",{className:"text-xs text-muted",children:r.description})]}),s?e.jsx("span",{className:"text-xs text-emerald-400 font-mono",children:"已就绪"}):a?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-amber-400",children:[e.jsx(I,{}),"安装中"]}):e.jsx("span",{className:"text-xs text-muted",children:"未安装"})]}),!s&&!a&&e.jsxs("div",{className:"space-y-2",children:[r.installHint&&e.jsx("p",{className:"text-xs text-muted",children:t(r.installHint)}),e.jsxs("button",{onClick:()=>ge(r.agentType),disabled:!!f,className:"bg-[#0066FF] text-white rounded-md px-4 py-2 text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200",children:["安装 ",r.displayName]})]})]},r.agentType)})})]}),x==="done"&&e.jsx("div",{className:"text-center py-4",children:H?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-white/10 border-t-[#0066FF] rounded-full animate-spin"})}),e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:done.finalizing")}),e.jsx("p",{className:"text-sm text-muted",children:t("setup:done.finalizingDesc")})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center",children:e.jsx("svg",{className:"w-6 h-6 text-emerald-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:done.complete")}),e.jsx("p",{className:"text-sm text-muted",children:t("setup:done.completeDesc")})]})}),x==="provider"&&(()=>{var u;const r=y.find(d=>d.id===b),s=[...new Set(y.map(d=>d.group))],a=(r==null?void 0:r.local)===!0,o=F.length>0?F.map(d=>({id:d.id,label:d.name||d.id})):((r==null?void 0:r.models)||[]).map(d=>({id:d.id,label:`${d.name} (${Math.round(d.contextWindow/1e3)}K)`}));return e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-medium text-foreground mb-1",children:t("setup:provider.title")}),e.jsx("p",{className:"text-sm text-muted mb-4",children:t("setup:provider.desc")}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Re,{title:t("setup:provider.recommendedTitle"),description:t("setup:provider.recommendedDescription"),apiKeyHint:t("setup:provider.apiKeyHint"),selectedProviderId:b,onSelectProvider:Y}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("setup:provider.label")}),e.jsxs("select",{value:b,onChange:d=>Y(d.target.value),className:"w-full bg-background border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60",children:[e.jsx("option",{value:"",children:t("setup:provider.placeholder")}),s.map(d=>e.jsx("optgroup",{label:t(`instance:configForm.providerGroup.${d}`,{defaultValue:d}),children:y.filter(l=>l.group===d).map(l=>e.jsx("option",{value:l.id,children:t(`instance:configForm.providerLabel.${l.id}`,{defaultValue:l.label})},l.id))},d))]})]}),b&&a&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("setup:provider.baseUrl")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:S,onChange:d=>{W(d.target.value),_([])},className:"flex-1 bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60"}),e.jsx("button",{type:"button",onClick:()=>{je()},disabled:z,className:"px-3 py-1.5 text-xs border border-[var(--border)] rounded-md hover:bg-[var(--input-bg)] disabled:opacity-40 transition-all whitespace-nowrap",children:t(z?"setup:provider.fetchingModels":"setup:provider.fetchModels")})]})]}),b&&!a&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-muted mb-1.5",children:t("setup:provider.apiKey")}),e.jsx(Le,{value:w,saved:!1,onChange:d=>{ce(d),_([])},baseUrl:(r==null?void 0:r.baseUrl)||"",api:(r==null?void 0:r.api)||"",authHeader:r!=null&&r.authHeader?"x-api-key":void 0,providerId:b,placeholder:t("setup:provider.apiKeyPlaceholder"),onModels:d=>{_(d),d.length>0&&T(d[0].id)},onStateChange:me,selectedModelId:D})]}),r&&o.length>0&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-muted mb-1.5",children:[t("setup:provider.defaultModel"),F.length>0&&e.jsxs("span",{className:"ml-1.5 text-emerald-400 text-xs",children:["(",F.length," ",t("setup:provider.liveModels"),")"]})]}),e.jsx("select",{value:D||((u=o[0])==null?void 0:u.id)||"",onChange:d=>T(d.target.value),className:"w-full bg-background border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60",children:o.map(d=>e.jsx("option",{value:d.id,children:d.label},d.id))})]})]})]})})(),q.length>0&&x!=="done"&&e.jsxs("div",{className:"mt-4 rounded-lg border border-[var(--border)] bg-[linear-gradient(180deg,rgba(2,6,23,0.96),rgba(15,23,42,0.92))] p-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] max-h-40 overflow-y-auto",children:[q.map((r,s)=>{const a=De(r.tone);return e.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[e.jsx("span",{className:`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ${a.dot}`}),e.jsx("div",{className:`min-w-0 whitespace-pre-wrap break-words text-xs font-mono leading-5 ${a.text}`,children:r.message})]},s)}),e.jsx("div",{className:"pointer-events-none sticky bottom-0 h-4 bg-gradient-to-t from-slate-950/85 to-transparent"})]}),M&&e.jsx("div",{className:"mt-4 bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-md px-3 py-2.5",children:M})]}),e.jsx("div",{className:"flex justify-between mt-6",children:x==="provider"?(()=>{var a;const r=((a=y.find(o=>o.id===b))==null?void 0:a.local)===!0,s=b&&(r||w.trim());return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:async()=>{await ne({skipped:!0}).catch(()=>{}),R()},className:"bg-[var(--card)] border border-[var(--border)] text-foreground rounded-md px-6 py-2 text-sm font-medium hover:bg-[var(--card-hover)] transition-all duration-200",children:t("setup:provider.skip")}),e.jsx("button",{onClick:async()=>{await Ne()&&R()},disabled:!s||B,className:"bg-[#0066FF] text-white rounded-md px-6 py-2 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:t(B?"setup:provider.saving":"setup:provider.saveAndContinue")})]})})():x!=="done"?e.jsxs(e.Fragment,{children:[e.jsx("div",{}),e.jsx("button",{onClick:R,disabled:!ve(x)||!!f,className:"bg-[#0066FF] text-white rounded-md px-6 py-2 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:t("setup:nav.next")})]}):e.jsx("button",{onClick:M?()=>R():i,disabled:H,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:t(M?"setup:nav.retry":"setup:nav.enterPanel")})})]})]}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("div",{className:"w-5 h-5 border-2 border-[var(--border)] border-t-foreground rounded-full animate-spin"})})}export{Ve as default};
@@ -1,9 +0,0 @@
1
- import{j as f,ad as he,af as fe,aG as Y,ae as me,ag as ge}from"./index-CCkaIEjn.js";import{e as b,r as A}from"./vendor-react-DW5juQin.js";import{u as K}from"./vendor-i18n-DqPtOicc.js";var pe=Object.defineProperty,B=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,V=(c,a,o)=>a in c?pe(c,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[a]=o,z=(c,a)=>{for(var o in a||(a={}))W.call(a,o)&&V(c,o,a[o]);if(B)for(var o of B(a))X.call(a,o)&&V(c,o,a[o]);return c},_=(c,a)=>{var o={};for(var m in c)W.call(c,m)&&a.indexOf(m)<0&&(o[m]=c[m]);if(c!=null&&B)for(var m of B(c))a.indexOf(m)<0&&X.call(c,m)&&(o[m]=c[m]);return o};/**
2
- * @license QR Code generator library (TypeScript)
3
- * Copyright (c) Project Nayuki.
4
- * SPDX-License-Identifier: MIT
5
- */var O;(c=>{const a=class E{constructor(e,r,t,s){if(this.version=e,this.errorCorrectionLevel=r,this.modules=[],this.isFunction=[],e<E.MIN_VERSION||e>E.MAX_VERSION)throw new RangeError("Version value out of range");if(s<-1||s>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let n=[];for(let i=0;i<this.size;i++)n.push(!1);for(let i=0;i<this.size;i++)this.modules.push(n.slice()),this.isFunction.push(n.slice());this.drawFunctionPatterns();const u=this.addEccAndInterleave(t);if(this.drawCodewords(u),s==-1){let i=1e9;for(let d=0;d<8;d++){this.applyMask(d),this.drawFormatBits(d);const h=this.getPenaltyScore();h<i&&(s=d,i=h),this.applyMask(d)}}p(0<=s&&s<=7),this.mask=s,this.applyMask(s),this.drawFormatBits(s),this.isFunction=[]}static encodeText(e,r){const t=c.QrSegment.makeSegments(e);return E.encodeSegments(t,r)}static encodeBinary(e,r){const t=c.QrSegment.makeBytes(e);return E.encodeSegments([t],r)}static encodeSegments(e,r,t=1,s=40,n=-1,u=!0){if(!(E.MIN_VERSION<=t&&t<=s&&s<=E.MAX_VERSION)||n<-1||n>7)throw new RangeError("Invalid value");let i,d;for(i=t;;i++){const g=E.getNumDataCodewords(i,r)*8,v=N.getTotalBits(e,i);if(v<=g){d=v;break}if(i>=s)throw new RangeError("Data too long")}for(const g of[E.Ecc.MEDIUM,E.Ecc.QUARTILE,E.Ecc.HIGH])u&&d<=E.getNumDataCodewords(i,g)*8&&(r=g);let h=[];for(const g of e){o(g.mode.modeBits,4,h),o(g.numChars,g.mode.numCharCountBits(i),h);for(const v of g.getData())h.push(v)}p(h.length==d);const M=E.getNumDataCodewords(i,r)*8;p(h.length<=M),o(0,Math.min(4,M-h.length),h),o(0,(8-h.length%8)%8,h),p(h.length%8==0);for(let g=236;h.length<M;g^=253)o(g,8,h);let R=[];for(;R.length*8<h.length;)R.push(0);return h.forEach((g,v)=>R[v>>>3]|=g<<7-(v&7)),new E(i,r,R,n)}getModule(e,r){return 0<=e&&e<this.size&&0<=r&&r<this.size&&this.modules[r][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),r=e.length;for(let t=0;t<r;t++)for(let s=0;s<r;s++)t==0&&s==0||t==0&&s==r-1||t==r-1&&s==0||this.drawAlignmentPattern(e[t],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const r=this.errorCorrectionLevel.formatBits<<3|e;let t=r;for(let n=0;n<10;n++)t=t<<1^(t>>>9)*1335;const s=(r<<10|t)^21522;p(s>>>15==0);for(let n=0;n<=5;n++)this.setFunctionModule(8,n,m(s,n));this.setFunctionModule(8,7,m(s,6)),this.setFunctionModule(8,8,m(s,7)),this.setFunctionModule(7,8,m(s,8));for(let n=9;n<15;n++)this.setFunctionModule(14-n,8,m(s,n));for(let n=0;n<8;n++)this.setFunctionModule(this.size-1-n,8,m(s,n));for(let n=8;n<15;n++)this.setFunctionModule(8,this.size-15+n,m(s,n));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const r=this.version<<12|e;p(r>>>18==0);for(let t=0;t<18;t++){const s=m(r,t),n=this.size-11+t%3,u=Math.floor(t/3);this.setFunctionModule(n,u,s),this.setFunctionModule(u,n,s)}}drawFinderPattern(e,r){for(let t=-4;t<=4;t++)for(let s=-4;s<=4;s++){const n=Math.max(Math.abs(s),Math.abs(t)),u=e+s,i=r+t;0<=u&&u<this.size&&0<=i&&i<this.size&&this.setFunctionModule(u,i,n!=2&&n!=4)}}drawAlignmentPattern(e,r){for(let t=-2;t<=2;t++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,r+t,Math.max(Math.abs(s),Math.abs(t))!=1)}setFunctionModule(e,r,t){this.modules[r][e]=t,this.isFunction[r][e]=!0}addEccAndInterleave(e){const r=this.version,t=this.errorCorrectionLevel;if(e.length!=E.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");const s=E.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],n=E.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],u=Math.floor(E.getNumRawDataModules(r)/8),i=s-u%s,d=Math.floor(u/s);let h=[];const M=E.reedSolomonComputeDivisor(n);for(let g=0,v=0;g<s;g++){let S=e.slice(v,v+d-n+(g<i?0:1));v+=S.length;const x=E.reedSolomonComputeRemainder(S,M);g<i&&S.push(0),h.push(S.concat(x))}let R=[];for(let g=0;g<h[0].length;g++)h.forEach((v,S)=>{(g!=d-n||S>=i)&&R.push(v[g])});return p(R.length==u),R}drawCodewords(e){if(e.length!=Math.floor(E.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let s=0;s<this.size;s++)for(let n=0;n<2;n++){const u=t-n,d=(t+1&2)==0?this.size-1-s:s;!this.isFunction[d][u]&&r<e.length*8&&(this.modules[d][u]=m(e[r>>>3],7-(r&7)),r++)}}p(r==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let t=0;t<this.size;t++){let s;switch(e){case 0:s=(t+r)%2==0;break;case 1:s=r%2==0;break;case 2:s=t%3==0;break;case 3:s=(t+r)%3==0;break;case 4:s=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:s=t*r%2+t*r%3==0;break;case 6:s=(t*r%2+t*r%3)%2==0;break;case 7:s=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&s&&(this.modules[r][t]=!this.modules[r][t])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let u=!1,i=0,d=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[n][h]==u?(i++,i==5?e+=E.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,d),u||(e+=this.finderPenaltyCountPatterns(d)*E.PENALTY_N3),u=this.modules[n][h],i=1);e+=this.finderPenaltyTerminateAndCount(u,i,d)*E.PENALTY_N3}for(let n=0;n<this.size;n++){let u=!1,i=0,d=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][n]==u?(i++,i==5?e+=E.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,d),u||(e+=this.finderPenaltyCountPatterns(d)*E.PENALTY_N3),u=this.modules[h][n],i=1);e+=this.finderPenaltyTerminateAndCount(u,i,d)*E.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let u=0;u<this.size-1;u++){const i=this.modules[n][u];i==this.modules[n][u+1]&&i==this.modules[n+1][u]&&i==this.modules[n+1][u+1]&&(e+=E.PENALTY_N2)}let r=0;for(const n of this.modules)r=n.reduce((u,i)=>u+(i?1:0),r);const t=this.size*this.size,s=Math.ceil(Math.abs(r*20-t*10)/t)-1;return p(0<=s&&s<=9),e+=s*E.PENALTY_N4,p(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,r=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let s=this.size-7;t.length<e;s-=r)t.splice(1,0,s);return t}}static getNumRawDataModules(e){if(e<E.MIN_VERSION||e>E.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;r-=(25*t-10)*t-55,e>=7&&(r-=36)}return p(208<=r&&r<=29648),r}static getNumDataCodewords(e,r){return Math.floor(E.getNumRawDataModules(e)/8)-E.ECC_CODEWORDS_PER_BLOCK[r.ordinal][e]*E.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let r=[];for(let s=0;s<e-1;s++)r.push(0);r.push(1);let t=1;for(let s=0;s<e;s++){for(let n=0;n<r.length;n++)r[n]=E.reedSolomonMultiply(r[n],t),n+1<r.length&&(r[n]^=r[n+1]);t=E.reedSolomonMultiply(t,2)}return r}static reedSolomonComputeRemainder(e,r){let t=r.map(s=>0);for(const s of e){const n=s^t.shift();t.push(0),r.forEach((u,i)=>t[i]^=E.reedSolomonMultiply(u,n))}return t}static reedSolomonMultiply(e,r){if(e>>>8||r>>>8)throw new RangeError("Byte out of range");let t=0;for(let s=7;s>=0;s--)t=t<<1^(t>>>7)*285,t^=(r>>>s&1)*e;return p(t>>>8==0),t}finderPenaltyCountPatterns(e){const r=e[1];p(r<=this.size*3);const t=r>0&&e[2]==r&&e[3]==r*3&&e[4]==r&&e[5]==r;return(t&&e[0]>=r*4&&e[6]>=r?1:0)+(t&&e[6]>=r*4&&e[0]>=r?1:0)}finderPenaltyTerminateAndCount(e,r,t){return e&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,r){r[0]==0&&(e+=this.size),r.pop(),r.unshift(e)}};a.MIN_VERSION=1,a.MAX_VERSION=40,a.PENALTY_N1=3,a.PENALTY_N2=3,a.PENALTY_N3=40,a.PENALTY_N4=10,a.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],a.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],c.QrCode=a;function o(w,e,r){if(e<0||e>31||w>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)r.push(w>>>t&1)}function m(w,e){return(w>>>e&1)!=0}function p(w){if(!w)throw new Error("Assertion error")}const l=class y{constructor(e,r,t){if(this.mode=e,this.numChars=r,this.bitData=t,r<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let r=[];for(const t of e)o(t,8,r);return new y(y.Mode.BYTE,e.length,r)}static makeNumeric(e){if(!y.isNumeric(e))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<e.length;){const s=Math.min(e.length-t,3);o(parseInt(e.substring(t,t+s),10),s*3+1,r),t+=s}return new y(y.Mode.NUMERIC,e.length,r)}static makeAlphanumeric(e){if(!y.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],t;for(t=0;t+2<=e.length;t+=2){let s=y.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;s+=y.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),o(s,11,r)}return t<e.length&&o(y.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,r),new y(y.Mode.ALPHANUMERIC,e.length,r)}static makeSegments(e){return e==""?[]:y.isNumeric(e)?[y.makeNumeric(e)]:y.isAlphanumeric(e)?[y.makeAlphanumeric(e)]:[y.makeBytes(y.toUtf8ByteArray(e))]}static makeEci(e){let r=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)o(e,8,r);else if(e<16384)o(2,2,r),o(e,14,r);else if(e<1e6)o(6,3,r),o(e,21,r);else throw new RangeError("ECI assignment value out of range");return new y(y.Mode.ECI,0,r)}static isNumeric(e){return y.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return y.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,r){let t=0;for(const s of e){const n=s.mode.numCharCountBits(r);if(s.numChars>=1<<n)return 1/0;t+=4+n+s.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let r=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?r.push(e.charCodeAt(t)):(r.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return r}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let N=l;c.QrSegment=l})(O||(O={}));(c=>{(a=>{const o=class{constructor(p,l){this.ordinal=p,this.formatBits=l}};o.LOW=new o(0,1),o.MEDIUM=new o(1,0),o.QUARTILE=new o(2,3),o.HIGH=new o(3,2),a.Ecc=o})(c.QrCode||(c.QrCode={}))})(O||(O={}));(c=>{(a=>{const o=class{constructor(p,l){this.modeBits=p,this.numBitsCharCount=l}numCharCountBits(p){return this.numBitsCharCount[Math.floor((p+7)/17)]}};o.NUMERIC=new o(1,[10,12,14]),o.ALPHANUMERIC=new o(2,[9,11,13]),o.BYTE=new o(4,[8,16,16]),o.KANJI=new o(8,[8,10,12]),o.ECI=new o(7,[0,0,0]),a.Mode=o})(c.QrSegment||(c.QrSegment={}))})(O||(O={}));var T=O;/**
6
- * @license qrcode.react
7
- * Copyright (c) Paul O'Shannessy
8
- * SPDX-License-Identifier: ISC
9
- */var xe={L:T.QrCode.Ecc.LOW,M:T.QrCode.Ecc.MEDIUM,Q:T.QrCode.Ecc.QUARTILE,H:T.QrCode.Ecc.HIGH},Z=128,J="L",ee="#FFFFFF",te="#000000",re=!1,se=1,Ee=4,we=0,Ce=.1;function ne(c,a=0){const o=[];return c.forEach(function(m,p){let l=null;m.forEach(function(N,w){if(!N&&l!==null){o.push(`M${l+a} ${p+a}h${w-l}v1H${l+a}z`),l=null;return}if(w===m.length-1){if(!N)return;l===null?o.push(`M${w+a},${p+a} h1v1H${w+a}z`):o.push(`M${l+a},${p+a} h${w+1-l}v1H${l+a}z`);return}N&&l===null&&(l=w)})}),o.join("")}function oe(c,a){return c.slice().map((o,m)=>m<a.y||m>=a.y+a.h?o:o.map((p,l)=>l<a.x||l>=a.x+a.w?p:!1))}function Ne(c,a,o,m){if(m==null)return null;const p=c.length+o*2,l=Math.floor(a*Ce),N=p/a,w=(m.width||l)*N,e=(m.height||l)*N,r=m.x==null?c.length/2-w/2:m.x*N,t=m.y==null?c.length/2-e/2:m.y*N,s=m.opacity==null?1:m.opacity;let n=null;if(m.excavate){let i=Math.floor(r),d=Math.floor(t),h=Math.ceil(w+r-i),M=Math.ceil(e+t-d);n={x:i,y:d,w:h,h:M}}const u=m.crossOrigin;return{x:r,y:t,h:e,w,excavation:n,opacity:s,crossOrigin:u}}function ve(c,a){return a!=null?Math.max(Math.floor(a),0):c?Ee:we}function ie({value:c,level:a,minVersion:o,includeMargin:m,marginSize:p,imageSettings:l,size:N,boostLevel:w}){let e=b.useMemo(()=>{const i=(Array.isArray(c)?c:[c]).reduce((d,h)=>(d.push(...T.QrSegment.makeSegments(h)),d),[]);return T.QrCode.encodeSegments(i,xe[a],o,void 0,void 0,w)},[c,a,o,w]);const{cells:r,margin:t,numCells:s,calculatedImageSettings:n}=b.useMemo(()=>{let u=e.getModules();const i=ve(m,p),d=u.length+i*2,h=Ne(u,N,i,l);return{cells:u,margin:i,numCells:d,calculatedImageSettings:h}},[e,N,l,m,p]);return{qrcode:e,margin:t,cells:r,numCells:s,calculatedImageSettings:n}}var Me=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Re=b.forwardRef(function(a,o){const m=a,{value:p,size:l=Z,level:N=J,bgColor:w=ee,fgColor:e=te,includeMargin:r=re,minVersion:t=se,boostLevel:s,marginSize:n,imageSettings:u}=m,d=_(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:h}=d,M=_(d,["style"]),R=u==null?void 0:u.src,g=b.useRef(null),v=b.useRef(null),S=b.useCallback(j=>{g.current=j,typeof o=="function"?o(j):o&&(o.current=j)},[o]),[x,F]=b.useState(!1),{margin:C,cells:I,numCells:D,calculatedImageSettings:P}=ie({value:p,level:N,minVersion:t,boostLevel:s,includeMargin:r,marginSize:n,imageSettings:u,size:l});b.useEffect(()=>{if(g.current!=null){const j=g.current,L=j.getContext("2d");if(!L)return;let H=I;const U=v.current,q=P!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;q&&P.excavation!=null&&(H=oe(I,P.excavation));const $=window.devicePixelRatio||1;j.height=j.width=l*$;const G=l/D*$;L.scale(G,G),L.fillStyle=w,L.fillRect(0,0,D,D),L.fillStyle=e,Me?L.fill(new Path2D(ne(H,C))):I.forEach(function(ae,ce){ae.forEach(function(ue,de){ue&&L.fillRect(de+C,ce+C,1,1)})}),P&&(L.globalAlpha=P.opacity),q&&L.drawImage(U,P.x+C,P.y+C,P.w,P.h)}}),b.useEffect(()=>{F(!1)},[R]);const le=z({height:l,width:l},h);let Q=null;return R!=null&&(Q=b.createElement("img",{src:R,key:R,style:{display:"none"},onLoad:()=>{F(!0)},ref:v,crossOrigin:P==null?void 0:P.crossOrigin})),b.createElement(b.Fragment,null,b.createElement("canvas",z({style:le,height:l,width:l,ref:S,role:"img"},M)),Q)});Re.displayName="QRCodeCanvas";var k=b.forwardRef(function(a,o){const m=a,{value:p,size:l=Z,level:N=J,bgColor:w=ee,fgColor:e=te,includeMargin:r=re,minVersion:t=se,boostLevel:s,title:n,marginSize:u,imageSettings:i}=m,d=_(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:h,cells:M,numCells:R,calculatedImageSettings:g}=ie({value:p,level:N,minVersion:t,boostLevel:s,includeMargin:r,marginSize:u,imageSettings:i,size:l});let v=M,S=null;i!=null&&g!=null&&(g.excavation!=null&&(v=oe(M,g.excavation)),S=b.createElement("image",{href:i.src,height:g.h,width:g.w,x:g.x+h,y:g.y+h,preserveAspectRatio:"none",opacity:g.opacity,crossOrigin:g.crossOrigin}));const x=ne(v,h);return b.createElement("svg",z({height:l,width:l,viewBox:`0 0 ${R} ${R}`,ref:o,role:"img"},d),!!n&&b.createElement("title",null,n),b.createElement("path",{fill:w,d:`M0,0 h${R}v${R}H0z`,shapeRendering:"crispEdges"}),b.createElement("path",{fill:e,d:x,shapeRendering:"crispEdges"}),S)});k.displayName="QRCodeSVG";function Pe({instanceId:c,channelKey:a,existingAppId:o,existingDomain:m,onConfigured:p}){const{t:l}=K(["instance","common"]),[N,w]=A.useState(""),[,e]=A.useState(""),[r,t]=A.useState("idle"),[s,n]=A.useState(""),[u,i]=A.useState(""),d=A.useRef(!1),h=A.useRef(!1),M=A.useRef(0),R=6,g=async()=>{if(c){h.current=!1,t("loading"),n(""),w("");try{let x=null;for(let F=0;F<3;F++){if(h.current)return;try{if(x=await he(c,a),x!=null&&x.qrcodeUrl)break}catch{F<2&&await new Promise(C=>setTimeout(C,1500))}}if(h.current)return;x!=null&&x.qrcodeUrl?(w(x.qrcodeUrl),e(x.sessionKey),t("waiting"),n(l("configForm.feishu.scanHint")),v(x.sessionKey)):(t("error"),n(l("qr.getFailed")))}catch{h.current||(t("error"),n(l("qr.getFailed")))}}},v=x=>{if(!c||d.current)return;d.current=!0,M.current=0;const F=async()=>{if(d.current)try{const C=await fe(c,x);if(M.current=0,C.connected){d.current=!1,t("confirmed"),n(C.message||l("qr.loginSuccess")),i(C.domain||"feishu"),w(""),p==null||p();return}if(C.status==="expired"){d.current=!1,t("error"),n(C.message||l("qr.expired"));return}setTimeout(F,3e3)}catch{if(!d.current)return;if(M.current+=1,M.current>=R){d.current=!1,t("error"),n(l("qr.pollFailed",{defaultValue:"轮询失败,请刷新后重试"}));return}setTimeout(F,3e3)}};F()};if(A.useEffect(()=>()=>{d.current=!1},[]),r==="confirmed")return f.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/20 rounded-md px-4 py-3 text-sm",children:[f.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[f.jsx("span",{className:"text-lg",children:"✓"}),f.jsx("span",{className:"font-medium",children:s})]}),f.jsx("p",{className:"text-xs text-muted mt-1",children:l("configForm.feishu.platform",{platform:l(u==="lark"?"configForm.feishu.platformLark":"configForm.feishu.platformFeishu")})})]});if(r==="idle"||r==="error")return f.jsxs("div",{className:"bg-[var(--card-hover)] rounded-md px-4 py-3 space-y-3",children:[o&&f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-muted mb-1",children:l("configForm.feishu.added")}),f.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[f.jsx("span",{className:"text-emerald-400",children:"✓"}),f.jsx("code",{className:"font-mono text-foreground/70",children:o}),f.jsx("span",{className:"text-muted opacity-60",children:m==="lark"?"Lark":l("configForm.feishu.platformFeishu")})]})]}),f.jsxs("div",{children:[f.jsx("button",{onClick:g,className:"px-4 py-2 bg-[#3370FF] text-white rounded-md text-xs font-medium hover:bg-[#3370FF]/90 transition-colors",children:l("configForm.feishu.addBot")}),f.jsx("p",{className:"text-xs text-muted mt-2",children:l("configForm.feishu.addBotHint")})]})]});const S=()=>{h.current=!0,d.current=!1,t("idle"),n(""),w(""),e("")};return f.jsx("div",{className:"bg-[var(--card-hover)] rounded-md px-4 py-4",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[N?f.jsx(k,{value:N,size:192,className:"rounded-lg"}):f.jsx("div",{className:"w-48 h-48 flex items-center justify-center",children:f.jsx("div",{className:"w-6 h-6 border-2 border-[#3370FF]/30 border-t-[#3370FF] rounded-full animate-spin"})}),f.jsx("div",{className:"text-sm text-muted",children:r==="loading"?l("configForm.feishu.gettingQr"):s}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("button",{onClick:S,className:"px-3 py-1.5 text-xs text-white bg-red-500 rounded-md hover:bg-red-500/90 transition-colors",children:l("configForm.feishu.cancel")}),f.jsx("button",{onClick:()=>{S(),setTimeout(g,100)},className:"px-3 py-1.5 text-xs text-white bg-[#0066FF] rounded-md hover:bg-[#0066FF]/90 transition-colors",children:l("configForm.feishu.refresh")})]})]})})}function Le({instanceId:c,onConfigured:a}){const{t:o,i18n:m}=K(["instance","common"]),[p,l]=A.useState(""),[,N]=A.useState(""),[w,e]=A.useState("idle"),[r,t]=A.useState(""),[s,n]=A.useState(""),[u,i]=A.useState([]),d=A.useRef(!1),h=A.useRef(!1),M=A.useRef(0),R=6;A.useEffect(()=>{c&&Y(c).then(x=>{var F;(F=x==null?void 0:x.accounts)!=null&&F.length&&i(x.accounts)}).catch(()=>{})},[c]);const g=async()=>{if(c){h.current=!1,e("loading"),t(""),l("");try{let x=null;for(let F=0;F<3;F++){if(h.current)return;try{if(x=await me(c),x!=null&&x.qrcodeUrl)break}catch{F<2&&await new Promise(C=>setTimeout(C,1500))}}if(h.current)return;x!=null&&x.qrcodeUrl?(l(x.qrcodeUrl),N(x.sessionKey),e("waiting"),t(o("configForm.weixin.scanHint")),v(x.sessionKey)):(e("error"),t(o("qr.getFailed")))}catch{h.current||(e("error"),t(o("qr.getFailed")))}}},v=x=>{if(!c||d.current)return;d.current=!0,M.current=0;const F=async()=>{if(d.current)try{const C=await ge(c,x);if(M.current=0,C.connected){d.current=!1,e("confirmed"),t(C.message||o("qr.loginSuccess")),n(C.accountId||""),l(""),c&&Y(c).then(I=>{I!=null&&I.accounts&&i(I.accounts)}).catch(()=>{}),a==null||a();return}if(C.status==="scaned")e("scaned"),t(C.message||o("qr.scaned"));else if(C.status==="refreshed"&&C.qrcodeUrl)l(C.qrcodeUrl),e("waiting"),t(o("qr.refreshed"));else if(C.status==="expired"){d.current=!1,e("error"),t(C.message||o("qr.expired"));return}setTimeout(F,2e3)}catch{if(!d.current)return;if(M.current+=1,M.current>=R){d.current=!1,e("error"),t(o("qr.pollFailed",{defaultValue:"轮询失败,请刷新后重试"}));return}setTimeout(F,3e3)}};F()};if(A.useEffect(()=>()=>{d.current=!1},[]),w==="confirmed")return f.jsxs("div",{className:"bg-emerald-500/10 border border-emerald-500/20 rounded-md px-4 py-3 text-sm",children:[f.jsxs("div",{className:"flex items-center gap-2 text-emerald-400",children:[f.jsx("span",{className:"text-lg",children:"✓"}),f.jsx("span",{className:"font-medium",children:r})]}),s&&f.jsxs("p",{className:"text-xs text-muted mt-1",children:[o("configForm.weixin.accountId")," ",f.jsx("code",{className:"font-mono",children:s})]}),f.jsx("p",{className:"text-xs text-muted mt-1",children:o("configForm.weixin.restartHint")}),f.jsx("button",{onClick:g,className:"mt-2 px-3 py-1 text-xs border border-emerald-500/30 rounded text-emerald-400 hover:bg-emerald-500/10 transition-colors",children:o("configForm.weixin.addAnother")})]});if(w==="idle"||w==="error")return f.jsxs("div",{className:"bg-[var(--card-hover)] rounded-md px-4 py-3 space-y-3",children:[u.length>0&&f.jsxs("div",{children:[f.jsx("p",{className:"text-xs text-muted mb-1.5",children:o("configForm.weixin.added")}),u.map(x=>f.jsxs("div",{className:"flex items-center gap-2 text-xs py-1",children:[f.jsx("span",{className:"text-emerald-400",children:"✓"}),f.jsx("code",{className:"font-mono text-foreground/70",children:x.accountId}),x.savedAt&&f.jsx("span",{className:"text-muted opacity-60",children:new Date(x.savedAt).toLocaleDateString(m.language==="zh"?"zh-CN":"en-US")})]},x.accountId))]}),f.jsxs("div",{children:[f.jsx("button",{onClick:g,className:"px-4 py-2 bg-[#07C160] text-white rounded-md text-xs font-medium hover:bg-[#07C160]/90 transition-colors",children:o("configForm.weixin.addClawBot")}),f.jsx("p",{className:"text-xs text-muted mt-2",children:o("configForm.weixin.addClawBotHint",{extra:u.length>0?o("configForm.weixin.addClawBotHintRestart"):o("configForm.weixin.addClawBotHintMulti")})})]})]});const S=()=>{h.current=!0,d.current=!1,e("idle"),t(""),l(""),N("")};return f.jsx("div",{className:"bg-[var(--card-hover)] rounded-md px-4 py-4",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[p?f.jsx(k,{value:p,size:192,className:"rounded-lg"}):f.jsx("div",{className:"w-48 h-48 flex items-center justify-center",children:f.jsx("div",{className:"w-6 h-6 border-2 border-[#07C160]/30 border-t-[#07C160] rounded-full animate-spin"})}),f.jsx("div",{className:"flex items-center gap-2 text-sm",children:w==="scaned"?f.jsxs("span",{className:"text-[#07C160] font-medium",children:["👀 ",r]}):w==="loading"?f.jsx("span",{className:"text-muted",children:o("configForm.weixin.gettingQr")}):f.jsx("span",{className:"text-muted",children:r})}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("button",{onClick:S,className:"px-3 py-1.5 text-xs text-white bg-red-500 rounded-md hover:bg-red-500/90 transition-colors",children:o("configForm.weixin.cancel")}),f.jsx("button",{onClick:()=>{S(),setTimeout(g,100)},className:"px-3 py-1.5 text-xs text-white bg-[#0066FF] rounded-md hover:bg-[#0066FF]/90 transition-colors",children:o("configForm.weixin.refresh")})]})]})})}export{Pe as F,k as Q,Le as W};