jishushell 0.6.5 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/anythingllm-container.yaml +16 -170
- package/apps/browserless-chromium-container.yaml +16 -10
- package/apps/filebrowser-container.yaml +15 -9
- package/apps/hermes-container.yaml +20 -5
- package/apps/immich-container-lite.yaml +337 -0
- package/apps/immich-container.yaml +371 -0
- package/apps/jishu-kb-container.yaml +50 -177
- package/apps/ollama-binary.yaml +33 -28
- package/apps/ollama-cpu-container.yaml +6 -0
- package/apps/ollama-with-hollama-binary.yaml +35 -28
- package/apps/openclaw-binary.yaml +35 -15
- package/apps/openclaw-container.yaml +29 -11
- package/apps/openclaw-with-ollama-container.yaml +9 -2
- package/apps/openclaw-with-searxng-container.yaml +38 -6
- package/apps/searxng-container.yaml +31 -6
- package/apps/weknora-container.yaml +26 -21
- package/dependencies/jishushell-panel-0.7.3.tgz +0 -0
- package/dist/cli/app.js +244 -213
- package/dist/cli/app.js.map +1 -1
- package/dist/cli/backup.js +15 -12
- package/dist/cli/backup.js.map +1 -1
- package/dist/cli/core.d.ts +4 -3
- package/dist/cli/core.js +392 -227
- package/dist/cli/core.js.map +1 -1
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.js +113 -10
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/job.js +62 -14
- package/dist/cli/job.js.map +1 -1
- package/dist/cli/llm.js +80 -11
- package/dist/cli/llm.js.map +1 -1
- package/dist/cli/managed-list.d.ts +1 -3
- package/dist/cli/managed-list.js +18 -16
- package/dist/cli/managed-list.js.map +1 -1
- package/dist/cli/migrate.d.ts +2 -0
- package/dist/cli/migrate.js +160 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +32 -20
- package/dist/config.js +132 -51
- package/dist/config.js.map +1 -1
- package/dist/control.d.ts +6 -6
- package/dist/control.js +31 -23
- package/dist/control.js.map +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/core.js +5 -5
- package/dist/core.js.map +1 -1
- package/dist/install.d.ts +2 -2
- package/dist/install.js +78 -37
- package/dist/install.js.map +1 -1
- package/dist/routes/admin.d.ts +2 -0
- package/dist/routes/admin.js +72 -0
- package/dist/routes/admin.js.map +1 -0
- package/dist/routes/apps.d.ts +1 -1
- package/dist/routes/apps.js +101 -193
- package/dist/routes/apps.js.map +1 -1
- package/dist/routes/auth.js +1 -1
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/backup.js +1 -1
- package/dist/routes/backup.js.map +1 -1
- package/dist/routes/docker.d.ts +2 -0
- package/dist/routes/docker.js +58 -0
- package/dist/routes/docker.js.map +1 -0
- package/dist/routes/external-mounts.d.ts +1 -1
- package/dist/routes/external-mounts.js +1 -1
- package/dist/routes/external-mounts.js.map +1 -1
- package/dist/routes/file-mounts.d.ts +4 -3
- package/dist/routes/file-mounts.js +49 -31
- package/dist/routes/file-mounts.js.map +1 -1
- package/dist/routes/files-organize.d.ts +2 -2
- package/dist/routes/files-organize.js +5 -5
- package/dist/routes/files-organize.js.map +1 -1
- package/dist/routes/files.d.ts +1 -1
- package/dist/routes/files.js +1 -1
- package/dist/routes/files.js.map +1 -1
- package/dist/routes/instances.d.ts +0 -8
- package/dist/routes/instances.js +202 -1560
- package/dist/routes/instances.js.map +1 -1
- package/dist/routes/integration-apps.d.ts +14 -0
- package/dist/routes/integration-apps.js +81 -0
- package/dist/routes/integration-apps.js.map +1 -0
- package/dist/routes/integrations.d.ts +9 -0
- package/dist/routes/integrations.js +12 -0
- package/dist/routes/integrations.js.map +1 -0
- package/dist/routes/llm-proxy.js +26 -3
- package/dist/routes/llm-proxy.js.map +1 -1
- package/dist/routes/setup.js +53 -38
- package/dist/routes/setup.js.map +1 -1
- package/dist/routes/system.js +108 -68
- package/dist/routes/system.js.map +1 -1
- package/dist/routes/webdav.d.ts +1 -1
- package/dist/routes/webdav.js +2 -2
- package/dist/routes/webdav.js.map +1 -1
- package/dist/server.d.ts +6 -0
- package/dist/server.js +368 -233
- package/dist/server.js.map +1 -1
- package/dist/services/app-common/app-compiler.js +186 -0
- package/dist/services/app-common/app-compiler.js.map +1 -0
- package/dist/services/app-common/app-shared.d.ts +15 -0
- package/dist/services/app-common/app-shared.js +64 -0
- package/dist/services/app-common/app-shared.js.map +1 -0
- package/dist/services/app-common/capability-service.d.ts +45 -0
- package/dist/services/app-common/capability-service.js +331 -0
- package/dist/services/app-common/capability-service.js.map +1 -0
- package/dist/services/app-common/catalog-service.d.ts +59 -0
- package/dist/services/app-common/catalog-service.js +318 -0
- package/dist/services/app-common/catalog-service.js.map +1 -0
- package/dist/services/app-common/create-pipeline.d.ts +26 -0
- package/dist/services/app-common/create-pipeline.js +298 -0
- package/dist/services/app-common/create-pipeline.js.map +1 -0
- package/dist/services/app-common/delete-service.d.ts +5 -0
- package/dist/services/app-common/delete-service.js +109 -0
- package/dist/services/app-common/delete-service.js.map +1 -0
- package/dist/services/app-common/execution-owner.d.ts +23 -0
- package/dist/services/app-common/execution-owner.js +124 -0
- package/dist/services/app-common/execution-owner.js.map +1 -0
- package/dist/services/app-common/execution-service.d.ts +23 -0
- package/dist/services/app-common/execution-service.js +105 -0
- package/dist/services/app-common/execution-service.js.map +1 -0
- package/dist/services/app-common/id-normalizer.d.ts +31 -0
- package/dist/services/app-common/id-normalizer.js +83 -0
- package/dist/services/app-common/id-normalizer.js.map +1 -0
- package/dist/services/app-common/install-store.d.ts +34 -0
- package/dist/services/app-common/install-store.js +261 -0
- package/dist/services/app-common/install-store.js.map +1 -0
- package/dist/services/app-common/instance-store.d.ts +78 -0
- package/dist/services/app-common/instance-store.js +498 -0
- package/dist/services/app-common/instance-store.js.map +1 -0
- package/dist/services/app-common/integration-refs.d.ts +17 -0
- package/dist/services/app-common/integration-refs.js +47 -0
- package/dist/services/app-common/integration-refs.js.map +1 -0
- package/dist/services/app-common/lifecycle-pipeline.d.ts +62 -0
- package/dist/services/app-common/lifecycle-pipeline.js +317 -0
- package/dist/services/app-common/lifecycle-pipeline.js.map +1 -0
- package/dist/services/app-common/lifecycle-scripts.d.ts +38 -0
- package/dist/services/app-common/lifecycle-scripts.js +935 -0
- package/dist/services/app-common/lifecycle-scripts.js.map +1 -0
- package/dist/services/app-common/lifecycle-service.d.ts +68 -0
- package/dist/services/app-common/lifecycle-service.js +475 -0
- package/dist/services/app-common/lifecycle-service.js.map +1 -0
- package/dist/services/app-common/ownership.d.ts +3 -0
- package/dist/services/app-common/ownership.js +11 -0
- package/dist/services/app-common/ownership.js.map +1 -0
- package/dist/services/app-common/paths.d.ts +29 -0
- package/dist/services/app-common/paths.js +34 -0
- package/dist/services/app-common/paths.js.map +1 -0
- package/dist/services/app-common/platform-transform.d.ts +32 -0
- package/dist/services/app-common/platform-transform.js +65 -0
- package/dist/services/app-common/platform-transform.js.map +1 -0
- package/dist/services/app-common/provide-resolver.d.ts +29 -0
- package/dist/services/app-common/provide-resolver.js +129 -0
- package/dist/services/app-common/provide-resolver.js.map +1 -0
- package/dist/services/app-common/remote-spec.d.ts +14 -0
- package/dist/services/app-common/remote-spec.js +58 -0
- package/dist/services/app-common/remote-spec.js.map +1 -0
- package/dist/services/app-common/runtime-builder.d.ts +1 -0
- package/dist/services/app-common/runtime-builder.js +2 -0
- package/dist/services/app-common/runtime-builder.js.map +1 -0
- package/dist/services/app-common/runtime-facts.d.ts +19 -0
- package/dist/services/app-common/runtime-facts.js +128 -0
- package/dist/services/app-common/runtime-facts.js.map +1 -0
- package/dist/services/app-common/service.d.ts +9 -0
- package/dist/services/app-common/service.js +10 -0
- package/dist/services/app-common/service.js.map +1 -0
- package/dist/services/app-common/spec-materializer.d.ts +8 -0
- package/dist/services/app-common/spec-materializer.js +295 -0
- package/dist/services/app-common/spec-materializer.js.map +1 -0
- package/dist/services/app-common/status-refresh.d.ts +33 -0
- package/dist/services/app-common/status-refresh.js +771 -0
- package/dist/services/app-common/status-refresh.js.map +1 -0
- package/dist/services/app-common/task-service.d.ts +29 -0
- package/dist/services/app-common/task-service.js +93 -0
- package/dist/services/app-common/task-service.js.map +1 -0
- package/dist/services/app-common/terminal-session-manager.js +157 -0
- package/dist/services/app-common/terminal-session-manager.js.map +1 -0
- package/dist/services/app-modules/browserless/routes.d.ts +9 -0
- package/dist/services/app-modules/browserless/routes.js +519 -0
- package/dist/services/app-modules/browserless/routes.js.map +1 -0
- package/dist/services/app-modules/routes.d.ts +2 -0
- package/dist/services/app-modules/routes.js +5 -0
- package/dist/services/app-modules/routes.js.map +1 -0
- package/dist/services/backup/backup-admin.d.ts +95 -0
- package/dist/services/backup/backup-admin.js +246 -0
- package/dist/services/backup/backup-admin.js.map +1 -0
- package/dist/services/backup/backup-manager.d.ts +264 -0
- package/dist/services/backup/backup-manager.js +2318 -0
- package/dist/services/backup/backup-manager.js.map +1 -0
- package/dist/services/backup/backup-verify.js +240 -0
- package/dist/services/backup/backup-verify.js.map +1 -0
- package/dist/services/capabilities/browser-policy.d.ts +14 -0
- package/dist/services/capabilities/browser-policy.js +141 -0
- package/dist/services/capabilities/browser-policy.js.map +1 -0
- package/dist/services/capabilities/contract.d.ts +49 -0
- package/dist/services/capabilities/contract.js +119 -0
- package/dist/services/capabilities/contract.js.map +1 -0
- package/dist/services/capabilities/endpoint-validator.d.ts +42 -0
- package/dist/services/capabilities/endpoint-validator.js +113 -0
- package/dist/services/capabilities/endpoint-validator.js.map +1 -0
- package/dist/services/capabilities/health.d.ts +16 -0
- package/dist/services/capabilities/health.js +121 -0
- package/dist/services/capabilities/health.js.map +1 -0
- package/dist/services/capabilities/registry.d.ts +56 -0
- package/dist/services/capabilities/registry.js +222 -0
- package/dist/services/capabilities/registry.js.map +1 -0
- package/dist/services/capabilities/sync.d.ts +7 -0
- package/dist/services/capabilities/sync.js +223 -0
- package/dist/services/capabilities/sync.js.map +1 -0
- package/dist/services/capability-proxy/html-rewriters/browserless.d.ts +1 -0
- package/dist/services/capability-proxy/html-rewriters/browserless.js +83 -0
- package/dist/services/capability-proxy/html-rewriters/browserless.js.map +1 -0
- package/dist/services/capability-proxy/html-rewriters/index.d.ts +12 -0
- package/dist/services/capability-proxy/html-rewriters/index.js +25 -0
- package/dist/services/capability-proxy/html-rewriters/index.js.map +1 -0
- package/dist/services/capability-proxy/html-rewriters/jishukb.d.ts +1 -0
- package/dist/services/capability-proxy/html-rewriters/jishukb.js +161 -0
- package/dist/services/capability-proxy/html-rewriters/jishukb.js.map +1 -0
- package/dist/services/capability-proxy/http.d.ts +7 -0
- package/dist/services/capability-proxy/http.js +555 -0
- package/dist/services/capability-proxy/http.js.map +1 -0
- package/dist/services/capability-proxy/terminal.d.ts +4 -0
- package/dist/services/capability-proxy/terminal.js +179 -0
- package/dist/services/capability-proxy/terminal.js.map +1 -0
- package/dist/services/connections/admin.d.ts +80 -0
- package/dist/services/connections/admin.js +337 -0
- package/dist/services/connections/admin.js.map +1 -0
- package/dist/services/connections/apply.d.ts +104 -0
- package/dist/services/connections/apply.js +415 -0
- package/dist/services/connections/apply.js.map +1 -0
- package/dist/services/connections/resolver.d.ts +82 -0
- package/dist/services/connections/resolver.js +289 -0
- package/dist/services/connections/resolver.js.map +1 -0
- package/dist/services/connections/transactor.d.ts +39 -0
- package/dist/services/connections/transactor.js +307 -0
- package/dist/services/connections/transactor.js.map +1 -0
- package/dist/services/files/bootstrap.d.ts +7 -0
- package/dist/services/files/bootstrap.js +16 -0
- package/dist/services/files/bootstrap.js.map +1 -0
- package/dist/services/files/external-mounts.js +187 -0
- package/dist/services/files/external-mounts.js.map +1 -0
- package/dist/services/files/files-manager.d.ts +265 -0
- package/dist/services/files/files-manager.js +1189 -0
- package/dist/services/files/files-manager.js.map +1 -0
- package/dist/services/files/files-mounts.d.ts +42 -0
- package/dist/services/files/files-mounts.js +207 -0
- package/dist/services/files/files-mounts.js.map +1 -0
- package/dist/services/files/organize/applier.js +218 -0
- package/dist/services/files/organize/applier.js.map +1 -0
- package/dist/services/files/organize/rules.js +286 -0
- package/dist/services/files/organize/rules.js.map +1 -0
- package/dist/services/files/organize/scanner.js +366 -0
- package/dist/services/files/organize/scanner.js.map +1 -0
- package/dist/services/files/organize/store.js +82 -0
- package/dist/services/files/organize/store.js.map +1 -0
- package/dist/services/files/photos/upload-page.d.ts +2 -0
- package/dist/services/files/photos/upload-page.js +248 -0
- package/dist/services/files/photos/upload-page.js.map +1 -0
- package/dist/services/files/photos/upload-store.d.ts +74 -0
- package/dist/services/files/photos/upload-store.js +432 -0
- package/dist/services/files/photos/upload-store.js.map +1 -0
- package/dist/services/files/webdav/server.d.ts +47 -0
- package/dist/services/files/webdav/server.js +329 -0
- package/dist/services/files/webdav/server.js.map +1 -0
- package/dist/services/files/webdav/xml-builder.js.map +1 -0
- package/dist/services/http/proxy-utils.d.ts +7 -0
- package/dist/services/http/proxy-utils.js +29 -0
- package/dist/services/http/proxy-utils.js.map +1 -0
- package/dist/services/http/request-utils.d.ts +3 -0
- package/dist/services/http/request-utils.js +23 -0
- package/dist/services/http/request-utils.js.map +1 -0
- package/dist/services/instances/admin.d.ts +23 -0
- package/dist/services/instances/admin.js +218 -0
- package/dist/services/instances/admin.js.map +1 -0
- package/dist/services/instances/clone.d.ts +26 -0
- package/dist/services/instances/clone.js +78 -0
- package/dist/services/instances/clone.js.map +1 -0
- package/dist/services/instances/config-admin.d.ts +17 -0
- package/dist/services/instances/config-admin.js +181 -0
- package/dist/services/instances/config-admin.js.map +1 -0
- package/dist/services/instances/manager.d.ts +232 -0
- package/dist/services/instances/manager.js +1342 -0
- package/dist/services/instances/manager.js.map +1 -0
- package/dist/services/instances/pairing.d.ts +17 -0
- package/dist/services/instances/pairing.js +53 -0
- package/dist/services/instances/pairing.js.map +1 -0
- package/dist/services/instances/passwords.js +173 -0
- package/dist/services/instances/passwords.js.map +1 -0
- package/dist/services/instances/status.d.ts +2 -0
- package/dist/services/instances/status.js +11 -0
- package/dist/services/instances/status.js.map +1 -0
- package/dist/services/instances/types.d.ts +21 -0
- package/dist/services/instances/types.js +2 -0
- package/dist/services/instances/types.js.map +1 -0
- package/dist/services/integrations/anythingllm/integration.d.ts +25 -0
- package/dist/services/integrations/anythingllm/integration.js +251 -0
- package/dist/services/integrations/anythingllm/integration.js.map +1 -0
- package/dist/services/integrations/catalog.d.ts +3 -0
- package/dist/services/integrations/catalog.js +73 -0
- package/dist/services/integrations/catalog.js.map +1 -0
- package/dist/services/integrations/custom/integration.d.ts +28 -0
- package/dist/services/integrations/custom/integration.js +179 -0
- package/dist/services/integrations/custom/integration.js.map +1 -0
- package/dist/services/integrations/hermes/integration.d.ts +194 -0
- package/dist/services/integrations/hermes/integration.js +1668 -0
- package/dist/services/integrations/hermes/integration.js.map +1 -0
- package/dist/services/integrations/immich/client.d.ts +93 -0
- package/dist/services/integrations/immich/client.js +458 -0
- package/dist/services/integrations/immich/client.js.map +1 -0
- package/dist/services/integrations/immich/config.d.ts +15 -0
- package/dist/services/integrations/immich/config.js +178 -0
- package/dist/services/integrations/immich/config.js.map +1 -0
- package/dist/services/integrations/immich/discovery.d.ts +9 -0
- package/dist/services/integrations/immich/discovery.js +101 -0
- package/dist/services/integrations/immich/discovery.js.map +1 -0
- package/dist/services/integrations/immich/gallery-renderer.d.ts +5 -0
- package/dist/services/integrations/immich/gallery-renderer.js +150 -0
- package/dist/services/integrations/immich/gallery-renderer.js.map +1 -0
- package/dist/services/integrations/immich/immich-shim.d.ts +11 -0
- package/dist/services/integrations/immich/immich-shim.js +439 -0
- package/dist/services/integrations/immich/immich-shim.js.map +1 -0
- package/dist/services/integrations/immich/integration.d.ts +18 -0
- package/dist/services/integrations/immich/integration.js +64 -0
- package/dist/services/integrations/immich/integration.js.map +1 -0
- package/dist/services/integrations/immich/photo-library.d.ts +4 -0
- package/dist/services/integrations/immich/photo-library.js +63 -0
- package/dist/services/integrations/immich/photo-library.js.map +1 -0
- package/dist/services/integrations/immich/review-executor.d.ts +3 -0
- package/dist/services/integrations/immich/review-executor.js +41 -0
- package/dist/services/integrations/immich/review-executor.js.map +1 -0
- package/dist/services/integrations/immich/review-session-service.d.ts +27 -0
- package/dist/services/integrations/immich/review-session-service.js +206 -0
- package/dist/services/integrations/immich/review-session-service.js.map +1 -0
- package/dist/services/integrations/immich/review-store.d.ts +47 -0
- package/dist/services/integrations/immich/review-store.js +347 -0
- package/dist/services/integrations/immich/review-store.js.map +1 -0
- package/dist/services/integrations/immich/routes.d.ts +7 -0
- package/dist/services/integrations/immich/routes.js +363 -0
- package/dist/services/integrations/immich/routes.js.map +1 -0
- package/dist/services/integrations/immich/types.d.ts +186 -0
- package/dist/services/integrations/immich/types.js +2 -0
- package/dist/services/integrations/immich/types.js.map +1 -0
- package/dist/services/integrations/index.d.ts +41 -0
- package/dist/services/integrations/index.js +60 -0
- package/dist/services/integrations/index.js.map +1 -0
- package/dist/services/integrations/installable/catalog.d.ts +33 -0
- package/dist/services/integrations/installable/catalog.js +88 -0
- package/dist/services/integrations/installable/catalog.js.map +1 -0
- package/dist/services/integrations/installable/index.d.ts +35 -0
- package/dist/services/integrations/installable/index.js +170 -0
- package/dist/services/integrations/installable/index.js.map +1 -0
- package/dist/services/integrations/installable/installers/integration-probes.d.ts +50 -0
- package/dist/services/integrations/installable/installers/integration-probes.js +231 -0
- package/dist/services/integrations/installable/installers/integration-probes.js.map +1 -0
- package/dist/services/integrations/installable/installers/integration.d.ts +30 -0
- package/dist/services/integrations/installable/installers/integration.js +283 -0
- package/dist/services/integrations/installable/installers/integration.js.map +1 -0
- package/dist/services/integrations/installable/installers/registry-probe.js.map +1 -0
- package/dist/services/integrations/installable/installers/shell-script.d.ts +46 -0
- package/dist/services/integrations/installable/installers/shell-script.js +487 -0
- package/dist/services/integrations/installable/installers/shell-script.js.map +1 -0
- package/dist/services/integrations/installable/types.d.ts +130 -0
- package/dist/services/integrations/installable/types.js +19 -0
- package/dist/services/integrations/installable/types.js.map +1 -0
- package/dist/services/integrations/jishukb/integration.d.ts +24 -0
- package/dist/services/integrations/jishukb/integration.js +300 -0
- package/dist/services/integrations/jishukb/integration.js.map +1 -0
- package/dist/services/integrations/openclaw/anythingllm-shim.d.ts +46 -0
- package/dist/services/integrations/openclaw/anythingllm-shim.js +281 -0
- package/dist/services/integrations/openclaw/anythingllm-shim.js.map +1 -0
- package/dist/services/integrations/openclaw/drive-shim.js +490 -0
- package/dist/services/integrations/openclaw/drive-shim.js.map +1 -0
- package/dist/services/integrations/openclaw/integration.d.ts +438 -0
- package/dist/services/integrations/openclaw/integration.js +4629 -0
- package/dist/services/integrations/openclaw/integration.js.map +1 -0
- package/dist/services/integrations/openclaw/jishukb-native-mcp.d.ts +58 -0
- package/dist/services/integrations/openclaw/jishukb-native-mcp.js +373 -0
- package/dist/services/integrations/openclaw/jishukb-native-mcp.js.map +1 -0
- package/dist/services/integrations/openclaw/jishukb-shim.d.ts +52 -0
- package/dist/services/integrations/openclaw/jishukb-shim.js +1357 -0
- package/dist/services/integrations/openclaw/jishukb-shim.js.map +1 -0
- package/dist/services/integrations/openclaw/mcporter-lite.js +276 -0
- package/dist/services/integrations/openclaw/mcporter-lite.js.map +1 -0
- package/dist/services/integrations/openclaw/mcporter.d.ts +59 -0
- package/dist/services/integrations/openclaw/mcporter.js +143 -0
- package/dist/services/integrations/openclaw/mcporter.js.map +1 -0
- package/dist/services/integrations/openclaw/native-mcp.d.ts +48 -0
- package/dist/services/integrations/openclaw/native-mcp.js +125 -0
- package/dist/services/integrations/openclaw/native-mcp.js.map +1 -0
- package/dist/services/integrations/openclaw/routes.d.ts +21 -0
- package/dist/services/integrations/openclaw/routes.js +1194 -0
- package/dist/services/integrations/openclaw/routes.js.map +1 -0
- package/dist/services/integrations/registry.d.ts +17 -0
- package/dist/services/integrations/registry.js +36 -0
- package/dist/services/integrations/registry.js.map +1 -0
- package/dist/services/integrations/routes.d.ts +2 -0
- package/dist/services/integrations/routes.js +9 -0
- package/dist/services/integrations/routes.js.map +1 -0
- package/dist/services/integrations/types.d.ts +457 -0
- package/dist/services/integrations/types.js +2 -0
- package/dist/services/integrations/types.js.map +1 -0
- package/dist/services/legacy-migrator/classifier.d.ts +44 -0
- package/dist/services/legacy-migrator/classifier.js +309 -0
- package/dist/services/legacy-migrator/classifier.js.map +1 -0
- package/dist/services/legacy-migrator/executor.d.ts +42 -0
- package/dist/services/legacy-migrator/executor.js +637 -0
- package/dist/services/legacy-migrator/executor.js.map +1 -0
- package/dist/services/legacy-migrator/index.d.ts +31 -0
- package/dist/services/legacy-migrator/index.js +34 -0
- package/dist/services/legacy-migrator/index.js.map +1 -0
- package/dist/services/legacy-migrator/planner.d.ts +8 -0
- package/dist/services/legacy-migrator/planner.js +154 -0
- package/dist/services/legacy-migrator/planner.js.map +1 -0
- package/dist/services/legacy-migrator/provider-settings.d.ts +6 -0
- package/dist/services/legacy-migrator/provider-settings.js +72 -0
- package/dist/services/legacy-migrator/provider-settings.js.map +1 -0
- package/dist/services/legacy-migrator/report.d.ts +9 -0
- package/dist/services/legacy-migrator/report.js +99 -0
- package/dist/services/legacy-migrator/report.js.map +1 -0
- package/dist/services/legacy-migrator/scanner.d.ts +13 -0
- package/dist/services/legacy-migrator/scanner.js +157 -0
- package/dist/services/legacy-migrator/scanner.js.map +1 -0
- package/dist/services/legacy-migrator/types.d.ts +97 -0
- package/dist/services/legacy-migrator/types.js +23 -0
- package/dist/services/legacy-migrator/types.js.map +1 -0
- package/dist/services/llm-proxy/instance-proxy.d.ts +17 -1
- package/dist/services/llm-proxy/instance-proxy.js +171 -44
- package/dist/services/llm-proxy/instance-proxy.js.map +1 -1
- package/dist/services/llm-proxy/probe.js +5 -14
- package/dist/services/llm-proxy/probe.js.map +1 -1
- package/dist/services/llm-proxy/providers.js +23 -31
- package/dist/services/llm-proxy/providers.js.map +1 -1
- package/dist/services/llm-proxy/ssrf.d.ts +11 -4
- package/dist/services/llm-proxy/ssrf.js +45 -7
- package/dist/services/llm-proxy/ssrf.js.map +1 -1
- package/dist/services/llm-proxy/validate-key.js +16 -37
- package/dist/services/llm-proxy/validate-key.js.map +1 -1
- package/dist/services/repair/runtime-repair.d.ts +22 -0
- package/dist/services/repair/runtime-repair.js +374 -0
- package/dist/services/repair/runtime-repair.js.map +1 -0
- package/dist/services/runtime/docker-network.d.ts +8 -0
- package/dist/services/runtime/docker-network.js +123 -0
- package/dist/services/runtime/docker-network.js.map +1 -0
- package/dist/services/runtime/driver-registry.d.ts +25 -0
- package/dist/services/runtime/driver-registry.js +22 -0
- package/dist/services/runtime/driver-registry.js.map +1 -0
- package/dist/services/runtime/drivers/nomad.d.ts +261 -0
- package/dist/services/runtime/drivers/nomad.js +3122 -0
- package/dist/services/runtime/drivers/nomad.js.map +1 -0
- package/dist/services/runtime/errors.d.ts +3 -3
- package/dist/services/runtime/errors.js +3 -3
- package/dist/services/runtime/instance.d.ts +14 -16
- package/dist/services/runtime/instance.js +93 -123
- package/dist/services/runtime/instance.js.map +1 -1
- package/dist/services/runtime/job-id.d.ts +1 -1
- package/dist/services/runtime/job-id.js +1 -1
- package/dist/services/runtime/mcp-shims/firewall.d.ts +2 -2
- package/dist/services/runtime/mcp-shims/firewall.js +2 -2
- package/dist/services/runtime/mcp-shims/searxng-shim.d.ts +3 -5
- package/dist/services/runtime/mcp-shims/searxng-shim.js +3 -5
- package/dist/services/runtime/mcp-shims/searxng-shim.js.map +1 -1
- package/dist/services/runtime/mcp-shims/write-mcp-entry.d.ts +20 -20
- package/dist/services/runtime/mcp-shims/write-mcp-entry.js +16 -16
- package/dist/services/runtime/mcp-shims/write-mcp-entry.js.map +1 -1
- package/dist/services/runtime/ownership-marker.d.ts +83 -0
- package/dist/services/runtime/ownership-marker.js +109 -0
- package/dist/services/runtime/ownership-marker.js.map +1 -0
- package/dist/services/runtime/service-manager.d.ts +2 -0
- package/dist/services/runtime/service-manager.js +18 -0
- package/dist/services/runtime/service-manager.js.map +1 -0
- package/dist/services/runtime/types.d.ts +23 -501
- package/dist/services/runtime/types.js +0 -12
- package/dist/services/runtime/types.js.map +1 -1
- package/dist/services/runtime/workload-compiler.d.ts +17 -0
- package/dist/services/runtime/workload-compiler.js +550 -0
- package/dist/services/runtime/workload-compiler.js.map +1 -0
- package/dist/services/runtime/workload-types.d.ts +11 -0
- package/dist/services/runtime/workload-types.js +2 -0
- package/dist/services/runtime/workload-types.js.map +1 -0
- package/dist/services/setup/core-manager.d.ts +50 -0
- package/dist/services/setup/core-manager.js +456 -0
- package/dist/services/setup/core-manager.js.map +1 -0
- package/dist/services/setup/plugin-installer.js +136 -0
- package/dist/services/setup/plugin-installer.js.map +1 -0
- package/dist/services/setup/setup-manager.d.ts +158 -0
- package/dist/services/setup/setup-manager.js +2724 -0
- package/dist/services/setup/setup-manager.js.map +1 -0
- package/dist/services/system/cli-command.d.ts +5 -0
- package/dist/services/system/cli-command.js +18 -0
- package/dist/services/system/cli-command.js.map +1 -0
- package/dist/services/system/macos-launchd.js +312 -0
- package/dist/services/system/macos-launchd.js.map +1 -0
- package/dist/services/system/repair-orchestrator.d.ts +71 -0
- package/dist/services/system/repair-orchestrator.js +412 -0
- package/dist/services/system/repair-orchestrator.js.map +1 -0
- package/dist/services/system/runtime-ownership.d.ts +36 -0
- package/dist/services/system/runtime-ownership.js +250 -0
- package/dist/services/system/runtime-ownership.js.map +1 -0
- package/dist/services/system/system-monitor.js +96 -0
- package/dist/services/system/system-monitor.js.map +1 -0
- package/dist/services/system/system-ollama-provider.d.ts +14 -0
- package/dist/services/system/system-ollama-provider.js +129 -0
- package/dist/services/system/system-ollama-provider.js.map +1 -0
- package/dist/services/system/system-reconciler.d.ts +59 -0
- package/dist/services/system/system-reconciler.js +763 -0
- package/dist/services/system/system-reconciler.js.map +1 -0
- package/dist/services/system/update-manager.d.ts +43 -0
- package/dist/services/system/update-manager.js +315 -0
- package/dist/services/system/update-manager.js.map +1 -0
- package/dist/services/system/upgrade-finalize.d.ts +80 -0
- package/dist/services/system/upgrade-finalize.js +507 -0
- package/dist/services/system/upgrade-finalize.js.map +1 -0
- package/dist/services/tasks/registry.d.ts +44 -0
- package/dist/services/tasks/registry.js +90 -0
- package/dist/services/tasks/registry.js.map +1 -0
- package/dist/services/telemetry/activation.d.ts +6 -2
- package/dist/services/telemetry/activation.js +6 -2
- package/dist/services/telemetry/activation.js.map +1 -1
- package/dist/services/telemetry/heartbeat.d.ts +6 -2
- package/dist/services/telemetry/heartbeat.js +6 -2
- package/dist/services/telemetry/heartbeat.js.map +1 -1
- package/dist/services/workspaces/builder.d.ts +29 -0
- package/dist/services/workspaces/builder.js +186 -0
- package/dist/services/workspaces/builder.js.map +1 -0
- package/dist/types.d.ts +350 -48
- package/dist/utils/instance-lock.d.ts +2 -2
- package/dist/utils/instance-lock.js +2 -2
- package/dist/utils/path-safety.js +1 -1
- package/dist/utils/service-user.d.ts +13 -0
- package/dist/utils/service-user.js +129 -0
- package/dist/utils/service-user.js.map +1 -0
- package/install/jishu-install.sh +107 -27
- package/install/jishu-uninstall.sh +8 -0
- package/install/post-install.sh +162 -185
- package/install/post-uninstall.sh +6 -0
- package/node_modules/@fastify/static/.github/workflows/ci.yml +1 -1
- package/node_modules/@fastify/static/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/static/LICENSE +1 -3
- package/node_modules/@fastify/static/example/server-benchmark.js +39 -0
- package/node_modules/@fastify/static/index.js +169 -23
- package/node_modules/@fastify/static/lib/dirList.js +20 -6
- package/node_modules/@fastify/static/package.json +10 -8
- package/node_modules/@fastify/static/test/dir-list.test.js +82 -0
- package/node_modules/@fastify/static/test/static.test.js +326 -4
- package/node_modules/@fastify/static/types/index.d.ts +0 -4
- package/node_modules/@fastify/static/types/index.test-d.ts +1 -1
- package/node_modules/brace-expansion/dist/commonjs/index.js +24 -14
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.js +24 -14
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
- package/node_modules/brace-expansion/package.json +2 -2
- package/node_modules/content-disposition/README.md +21 -22
- package/node_modules/content-disposition/index.js +122 -44
- package/node_modules/content-disposition/package.json +16 -20
- package/node_modules/fast-uri/index.js +1 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +28 -0
- package/node_modules/fastify/SECURITY.md +1 -1
- package/node_modules/fastify/SPONSORS.md +6 -4
- package/node_modules/fastify/docs/Guides/Database.md +0 -28
- package/node_modules/fastify/docs/Guides/Ecosystem.md +13 -2
- package/node_modules/fastify/docs/Guides/Serverless.md +2 -2
- package/node_modules/fastify/docs/Guides/Write-Plugin.md +1 -1
- package/node_modules/fastify/docs/Reference/Encapsulation.md +27 -26
- package/node_modules/fastify/docs/Reference/Errors.md +10 -4
- package/node_modules/fastify/docs/Reference/HTTP2.md +10 -10
- package/node_modules/fastify/docs/Reference/Hooks.md +4 -4
- package/node_modules/fastify/docs/Reference/Index.md +14 -16
- package/node_modules/fastify/docs/Reference/LTS.md +12 -13
- package/node_modules/fastify/docs/Reference/Lifecycle.md +9 -8
- package/node_modules/fastify/docs/Reference/Logging.md +44 -39
- package/node_modules/fastify/docs/Reference/Middleware.md +21 -25
- package/node_modules/fastify/docs/Reference/Principles.md +2 -2
- package/node_modules/fastify/docs/Reference/Reply.md +6 -1
- package/node_modules/fastify/docs/Reference/Request.md +27 -16
- package/node_modules/fastify/docs/Reference/Routes.md +5 -2
- package/node_modules/fastify/docs/Reference/Server.md +31 -3
- package/node_modules/fastify/docs/Reference/Type-Providers.md +29 -5
- package/node_modules/fastify/docs/Reference/Validation-and-Serialization.md +15 -2
- package/node_modules/fastify/docs/Reference/Warnings.md +7 -6
- package/node_modules/fastify/eslint.config.js +7 -2
- package/node_modules/fastify/fastify.d.ts +8 -3
- package/node_modules/fastify/fastify.js +43 -14
- package/node_modules/fastify/lib/content-type-parser.js +13 -1
- package/node_modules/fastify/lib/decorate.js +11 -3
- package/node_modules/fastify/lib/error-handler.js +4 -3
- package/node_modules/fastify/lib/error-serializer.js +59 -59
- package/node_modules/fastify/lib/errors.js +16 -1
- package/node_modules/fastify/lib/four-oh-four.js +14 -9
- package/node_modules/fastify/lib/handle-request.js +11 -5
- package/node_modules/fastify/lib/plugin-override.js +2 -1
- package/node_modules/fastify/lib/plugin-utils.js +5 -5
- package/node_modules/fastify/lib/reply.js +63 -8
- package/node_modules/fastify/lib/request.js +14 -4
- package/node_modules/fastify/lib/route.js +20 -6
- package/node_modules/fastify/lib/schema-controller.js +1 -1
- package/node_modules/fastify/lib/schemas.js +37 -30
- package/node_modules/fastify/lib/symbols.js +3 -1
- package/node_modules/fastify/lib/validation.js +1 -13
- package/node_modules/fastify/lib/warnings.js +3 -3
- package/node_modules/fastify/package.json +13 -15
- package/node_modules/fastify/scripts/validate-ecosystem-links.js +1 -0
- package/node_modules/fastify/test/bundler/esbuild/package.json +1 -1
- package/node_modules/fastify/test/close-pipelining.test.js +1 -2
- package/node_modules/fastify/test/custom-http-server.test.js +38 -0
- package/node_modules/fastify/test/decorator-instance-properties.test.js +63 -0
- package/node_modules/fastify/test/diagnostics-channel/async-error-handler.test.js +74 -0
- package/node_modules/fastify/test/hooks.test.js +23 -0
- package/node_modules/fastify/test/http-methods/get.test.js +1 -1
- package/node_modules/fastify/test/http2/plain.test.js +135 -0
- package/node_modules/fastify/test/http2/secure-with-fallback.test.js +1 -1
- package/node_modules/fastify/test/https/https.test.js +1 -2
- package/node_modules/fastify/test/internals/errors.test.js +31 -1
- package/node_modules/fastify/test/internals/plugin.test.js +3 -1
- package/node_modules/fastify/test/internals/request.test.js +27 -3
- package/node_modules/fastify/test/internals/schema-controller-perf.test.js +33 -0
- package/node_modules/fastify/test/logger/logging.test.js +18 -1
- package/node_modules/fastify/test/logger/options.test.js +38 -1
- package/node_modules/fastify/test/reply-error.test.js +1 -1
- package/node_modules/fastify/test/reply-trailers.test.js +70 -0
- package/node_modules/fastify/test/request-media-type.test.js +105 -0
- package/node_modules/fastify/test/route-prefix.test.js +34 -0
- package/node_modules/fastify/test/router-options.test.js +222 -11
- package/node_modules/fastify/test/schema-serialization.test.js +108 -0
- package/node_modules/fastify/test/schema-validation.test.js +24 -0
- package/node_modules/fastify/test/scripts/validate-ecosystem-links.test.js +40 -57
- package/node_modules/fastify/test/throw.test.js +14 -0
- package/node_modules/fastify/test/trust-proxy.test.js +21 -0
- package/node_modules/fastify/test/types/content-type-parser.tst.ts +70 -0
- package/node_modules/fastify/test/types/decorate-request-reply.tst.ts +18 -0
- package/node_modules/fastify/test/types/dummy-plugin.mts +9 -0
- package/node_modules/fastify/test/types/errors.tst.ts +91 -0
- package/node_modules/fastify/test/types/fastify.tst.ts +351 -0
- package/node_modules/fastify/test/types/hooks.tst.ts +578 -0
- package/node_modules/fastify/test/types/instance.tst.ts +597 -0
- package/node_modules/fastify/test/types/logger.tst.ts +276 -0
- package/node_modules/fastify/test/types/plugin.tst.ts +96 -0
- package/node_modules/fastify/test/types/register.tst.ts +245 -0
- package/node_modules/fastify/test/types/reply.tst.ts +297 -0
- package/node_modules/fastify/test/types/request.tst.ts +199 -0
- package/node_modules/fastify/test/types/route.tst.ts +576 -0
- package/node_modules/fastify/test/types/schema.tst.ts +135 -0
- package/node_modules/fastify/test/types/serverFactory.tst.ts +37 -0
- package/node_modules/fastify/test/types/tsconfig.json +9 -0
- package/node_modules/fastify/test/types/type-provider.tst.ts +1219 -0
- package/node_modules/fastify/test/types/using.tst.ts +14 -0
- package/node_modules/fastify/types/errors.d.ts +3 -0
- package/node_modules/fastify/types/request.d.ts +23 -2
- package/node_modules/glob/README.md +39 -130
- package/node_modules/glob/dist/commonjs/glob.d.ts +8 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/glob.js +2 -1
- package/node_modules/glob/dist/commonjs/glob.js.map +1 -1
- package/node_modules/glob/dist/commonjs/index.min.js +4 -0
- package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts +3 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -1
- package/node_modules/glob/dist/commonjs/pattern.js +4 -0
- package/node_modules/glob/dist/commonjs/pattern.js.map +1 -1
- package/node_modules/glob/dist/esm/glob.d.ts +8 -0
- package/node_modules/glob/dist/esm/glob.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/glob.js +2 -1
- package/node_modules/glob/dist/esm/glob.js.map +1 -1
- package/node_modules/glob/dist/esm/index.min.js +4 -0
- package/node_modules/glob/dist/esm/index.min.js.map +7 -0
- package/node_modules/glob/dist/esm/pattern.d.ts +3 -0
- package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -1
- package/node_modules/glob/dist/esm/pattern.js +4 -0
- package/node_modules/glob/dist/esm/pattern.js.map +1 -1
- package/node_modules/glob/package.json +38 -37
- package/node_modules/jishushell-panel/README.md +4 -4
- package/node_modules/jishushell-panel/output/dist/server.js +17 -6
- package/node_modules/jishushell-panel/output/dist/server.js.map +1 -1
- package/node_modules/jishushell-panel/output/public/assets/ApiKeyField-Ce5d1xna.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/Dashboard-BXame3yg.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/HermesChatPanel-BHZtPCJd.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/HermesConfigForm-CB3GbNX9.js +4 -0
- package/node_modules/jishushell-panel/output/public/assets/InitPassword-Boab9F6g.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/InstanceDetail-DrIWCqo-.js +14 -0
- package/node_modules/jishushell-panel/output/public/assets/Login-CzpOkNau.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/NewInstance-CANXyCcL.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-BABo9VOC.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/Settings-CKp5XxFh.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/Setup-C7xVDPow.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/WeixinLoginPanel-B765Xz4C.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/api-C70Gt678.js +4 -0
- package/node_modules/jishushell-panel/output/public/assets/index-Bs6DSbiR.js +23 -0
- package/node_modules/jishushell-panel/output/public/assets/index-DnnqTf7s.css +1 -0
- package/node_modules/jishushell-panel/output/public/assets/registry-sWIZsIEF.js +2 -0
- package/node_modules/jishushell-panel/output/public/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/setup-task-q21GnI0E.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/usePolling-D4IDOQd_.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/vendor-i18n-Df8aUdv8.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/vendor-react-0L0rjmYG.js +8 -0
- package/node_modules/jishushell-panel/output/public/index.html +6 -4
- package/node_modules/jishushell-panel/package.json +2 -2
- package/node_modules/semver/classes/range.js +17 -4
- package/node_modules/semver/package.json +2 -2
- package/package.json +12 -64
- package/scripts/check-app-path-boundaries.mjs +121 -0
- package/scripts/check-app-spec.mjs +123 -29
- package/scripts/check-architecture-boundaries.mjs +178 -0
- package/scripts/check-colima-launchd.mjs +10 -8
- package/scripts/check-integration-isolation.ts +541 -0
- package/scripts/check-new-file-tests.mjs +11 -3
- package/scripts/check-open-core-boundaries.mjs +60 -10
- package/scripts/check-test-layering.sh +1 -1
- package/scripts/fixtures/instances/hermes-sample/instance.json +3 -2
- package/scripts/fixtures/instances/legacy-openclaw-sample/instance.json +1 -1
- package/scripts/local-web-upgrade-test.README +4 -3
- package/scripts/local-web-upgrade-test.example.env +2 -2
- package/scripts/local-web-upgrade-test.sh +14 -1
- package/scripts/pack-gui-and-send-pi.sh +43 -0
- package/scripts/perf/instances.js +1 -1
- package/scripts/prune-open-core-dist.mjs +89 -2
- package/scripts/smoke/hermes-bootstrap.sh +5 -5
- package/templates/hermes-entrypoint.sh +19 -29
- package/apps/openwebui-container.yaml +0 -97
- package/apps/playwright-container.yaml +0 -126
- package/dependencies/jishushell-panel-0.6.5.tgz +0 -0
- package/dist/crypto-shim.d.ts +0 -1
- package/dist/crypto-shim.js +0 -2
- package/dist/crypto-shim.js.map +0 -1
- package/dist/routes/agent-apps.d.ts +0 -14
- package/dist/routes/agent-apps.js +0 -77
- package/dist/routes/agent-apps.js.map +0 -1
- package/dist/routes/internal.d.ts +0 -2
- package/dist/routes/internal.js +0 -55
- package/dist/routes/internal.js.map +0 -1
- package/dist/routes/openclaw-routes.d.ts +0 -22
- package/dist/routes/openclaw-routes.js +0 -1020
- package/dist/routes/openclaw-routes.js.map +0 -1
- package/dist/routes/runtime.d.ts +0 -15
- package/dist/routes/runtime.js +0 -76
- package/dist/routes/runtime.js.map +0 -1
- package/dist/services/agent-apps/catalog.d.ts +0 -33
- package/dist/services/agent-apps/catalog.js +0 -88
- package/dist/services/agent-apps/catalog.js.map +0 -1
- package/dist/services/agent-apps/index.d.ts +0 -36
- package/dist/services/agent-apps/index.js +0 -171
- package/dist/services/agent-apps/index.js.map +0 -1
- package/dist/services/agent-apps/installers/adapter-probes.d.ts +0 -49
- package/dist/services/agent-apps/installers/adapter-probes.js +0 -230
- package/dist/services/agent-apps/installers/adapter-probes.js.map +0 -1
- package/dist/services/agent-apps/installers/adapter.d.ts +0 -30
- package/dist/services/agent-apps/installers/adapter.js +0 -171
- package/dist/services/agent-apps/installers/adapter.js.map +0 -1
- package/dist/services/agent-apps/installers/registry-probe.js.map +0 -1
- package/dist/services/agent-apps/installers/shell-script.d.ts +0 -47
- package/dist/services/agent-apps/installers/shell-script.js +0 -488
- package/dist/services/agent-apps/installers/shell-script.js.map +0 -1
- package/dist/services/agent-apps/types.d.ts +0 -128
- package/dist/services/agent-apps/types.js +0 -17
- package/dist/services/agent-apps/types.js.map +0 -1
- package/dist/services/app/app-compiler.js +0 -185
- package/dist/services/app/app-compiler.js.map +0 -1
- package/dist/services/app/app-manager.d.ts +0 -184
- package/dist/services/app/app-manager.js +0 -2933
- package/dist/services/app/app-manager.js.map +0 -1
- package/dist/services/app/custom-manager.d.ts +0 -27
- package/dist/services/app/custom-manager.js +0 -382
- package/dist/services/app/custom-manager.js.map +0 -1
- package/dist/services/app/hermes-agent-manager.d.ts +0 -20
- package/dist/services/app/hermes-agent-manager.js +0 -299
- package/dist/services/app/hermes-agent-manager.js.map +0 -1
- package/dist/services/app/id-normalizer.d.ts +0 -27
- package/dist/services/app/id-normalizer.js +0 -77
- package/dist/services/app/id-normalizer.js.map +0 -1
- package/dist/services/app/ollama-manager.d.ts +0 -18
- package/dist/services/app/ollama-manager.js +0 -224
- package/dist/services/app/ollama-manager.js.map +0 -1
- package/dist/services/app/openclaw-manager.d.ts +0 -63
- package/dist/services/app/openclaw-manager.js +0 -1215
- package/dist/services/app/openclaw-manager.js.map +0 -1
- package/dist/services/app/paths.d.ts +0 -27
- package/dist/services/app/paths.js +0 -40
- package/dist/services/app/paths.js.map +0 -1
- package/dist/services/app/platform-transform.d.ts +0 -32
- package/dist/services/app/platform-transform.js +0 -65
- package/dist/services/app/platform-transform.js.map +0 -1
- package/dist/services/app/provide-resolver.d.ts +0 -29
- package/dist/services/app/provide-resolver.js +0 -135
- package/dist/services/app/provide-resolver.js.map +0 -1
- package/dist/services/app/registry.d.ts +0 -17
- package/dist/services/app/registry.js +0 -31
- package/dist/services/app/registry.js.map +0 -1
- package/dist/services/app/remote-spec.d.ts +0 -14
- package/dist/services/app/remote-spec.js +0 -58
- package/dist/services/app/remote-spec.js.map +0 -1
- package/dist/services/app/terminal-session-manager.js +0 -157
- package/dist/services/app/terminal-session-manager.js.map +0 -1
- package/dist/services/app/types.d.ts +0 -74
- package/dist/services/app/types.js +0 -16
- package/dist/services/app/types.js.map +0 -1
- package/dist/services/app-config-admin.d.ts +0 -17
- package/dist/services/app-config-admin.js +0 -177
- package/dist/services/app-config-admin.js.map +0 -1
- package/dist/services/app-create-from-installed.d.ts +0 -23
- package/dist/services/app-create-from-installed.js +0 -75
- package/dist/services/app-create-from-installed.js.map +0 -1
- package/dist/services/app-passwords.js +0 -173
- package/dist/services/app-passwords.js.map +0 -1
- package/dist/services/backup-admin.d.ts +0 -101
- package/dist/services/backup-admin.js +0 -259
- package/dist/services/backup-admin.js.map +0 -1
- package/dist/services/backup-manager.d.ts +0 -264
- package/dist/services/backup-manager.js +0 -2263
- package/dist/services/backup-manager.js.map +0 -1
- package/dist/services/backup-verify.js +0 -240
- package/dist/services/backup-verify.js.map +0 -1
- package/dist/services/capability-endpoint-validator.d.ts +0 -41
- package/dist/services/capability-endpoint-validator.js +0 -114
- package/dist/services/capability-endpoint-validator.js.map +0 -1
- package/dist/services/capability-health.d.ts +0 -16
- package/dist/services/capability-health.js +0 -121
- package/dist/services/capability-health.js.map +0 -1
- package/dist/services/capability-registry.d.ts +0 -29
- package/dist/services/capability-registry.js +0 -176
- package/dist/services/capability-registry.js.map +0 -1
- package/dist/services/capability-sync.d.ts +0 -4
- package/dist/services/capability-sync.js +0 -220
- package/dist/services/capability-sync.js.map +0 -1
- package/dist/services/connection-admin.d.ts +0 -74
- package/dist/services/connection-admin.js +0 -287
- package/dist/services/connection-admin.js.map +0 -1
- package/dist/services/connection-apply.d.ts +0 -91
- package/dist/services/connection-apply.js +0 -471
- package/dist/services/connection-apply.js.map +0 -1
- package/dist/services/connection-resolver.d.ts +0 -65
- package/dist/services/connection-resolver.js +0 -281
- package/dist/services/connection-resolver.js.map +0 -1
- package/dist/services/connection-transactor.d.ts +0 -39
- package/dist/services/connection-transactor.js +0 -354
- package/dist/services/connection-transactor.js.map +0 -1
- package/dist/services/core-manager.d.ts +0 -50
- package/dist/services/core-manager.js +0 -411
- package/dist/services/core-manager.js.map +0 -1
- package/dist/services/external-mounts.js +0 -187
- package/dist/services/external-mounts.js.map +0 -1
- package/dist/services/files-manager.d.ts +0 -252
- package/dist/services/files-manager.js +0 -1156
- package/dist/services/files-manager.js.map +0 -1
- package/dist/services/files-mounts.d.ts +0 -42
- package/dist/services/files-mounts.js +0 -207
- package/dist/services/files-mounts.js.map +0 -1
- package/dist/services/instance-admin.d.ts +0 -26
- package/dist/services/instance-admin.js +0 -218
- package/dist/services/instance-admin.js.map +0 -1
- package/dist/services/instance-manager.d.ts +0 -192
- package/dist/services/instance-manager.js +0 -1289
- package/dist/services/instance-manager.js.map +0 -1
- package/dist/services/macos-launchd.js +0 -312
- package/dist/services/macos-launchd.js.map +0 -1
- package/dist/services/nomad-manager.d.ts +0 -307
- package/dist/services/nomad-manager.js +0 -3958
- package/dist/services/nomad-manager.js.map +0 -1
- package/dist/services/organize/applier.js +0 -218
- package/dist/services/organize/applier.js.map +0 -1
- package/dist/services/organize/rules.js +0 -286
- package/dist/services/organize/rules.js.map +0 -1
- package/dist/services/organize/scanner.js +0 -366
- package/dist/services/organize/scanner.js.map +0 -1
- package/dist/services/organize/store.js +0 -82
- package/dist/services/organize/store.js.map +0 -1
- package/dist/services/plugin-installer.js +0 -128
- package/dist/services/plugin-installer.js.map +0 -1
- package/dist/services/process-manager.d.ts +0 -25
- package/dist/services/process-manager.js +0 -568
- package/dist/services/process-manager.js.map +0 -1
- package/dist/services/runtime/adapters/custom.d.ts +0 -20
- package/dist/services/runtime/adapters/custom.js +0 -188
- package/dist/services/runtime/adapters/custom.js.map +0 -1
- package/dist/services/runtime/adapters/hermes.d.ts +0 -204
- package/dist/services/runtime/adapters/hermes.js +0 -1684
- package/dist/services/runtime/adapters/hermes.js.map +0 -1
- package/dist/services/runtime/adapters/openclaw-mcporter.d.ts +0 -45
- package/dist/services/runtime/adapters/openclaw-mcporter.js +0 -108
- package/dist/services/runtime/adapters/openclaw-mcporter.js.map +0 -1
- package/dist/services/runtime/adapters/openclaw.d.ts +0 -426
- package/dist/services/runtime/adapters/openclaw.js +0 -3975
- package/dist/services/runtime/adapters/openclaw.js.map +0 -1
- package/dist/services/runtime/index.d.ts +0 -34
- package/dist/services/runtime/index.js +0 -51
- package/dist/services/runtime/index.js.map +0 -1
- package/dist/services/runtime/mcp-shims/anythingllm-shim.d.ts +0 -46
- package/dist/services/runtime/mcp-shims/anythingllm-shim.js +0 -281
- package/dist/services/runtime/mcp-shims/anythingllm-shim.js.map +0 -1
- package/dist/services/runtime/mcp-shims/drive-shim.js +0 -490
- package/dist/services/runtime/mcp-shims/drive-shim.js.map +0 -1
- package/dist/services/runtime/mcp-shims/jishukb-shim.d.ts +0 -48
- package/dist/services/runtime/mcp-shims/jishukb-shim.js +0 -723
- package/dist/services/runtime/mcp-shims/jishukb-shim.js.map +0 -1
- package/dist/services/runtime/mcp-shims/mcporter-lite.js +0 -276
- package/dist/services/runtime/mcp-shims/mcporter-lite.js.map +0 -1
- package/dist/services/runtime/migrations.d.ts +0 -23
- package/dist/services/runtime/migrations.js +0 -125
- package/dist/services/runtime/migrations.js.map +0 -1
- package/dist/services/runtime/registry.d.ts +0 -13
- package/dist/services/runtime/registry.js +0 -32
- package/dist/services/runtime/registry.js.map +0 -1
- package/dist/services/runtime-identity.d.ts +0 -13
- package/dist/services/runtime-identity.js +0 -166
- package/dist/services/runtime-identity.js.map +0 -1
- package/dist/services/runtime-repair.d.ts +0 -52
- package/dist/services/runtime-repair.js +0 -352
- package/dist/services/runtime-repair.js.map +0 -1
- package/dist/services/setup-manager.d.ts +0 -158
- package/dist/services/setup-manager.js +0 -2740
- package/dist/services/setup-manager.js.map +0 -1
- package/dist/services/suggestions.d.ts +0 -27
- package/dist/services/suggestions.js +0 -133
- package/dist/services/suggestions.js.map +0 -1
- package/dist/services/system-monitor.js +0 -79
- package/dist/services/system-monitor.js.map +0 -1
- package/dist/services/system-ollama-provider.d.ts +0 -14
- package/dist/services/system-ollama-provider.js +0 -125
- package/dist/services/system-ollama-provider.js.map +0 -1
- package/dist/services/system-reconciler.d.ts +0 -72
- package/dist/services/system-reconciler.js +0 -600
- package/dist/services/system-reconciler.js.map +0 -1
- package/dist/services/task-registry.d.ts +0 -44
- package/dist/services/task-registry.js +0 -76
- package/dist/services/task-registry.js.map +0 -1
- package/dist/services/types-shim.d.ts +0 -16
- package/dist/services/types-shim.js +0 -2
- package/dist/services/types-shim.js.map +0 -1
- package/dist/services/update-manager.d.ts +0 -47
- package/dist/services/update-manager.js +0 -351
- package/dist/services/update-manager.js.map +0 -1
- package/dist/services/webdav/server.d.ts +0 -24
- package/dist/services/webdav/server.js +0 -420
- package/dist/services/webdav/server.js.map +0 -1
- package/dist/services/webdav/xml-builder.js.map +0 -1
- package/dist/services/workspace-builder.d.ts +0 -29
- package/dist/services/workspace-builder.js +0 -188
- package/dist/services/workspace-builder.js.map +0 -1
- package/node_modules/@fastify/static/.github/stale.yml +0 -21
- package/node_modules/@isaacs/cliui/LICENSE.md +0 -63
- package/node_modules/@isaacs/cliui/README.md +0 -151
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts +0 -4
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js +0 -16
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts +0 -34
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js +0 -170
- package/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts +0 -6
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js +0 -307
- package/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js +0 -7
- package/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/index.d.ts +0 -41
- package/node_modules/@isaacs/cliui/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/index.js +0 -322
- package/node_modules/@isaacs/cliui/dist/commonjs/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/index.min.js +0 -12
- package/node_modules/@isaacs/cliui/dist/commonjs/index.min.js.map +0 -7
- package/node_modules/@isaacs/cliui/dist/commonjs/package.json +0 -3
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts +0 -5
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js +0 -49
- package/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js +0 -8
- package/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts +0 -7
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js +0 -176
- package/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts +0 -4
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js +0 -12
- package/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts +0 -34
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js +0 -167
- package/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts +0 -6
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js +0 -299
- package/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js +0 -3
- package/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/index.d.ts +0 -41
- package/node_modules/@isaacs/cliui/dist/esm/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/index.js +0 -317
- package/node_modules/@isaacs/cliui/dist/esm/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/index.min.js +0 -12
- package/node_modules/@isaacs/cliui/dist/esm/index.min.js.map +0 -7
- package/node_modules/@isaacs/cliui/dist/esm/package.json +0 -3
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts +0 -5
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.js +0 -46
- package/node_modules/@isaacs/cliui/dist/esm/string-width/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts +0 -2
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js +0 -4
- package/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts +0 -7
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts.map +0 -1
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js +0 -172
- package/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js.map +0 -1
- package/node_modules/@isaacs/cliui/package.json +0 -163
- package/node_modules/content-disposition/HISTORY.md +0 -60
- package/node_modules/cross-spawn/LICENSE +0 -21
- package/node_modules/cross-spawn/README.md +0 -89
- package/node_modules/cross-spawn/index.js +0 -39
- package/node_modules/cross-spawn/lib/enoent.js +0 -59
- package/node_modules/cross-spawn/lib/parse.js +0 -91
- package/node_modules/cross-spawn/lib/util/escape.js +0 -47
- package/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
- package/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
- package/node_modules/cross-spawn/package.json +0 -73
- package/node_modules/fastify/test/types/content-type-parser.test-d.ts +0 -72
- package/node_modules/fastify/test/types/decorate-request-reply.test-d.ts +0 -18
- package/node_modules/fastify/test/types/dummy-plugin.ts +0 -9
- package/node_modules/fastify/test/types/errors.test-d.ts +0 -90
- package/node_modules/fastify/test/types/fastify.test-d.ts +0 -352
- package/node_modules/fastify/test/types/hooks.test-d.ts +0 -550
- package/node_modules/fastify/test/types/import.ts +0 -2
- package/node_modules/fastify/test/types/instance.test-d.ts +0 -588
- package/node_modules/fastify/test/types/logger.test-d.ts +0 -277
- package/node_modules/fastify/test/types/plugin.test-d.ts +0 -97
- package/node_modules/fastify/test/types/register.test-d.ts +0 -237
- package/node_modules/fastify/test/types/reply.test-d.ts +0 -254
- package/node_modules/fastify/test/types/request.test-d.ts +0 -188
- package/node_modules/fastify/test/types/route.test-d.ts +0 -553
- package/node_modules/fastify/test/types/schema.test-d.ts +0 -135
- package/node_modules/fastify/test/types/serverFactory.test-d.ts +0 -37
- package/node_modules/fastify/test/types/type-provider.test-d.ts +0 -1213
- package/node_modules/fastify/test/types/using.test-d.ts +0 -17
- package/node_modules/foreground-child/LICENSE +0 -15
- package/node_modules/foreground-child/README.md +0 -128
- package/node_modules/foreground-child/dist/commonjs/all-signals.d.ts +0 -2
- package/node_modules/foreground-child/dist/commonjs/all-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/all-signals.js +0 -58
- package/node_modules/foreground-child/dist/commonjs/all-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/index.d.ts +0 -58
- package/node_modules/foreground-child/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/index.js +0 -123
- package/node_modules/foreground-child/dist/commonjs/index.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/package.json +0 -3
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts +0 -6
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.js +0 -38
- package/node_modules/foreground-child/dist/commonjs/proxy-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/watchdog.d.ts +0 -10
- package/node_modules/foreground-child/dist/commonjs/watchdog.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/commonjs/watchdog.js +0 -50
- package/node_modules/foreground-child/dist/commonjs/watchdog.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/all-signals.d.ts +0 -2
- package/node_modules/foreground-child/dist/esm/all-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/all-signals.js +0 -52
- package/node_modules/foreground-child/dist/esm/all-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/index.d.ts +0 -58
- package/node_modules/foreground-child/dist/esm/index.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/index.js +0 -115
- package/node_modules/foreground-child/dist/esm/index.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/package.json +0 -3
- package/node_modules/foreground-child/dist/esm/proxy-signals.d.ts +0 -6
- package/node_modules/foreground-child/dist/esm/proxy-signals.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/proxy-signals.js +0 -34
- package/node_modules/foreground-child/dist/esm/proxy-signals.js.map +0 -1
- package/node_modules/foreground-child/dist/esm/watchdog.d.ts +0 -10
- package/node_modules/foreground-child/dist/esm/watchdog.d.ts.map +0 -1
- package/node_modules/foreground-child/dist/esm/watchdog.js +0 -46
- package/node_modules/foreground-child/dist/esm/watchdog.js.map +0 -1
- package/node_modules/foreground-child/package.json +0 -106
- package/node_modules/glob/dist/esm/bin.d.mts +0 -3
- package/node_modules/glob/dist/esm/bin.d.mts.map +0 -1
- package/node_modules/glob/dist/esm/bin.mjs +0 -346
- package/node_modules/glob/dist/esm/bin.mjs.map +0 -1
- package/node_modules/isexe/.npmignore +0 -2
- package/node_modules/isexe/LICENSE +0 -15
- package/node_modules/isexe/README.md +0 -51
- package/node_modules/isexe/index.js +0 -57
- package/node_modules/isexe/mode.js +0 -41
- package/node_modules/isexe/package.json +0 -31
- package/node_modules/isexe/test/basic.js +0 -221
- package/node_modules/isexe/windows.js +0 -42
- package/node_modules/jackspeak/LICENSE.md +0 -55
- package/node_modules/jackspeak/README.md +0 -394
- package/node_modules/jackspeak/dist/commonjs/index.d.ts +0 -323
- package/node_modules/jackspeak/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/jackspeak/dist/commonjs/index.js +0 -944
- package/node_modules/jackspeak/dist/commonjs/index.js.map +0 -1
- package/node_modules/jackspeak/dist/commonjs/index.min.js +0 -33
- package/node_modules/jackspeak/dist/commonjs/index.min.js.map +0 -7
- package/node_modules/jackspeak/dist/commonjs/package.json +0 -3
- package/node_modules/jackspeak/dist/esm/index.d.ts +0 -323
- package/node_modules/jackspeak/dist/esm/index.d.ts.map +0 -1
- package/node_modules/jackspeak/dist/esm/index.js +0 -936
- package/node_modules/jackspeak/dist/esm/index.js.map +0 -1
- package/node_modules/jackspeak/dist/esm/index.min.js +0 -33
- package/node_modules/jackspeak/dist/esm/index.min.js.map +0 -7
- package/node_modules/jackspeak/dist/esm/package.json +0 -3
- package/node_modules/jackspeak/package.json +0 -115
- package/node_modules/jishushell-panel/output/public/assets/ApiKeyField-D1i7zWXR.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/Dashboard-sWIvL43F.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/HermesChatPanel-DQ8RyvQY.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/HermesConfigForm-tIbPP1sB.js +0 -4
- package/node_modules/jishushell-panel/output/public/assets/InitPassword-C3Slq3Dd.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/InstanceDetail-7JqY9tq4.js +0 -92
- package/node_modules/jishushell-panel/output/public/assets/Login-BXLDJlQN.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/NewInstance-dLc5Xrpx.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-DIAXxesl.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/Settings-Bd5utbBh.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/Setup-Yn9_20FL.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/WeixinLoginPanel-C21doQTJ.js +0 -9
- package/node_modules/jishushell-panel/output/public/assets/index-CCkaIEjn.js +0 -20
- package/node_modules/jishushell-panel/output/public/assets/index-D7qxy-Vh.css +0 -1
- package/node_modules/jishushell-panel/output/public/assets/registry-B2ZQZXWL.js +0 -2
- package/node_modules/jishushell-panel/output/public/assets/usePolling-BFZm4do_.js +0 -1
- package/node_modules/jishushell-panel/output/public/assets/vendor-i18n-DqPtOicc.js +0 -9
- package/node_modules/jishushell-panel/output/public/assets/vendor-react-DW5juQin.js +0 -59
- package/node_modules/package-json-from-dist/LICENSE.md +0 -63
- package/node_modules/package-json-from-dist/README.md +0 -110
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts +0 -89
- package/node_modules/package-json-from-dist/dist/commonjs/index.d.ts.map +0 -1
- package/node_modules/package-json-from-dist/dist/commonjs/index.js +0 -134
- package/node_modules/package-json-from-dist/dist/commonjs/index.js.map +0 -1
- package/node_modules/package-json-from-dist/dist/commonjs/package.json +0 -3
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts +0 -89
- package/node_modules/package-json-from-dist/dist/esm/index.d.ts.map +0 -1
- package/node_modules/package-json-from-dist/dist/esm/index.js +0 -129
- package/node_modules/package-json-from-dist/dist/esm/index.js.map +0 -1
- package/node_modules/package-json-from-dist/dist/esm/package.json +0 -3
- package/node_modules/package-json-from-dist/package.json +0 -68
- package/node_modules/path-key/index.d.ts +0 -40
- package/node_modules/path-key/index.js +0 -16
- package/node_modules/path-key/license +0 -9
- package/node_modules/path-key/package.json +0 -39
- package/node_modules/path-key/readme.md +0 -61
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -65
- package/node_modules/safe-buffer/package.json +0 -51
- package/node_modules/shebang-command/index.js +0 -19
- package/node_modules/shebang-command/license +0 -9
- package/node_modules/shebang-command/package.json +0 -34
- package/node_modules/shebang-command/readme.md +0 -34
- package/node_modules/shebang-regex/index.d.ts +0 -22
- package/node_modules/shebang-regex/index.js +0 -2
- package/node_modules/shebang-regex/license +0 -9
- package/node_modules/shebang-regex/package.json +0 -35
- package/node_modules/shebang-regex/readme.md +0 -33
- package/node_modules/signal-exit/LICENSE.txt +0 -16
- package/node_modules/signal-exit/README.md +0 -74
- package/node_modules/signal-exit/dist/cjs/browser.d.ts +0 -12
- package/node_modules/signal-exit/dist/cjs/browser.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/browser.js +0 -10
- package/node_modules/signal-exit/dist/cjs/browser.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/index.d.ts +0 -48
- package/node_modules/signal-exit/dist/cjs/index.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/index.js +0 -279
- package/node_modules/signal-exit/dist/cjs/index.js.map +0 -1
- package/node_modules/signal-exit/dist/cjs/package.json +0 -3
- package/node_modules/signal-exit/dist/cjs/signals.d.ts +0 -29
- package/node_modules/signal-exit/dist/cjs/signals.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/cjs/signals.js +0 -42
- package/node_modules/signal-exit/dist/cjs/signals.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/browser.d.ts +0 -12
- package/node_modules/signal-exit/dist/mjs/browser.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/browser.js +0 -4
- package/node_modules/signal-exit/dist/mjs/browser.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/index.d.ts +0 -48
- package/node_modules/signal-exit/dist/mjs/index.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/index.js +0 -275
- package/node_modules/signal-exit/dist/mjs/index.js.map +0 -1
- package/node_modules/signal-exit/dist/mjs/package.json +0 -3
- package/node_modules/signal-exit/dist/mjs/signals.d.ts +0 -29
- package/node_modules/signal-exit/dist/mjs/signals.d.ts.map +0 -1
- package/node_modules/signal-exit/dist/mjs/signals.js +0 -39
- package/node_modules/signal-exit/dist/mjs/signals.js.map +0 -1
- package/node_modules/signal-exit/package.json +0 -106
- package/node_modules/which/CHANGELOG.md +0 -166
- package/node_modules/which/LICENSE +0 -15
- package/node_modules/which/README.md +0 -54
- package/node_modules/which/bin/node-which +0 -52
- package/node_modules/which/package.json +0 -43
- package/node_modules/which/which.js +0 -125
- package/scripts/check-adapter-isolation.ts +0 -293
- /package/dist/services/{app → app-common}/app-compiler.d.ts +0 -0
- /package/dist/services/{app → app-common}/terminal-session-manager.d.ts +0 -0
- /package/dist/services/{backup-verify.d.ts → backup/backup-verify.d.ts} +0 -0
- /package/dist/services/{external-mounts.d.ts → files/external-mounts.d.ts} +0 -0
- /package/dist/services/{organize → files/organize}/applier.d.ts +0 -0
- /package/dist/services/{organize → files/organize}/rules.d.ts +0 -0
- /package/dist/services/{organize → files/organize}/scanner.d.ts +0 -0
- /package/dist/services/{organize → files/organize}/store.d.ts +0 -0
- /package/dist/services/{webdav → files/webdav}/xml-builder.d.ts +0 -0
- /package/dist/services/{webdav → files/webdav}/xml-builder.js +0 -0
- /package/dist/services/{app-passwords.d.ts → instances/passwords.d.ts} +0 -0
- /package/dist/services/{agent-apps → integrations/installable}/installers/registry-probe.d.ts +0 -0
- /package/dist/services/{agent-apps → integrations/installable}/installers/registry-probe.js +0 -0
- /package/dist/services/{runtime/mcp-shims → integrations/openclaw}/drive-shim.d.ts +0 -0
- /package/dist/services/{runtime/mcp-shims → integrations/openclaw}/mcporter-lite.d.ts +0 -0
- /package/dist/services/{plugin-installer.d.ts → setup/plugin-installer.d.ts} +0 -0
- /package/dist/services/{macos-launchd.d.ts → system/macos-launchd.d.ts} +0 -0
- /package/dist/services/{system-monitor.d.ts → system/system-monitor.d.ts} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/api-C70Gt678.js","assets/rolldown-runtime-QTnfLwEv.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{a as t,n,t as r}from"./vendor-i18n-Df8aUdv8.js";import{l as i,r as a,t as o,u as s}from"./vendor-react-0L0rjmYG.js";import{A as c,B as l,C as u,Dt as d,E as f,Et as p,H as m,I as h,J as g,L as _,Lt as v,M as y,N as b,O as x,Ot as S,P as C,Pt as w,Q as ee,T,Tt as E,U as D,V as O,_ as k,_t as A,a as j,b as te,d as ne,et as M,ft as N,i as re,j as ie,jt as ae,k as P,kt as oe,n as se,ot as F,pt as I,st as ce,tt as le,ut as L,v as ue,w as de,wt as fe,x as pe,y as me,yt as R}from"./api-C70Gt678.js";import{_ as he,a as ge,b as _e,d as ve,g as z,l as ye,m as be,r as xe,s as Se,t as B,u as Ce,v as we}from"./index-Bs6DSbiR.js";import{c as V,i as H,l as U,n as W,o as Te,r as G,s as K,t as Ee,u as De}from"./ApiKeyField-Ce5d1xna.js";import{n as Oe,r as ke,t as Ae}from"./WeixinLoginPanel-B765Xz4C.js";import{t as je}from"./usePolling-D4IDOQd_.js";import{n as Me}from"./registry-sWIZsIEF.js";var q=e(t(),1),J=o(),Ne=[`feishu`,`openclaw-weixin`],Pe={feishu:`feishu`,lark:`feishu`,"openclaw-weixin":`openclaw-weixin`};function Fe({config:e,onChange:t,instanceId:n,isRunning:i=!1,pluginStatuses:a={},onInstallPlugin:o}){let{t:s}=r([`instance`,`common`]),c=(n,r)=>t(U(e,n,r)),l=e?.[`x-jishushell`]?.proxy||{},u=l.upstream||{},d=u.providerId||``,f=De.find(e=>e.id===d),p=u.models||[],m=f?f.models.map(e=>({id:e.id,name:e.name,contextWindow:e.contextWindow})):p.map(e=>({id:e.id,name:e.name||e.id,contextWindow:e.contextWindow})),h=u.selectedModelId||m[0]?.id||``,g=m.find(e=>e.id===h)||m[0]||{},_=p.find(e=>e.id===h)||(g.id?g:{id:``,name:``,contextWindow:0}),v=l.proxy||{},y=n=>{let r=De.find(e=>e.id===n);if(!r||u.apiKey&&!window.confirm(s(`configForm.switchProviderConfirm`)))return;let i=JSON.parse(JSON.stringify(e));i[`x-jishushell`]||={},i[`x-jishushell`].proxy||(i[`x-jishushell`].proxy={}),i[`x-jishushell`].proxy.upstream={providerId:r.id,baseUrl:r.baseUrl,api:r.api,authHeader:r.authHeader===!0,headers:r.headers||{},models:r.models.map(e=>({id:e.id,name:e.name,contextWindow:e.contextWindow})),selectedModelId:r.models[0]?.id||``,apiKey:``,hasApiKey:!1,clearApiKey:!1},t(i)},b=e=>{c(`x-jishushell.proxy.upstream.selectedModelId`,e)},x=(e,t)=>{c(`x-jishushell.proxy.upstream.${e}`,t)},S=e?.channels||{},C=Object.keys(S),w=(e,t,n)=>c(`channels.${e}.${t}`,n),ee={},T=n=>{let r=W.find(e=>e.id===n),i=JSON.parse(JSON.stringify(e));i.channels||={};let a=ee[n]||n;if(r){let e={enabled:!0,...r.defaults};r.fields.forEach(t=>{e[t.key]=``}),i.channels[a]=e}else i.channels[a]={enabled:!0};t(i)},E=n=>{let r=JSON.parse(JSON.stringify(e));delete r.channels[n],t(r)},[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(!(u.hasApiKey&&d)),j={"moonshot-coding":`configForm.hint.moonshot-coding`,volcengine:`configForm.hint.volcengine`,byteplus:`configForm.hint.byteplus`,openrouter:`configForm.hint.openrouter`,ollama:`configForm.hint.ollama`,vllm:`configForm.hint.vllm`,sglang:`configForm.hint.sglang`},te=j[d]?s(j[d]):void 0,ne=[...new Set(De.map(e=>e.group))];return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(Te,{title:s(`configForm.modelConfig`),children:[(0,J.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-lg p-3 text-sm text-muted`,children:[(0,J.jsx)(`div`,{className:`font-medium text-foreground mb-1`,children:s(`configForm.proxyChain`)}),(0,J.jsx)(`p`,{children:s(`configForm.proxyChainDesc`)}),(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-muted opacity-60 space-y-1`,children:[(0,J.jsxs)(`div`,{children:[s(`configForm.proxyAddress`),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:v.coreProxyBaseUrl||s(`configForm.notConfigured`)})]}),(0,J.jsxs)(`div`,{children:[s(`configForm.proxyStatus`),` `,v.running?s(`configForm.running`):s(`configForm.notRunning`),s(`configForm.virtualKeyLabel`),` `,v.hasVirtualKey?s(`configForm.generated`):s(`configForm.notGenerated`)]})]})]}),!k&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>A(!0),className:`text-xs text-[#0066FF] hover:text-[#0066FF]/80 transition-colors`,children:s(`configForm.editModelConfig`)}),k&&(0,J.jsx)(G,{label:s(`configForm.upstreamProvider`),hint:s(`configForm.upstreamProviderHint`),children:(0,J.jsxs)(K,{value:d,onChange:y,children:[(0,J.jsx)(`option`,{value:``,children:s(`configForm.selectProvider`)}),!f&&d&&(0,J.jsxs)(`option`,{value:d,children:[d,` `,s(`configForm.custom`)]}),ne.map(e=>(0,J.jsx)(`optgroup`,{label:s(`configForm.providerGroup.${e}`,{defaultValue:e}),children:De.filter(t=>t.group===e).map(e=>(0,J.jsx)(`option`,{value:e.id,children:s(`configForm.providerLabel.${e.id}`,{defaultValue:e.label})},e.id))},e))]})}),k&&te&&(0,J.jsxs)(`div`,{className:`flex items-start gap-2 bg-amber-500/10 border border-amber-500/20 rounded-lg px-3 py-2.5 text-xs text-amber-400`,children:[(0,J.jsx)(`span`,{className:`shrink-0 mt-0.5`,children:`⚠`}),(0,J.jsx)(`span`,{children:te})]}),k&&![`ollama`,`vllm`,`sglang`].includes(d)&&d&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(G,{label:s(`configForm.upstreamApiKey`),hint:u.hasApiKey&&!u.clearApiKey?s(`configForm.apiKeyHintSaved`):s(`configForm.apiKeyHintNew`),children:[(0,J.jsx)(Ee,{value:u.apiKey||``,saved:u.hasApiKey&&!u.clearApiKey,onChange:n=>{let r=U(e,`x-jishushell.proxy.upstream.apiKey`,n);n&&(r=U(r,`x-jishushell.proxy.upstream.clearApiKey`,!1)),t(r)},baseUrl:u.baseUrl||f?.baseUrl||``,api:u.api||f?.api||``,authHeader:typeof u.authHeader==`string`?u.authHeader:void 0,providerId:d,placeholder:s(`configForm.enterApiKey`),selectedModelId:h}),u.hasApiKey&&(0,J.jsx)(`button`,{type:`button`,onClick:()=>{let n=U(e,`x-jishushell.proxy.upstream.apiKey`,``);n=U(n,`x-jishushell.proxy.upstream.clearApiKey`,!u.clearApiKey),t(n)},className:`mt-2 text-xs ${u.clearApiKey?`text-red-400`:`text-muted hover:text-foreground`} transition-colors`,children:u.clearApiKey?s(`configForm.markedForClear`):s(`configForm.clearSavedApiKey`)})]}),m.length>0&&(0,J.jsx)(G,{label:s(`configForm.upstreamModel`),hint:s(`configForm.upstreamModelHint`),children:(0,J.jsx)(K,{value:h,onChange:b,children:m.map(e=>(0,J.jsxs)(`option`,{value:e.id,children:[e.name,` (`,Math.round(e.contextWindow/1e3),`K)`]},e.id))})})]}),k&&[`ollama`,`vllm`,`sglang`].includes(d)&&(0,J.jsxs)(`div`,{className:`space-y-4 border-t border-[var(--border)] pt-4`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,J.jsx)(G,{label:`Base URL`,hint:s(`configForm.localServiceAddress`),children:(0,J.jsx)(H,{value:u.baseUrl||``,onChange:e=>x(`baseUrl`,e),placeholder:`http://127.0.0.1:11434`,mono:!0})}),(0,J.jsx)(G,{label:s(`configForm.apiProtocol`),children:(0,J.jsxs)(K,{value:u.api||`openai-completions`,onChange:e=>x(`api`,e),children:[(0,J.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Compatible`}),(0,J.jsx)(`option`,{value:`ollama`,children:`Ollama`})]})})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,J.jsx)(G,{label:s(`configForm.modelId`),hint:s(`configForm.modelIdHint`),children:(0,J.jsx)(H,{value:_.id==="default"?``:_.id,onChange:n=>{let r=[...p],i=r.findIndex(e=>e.id===h);i>=0?r[i]={..._,id:n||`default`}:r.push({id:n||`default`,name:n||`default`,contextWindow:_.contextWindow||0});let a=U(e,`x-jishushell.proxy.upstream.models`,r);a=U(a,`x-jishushell.proxy.upstream.selectedModelId`,n||`default`),t(a)},placeholder:`llama3`,mono:!0})}),(0,J.jsx)(G,{label:s(`configForm.modelName`),children:(0,J.jsx)(H,{value:_.name==="default"?``:_.name||``,onChange:e=>{let t=[...p],n=t.findIndex(e=>e.id===h);n>=0?t[n]={..._,name:e||_.id}:t.push({id:_.id||`default`,name:e||`default`,contextWindow:_.contextWindow||0}),x(`models`,t)},placeholder:s(`configForm.modelNamePlaceholder`)})}),(0,J.jsx)(G,{label:s(`configForm.contextWindow`),children:(0,J.jsx)(H,{value:String(_.contextWindow||``),onChange:e=>{let t=[...p],n=t.findIndex(e=>e.id===h);n>=0?t[n]={..._,contextWindow:parseInt(e,10)||0}:t.push({id:_.id||`default`,name:_.name||`default`,contextWindow:parseInt(e,10)||0}),x(`models`,t)},placeholder:`128000`,mono:!0})})]})]}),k&&![`ollama`,`vllm`,`sglang`].includes(d)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>O(!D),className:`text-xs text-muted hover:text-foreground transition-colors`,children:s(D?`configForm.collapseAdvanced`:`configForm.advancedOptions`)}),D&&(0,J.jsxs)(`div`,{className:`space-y-4 border-t border-[var(--border)] pt-4`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,J.jsx)(G,{label:s(`configForm.upstreamBaseUrl`),children:(0,J.jsx)(H,{value:u.baseUrl||``,onChange:e=>x(`baseUrl`,e),placeholder:s(`configForm.baseUrlPlaceholder`),mono:!0})}),(0,J.jsx)(G,{label:s(`configForm.upstreamApiProtocol`),children:(0,J.jsxs)(K,{value:u.api||`openai-completions`,onChange:e=>x(`api`,e),children:[(0,J.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Compatible`}),(0,J.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,J.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`}),(0,J.jsx)(`option`,{value:`google-generative-ai`,children:`Google Generative AI`}),(0,J.jsx)(`option`,{value:`ollama`,children:`Ollama`})]})})]}),d&&(0,J.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,J.jsx)(G,{label:s(`configForm.modelId`),children:(0,J.jsx)(H,{value:_.id,onChange:n=>{let r=[...p],i=r.findIndex(e=>e.id===h);i>=0?r[i]={..._,id:n}:r.push({..._,id:n});let a=U(e,`x-jishushell.proxy.upstream.models`,r);a=U(a,`x-jishushell.proxy.upstream.selectedModelId`,n),t(a)},placeholder:`model-id`,mono:!0})}),(0,J.jsx)(G,{label:s(`configForm.modelName`),children:(0,J.jsx)(H,{value:_.name||``,onChange:e=>{let t=[...p],n=t.findIndex(e=>e.id===h);n>=0?t[n]={..._,name:e}:t.push({..._,name:e}),x(`models`,t)},placeholder:`Model Name`})}),(0,J.jsx)(G,{label:s(`configForm.contextWindow`),children:(0,J.jsx)(H,{value:String(_.contextWindow||``),onChange:e=>{let t=[...p],n=t.findIndex(e=>e.id===h);n>=0?t[n]={..._,contextWindow:parseInt(e,10)||0}:t.push({..._,contextWindow:parseInt(e,10)||0}),x(`models`,t)},placeholder:`200000`,mono:!0})})]}),(0,J.jsx)(`div`,{className:`text-xs text-muted bg-[var(--card)] border border-[var(--border)] rounded-md p-3`,children:s(`configForm.proxyNote`)})]})]})]}),(0,J.jsxs)(Te,{title:s(`configForm.imChannelConfig`),id:`im-channel-section`,children:[(0,J.jsx)(G,{label:s(`configForm.sessionIsolation`),hint:s(`configForm.sessionIsolationHint`),children:(0,J.jsxs)(K,{value:e?.session?.dmScope||`main`,onChange:e=>c(`session.dmScope`,e),children:[(0,J.jsx)(`option`,{value:`main`,children:s(`configForm.sessionMain`)}),(0,J.jsx)(`option`,{value:`per-peer`,children:s(`configForm.sessionPerPeer`)}),(0,J.jsx)(`option`,{value:`per-channel-peer`,children:s(`configForm.sessionPerChannelPeer`)}),(0,J.jsx)(`option`,{value:`per-account-channel-peer`,children:s(`configForm.sessionPerAccountChannelPeer`)})]})}),Ne.map(e=>{W.find(t=>t.id===e);let r=s(`configForm.channel.${e}`,{defaultValue:e}),i=S[e]||{enabled:!0},c=i.enabled!==!1,l=Pe[e]||e,u=a[l],d=e===`openclaw-weixin`?`#07C160`:`#3370FF`;return(0,J.jsxs)(`div`,{className:`border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r}),(0,J.jsx)(`span`,{className:`text-[11px] text-muted font-mono`,children:e})]}),(0,J.jsx)(V,{checked:c,onChange:t=>{S[e]||T(e),w(e,`enabled`,t)},label:s(c?`common:label.enabled`:`common:label.disabled`)})]}),c&&(u===`installing`?(0,J.jsx)(`div`,{className:`rounded-md px-4 py-3`,style:{background:`${d}10`,borderColor:`${d}30`,borderWidth:1,borderStyle:`solid`},children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,style:{color:d},children:[(0,J.jsx)(`div`,{className:`w-4 h-4 border-2 rounded-full animate-spin`,style:{borderColor:`${d}30`,borderTopColor:d}}),(0,J.jsx)(`span`,{children:s(`configForm.pluginInstalling`,{label:r})})]})}):u===`installed`?(0,J.jsxs)(J.Fragment,{children:[(e===`feishu`||e===`lark`)&&(0,J.jsx)(Oe,{instanceId:n,channelKey:e,existingAppId:i.appId,existingDomain:i.domain||e,onConfigured:()=>{n&&B(async()=>{let{getConfig:e}=await import(`./api-C70Gt678.js`).then(e=>e.o);return{getConfig:e}},__vite__mapDeps([0,1])).then(({getConfig:e})=>{e(n).then(e=>{e&&t(e)})})}}),e===`openclaw-weixin`&&(0,J.jsx)(Ae,{instanceId:n,onConfigured:()=>{n&&B(async()=>{let{getConfig:e}=await import(`./api-C70Gt678.js`).then(e=>e.o);return{getConfig:e}},__vite__mapDeps([0,1])).then(({getConfig:e})=>{e(n).then(e=>{e&&t(e)})})}})]}):(0,J.jsxs)(`div`,{className:`rounded-md px-4 py-3`,style:{background:`${d}08`,borderColor:`${d}30`,borderWidth:1,borderStyle:`dashed`},children:[(0,J.jsx)(`button`,{onClick:()=>o?.(l),className:`px-4 py-2 text-white rounded-md text-xs font-medium hover:opacity-90 transition-opacity`,style:{background:d},children:s(`configForm.installPlugin`,{label:r})}),(0,J.jsx)(`p`,{className:`text-xs text-muted mt-2`,children:s(`configForm.installPluginHint`,{label:r})})]}))]},e)}),C.filter(e=>!Ne.includes(e)).map(e=>{let t=S[e],n=W.find(t=>t.id===e),r=s(`configForm.channel.${e}`,{defaultValue:e}),i=n?.fields||[],a=n?[]:Object.keys(t).filter(e=>e!==`enabled`&&typeof t[e]==`string`);return(0,J.jsxs)(`div`,{className:`border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--card)]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r}),n&&(0,J.jsx)(`span`,{className:`text-[11px] text-muted font-mono`,children:e})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(V,{checked:t.enabled!==!1,onChange:t=>w(e,`enabled`,t),label:t.enabled===!1?s(`common:label.disabled`):s(`common:label.enabled`)}),(0,J.jsx)(`button`,{onClick:()=>E(e),className:`text-xs text-red-400 hover:text-red-300 transition-colors`,children:s(`configForm.remove`)})]})]}),t.enabled!==!1&&i.length>0&&(0,J.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:i.map(n=>(0,J.jsx)(G,{label:n.label,children:(0,J.jsx)(H,{value:t[n.key]||``,onChange:t=>w(e,n.key,t),placeholder:n.placeholder,type:n.type||`text`,mono:!0})},n.key))}),t.enabled!==!1&&a.length>0&&(0,J.jsx)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:a.map(n=>(0,J.jsx)(G,{label:n,children:(0,J.jsx)(H,{value:t[n]||``,onChange:t=>w(e,n,t),placeholder:n,type:n.toLowerCase().includes(`secret`)||n.toLowerCase().includes(`token`)||n.toLowerCase().includes(`password`)?`password`:`text`,mono:!0})},n))}),t.enabled!==!1&&e===`whatsapp`&&i.length===0&&(0,J.jsxs)(`div`,{className:`bg-amber-500/10 border border-amber-500/20 rounded-md px-3 py-2 text-xs text-amber-400`,children:[(0,J.jsx)(`p`,{className:`font-medium mb-1`,children:s(`configForm.whatsappTitle`)}),(0,J.jsx)(`p`,{children:s(`configForm.whatsappHint`)})]})]},e)}),(0,J.jsxs)(`div`,{className:`pt-2`,children:[(0,J.jsx)(`p`,{className:`text-xs text-muted mb-2`,children:s(`configForm.addImChannel`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:W.filter(e=>{if(Ne.includes(e.id))return!1;let t=ee[e.id]||e.id;return!C.includes(t)&&!C.includes(e.id)}).map(e=>(0,J.jsxs)(`button`,{onClick:()=>T(e.id),className:`px-3 py-1.5 text-xs border border-dashed rounded-md transition-colors duration-150 border-[var(--border)] text-muted hover:border-[var(--border-hover)] hover:text-foreground`,children:[`+ `,s(e.labelKey,{defaultValue:e.id})]},e.id))})]})]})]})}var Ie={id:`im`,label:`即时通讯`,emoji:`💬`,items:[{id:`feishu`,label:`飞书 / Lark`,desc:`飞书机器人(WebSocket 模式)`},{id:`openclaw-weixin`,label:`微信`,desc:`微信扫码接入`}]},Le={id:`skills`,label:`常用 Skill`,emoji:`⚡`,groups:[{id:`hubs`,label:`热门Hub`,emoji:`🌐`,skills:[{id:`clawhub`,type:`hub`,label:`ClawHub`,desc:`OpenClaw 官方 Skill 市场`,url:`https://clawhub.ai/`,installMsg:``},{id:`skillhub-tencent`,type:`hub`,label:`腾讯 SkillHub`,desc:`腾讯技能中心,官方出品`,url:`https://skillhub.tencent.com/`,installMsg:``},{id:`skills-sh`,type:`hub`,label:`Skills.sh`,desc:`第三方 Skill 聚合社区`,url:`https://skills.sh/`,installMsg:``},{id:`lobehub-skills`,type:`hub`,label:`LobeHub Skills`,desc:`LobeHub 社区 Skill 市场`,url:`https://lobehub.com/skills`,installMsg:``},{id:`findskills`,type:`hub`,label:`FindSkills.org`,desc:`开源 Skill 搜索与聚合平台`,url:`https://www.findskills.org/`,installMsg:``},{id:`playbooks-skills`,type:`hub`,label:`Playbooks Skills`,desc:`Playbooks 社区 Skill 目录`,url:`https://playbooks.com/skills`,installMsg:``}]},{id:`general`,label:`通用基础`,emoji:`🧠`,skills:[{id:`skill-vetter`,label:`Skill Vetter`,desc:`安全审计 Skill,安装前建议先审查`,installMsg:`根据以下链接安装skill:https://clawhub.ai/spclaudehome/skill-vetter`,autoInstall:!0,slashCmd:`/skill-vetter`,checkDirs:[`skill-vetter`,`Skill Vetter`,`SkillVetter`,`vetter`]},{id:`self-improving-agent-cn`,label:`Self-Improving CN Agent`,desc:`自我优化的 Agent,持续改进任务执行`,installMsg:`根据以下链接安装skill:https://clawhub.ai/zhengxinjipai/self-improving-agent-cn`,autoInstall:!0,slashCmd:`/self-improving-agent-cn`,checkDirs:[`self-improving-agent-cn`,`SelfImprovingAgentCn`,`self_improving_agent_cn`]},{id:`proactive-agent`,label:`Proactive Agent`,desc:`主动式 Agent,自动感知并提前完成任务`,installMsg:`根据以下链接安装skill:https://clawhub.ai/bestrocky/proactive-agent-lite`,autoInstall:!0,slashCmd:`/proactive-agent`,checkDirs:[`proactive-agent-lite`,`proactive-agent`,`ProactiveAgent`,`proactive_agent`]},{id:`multi-search-engine`,label:`Multi Search Engine`,desc:`多搜索引擎聚合搜索`,installMsg:`根据以下链接安装skill:https://clawhub.ai/gpyangyoujun/multi-search-engine`,autoInstall:!0,slashCmd:`/multi-search-engine`,checkDirs:[`multi-search-engine`,`MultiSearchEngine`,`multi_search_engine`]},{id:`exa-web-search-free`,label:`Exa Web Search Free`,desc:`免费 Exa 网页语义搜索`,installMsg:`根据以下链接安装skill:https://clawhub.ai/whiteknight07/exa-web-search-free`,autoInstall:!0,slashCmd:`/exa-web-search-free`,checkDirs:[`exa-web-search-free`,`ExaWebSearchFree`,`exa_web_search_free`]},{id:`filesystem`,label:`Filesystem`,desc:`本地文件系统读写与管理`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/filesystem`,autoInstall:!0,slashCmd:`/filesystem`,checkDirs:[`filesystem`,`steipete-filesystem`]},{id:`summarize`,label:`Summarize`,desc:`内容摘要与总结提炼`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/summarize`,autoInstall:!0,slashCmd:`/summarize`,checkDirs:[`summarize`,`steipete-summarize`]},{id:`baidu-search`,label:`百度搜索`,desc:`百度搜索引擎集成`,installMsg:`根据以下链接安装skill:https://clawhub.ai/ide-rea/baidu-search`,autoInstall:!0,slashCmd:`/baidu-search`,checkDirs:[`baidu-search`,`BaiduSearch`]},{id:`agent-browser-clawdbot`,label:`Agent Browser`,desc:`AI 驱动的网页浏览与自动化操作`,installMsg:`根据以下链接安装skill:https://clawhub.ai/matrixy/agent-browser-clawdbot`,autoInstall:!0,slashCmd:`/agent-browser-clawdbot`,checkDirs:[`agent-browser-clawdbot`,`agent-browser`,`AgentBrowser`]},{id:`automation-workflows`,label:`Automation Workflows`,desc:`自动化工作流编排与执行`,installMsg:`根据以下链接安装skill:https://clawhub.ai/jk-0001/automation-workflows`,autoInstall:!0,slashCmd:`/automation-workflows`,checkDirs:[`automation-workflows`,`AutomationWorkflows`]},{id:`evolver`,label:`Evolver`,desc:`Agent 自动进化与能力迭代`,installMsg:`根据以下链接安装skill:https://clawhub.ai/autogame-17/evolver`,autoInstall:!0,slashCmd:`/evolver`,checkDirs:[`evolver`,`autogame-evolver`]}]},{id:`productivity`,label:`工作效率`,emoji:`💼`,skills:[{id:`pdf-reader`,label:`PDF Reader`,desc:`PDF 文档读取与分析`,installMsg:`根据以下链接安装skill:https://clawhub.ai/awspace/pdf`,autoInstall:!0,slashCmd:`/pdf`,checkDirs:[`pdf`,`pdf-reader`,`awspace-pdf`]},{id:`powerpoint-pptx`,label:`PowerPoint / PPTX`,desc:`PPT 演示文稿生成与编辑`,installMsg:`根据以下链接安装skill:https://clawhub.ai/ivangdavila/powerpoint-pptx`,autoInstall:!0,slashCmd:`/powerpoint-pptx`,checkDirs:[`powerpoint-pptx`,`powerpoint`,`pptx`]},{id:`word-docx`,label:`Word / DOCX`,desc:`Word 文档生成与编辑`,installMsg:`根据以下链接安装skill:https://clawhub.ai/ivangdavila/word-docx`,autoInstall:!0,slashCmd:`/word-docx`,checkDirs:[`word-docx`,`word`,`docx`]},{id:`excel-xlsx`,label:`Excel / XLSX`,desc:`Excel 表格生成与数据处理`,installMsg:`根据以下链接安装skill:https://clawhub.ai/ivangdavila/excel-xlsx`,autoInstall:!0,slashCmd:`/excel-xlsx`,checkDirs:[`excel-xlsx`,`excel`,`xlsx`]},{id:`ai-ppt-generator`,label:`AI PPT Generator`,desc:`AI 自动生成 PPT 演示文稿`,installMsg:`根据以下链接安装skill:https://clawhub.ai/ide-rea/ai-ppt-generator`,autoInstall:!0,slashCmd:`/ai-ppt-generator`,checkDirs:[`ai-ppt-generator`,`AiPptGenerator`]},{id:`nano-banana-pro`,label:`Nano Banana Pro`,desc:`轻量高效的任务执行与流程优化`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/nano-banana-pro`,autoInstall:!0,slashCmd:`/nano-banana-pro`,checkDirs:[`nano-banana-pro`,`NanoBananaPro`]},{id:`ppt-generator`,label:`PPT Generator`,desc:`PPT 演示文稿智能生成`,installMsg:`根据以下链接安装skill:https://clawhub.ai/wwlyzzyorg/ppt-generator`,autoInstall:!0,slashCmd:`/ppt-generator`,checkDirs:[`ppt-generator`,`PptGenerator`]},{id:`marketing-mode`,label:`Marketing Mode`,desc:`营销文案与推广内容创作`,installMsg:`根据以下链接安装skill:https://clawhub.ai/thesethrose/marketing-mode`,autoInstall:!0,slashCmd:`/marketing-mode`,checkDirs:[`marketing-mode`,`MarketingMode`]},{id:`data-analysis`,label:`Data Analysis`,desc:`数据分析与可视化报告生成`,installMsg:`根据以下链接安装skill:https://clawhub.ai/ivangdavila/data-analysis`,autoInstall:!0,slashCmd:`/data-analysis`,checkDirs:[`data-analysis`,`DataAnalysis`]}]},{id:`life`,label:`生活辅助`,emoji:`🏠`,skills:[{id:`todo-manager`,label:`Todo Manager`,desc:`任务与待办事项管理`,installMsg:`根据以下链接安装skill:https://clawhub.ai/aeoleader/todo-manager`,autoInstall:!0,slashCmd:`/todo-manager`,checkDirs:[`todo-manager`,`todo`,`TodoManager`]},{id:`12306`,label:`12306 火车票`,desc:`查询与购买 12306 火车票`,installMsg:`根据以下链接安装skill:https://clawhub.ai/kirorab/12306`,autoInstall:!0,slashCmd:`/12306`,checkDirs:[`12306`,`kirorab-12306`]},{id:`youtube-watcher`,label:`YouTube Watcher`,desc:`YouTube 视频摘要与内容分析`,installMsg:`根据以下链接安装skill:https://clawhub.ai/michaelgathara/youtube-watcher`,autoInstall:!0,slashCmd:`/youtube-watcher`,checkDirs:[`youtube-watcher`,`youtube`,`YoutubeWatcher`]},{id:`xiaohongshu-cn`,label:`小红书助手`,desc:`小红书内容创作与运营辅助`,installMsg:`根据以下链接安装skill:https://clawhub.ai/guohongbin-git/xiaohongshu-cn`,autoInstall:!0,slashCmd:`/xiaohongshu-cn`,checkDirs:[`xiaohongshu-cn`,`xiaohongshu`,`XiaohongshuCn`]},{id:`wechat-mp-cn`,label:`微信公众号助手`,desc:`微信公众号内容创作与发布辅助`,installMsg:`根据以下链接安装skill:https://clawhub.ai/guohongbin-git/wechat-mp-cn`,autoInstall:!0,slashCmd:`/wechat-mp-cn`,checkDirs:[`wechat-mp-cn`,`wechat-mp`,`WechatMpCn`]},{id:`weather`,label:`Weather`,desc:`实时天气查询与预报`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/weather`,autoInstall:!0,slashCmd:`/weather`,checkDirs:[`weather`,`steipete-weather`]},{id:`stock-analysis`,label:`Stock Analysis`,desc:`股票行情分析与投资参考`,installMsg:`根据以下链接安装skill:https://clawhub.ai/udiedrichsen/stock-analysis`,autoInstall:!0,slashCmd:`/stock-analysis`,checkDirs:[`stock-analysis`,`StockAnalysis`]},{id:`news-summary`,label:`News Summary`,desc:`新闻资讯聚合与摘要生成`,installMsg:`根据以下链接安装skill:https://clawhub.ai/joargp/news-summary`,autoInstall:!0,slashCmd:`/news-summary`,checkDirs:[`news-summary`,`NewsSummary`]}]},{id:`dev`,label:`开发工具`,emoji:`🛠️`,skills:[{id:`github`,label:`GitHub`,desc:`GitHub 仓库管理与代码协作`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/github`,autoInstall:!0,slashCmd:`/github`,checkDirs:[`github`,`GitHub`,`steipete-github`]},{id:`gemini`,label:`Gemini`,desc:`Google Gemini 模型接入与调用`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/gemini`,autoInstall:!0,slashCmd:`/gemini`,checkDirs:[`gemini`,`Gemini`,`steipete-gemini`]},{id:`api-gateway`,label:`API Gateway`,desc:`API 接口管理与请求代理`,installMsg:`根据以下链接安装skill:https://clawhub.ai/byungkyu/api-gateway`,autoInstall:!0,slashCmd:`/api-gateway`,checkDirs:[`api-gateway`,`ApiGateway`]},{id:`mcporter`,label:`MCPorter`,desc:`MCP 服务器管理工具`,installMsg:`根据以下链接安装skill:https://clawhub.ai/steipete/mcporter`,autoInstall:!0,slashCmd:`/mcporter`,checkDirs:[`mcporter`,`MCPorter`,`steipete-mcporter`]},{id:`session-logs`,label:`Session Logs`,desc:`会话日志记录与回放分析`,installMsg:`根据以下链接安装skill:https://clawhub.ai/guogang1024/session-logs`,autoInstall:!0,slashCmd:`/session-logs`,checkDirs:[`session-logs`,`SessionLogs`]}]}]},Re={id:`mcp`,label:`常用 MCP`,emoji:`🔌`,items:[{id:`12306-mcp`,label:`12306-MCP车票查询工具`,desc:`12306-MCP车票查询工具`,mcpJson:{"12306-mcp":{command:`npx`,args:[`-y`,`12306-mcp`]}}},{id:`bing-search`,label:`Bing 搜索`,desc:`必应搜索引擎 MCP 接入`,mcpJson:{"bing-search":{command:`npx`,args:[`-y`,`bing-cn-mcp`]}}},{id:`fxbaogao-mcp`,label:`发现报告`,desc:`发现报告研究报告检索与阅读`,mcpJson:{"fxbaogao-mcp":{command:`uvx`,args:[`fxbaogao-mcp@latest`]}}}]},ze={id:`slash`,label:`常用 /命令`,emoji:`/`,groups:[{label:`会话`,items:[{id:`slash-new`,label:`/new`,desc:`开启新会话`,cmd:`/new`,send:!0},{id:`slash-reset`,label:`/reset`,desc:`重置当前会话`,cmd:`/reset`,send:!0},{id:`slash-compact`,label:`/compact`,desc:`压缩会话上下文`,cmd:`/compact`,send:!0},{id:`slash-stop`,label:`/stop`,desc:`停止当前运行`,cmd:`/stop`,send:!0},{id:`slash-clear`,label:`/clear`,desc:`清空聊天记录`,cmd:`/clear`,send:!0},{id:`slash-focus`,label:`/focus`,desc:`切换专注模式`,cmd:`/focus`,send:!0}]},{label:`模型`,items:[{id:`slash-model`,label:`/model <name>`,desc:`查看或切换模型`,cmd:`/model `,send:!1},{id:`slash-think`,label:`/think <level>`,desc:`设置思考深度`,cmd:`/think `,send:!1},{id:`slash-verbose`,label:`/verbose <on|off|full>`,desc:`切换详细输出模式`,cmd:`/verbose `,send:!1},{id:`slash-fast`,label:`/fast <status|on|off>`,desc:`切换快速模式`,cmd:`/fast `,send:!1}]},{label:`工具`,items:[{id:`slash-help`,label:`/help`,desc:`查看可用命令`,cmd:`/help`,send:!0},{id:`slash-status`,label:`/status`,desc:`显示会话状态(agent)`,cmd:`/status`,send:!0},{id:`slash-export`,label:`/export`,desc:`导出会话为 Markdown`,cmd:`/export`,send:!0},{id:`slash-usage`,label:`/usage`,desc:`显示 Token 用量`,cmd:`/usage`,send:!0}]}]},Be=2,Ve=1600,He=3200,Ue=720,We=1440;function Ge(e){let t=Array.isArray(e?.provides)?e.provides:[],n=new Set(t.map(e=>typeof e?.capability==`string`?e.capability:``).filter(Boolean));return n.has(`browserless-api`)||n.has(`browserless-debugger`)||e?.embeddedUi?.capability===`browserless-debugger`||e?.definitionId===`browserless-chromium-container`||e?.definition?.id===`browserless-chromium-container`||e?.spec_id===`browserless-chromium-container`}function Ke(e,t){if(!e)return null;let n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString(t)}function qe(e){let t=e.trim();if(!t)return null;if(t.startsWith(`*.`)){let e=qe(t.slice(2));return e?`*.${e}`:null}if(t===`about:blank`)return null;try{return new URL(t).hostname.toLowerCase()}catch{try{return new URL(`https://${t}`).hostname.toLowerCase()}catch{return t.replace(/^https?:\/\//i,``).replace(/\/.*$/,``).replace(/:\d+$/,``).trim().toLowerCase()||null}}}function Je(e,t){return t?.includes(`blocked by policy`)?qe(e||``):null}function Ye(e,t){let n=`3000`,r=n;try{r=new URL(t||`ws://${window.location.hostname}:${n}`).port||n}catch{r=n}let i=`/devtools/page/${encodeURIComponent(e)}`;return`${`${window.location.protocol}//${window.location.hostname}:${r}`}/devtools/inspector.html?${new URLSearchParams({ws:`${window.location.hostname}:${r}${i}`}).toString()}`}function Xe(e,t){let n=`3000`,r=window.location.protocol===`https:`?`wss:`:`ws:`,i=n;try{let e=new URL(t||`${r}//${window.location.hostname}:${n}`);r=e.protocol===`wss:`?`wss:`:`ws:`,i=e.port||n}catch{i=n}return`${r}//${window.location.hostname}:${i}/devtools/page/${encodeURIComponent(e)}`}function Ze(e,t,n){return new Promise(r=>{if(typeof WebSocket!=`function`){r();return}let i=!1,a=e=>{if(!i){i=!0;try{e?.close()}catch{}r()}},o;try{o=new WebSocket(Xe(e,t))}catch{r();return}let s=window.setTimeout(()=>a(o),1800);o.onopen=()=>{o.send(JSON.stringify({id:1,method:`Emulation.setDeviceMetricsOverride`,params:{width:n.width,height:n.height,deviceScaleFactor:1,mobile:!1,screenWidth:n.width,screenHeight:n.height,positionX:0,positionY:0,dontSetVisibleSize:!1}}))},o.onmessage=()=>{window.clearTimeout(s),a(o)},o.onerror=()=>{window.clearTimeout(s),a(o)}})}function Qe(e,t,n){return Math.max(t,Math.min(n,Math.round(e)))}function $e(e,t){let n=e?.clientWidth&&e.clientWidth>0?e.clientWidth:window.innerWidth,r=t===`expanded`?window.innerHeight-112:Math.min(window.innerHeight*.7,900),i=t===`expanded`?1:Be;return{width:Qe(t===`expanded`?window.innerWidth-64:n*Be,Ve,He),height:Qe(r*i,Ue,We)}}function et(e,t){switch(e){case`running`:return t(`browserless.serviceStatus.running`);case`pending`:return t(`browserless.serviceStatus.pending`);case`failed`:return t(`browserless.serviceStatus.failed`);case`dead`:return t(`browserless.serviceStatus.dead`);case`stopped`:return t(`browserless.serviceStatus.stopped`);default:return t(`browserless.serviceStatus.unknown`)}}function tt(e){return e.emptyState.code===`service_stopped`?e.provider.serviceStatus===`pending`?`service_pending`:e.provider.serviceStatus===`failed`||e.provider.serviceStatus===`dead`?`service_failed`:`service_stopped`:e.emptyState.code||`no_live_sessions`}function nt(e,t){return t(`browserless.consumerConfig.${e}`)}function rt(e,t){return t(`browserless.consumerSession.${e}`)}function it(e,t){return t(`browserless.browserAttempt.${e}`)}function at(e){if(!e)return null;let t=e.toLowerCase().split(`.`).filter(Boolean);return t.length<2?e.toLowerCase():t.slice(-2).join(`.`)}function ot(e){if(!e)return null;try{let t=new URL(e);return t.protocol===`blob:`&&t.pathname.startsWith(`http`)?ot(t.pathname):t.hostname||null}catch{return null}}function Y(e){let t=(e.url||e.normalizedUrl||e.title||e.label||``).trim().toLowerCase();return!!(!t||t===`blank`||t===`about:blank`||t.startsWith(`chrome-extension:`)||t.startsWith(`devtools:`)||t.startsWith(`chrome:`)||t.includes(`/devtools/`))}function st(e){let t=(e.url||e.normalizedUrl||``).toLowerCase();return/\.pdf(?:[?#]|$)/.test(t)}function ct(e,t){if(Y(e))return-1e3;let n=ot(e.url)||e.domain,r=ot(t?.lastBrowserAttempt.url??null),i=0;n&&(i+=20),e.connectedClients!=null&&e.connectedClients>0&&(i+=10),st(e)||(i+=8),e.title&&e.title!==e.url&&(i+=3),r&&n&&(n===r&&(i+=80),at(n)===at(r)&&(i+=50));let a=Date.parse(e.updatedAt??e.createdAt??``);return Number.isFinite(a)&&(i+=Math.min(10,a/0xe8d4a51000)),i}function lt(e,t,n={}){let r=e.map(e=>({session:e,score:ct(e,t)})).sort((e,t)=>t.score-e.score).find(e=>e.score>-1e3);return n.includeFallback?r?[r.session]:e.slice(0,1):r?[r.session]:[]}function ut(e){if(!e)return null;switch(e.derivedState.code){case`live_session_visible`:case`ready_no_live_session`:return{tone:`ok`,message:`browserless.derived.${e.derivedState.code}`};case`consumer_browser_disabled`:case`consumer_defaults_elsewhere`:case`consumer_no_default`:case`api_unreachable`:case`provider_not_ready`:case`wrong_profile_selected`:case`browser_failed_before_session`:return{tone:`warn`,message:`browserless.derived.${e.derivedState.code}`};default:return{tone:`neutral`,message:`browserless.derived.${e.derivedState.code}`}}}function dt(e){switch(e){case`success`:return{badge:`border-emerald-500/20 bg-emerald-500/10 text-emerald-300`,dot:`bg-emerald-400`,detail:`text-emerald-200/80`};case`warning`:return{badge:`border-amber-500/20 bg-amber-500/10 text-amber-300`,dot:`bg-amber-400`,detail:`text-amber-200/80`};case`danger`:return{badge:`border-red-500/20 bg-red-500/10 text-red-300`,dot:`bg-red-400`,detail:`text-red-200/80`};case`info`:return{badge:`border-sky-500/20 bg-sky-500/10 text-sky-300`,dot:`bg-sky-400`,detail:`text-sky-200/80`};default:return{badge:`border-[var(--border)] bg-[var(--card)] text-foreground`,dot:`bg-[var(--muted)]`,detail:`text-muted`}}}function ft(e){switch(e){case`running`:return`success`;case`pending`:return`warning`;case`failed`:case`dead`:return`danger`;default:return`neutral`}}function pt(e){switch(e){case`single`:return`info`;case`multiple`:return`warning`;default:return`neutral`}}function mt({label:e,value:t,tone:n,detail:r}){let i=dt(n);return(0,J.jsxs)(`div`,{className:`rounded-xl border border-[var(--border)] bg-[var(--card-hover)] px-4 py-3`,children:[(0,J.jsx)(`div`,{className:`text-[11px] uppercase tracking-[0.08em] text-muted`,children:e}),(0,J.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-2 rounded-full border px-2.5 py-1 text-sm font-medium ${i.badge}`,children:[(0,J.jsx)(`span`,{className:`h-2 w-2 rounded-full ${i.dot}`}),(0,J.jsx)(`span`,{children:t})]}),r&&(0,J.jsx)(`div`,{className:`mt-2 text-xs ${i.detail}`,children:r})]})}function ht({instanceId:e,isRunning:t,isPending:n,actionLoading:i,onAction:o}){let{t:s,i18n:l}=r(`instance`),[u,d]=(0,q.useState)(null),[f,p]=(0,q.useState)(!0),[m,h]=(0,q.useState)(``),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1),[w,ee]=(0,q.useState)(!1),[T,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(null),te=(0,q.useRef)(null),M=l.language===`zh`?`zh-CN`:`en-US`,N=(0,q.useCallback)(async t=>{t&&p(!0);try{let t=await c(e);d(t),h(``)}catch(e){d(null),h(e?.message||s(`browserless.loadFailed`))}finally{p(!1)}},[e,s]);(0,q.useEffect)(()=>{let e=!1,t=async t=>{e||await N(t)};t(!0);let n=window.setInterval(()=>{t(!1)},15e3);return()=>{e=!0,window.clearInterval(n)}},[N]),(0,q.useEffect)(()=>{u?.provider.debuggerUrl||(_(!1),y(null),ee(!1))},[u?.provider.debuggerUrl]),(0,q.useEffect)(()=>{u?.binding?.consumers?.length||x(!1)},[u?.binding?.consumers?.length]),(0,q.useEffect)(()=>{if(!w)return;let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[w]),(0,q.useEffect)(()=>{if(!w)return;let e=e=>{e.key===`Escape`&&ee(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[w]);let ie=(0,q.useMemo)(()=>u?.provider.debuggerUrl?ne(u.provider.debuggerUrl):``,[u?.provider.debuggerUrl]),ae=(0,q.useMemo)(()=>u?.provider.docsUrl?ne(u.provider.docsUrl):``,[u?.provider.docsUrl]),P=u?.binding,oe=u?tt(u):null,se=ut(u),F=P?.state===`single`?P.consumers[0]:null,I=u?.sessions??[],ce=(0,q.useMemo)(()=>lt(I,F),[I,F]),le=S?I:ce,L=Math.max(0,I.length-ce.length),ue=ce[0]??null,de=(0,q.useMemo)(()=>ue?Ye(ue.id,u?.provider.devtoolsOrigin):``,[ue,u?.provider.devtoolsOrigin]),fe=de||ie,pe=v||fe,me=Je(F?.lastBrowserAttempt.url??null,F?.lastBrowserAttempt.error??null),R=F?.config.policy.allowedHostnames??[],he=F?.config.policy.temporaryAllowedHostnames??[],_e=F?.config.policy.persistentAllowedHostnames??[],ve=F?.config.policy.allowAll??!1,z=(F?.integrationKind||F?.agentType)===`openclaw`&&F?.config.policy.configurable,ye=u?.provider.serviceStatus??(t?`running`:`stopped`),be=et(ye,s),xe=!!u?.provider.apiReachable,Se=s(xe?`browserless.apiStatus.reachable`:`browserless.apiStatus.unreachable`),B=P?.state===`single`?s(`browserless.bindingState.single`):P?.state===`multiple`?s(`browserless.bindingState.multiple`):s(`browserless.bindingState.none`),Ce=(0,q.useCallback)(async(e,t)=>{await Ze(e,u?.provider.devtoolsOrigin,$e(te.current,t)),y(Ye(e,u?.provider.devtoolsOrigin)),_(!0),ee(t===`expanded`)},[u?.provider.devtoolsOrigin]),we=(0,q.useCallback)(async e=>{if(ue){await Ce(ue.id,e);return}y(de||null),_(!0),ee(e===`expanded`)},[Ce,ue,de]),V=async(e,t)=>{if(!F||!z)return;let n=qe(e);if(!n){A({tone:`error`,text:s(`browserless.allowlist.invalidHost`)});return}try{O(!0),A(null),await j(F.instanceId,{host:n,scope:t}),E(``),A({tone:`success`,text:s(t===`temporary`?`browserless.allowlist.savedTemporary`:`browserless.allowlist.savedPersistent`,{host:n})}),await N(!0)}catch(e){A({tone:`error`,text:e?.message||s(`browserless.allowlist.saveFailed`)})}finally{O(!1)}},H=async e=>{if(!(!F||!z))try{O(!0),A(null),await re(F.instanceId,{allowAll:e}),A({tone:`success`,text:s(e?`browserless.allowlist.allowAllEnabled`:`browserless.allowlist.allowAllDisabled`)}),await N(!0)}catch(e){A({tone:`error`,text:e?.message||s(`browserless.allowlist.saveFailed`)})}finally{O(!1)}};return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)]`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:s(`browserless.title`)}),(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:s(`browserless.subtitle`)})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(ge,{className:`bg-[var(--card-hover)] text-foreground hover:bg-[var(--card)]`}),!t&&(0,J.jsx)(`button`,{onClick:()=>o(`start`),disabled:!!i||n,className:`px-4 py-2 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200`,children:s(i===`start`||n?`action.starting`:`chat.startInstance`)})]})]}),m&&(0,J.jsx)(`div`,{className:`mt-4 rounded-xl border border-amber-500/20 bg-amber-500/10 px-4 py-3 text-sm text-amber-300`,children:m}),(0,J.jsxs)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-3`,children:[(0,J.jsx)(mt,{label:s(`browserless.service`),value:be,tone:ft(ye)}),(0,J.jsx)(mt,{label:s(`browserless.api`),value:Se,tone:xe?`success`:ye===`running`?`warning`:`neutral`,detail:u?.provider.apiError||void 0}),(0,J.jsx)(mt,{label:s(`browserless.binding`),value:B,tone:pt(P?.state),detail:P?.state===`single`&&P.consumers[0]?(0,J.jsx)(a,{to:`/instances/${P.consumers[0].instanceId}`,className:`text-[#4DA3FF] hover:text-[#7BB8FF]`,children:P.consumers[0].name}):P?.state===`multiple`&&P.consumers.length>0?P.consumers.map(e=>e.name).join(`, `):void 0})]}),(0,J.jsx)(`div`,{className:`mt-4 rounded-xl border border-[var(--border)] bg-[var(--card-hover)] px-4 py-3 text-sm text-muted`,children:u?.telemetry.effectiveUsageAvailable?u.telemetry.reason:s(`browserless.telemetryFallback`)}),se&&(0,J.jsx)(`div`,{className:`mt-4 rounded-xl px-4 py-3 text-sm ${se.tone===`ok`?`border border-emerald-500/20 bg-emerald-500/10 text-emerald-300`:se.tone===`warn`?`border border-amber-500/20 bg-amber-500/10 text-amber-300`:`border border-[var(--border)] bg-[var(--card-hover)] text-muted`}`,children:s(se.message)}),F&&(0,J.jsxs)(`div`,{className:`mt-4 rounded-xl border border-[var(--border)] bg-[var(--card-hover)] px-4 py-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:s(`browserless.allowlist.title`)}),(0,J.jsx)(`div`,{className:`text-xs text-muted`,children:s(`browserless.allowlist.subtitle`)})]}),(0,J.jsx)(`div`,{className:`text-xs text-muted`,children:F.config.policy.allowPrivateNetwork===!0?s(`browserless.allowlist.privateNetwork.on`):F.config.policy.allowPrivateNetwork===!1?s(`browserless.allowlist.privateNetwork.off`):s(`browserless.allowlist.privateNetwork.unknown`)})]}),z&&(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,J.jsxs)(`span`,{className:`text-xs text-muted`,children:[s(`browserless.allowlist.allowAllLabel`),`:`]}),ve?(0,J.jsx)(`button`,{onClick:()=>void H(!1),disabled:D,className:`px-3 py-1.5 rounded-md bg-amber-500/20 border border-amber-500/30 text-xs font-medium text-amber-300 hover:bg-amber-500/30 disabled:opacity-40 transition-colors`,children:s(D?`browserless.allowlist.saving`:`browserless.allowlist.allowAllDisable`)}):(0,J.jsx)(`button`,{onClick:()=>void H(!0),disabled:D,className:`px-3 py-1.5 rounded-md bg-emerald-500/10 border border-emerald-500/30 text-xs font-medium text-emerald-300 hover:bg-emerald-500/20 disabled:opacity-40 transition-colors`,children:s(D?`browserless.allowlist.saving`:`browserless.allowlist.allowAllEnable`)})]}),(0,J.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:R.length>0?R.map(e=>(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-[var(--border)] bg-[var(--card)] px-2.5 py-1 text-xs text-foreground`,children:[(0,J.jsx)(`span`,{children:e}),he.includes(e)&&(0,J.jsx)(`span`,{className:`rounded-full bg-sky-500/10 px-1.5 py-0.5 text-[10px] text-sky-300`,children:s(`browserless.allowlist.temporaryTag`)})]},e)):(0,J.jsx)(`span`,{className:`text-xs text-muted`,children:s(`browserless.allowlist.empty`)})}),!ve&&me&&!R.includes(me)&&(0,J.jsxs)(`div`,{className:`mt-3 rounded-xl border border-amber-500/20 bg-amber-500/10 px-3 py-3`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-amber-300`,children:s(`browserless.allowlist.blockedTitle`,{host:me})}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-amber-200/80`,children:s(`browserless.allowlist.blockedBody`)}),z&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[!he.includes(me)&&(0,J.jsx)(`button`,{onClick:()=>void V(me,`temporary`),disabled:D,className:`px-3 py-1.5 rounded-md bg-amber-400 text-slate-950 text-xs font-medium hover:bg-amber-300 disabled:opacity-40 transition-colors`,children:D?s(`browserless.allowlist.saving`):s(`browserless.allowlist.allowBlockedHostTemporary`,{host:me})}),!_e.includes(me)&&(0,J.jsx)(`button`,{onClick:()=>void V(me,`persistent`),disabled:D,className:`px-3 py-1.5 rounded-md border border-amber-400/40 text-xs font-medium text-amber-200 hover:bg-amber-500/10 disabled:opacity-40 transition-colors`,children:D?s(`browserless.allowlist.saving`):s(`browserless.allowlist.allowBlockedHostPersistent`,{host:me})})]})]}),z&&(0,J.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 md:flex-row`,children:[(0,J.jsx)(`input`,{value:T,onChange:e=>E(e.target.value),placeholder:s(`browserless.allowlist.placeholder`),className:`flex-1 rounded-md border border-[var(--border)] bg-[var(--card)] px-3 py-2 text-sm text-foreground outline-none focus:border-sky-500/60`}),(0,J.jsx)(`button`,{onClick:()=>void V(T,`temporary`),disabled:D||!T.trim(),className:`px-3 py-2 rounded-md border border-[var(--border)] text-xs font-medium text-foreground hover:bg-[var(--card)] disabled:opacity-40 transition-colors`,children:s(D?`browserless.allowlist.saving`:`browserless.allowlist.addTemporary`)}),(0,J.jsx)(`button`,{onClick:()=>void V(T,`persistent`),disabled:D||!T.trim(),className:`px-3 py-2 rounded-md border border-[var(--border)] text-xs font-medium text-foreground hover:bg-[var(--card)] disabled:opacity-40 transition-colors`,children:s(D?`browserless.allowlist.saving`:`browserless.allowlist.addPersistent`)})]}),k&&(0,J.jsx)(`div`,{className:`mt-3 rounded-xl px-3 py-2 text-xs ${k.tone===`success`?`border border-emerald-500/20 bg-emerald-500/10 text-emerald-300`:`border border-red-500/20 bg-red-500/10 text-red-300`}`,children:k.text})]}),P&&P.consumers.length>0&&(0,J.jsxs)(`div`,{className:`mt-4 rounded-xl border border-[var(--border)] bg-[var(--card-hover)] px-4 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:s(`browserless.consumerConfigTitle`)}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:P.consumers.length===1?s(`browserless.consumerConfigSummary.single`,{name:P.consumers[0].name,slot:P.consumers[0].slot}):s(`browserless.consumerConfigSummary.multiple`,{count:P.consumers.length})})]}),(0,J.jsx)(`button`,{onClick:()=>x(e=>!e),className:`px-3 py-1.5 border border-[var(--border)] rounded-md text-xs font-medium text-foreground hover:bg-[var(--card)] transition-colors`,children:s(b?`browserless.hideConsumerDetails`:`browserless.showConsumerDetails`)})]}),b&&(0,J.jsx)(`div`,{className:`mt-3 space-y-3`,children:P.consumers.map(e=>(0,J.jsxs)(`div`,{className:`rounded-xl border border-[var(--border)] bg-[var(--card)] px-3 py-3 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(a,{to:`/instances/${e.instanceId}`,className:`font-medium text-[#0066FF] hover:text-[#0066FF]/80`,children:e.name}),(0,J.jsx)(`span`,{className:`text-muted`,children:e.slot})]}),(0,J.jsx)(`span`,{className:`rounded-full border border-sky-500/20 bg-sky-500/10 px-2 py-0.5 text-[11px] font-medium text-sky-300`,children:nt(e.config.state,s)})]}),e.config.defaultProfile&&(0,J.jsx)(`div`,{className:`mt-2 text-xs text-muted`,children:s(`browserless.consumerDefaultProfile`,{profile:e.config.defaultProfile})}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:rt(e.recentSession.state,s)}),e.recentSession.lastMessageAt&&(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:s(`browserless.consumerLastSession`,{time:Ke(e.recentSession.lastMessageAt,M),origin:e.recentSession.origin||`-`})}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:it(e.lastBrowserAttempt.state,s)}),e.lastBrowserAttempt.timestamp&&(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:s(`browserless.browserAttemptAt`,{time:Ke(e.lastBrowserAttempt.timestamp,M)})}),e.lastBrowserAttempt.profile&&(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:s(`browserless.browserAttemptProfile`,{profile:e.lastBrowserAttempt.profile})}),e.lastBrowserAttempt.error&&(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted break-all`,children:e.lastBrowserAttempt.error})]},`${e.instanceId}:${e.slot}`))})]})]}),(0,J.jsxs)(`div`,{className:`rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:s(`browserless.activityTitle`)}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:F?s(`browserless.activitySubtitleForConsumer`,{name:F.name}):s(`browserless.activitySubtitle`)})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[I.length>ce.length&&(0,J.jsx)(`button`,{onClick:()=>C(e=>!e),className:`px-3 py-1.5 border border-[var(--border)] rounded-md text-xs font-medium text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:S?s(`browserless.hideExtraTargets`):s(`browserless.showAllTargets`,{count:L})}),f&&!u&&(0,J.jsx)(`div`,{className:`w-4 h-4 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin`})]})]}),I.length>ce.length&&!S&&(0,J.jsx)(`div`,{className:`mt-3 rounded-xl border border-[var(--border)] bg-[var(--card-hover)] px-3 py-2 text-xs text-muted`,children:s(`browserless.hiddenTargets`,{count:L})}),u?I.length>0?(0,J.jsx)(`div`,{className:`mt-4 space-y-3`,children:le.map(e=>{let t=Ke(e.updatedAt??e.createdAt,M),n=e.normalizedUrl||e.url||e.domain;return(0,J.jsx)(`div`,{className:`rounded-xl border border-[var(--border)] bg-[var(--card-hover)] px-4 py-3`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-start md:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-foreground truncate`,children:e.label}),n&&(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted truncate`,children:n}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted`,children:[(0,J.jsx)(`span`,{children:s(`browserless.sessionLive`)}),e.connectedClients!=null&&(0,J.jsx)(`span`,{children:s(`browserless.connectedClients`,{count:e.connectedClients})}),t&&(0,J.jsx)(`span`,{children:s(`browserless.lastActive`,{time:t})})]})]}),ie&&(0,J.jsx)(`button`,{onClick:()=>void Ce(e.id,`embedded`),className:`px-3 py-1.5 border border-[var(--border)] rounded-md text-xs text-foreground hover:bg-[var(--card)] transition-colors`,children:s(`browserless.showDebugger`)})]})},e.id)})}):(0,J.jsxs)(`div`,{className:`mt-4 rounded-xl border border-dashed border-[var(--border)] bg-[var(--card-hover)] px-4 py-5 text-sm text-muted space-y-2`,children:[(0,J.jsx)(`div`,{className:`font-medium text-foreground`,children:s(`browserless.empty.${oe}.title`)}),(0,J.jsx)(`div`,{children:s(`browserless.empty.${oe}.body`)})]}):(0,J.jsxs)(`div`,{className:`mt-4 rounded-xl border border-dashed border-[var(--border)] bg-[var(--card-hover)] px-4 py-5 text-sm text-muted space-y-2`,children:[(0,J.jsx)(`div`,{className:`font-medium text-foreground`,children:s(`browserless.unavailableTitle`)}),(0,J.jsx)(`div`,{children:m||s(`browserless.unavailableBody`)})]})]}),(0,J.jsxs)(`div`,{className:`rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-5 shadow-[0_18px_48px_rgba(15,23,42,0.06)]`,children:[(0,J.jsx)(`div`,{ref:te,children:(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:s(`browserless.advancedTitle`)})}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:s(`browserless.advancedSubtitle`)}),(0,J.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{if(g){_(!1),ee(!1);return}we(`embedded`)},disabled:!fe,className:`px-3 py-2 border border-[var(--border)] rounded-md text-xs font-medium text-foreground hover:bg-[var(--card-hover)] disabled:opacity-40 transition-colors`,children:s(g?`browserless.hideDebugger`:`browserless.showDebugger`)}),(0,J.jsx)(`button`,{onClick:()=>{we(w?`embedded`:`expanded`)},disabled:!fe,className:`px-3 py-2 border border-[var(--border)] rounded-md text-xs font-medium text-foreground hover:bg-[var(--card-hover)] disabled:opacity-40 transition-colors`,children:s(w?`browserless.restoreDebugger`:`browserless.expandDebugger`)}),(0,J.jsx)(`a`,{href:fe||void 0,target:`_blank`,rel:`noopener noreferrer`,"aria-disabled":!fe,className:`px-3 py-2 border border-[var(--border)] rounded-md text-xs font-medium transition-colors ${fe?`text-foreground hover:bg-[var(--card-hover)]`:`pointer-events-none text-muted opacity-40`}`,children:s(`browserless.openDebugger`)}),(0,J.jsx)(`a`,{href:ae||void 0,target:`_blank`,rel:`noopener noreferrer`,"aria-disabled":!ae,className:`px-3 py-2 border border-[var(--border)] rounded-md text-xs font-medium transition-colors ${ae?`text-foreground hover:bg-[var(--card-hover)]`:`pointer-events-none text-muted opacity-40`}`,children:s(`browserless.openDocs`)})]}),g&&pe&&(0,J.jsxs)(`div`,{className:w?`fixed inset-3 z-50 flex flex-col overflow-hidden rounded-[18px] border border-[var(--border)] bg-[var(--card)] p-3 shadow-[0_24px_80px_rgba(0,0,0,0.45)]`:`mt-4 overflow-hidden rounded-[18px] border border-[var(--border)] bg-[var(--card-hover)]`,"data-testid":`browserless-debugger-frame`,children:[w&&(0,J.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`Browserless Debugger`}),(0,J.jsx)(`button`,{onClick:()=>void we(`embedded`),className:`px-3 py-1.5 border border-[var(--border)] rounded-md text-xs font-medium text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:s(`browserless.restoreDebugger`)})]}),(0,J.jsx)(`iframe`,{id:`browserless-debugger-iframe`,src:pe,title:`Browserless Debugger`,className:w?`min-h-0 w-full flex-1`:`w-full`,style:w?void 0:{height:`min(70vh, 900px)`},sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-downloads allow-modals`,allow:`clipboard-write`})]})]})]})}function gt(e){for(let t of e.requires){if(t.category!==`browser`)continue;let n=e.connections[t.inject_as];if(n?.kind===`single`&&n.providerId)return n.providerId}for(let t of Object.values(e.connections))if(t?.kind===`single`&&t.capability.startsWith(`browser-`))return t.providerId;return null}function _t(e,t){return new Promise((n,r)=>{if(typeof WebSocket!=`function`){r(Error(`WebSocket unavailable`));return}let i=!1,a,o=(e,t)=>{if(!i){i=!0;try{a?.close()}catch{}e?r(e):n(t||``)}};try{a=new WebSocket(Xe(e,t))}catch(e){r(e instanceof Error?e:Error(String(e)));return}let s=window.setTimeout(()=>{o(Error(`Screenshot timed out`))},3500);a.onopen=()=>{a.send(JSON.stringify({id:1,method:`Page.captureScreenshot`,params:{format:`jpeg`,quality:58,captureBeyondViewport:!1}}))},a.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}if(t.id!==1)return;window.clearTimeout(s);let n=typeof t?.result?.data==`string`?t.result.data:``;if(!n){o(Error(`Screenshot response was empty`));return}o(void 0,`data:image/jpeg;base64,${n}`)},a.onerror=()=>{window.clearTimeout(s),o(Error(`Screenshot failed`))}})}function vt(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleTimeString(t,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function X({instanceId:e}){let{t,i18n:n}=r(`instance`),[i,o]=(0,q.useState)(null),[s,l]=(0,q.useState)(null),[u,d]=(0,q.useState)({status:`idle`,dataUrl:null,error:null}),f=n.language===`zh`?`zh-CN`:`en-US`;(0,q.useEffect)(()=>{let t=!1,n=async()=>{try{let n=await _(e);t||o(gt(n))}catch{t||o(null)}};n();let r=window.setInterval(()=>{n()},3e4);return()=>{t=!0,window.clearInterval(r)}},[e]);let p=(0,q.useCallback)(async()=>{if(i)try{let e=await c(i);l(e)}catch{l(null)}},[i]);(0,q.useEffect)(()=>{if(!i){l(null);return}p();let e=window.setInterval(()=>{p()},15e3);return()=>window.clearInterval(e)},[p,i]);let m=(0,q.useMemo)(()=>{let t=s?.binding.consumers??[];return t.find(t=>t.instanceId===e)??(t.length===1?t[0]:null)},[e,s?.binding.consumers]),h=(0,q.useMemo)(()=>s?lt(s.sessions,m,{includeFallback:!1})[0]??null:null,[m,s]),g=(0,q.useCallback)(async()=>{if(!(!s||!h)){d(e=>({status:`loading`,dataUrl:e.dataUrl,error:null}));try{let e=await _t(h.id,s.provider.devtoolsOrigin);d({status:`ready`,dataUrl:e,error:null})}catch(e){d(n=>({status:`error`,dataUrl:n.dataUrl,error:e?.message||t(`browserless.snapshot.captureFailed`)}))}}},[h,s,t]);if((0,q.useEffect)(()=>{if(!h?.id){d({status:`idle`,dataUrl:null,error:null});return}g()},[g,h?.id,h?.updatedAt]),!i||!h)return null;let v=h?.normalizedUrl||h?.url||h?.domain||``,y=vt(h?.updatedAt??h?.createdAt??null,f);return(0,J.jsx)(`div`,{className:`rounded-[18px] border border-[var(--border)] bg-[var(--card)] p-3 shadow-[0_12px_32px_rgba(15,23,42,0.05)]`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-center`,children:[(0,J.jsxs)(`div`,{className:`relative h-24 w-full overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--card-hover)] md:w-44 md:flex-none`,children:[u.dataUrl?(0,J.jsx)(`img`,{src:u.dataUrl,alt:t(`browserless.snapshot.alt`),className:`h-full w-full object-cover`}):(0,J.jsx)(`div`,{className:`flex h-full w-full items-center justify-center text-xs text-muted`,children:t(h?`browserless.snapshot.loading`:`browserless.snapshot.noSession`)}),u.status===`loading`&&(0,J.jsx)(`div`,{className:`absolute right-2 top-2 h-3 w-3 rounded-full border-2 border-sky-400/30 border-t-sky-400 animate-spin`})]}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-sky-300`,children:t(`browserless.snapshot.badge`)}),(0,J.jsx)(`div`,{className:`mt-1 truncate text-sm font-semibold text-foreground`,children:h?.label||t(`browserless.snapshot.noSessionTitle`)}),v&&(0,J.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted`,children:v}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted`,children:[y&&(0,J.jsx)(`span`,{children:t(`browserless.snapshot.updatedAt`,{time:y})}),u.status===`error`&&(0,J.jsx)(`span`,{className:`text-amber-300`,children:u.error})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:flex-none`,children:[(0,J.jsx)(`button`,{onClick:()=>void g(),disabled:!h||u.status===`loading`,className:`px-3 py-1.5 rounded-md border border-[var(--border)] text-xs font-medium text-foreground hover:bg-[var(--card-hover)] disabled:opacity-40 transition-colors`,children:u.status===`loading`?t(`browserless.snapshot.refreshing`):t(`browserless.snapshot.refresh`)}),(0,J.jsx)(a,{to:`/instances/${i}/chat`,className:`px-3 py-1.5 rounded-md border border-[var(--border)] text-xs font-medium text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:t(`browserless.snapshot.openBrowserless`)})]})]})})}function yt({instanceId:e,gatewayLaunchUrl:t,gatewayReady:n,isRunning:i,isPending:a,iframeLoaded:o,actionLoading:s,onAction:c,onReload:l,onIframeLoad:u}){let{t:d}=r(`instance`);return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[e&&(0,J.jsx)(X,{instanceId:e}),(0,J.jsx)(`div`,{className:`overflow-hidden rounded-[22px] border border-[var(--border)] bg-[var(--card)] shadow-[0_18px_48px_rgba(15,23,42,0.06)]`,children:(0,J.jsxs)(`div`,{className:`relative`,style:{height:`calc(100vh - 280px)`,minHeight:`500px`},children:[(!i||!n||!o)&&(0,J.jsx)(`div`,{className:`absolute inset-0 w-full h-full bg-[var(--card)] flex flex-col items-center justify-center z-10 transition-opacity duration-300 ${o?`opacity-0 pointer-events-none`:`opacity-100`}`,children:i?n?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`w-5 h-5 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin mb-3`}),(0,J.jsx)(`div`,{className:`text-sm text-foreground/60`,children:d(`chat.loadingChat`)})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`w-5 h-5 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin mb-3`}),(0,J.jsx)(`div`,{className:`text-sm text-foreground/60`,children:d(`chat.waitingGateway`)})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`text-4xl mb-4 opacity-40`,children:`💬`}),(0,J.jsx)(`div`,{className:`text-sm text-foreground/60 font-medium mb-1`,children:d(`chat.notReady`)}),(0,J.jsx)(`div`,{className:`text-xs text-muted mb-4`,children:d(`chat.startHint`)}),(0,J.jsx)(`button`,{onClick:()=>c(`start`),disabled:!!s||a,className:`px-4 py-2 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-200`,children:d(s===`start`||a?`action.starting`:`chat.startInstance`)})]})}),n&&t&&(0,J.jsx)(`iframe`,{id:`gateway-iframe`,src:t,className:`w-full h-full`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-downloads allow-modals`,allow:`microphone; camera; clipboard-write`,onLoad:u})]})})]})}function Z(e){return!e||typeof e!=`object`?[]:Object.entries(e).map(([e,t])=>({group:e,items:Array.isArray(t)?t.map(e=>typeof e==`string`?{cmd:e,label:e}:!e||typeof e!=`object`||typeof e.cmd!=`string`||!e.cmd.trim()?null:{cmd:e.cmd.trim(),label:typeof e.label==`string`&&e.label.trim()?e.label.trim():e.cmd.trim(),description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0}).filter(e=>!!e):[]})).filter(e=>e.items.length>0)}function bt({instanceId:e,provide:t,isRunning:n}){let[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(t.terminal?.prompt?.trim()||`shell`),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(()=>{let e=[],n=t.terminal?.welcome?.trim();return n&&e.push({id:1,kind:`status`,text:n}),e}),p=(0,q.useRef)(null),m=(0,q.useRef)(null),h=(0,q.useRef)(d.length+1),g=(0,q.useRef)(0),_=(0,q.useRef)(null),v=(0,q.useMemo)(()=>Z(t.terminal?.commands),[t.terminal?.commands]),y=(e,t,n=!1)=>{let r=t.trimEnd();r.trim()&&f(t=>{if(n&&t.length>0){let n=t[t.length-1];if(n.kind===e){let e=[...t];return e[e.length-1]={...n,text:r},e}}return[...t,{id:h.current++,kind:e,text:r}]})},b=()=>{p.current?.close(),p.current=null},x=n=>{b();let r=ne(`/api/instances/${encodeURIComponent(e)}/provides/${encodeURIComponent(t.capability)}/terminal/session/${encodeURIComponent(n)}/stream?since=${g.current}`),i=new EventSource(r,{withCredentials:M()});p.current=i;let a=e=>t=>{try{let n=JSON.parse(t.data);typeof n?.seq==`number`&&(g.current=Math.max(g.current,n.seq)),typeof n?.text==`string`&&n.text&&y(e,n.text,n?.replace===!0)}catch{typeof t.data==`string`&&t.data&&y(e,t.data)}};i.addEventListener(`stdout`,a(`stdout`)),i.addEventListener(`stderr`,a(`stderr`)),i.addEventListener(`error`,e=>{let t=e instanceof MessageEvent?e.data:``;typeof t==`string`&&t&&y(`stderr`,t),c(null),m.current=null,b()}),i.addEventListener(`exit`,e=>{try{let t=JSON.parse(e.data);typeof t?.seq==`number`&&(g.current=Math.max(g.current,t.seq)),y(`status`,`process exited with code ${t?.exitCode??`unknown`}`)}catch{y(`status`,`process exited`)}c(null),m.current=null,b()}),i.addEventListener(`done`,()=>{c(null),m.current=null,b()})},C=async r=>{let s=r.trim();if(!(!s||l||!n)){u(!0);try{y(`cmd`,`${a}> ${s}`);let n=await E(e,t.capability,{input:s});o(n.prompt||a),c(n.sessionId),m.current=n.sessionId,g.current=0,x(n.sessionId),i(``)}catch(e){y(`stderr`,e?.message||`failed to start terminal session`)}finally{u(!1)}}},w=async()=>{let o=r.trim();if(!(l||!n)){if(!s){await C(o);return}u(!0);try{y(`cmd`,`${a}> ${o}`),await R(e,t.capability,s,{input:o}),i(``)}catch(e){y(`stderr`,e?.message||`failed to send terminal input`)}finally{u(!1)}}},ee=async()=>{if(!(!s||l)){u(!0);try{await S(e,t.capability,s),y(`status`,`session stopped`)}catch(e){y(`stderr`,e?.message||`failed to stop terminal session`)}finally{u(!1)}}};return(0,q.useEffect)(()=>{let e=_.current;if(e){if(typeof e.scrollTo==`function`){e.scrollTo({top:e.scrollHeight});return}e.scrollTop=e.scrollHeight}},[d]),(0,q.useEffect)(()=>()=>{let n=m.current;b(),n&&S(e,t.capability,n).catch(()=>{})},[e,t.capability]),(0,J.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[280px_minmax(0,1fr)]`,children:[(0,J.jsxs)(`aside`,{className:`rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-4`,children:[(0,J.jsxs)(`div`,{className:`mb-3`,children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:`Ollama Commands`}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:`点击左侧命令会自动写入终端并执行。`})]}),(0,J.jsx)(`div`,{className:`space-y-4`,children:v.map(e=>(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-[0.18em] text-foreground/55`,children:e.group}),(0,J.jsx)(`div`,{className:`space-y-2`,children:e.items.map(t=>(0,J.jsxs)(`button`,{type:`button`,disabled:!n||!!s||l,onClick:()=>{i(t.cmd),C(t.cmd)},className:`w-full rounded-2xl border border-[var(--border)] bg-black/[0.03] px-3 py-2 text-left transition hover:border-[#0066FF]/35 hover:bg-[#0066FF]/[0.04] disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,J.jsx)(`div`,{className:`font-mono text-xs text-foreground`,children:t.label}),t.description&&(0,J.jsx)(`div`,{className:`mt-1 text-[11px] leading-5 text-muted`,children:t.description})]},`${e.group}:${t.cmd}`))})]},e.group))})]}),(0,J.jsxs)(`section`,{className:`rounded-[22px] border border-[var(--border)] bg-[#09111f] text-[#d7e3ff] shadow-[0_18px_60px_rgba(4,12,24,0.28)]`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between border-b border-white/10 px-4 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold text-white`,children:t.description||`Ollama Terminal`}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-[#9cb3d9]`,children:"支持直接输入 `ollama` 子命令;输入 `ollama list` 或 `list` 都可以。"})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[#9cb3d9]`,children:[(0,J.jsx)(`span`,{className:`inline-flex h-2.5 w-2.5 rounded-full ${n?`bg-[#39d98a]`:`bg-[#ff6b6b]`}`}),(0,J.jsx)(`span`,{children:n?s?`session running`:`ready`:`service stopped`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void ee(),disabled:!s||l,className:`rounded-full border border-white/15 px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-white transition hover:border-white/35 disabled:cursor-not-allowed disabled:opacity-45`,children:`Stop`})]})]}),(0,J.jsx)(`div`,{ref:_,className:`h-[520px] overflow-y-auto px-4 py-4 font-mono text-sm leading-6`,children:d.length===0?(0,J.jsxs)(`div`,{className:`text-[#9cb3d9]`,children:[a,"> 输入 `list`、`ps`、`pull gemma4:e4b` 或 `run gemma4:e2b` 开始。"]}):d.map(e=>(0,J.jsx)(`div`,{className:e.kind===`stderr`?`whitespace-pre-wrap text-[#ff9c9c]`:e.kind===`cmd`?`whitespace-pre-wrap text-[#7fd0ff]`:e.kind===`status`?`whitespace-pre-wrap text-[#9cb3d9]`:`whitespace-pre-wrap text-[#d7e3ff]`,children:e.text},e.id))}),(0,J.jsxs)(`div`,{className:`border-t border-white/10 px-4 py-4`,children:[!n&&(0,J.jsx)(`div`,{className:`mb-3 rounded-2xl border border-[#ff6b6b]/25 bg-[#ff6b6b]/10 px-3 py-2 text-sm text-[#ffc2c2]`,children:`当前实例未运行,先启动 Ollama 服务后才能执行命令。`}),(0,J.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 rounded-2xl border border-white/10 bg-black/20 px-3 py-2`,children:[(0,J.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-[0.18em] text-[#7f97c2]`,children:s?`stdin`:`command`}),(0,J.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())},rows:s?2:1,disabled:!n||l,placeholder:s?`向当前 ollama 会话发送一行输入`:`例如:list / pull qwen3.6:35b / run gemma4:e2b`,className:`w-full resize-none border-0 bg-transparent p-0 font-mono text-sm text-[#e8f0ff] outline-none placeholder:text-[#7188b2]`})]}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>void w(),disabled:!n||l||!r.trim(),className:`rounded-2xl bg-[#0066FF] px-4 py-3 text-sm font-semibold text-white transition hover:bg-[#0052cc] disabled:cursor-not-allowed disabled:opacity-50`,children:s?`Send`:`Run`})]})]})]})]})}function xt({logs:e,logSearch:t,logType:n,logsEndRef:i,onSearchChange:a,onLogTypeChange:o,onRefresh:s,onCopy:c}){let{t:l}=r(`instance`),u=t?e.filter(e=>e.toLowerCase().includes(t.toLowerCase())):e;return(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,J.jsxs)(`div`,{className:`relative flex-1 min-w-[200px]`,children:[(0,J.jsx)(he,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted`}),(0,J.jsx)(`input`,{type:`text`,value:t,onChange:e=>a(e.target.value),placeholder:l(`logs.searchPlaceholder`),className:`w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md pl-9 pr-3 py-1.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 transition-colors`})]}),(0,J.jsx)(`div`,{className:`flex items-center gap-1`,children:[`stderr`,`stdout`].map(e=>(0,J.jsx)(`button`,{onClick:()=>o(e),className:`px-2.5 py-1.5 text-xs rounded-md transition-colors duration-150 ${n===e?`bg-[#0066FF] text-white`:`text-muted hover:bg-[var(--card-hover)]`}`,children:e},e))}),(0,J.jsx)(`button`,{onClick:s,className:`p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-colors`,title:l(`common:action.refresh`),children:(0,J.jsx)(z,{className:`w-3.5 h-3.5`})}),(0,J.jsx)(`button`,{onClick:c,className:`p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-colors`,title:l(`common:action.copyAll`),children:(0,J.jsx)(Ce,{className:`w-3.5 h-3.5`})})]}),(0,J.jsxs)(`div`,{className:`bg-black/60 border border-[var(--border)] rounded-xl font-mono text-[13px] p-4 min-h-[400px] lg:min-h-[500px] overflow-auto max-h-[70vh]`,children:[u.length===0?(0,J.jsx)(`p`,{className:`text-muted`,children:l(`logs.empty`)}):u.map((e,t)=>{let n=/error|ERR|panic|fatal/i.test(e),r=/warn|WARN/i.test(e);return(0,J.jsx)(`div`,{className:`whitespace-pre-wrap break-all leading-5 ${n?`text-red-400 bg-red-950/20`:r?`text-amber-400`:`text-foreground opacity-70`}`,children:e},`${t}-${e.slice(0,32)}`)}),(0,J.jsx)(`div`,{ref:i})]})]})}function St({usage:e,onRefresh:t}){let{t:n}=r(`instance`);if(!e)return(0,J.jsx)(`div`,{className:`space-y-4`,children:(0,J.jsxs)(`div`,{className:`animate-pulse space-y-4`,children:[(0,J.jsx)(`div`,{className:`grid grid-cols-3 gap-3`,children:[1,2,3].map(e=>(0,J.jsx)(`div`,{className:`h-20 bg-[var(--card)] rounded-lg`},e))}),(0,J.jsx)(`div`,{className:`h-60 bg-[var(--card)] rounded-lg`})]})});let i=_e.language===`zh`?`zh-CN`:`en-US`;return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[e.totals.totalTokens===0&&e.totals.messages>0&&(0,J.jsx)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] text-muted text-sm rounded-lg px-4 py-3`,children:n(`usage.noTokenData`)}),(0,J.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-3 gap-3`,children:[{label:n(`usage.messages`),value:e.totals.messages.toLocaleString()},{label:n(`usage.totalTokens`),value:e.totals.totalTokens.toLocaleString()},{label:n(`usage.totalCost`),value:`$${e.totals.costTotal.toFixed(4)}`}].map(e=>(0,J.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4 hover:border-[var(--border-hover)] transition-colors`,children:[(0,J.jsx)(`div`,{className:`text-xs text-muted mb-1`,children:e.label}),(0,J.jsx)(`div`,{className:`text-2xl font-semibold text-foreground`,children:e.value})]},e.label))}),(0,J.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`px-4 py-3 border-b border-[var(--border)] flex items-center justify-between`,children:[(0,J.jsxs)(`span`,{className:`text-sm font-medium text-foreground`,children:[n(`usage.sessions`),` (`,e.sessions.length,`)`]}),(0,J.jsx)(`button`,{onClick:t,className:`text-xs text-muted hover:text-foreground transition-colors`,children:n(`common:action.refresh`)})]}),e.sessions.length===0?(0,J.jsx)(`p`,{className:`text-muted text-sm p-4`,children:n(`usage.noSessions`)}):(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-xs text-muted border-b border-[var(--border)]`,children:[(0,J.jsx)(`th`,{className:`text-left font-medium px-4 py-2`,children:n(`usage.time`)}),(0,J.jsx)(`th`,{className:`text-left font-medium px-4 py-2`,children:n(`usage.model`)}),(0,J.jsx)(`th`,{className:`text-left font-medium px-4 py-2`,children:n(`usage.source`)}),(0,J.jsx)(`th`,{className:`text-right font-medium px-4 py-2`,children:n(`usage.messagesShort`)}),(0,J.jsx)(`th`,{className:`text-right font-medium px-4 py-2`,children:n(`usage.input`)}),(0,J.jsx)(`th`,{className:`text-right font-medium px-4 py-2`,children:n(`usage.output`)}),(0,J.jsx)(`th`,{className:`text-right font-medium px-4 py-2`,children:n(`usage.tokens`)}),(0,J.jsx)(`th`,{className:`text-right font-medium px-4 py-2`,children:n(`usage.cost`)})]})}),(0,J.jsx)(`tbody`,{className:`divide-y divide-[var(--border)]`,children:e.sessions.map(e=>(0,J.jsxs)(`tr`,{className:`hover:bg-[var(--card-hover)] transition-colors`,children:[(0,J.jsx)(`td`,{className:`px-4 py-2 text-muted whitespace-nowrap`,children:e.lastMessage?new Date(e.lastMessage).toLocaleString(i,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):`-`}),(0,J.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-muted`,children:e.model||`-`}),(0,J.jsxs)(`td`,{className:`px-4 py-2 text-muted`,children:[e.channel&&(0,J.jsx)(`span`,{className:`inline-block bg-[var(--card-hover)] text-muted text-[11px] px-1.5 py-0.5 rounded mr-1 font-medium`,children:e.channel}),(0,J.jsx)(`span`,{className:`text-xs text-muted opacity-60`,children:e.origin?e.origin.length>20?e.origin.slice(0,20)+`...`:e.origin:``})]}),(0,J.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-muted`,children:e.usage.messages}),(0,J.jsx)(`td`,{className:`px-4 py-2 text-right font-mono text-xs tabular-nums text-muted`,children:e.usage.input.toLocaleString()}),(0,J.jsx)(`td`,{className:`px-4 py-2 text-right font-mono text-xs tabular-nums text-muted`,children:e.usage.output.toLocaleString()}),(0,J.jsx)(`td`,{className:`px-4 py-2 text-right font-mono text-xs tabular-nums text-muted`,children:e.usage.totalTokens.toLocaleString()}),(0,J.jsxs)(`td`,{className:`px-4 py-2 text-right font-mono text-xs tabular-nums text-muted`,children:[`$`,e.usage.costTotal.toFixed(4)]})]},e.key))})]})})]})]})}var Ct={llm:{iconEmoji:`🤖`,labelKey:`connections.category.llm.label`,descriptionKey:`connections.category.llm.description`,leaveBlankKey:`connections.category.llm.leaveBlank`,emptyMode:`installCta`,presetApps:[{specId:`ollama`,labelKey:`connections.preset.ollama`}]},search:{iconEmoji:`🔍`,labelKey:`connections.category.search.label`,descriptionKey:`connections.category.search.description`,leaveBlankKey:`connections.category.search.leaveBlank`,emptyMode:`installCta`,presetApps:[{specId:`searxng-container`,labelKey:`connections.preset.searxng`}]},browser:{iconEmoji:`🌐`,labelKey:`connections.category.browser.label`,descriptionKey:`connections.category.browser.description`,leaveBlankKey:`connections.category.browser.leaveBlank`,emptyMode:`installCta`,presetApps:[{specId:`browserless-chromium-container`,labelKey:`connections.preset.browserless`}]},mcp:{iconEmoji:`🧰`,labelKey:`connections.category.mcp.label`,descriptionKey:`connections.category.mcp.description`,leaveBlankKey:`connections.category.mcp.leaveBlank`,emptyMode:`mcpAddCta`,presetApps:[],hidden:!0},files:{iconEmoji:`📁`,labelKey:`connections.category.files.label`,descriptionKey:`connections.category.files.description`,leaveBlankKey:`connections.category.files.leaveBlank`,emptyMode:`installCta`,presetApps:[{specId:`filebrowser-container`,labelKey:`connections.preset.filebrowser`}]},knowledge:{iconEmoji:`📚`,labelKey:`connections.category.knowledge.label`,descriptionKey:`connections.category.knowledge.description`,leaveBlankKey:`connections.category.knowledge.leaveBlank`,emptyMode:`installCta`,presetApps:[{specId:`anythingllm-container`,labelKey:`connections.preset.anythingllm`},{specId:`jishu-kb-container`,labelKey:`connections.preset.jishu-kb`}]},ui:{iconEmoji:`🖥️`,labelKey:`connections.category.ui.label`,descriptionKey:`connections.category.ui.description`,leaveBlankKey:`connections.category.ui.leaveBlank`,emptyMode:`noCta`,presetApps:[]},terminal:{iconEmoji:`⌨️`,labelKey:`connections.category.terminal.label`,descriptionKey:`connections.category.terminal.description`,leaveBlankKey:`connections.category.terminal.leaveBlank`,emptyMode:`noCta`,presetApps:[]}},wt={iconEmoji:`⚙️`,labelKey:`connections.category.default.label`,descriptionKey:`connections.category.default.description`,leaveBlankKey:`connections.category.default.leaveBlank`,emptyMode:`noCta`,presetApps:[]};function Q(e){return Ct[e]??wt}function Tt(e){return e.unboundRequired.length>0?`required`:e.unboundOptional.length>0?`optional`:`ok`}function Et(e){let{t}=r(`instance`);if(e.totalSlots===0)return null;let n=Tt(e),i=n===`required`?`border-red-300 bg-red-50 dark:border-red-700 dark:bg-red-900/20`:n===`optional`?`border-amber-300 bg-amber-50 dark:border-amber-700 dark:bg-amber-900/20`:`border-green-300 bg-green-50 dark:border-green-700 dark:bg-green-900/20`,a=n===`required`?`⚠`:n===`optional`?`⚡`:`●`;if(n===`required`){let r=t(`connections.healthBar.required`,{slots:``}).replace(/\s*$/,``);return(0,J.jsxs)(`div`,{className:`mb-5 flex items-center justify-between gap-3 rounded-lg border px-4 py-2.5 text-sm ${i}`,"data-testid":`connections-health-bar`,"data-state":n,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:a}),(0,J.jsxs)(`span`,{className:`font-medium`,children:[r,` `,e.unboundRequired.map((t,n)=>(0,J.jsxs)(`span`,{title:e.pendingReasons?.[t]??void 0,children:[t,n<e.unboundRequired.length-1?`, `:``]},t))]})]}),(0,J.jsxs)(`span`,{className:`text-xs text-gray-600 dark:text-gray-400`,children:[`ⓘ `,t(`connections.healthBar.restartHint`)]})]})}let o;return o=n===`ok`?t(`connections.healthBar.allOk`,{bound:e.boundSlots,total:e.totalSlots}):t(`connections.healthBar.optional`,{bound:e.boundSlots,optional:e.unboundOptional.length}),(0,J.jsxs)(`div`,{className:`mb-5 flex items-center justify-between gap-3 rounded-lg border px-4 py-2.5 text-sm ${i}`,"data-testid":`connections-health-bar`,"data-state":n,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:a}),(0,J.jsx)(`span`,{className:`font-medium`,children:o})]}),(0,J.jsxs)(`span`,{className:`text-xs text-gray-600 dark:text-gray-400`,children:[`ⓘ `,t(`connections.healthBar.restartHint`)]})]})}var Dt=`inline-block w-2 h-2 rounded-full bg-green-500 mr-1.5 align-middle`,Ot=`inline-block w-2 h-2 rounded-full bg-gray-400 mr-1.5 align-middle`;function kt({slot:e,value:t,onPick:n,onToggleMany:i}){let{t:a}=r(`instance`);if(e.cardinality===`many`)return(0,J.jsx)(`div`,{className:`space-y-1.5`,children:e.candidates.map(n=>(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:!!(t?.kind===`many`&&t.providers.some(e=>e.providerId===n.providerId&&e.capability===n.capability)),onChange:t=>i(e,n.providerId,n.capability,t.target.checked)}),(0,J.jsx)(`span`,{className:n.status===`running`?Dt:Ot}),(0,J.jsx)(`span`,{className:`font-medium`,children:n.name??n.providerId}),(0,J.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[n.capability,` · `,n.status===`running`?a(`connections.statusRunning`):a(`connections.statusStopped`)]})]},`${n.providerId}::${n.capability}`))});let o=(e,t)=>`${e}|${t}`,s=t?.kind===`single`?o(t.providerId,t.capability):``;return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:(t?.kind===`single`?e.candidates.find(e=>e.providerId===t.providerId&&e.capability===t.capability):void 0)?.status===`running`?Dt:Ot,"aria-hidden":!0}),(0,J.jsxs)(`select`,{className:`flex-1 px-3 py-1.5 border border-gray-300 dark:border-gray-600 dark:bg-gray-800 rounded text-sm font-medium`,value:s,onChange:t=>{let r=t.target.value;if(!r){n(e,``,``);return}let i=r.indexOf(`|`);if(i<0)return;let a=r.slice(0,i),o=r.slice(i+1),s=e.candidates.find(e=>e.providerId===a&&e.capability===o);s&&n(e,s.providerId,s.capability)},children:[(0,J.jsx)(`option`,{value:``,children:a(`connections.unbound`)}),e.candidates.map(e=>(0,J.jsxs)(`option`,{value:o(e.providerId,e.capability),children:[e.name??e.providerId,` (`,e.capability,`) ·`,` `,e.status===`running`?a(`connections.statusRunning`):a(`connections.statusStopped`)]},o(e.providerId,e.capability)))]})]})}var At=`rounded border border-dashed border-gray-300 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/40 p-4 text-center`;function jt({category:e}){let{t}=r(`instance`),n=i(),a=Q(e);return a.emptyMode===`noCta`?(0,J.jsx)(`div`,{className:At,children:(0,J.jsx)(`div`,{className:`text-sm text-gray-700 dark:text-gray-300`,children:t(`connections.emptyEmpty`,{categoryLabel:t(a.labelKey)})})}):a.emptyMode===`mcpAddCta`?(0,J.jsxs)(`div`,{className:At,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-gray-800 dark:text-gray-200 mb-1`,children:t(`connections.emptyMcp`)}),(0,J.jsx)(`div`,{className:`text-xs text-gray-600 dark:text-gray-400 mb-3`,children:t(a.descriptionKey)}),(0,J.jsx)(`button`,{type:`button`,className:`inline-flex items-center gap-1 px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium`,onClick:()=>n(`/instances/new`),children:t(`connections.mcpAddCta`)})]}):(0,J.jsxs)(`div`,{className:At,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-gray-800 dark:text-gray-200 mb-1`,children:t(`connections.emptyEmpty`,{categoryLabel:t(a.labelKey)})}),(0,J.jsxs)(`div`,{className:`text-xs text-gray-600 dark:text-gray-400 mb-3`,children:[t(a.leaveBlankKey),` `,t(`connections.installCtaHint`)]}),(0,J.jsx)(`div`,{className:`flex justify-center gap-2 flex-wrap`,children:a.presetApps.map(e=>(0,J.jsx)(`button`,{type:`button`,className:`inline-flex items-center gap-1 px-3 py-1.5 rounded bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium`,onClick:()=>n(`/instances/new?app=${encodeURIComponent(e.specId)}`),children:t(`connections.installCta`,{label:t(e.labelKey)})},e.specId))})]})}function Mt({slot:e}){let{t}=r(`instance`),[n,i]=(0,q.useState)(!1);return(0,J.jsxs)(`div`,{className:`mt-2`,children:[(0,J.jsx)(`button`,{type:`button`,className:`text-xs text-gray-500 hover:text-blue-600 dark:hover:text-blue-400`,onClick:()=>i(e=>!e),children:n?`▾ ${t(`connections.techDetailsHide`)}`:`▸ ${t(`connections.techDetails`)}`}),n&&(0,J.jsxs)(`div`,{className:`mt-1.5 ml-2 text-xs font-mono text-gray-500 dark:text-gray-400 space-y-0.5`,children:[(0,J.jsxs)(`div`,{children:[`inject_as: `,(0,J.jsx)(`span`,{className:`text-gray-700 dark:text-gray-300`,children:e.inject_as})]}),(0,J.jsxs)(`div`,{children:[`capability: `,(0,J.jsx)(`span`,{className:`text-gray-700 dark:text-gray-300`,children:e.capability})]}),e.kind&&(0,J.jsxs)(`div`,{children:[`kind: `,(0,J.jsx)(`span`,{className:`text-gray-700 dark:text-gray-300`,children:e.kind})]}),e.interface&&(0,J.jsxs)(`div`,{children:[`interface: `,(0,J.jsx)(`span`,{className:`text-gray-700 dark:text-gray-300`,children:e.interface})]}),e.apply&&(0,J.jsxs)(`div`,{children:[`apply: `,(0,J.jsx)(`span`,{className:`text-gray-700 dark:text-gray-300`,children:e.apply})]})]})]})}function Nt({slot:e,value:t,duplicateCategory:n,onPick:i,onToggleMany:a}){let{t:o}=r(`instance`),s=Q(e.category),c=e.category==="default"?e.inject_as:o(s.labelKey),l=n&&e.category!=="default"?`${c} · ${e.inject_as}`:c,u=`inline-block px-2 py-0.5 rounded-full text-[10.5px] font-medium`;return(0,J.jsxs)(`div`,{className:`border border-gray-200 dark:border-gray-700 rounded-xl p-4 mb-3 bg-white dark:bg-gray-800/40`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`inline-flex w-7 h-7 rounded-md items-center justify-center bg-gray-100 dark:bg-gray-700 text-base`,children:s.iconEmoji}),(0,J.jsx)(`span`,{className:`text-sm font-semibold text-gray-900 dark:text-gray-100`,children:l})]}),(0,J.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,J.jsx)(`span`,{className:`${u} ${e.required?`bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-200`:`bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300`}`,children:e.required?o(`connections.tagRequired`):o(`connections.tagOptional`)}),e.cardinality===`many`&&(0,J.jsx)(`span`,{className:`${u} bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-200`,children:o(`connections.tagMulti`)})]})]}),e.category!=="default"&&(0,J.jsx)(`p`,{className:`ml-9 mt-1 mb-3 text-xs text-gray-600 dark:text-gray-400 leading-relaxed`,children:o(s.descriptionKey)}),(0,J.jsxs)(`div`,{className:`ml-9`,children:[e.candidates.length===0?(0,J.jsx)(jt,{category:e.category}):(0,J.jsx)(kt,{slot:e,value:t,onPick:i,onToggleMany:a}),(0,J.jsx)(Mt,{slot:e})]})]})}function Pt({hasUnsaved:e,saving:t,onSave:n}){let{t:i}=r(`instance`);return(0,J.jsxs)(`div`,{className:`mt-6 flex items-center gap-3`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:n,disabled:t||!e,className:`bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:cursor-not-allowed text-white px-4 py-2 rounded text-sm font-medium`,children:i(t?`connections.saving`:`connections.save`)}),e&&!t&&(0,J.jsx)(`span`,{className:`text-sm text-amber-700 dark:text-amber-400`,children:i(`connections.unsaved`)})]})}function $(e){return e?e.kind===`single`?!!e.providerId:e.kind===`many`?e.providers.length>0:!1:!1}var Ft=new Set([`MISSING_REQUIRED_CONNECTION`,`AMBIGUOUS_CONNECTION`,`USER_SELECTION_REQUIRED`,`PROVIDER_NOT_RUNNING`,`INVALID_BINDING`,`INVALID_PROVIDER_ID`,`INVALID_CAPABILITY_ENDPOINT`,`CONNECTION_APPLY_FAILED`,`CONNECTION_PERSIST_FAILED`]);function It(e,t){let n=t?.message??String(t),r=t?.code;return r&&Ft.has(r)?e(`connections.error.${r}`,{detail:n}):e(`connections.error.generic`,{detail:n})}function Lt({instanceId:e,onSaved:t}){let{t:n}=r(`instance`),[i,a]=(0,q.useState)(null),[o,s]=(0,q.useState)({}),[c,l]=(0,q.useState)({}),[u,d]=(0,q.useState)(!1),[f,p]=(0,q.useState)(null),m=(0,q.useRef)(!1),h=(0,q.useCallback)(async t=>{try{let n=await _(e);a(e=>!e||t?n:m.current?{...n,connections:e.connections}:n),(t||!m.current)&&(s(n.connections??{}),l(n.connections??{}))}catch(e){t&&p(e?.message??String(e))}},[e]);(0,q.useEffect)(()=>{let e=!1,t=!1,n=n=>{e||t||!n&&typeof document<`u`&&document.visibilityState!==`visible`||(t=!0,h(n).finally(()=>{t=!1}))};n(!0);let r=()=>n(!1);return typeof document<`u`&&document.addEventListener(`visibilitychange`,r),typeof window<`u`&&window.addEventListener(`focus`,r),()=>{e=!0,typeof document<`u`&&document.removeEventListener(`visibilitychange`,r),typeof window<`u`&&window.removeEventListener(`focus`,r)}},[h]);let g=(e,t,n)=>{l(r=>t?e.cardinality===`one`?{...r,[e.inject_as]:{kind:`single`,providerId:t,capability:n}}:r:{...r,[e.inject_as]:null})},v=(e,t,n,r)=>{l(i=>{let a=i[e.inject_as],o=a&&a.kind===`many`?[...a.providers]:[],s=o.findIndex(e=>e.providerId===t&&e.capability===n);return r&&s<0&&o.push({providerId:t,capability:n}),!r&&s>=0&&o.splice(s,1),o.length===0?{...i,[e.inject_as]:null}:{...i,[e.inject_as]:{kind:`many`,providers:o}}})},y=(0,q.useMemo)(()=>i?i.requires.filter(e=>!Q(e.category).hidden):[],[i]),b=async()=>{d(!0),p(null);try{await L(e,{connections:c}),t?.();let n=await _(e);a(n),s(n.connections??{}),l(n.connections??{})}catch(e){p(It(n,e))}finally{d(!1)}},x=(0,q.useMemo)(()=>{if(y.length===0)return{totalSlots:0,boundSlots:0,unboundOptional:[],unboundRequired:[]};let e=y.length,t=0,n=[],r=[];for(let e of y)$(c[e.inject_as])?t+=1:e.required?r.push(e.inject_as):n.push(e.inject_as);return{totalSlots:e,boundSlots:t,unboundOptional:n,unboundRequired:r}},[y,c]),S=(0,q.useMemo)(()=>{if(y.length===0)return new Set;let e={};for(let t of y)e[t.category]=(e[t.category]??0)+1;let t=new Set;for(let[n,r]of Object.entries(e))r>1&&t.add(n);return t},[y]),C=(0,q.useMemo)(()=>{if(!i)return{};let e={};for(let t of i.pending)e[t.slot]=t.reason;return e},[i]),w=(0,q.useMemo)(()=>JSON.stringify(o)!==JSON.stringify(c),[o,c]);return(0,q.useEffect)(()=>{m.current=w},[w]),f?(0,J.jsx)(`div`,{className:`p-4 text-red-600`,children:f}):i?y.length===0?(0,J.jsx)(`div`,{className:`p-4 text-gray-500`,children:n(`connections.empty`)}):(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h2`,{className:`text-xl font-semibold mb-1 flex items-center gap-2`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`🔗`}),` `,n(`connections.title`)]}),(0,J.jsx)(`p`,{className:`text-sm text-gray-600 dark:text-gray-400 mb-4 leading-relaxed`,children:n(`connections.subtitle`)}),(0,J.jsx)(Et,{totalSlots:x.totalSlots,boundSlots:x.boundSlots,unboundOptional:x.unboundOptional,unboundRequired:x.unboundRequired,pendingReasons:C}),(0,J.jsx)(`div`,{children:y.map(e=>(0,J.jsx)(Nt,{slot:e,value:c[e.inject_as]??null,duplicateCategory:S.has(e.category),onPick:g,onToggleMany:v},e.inject_as))}),(0,J.jsx)(Pt,{hasUnsaved:w,saving:u,onSave:b})]}):(0,J.jsx)(`div`,{className:`p-4 text-gray-500`,children:n(`connections.loading`)})}function Rt({instanceId:e}){let{t}=r(),[n,a]=(0,q.useState)(null),o=i();if((0,q.useEffect)(()=>{let t=!1,n,r=()=>{b(e).then(e=>!t&&a(e)).catch(()=>{}).finally(()=>{t||(n=setTimeout(r,3e4))})};return r(),()=>{t=!0,n&&clearTimeout(n)}},[e]),!n||n.state===`empty`||n.state===`ok`)return null;let s=n.state===`warn`?`⚡`:`⚠`,c=n.state===`warn`?`text-amber-400`:`text-red-400`,l=n.state===`warn`?t(`instance:connections.badgeWarn`,{count:n.bindable??n.unboundOptional.length}):t(`instance:connections.badgeError`);return(0,J.jsxs)(`button`,{onClick:()=>o(`/instances/${e}/connections`),title:l,className:`text-xs ${c} hover:underline cursor-pointer`,children:[s,` `,l]})}function zt({instanceId:e,instanceName:t,showToast:n,onRestoreComplete:a,openBackup:o,openManage:s,openExport:c,onDialogClose:l}){let{t:u}=r(`instance`),d=i(),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(null),[S,C]=(0,q.useState)(!1),[w,ee]=(0,q.useState)(!1),[E,D]=(0,q.useState)(null),[O,A]=(0,q.useState)(null),[j,ne]=(0,q.useState)([]),[M,N]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(!1),[oe,se]=(0,q.useState)(`home`),[F,ce]=(0,q.useState)(``),[L,de]=(0,q.useState)(``),[fe,pe]=(0,q.useState)(``),[R,he]=(0,q.useState)(null),[ge,_e]=(0,q.useState)(!1);(0,q.useEffect)(()=>{o&&m(!0)},[o]),(0,q.useEffect)(()=>{s&&(H(),g(!0))},[s]),(0,q.useEffect)(()=>{c&&C(!0)},[c]);let[ve,z]=(0,q.useState)(null),[ye,be]=(0,q.useState)(``),[xe,Se]=(0,q.useState)(``);(0,q.useEffect)(()=>{!p&&!h&&!S&&!_&&!y&&!O&&!E&&!ve&&l?.()},[p,h,S,_,y,O,E,ve]);let[B,Ce]=(0,q.useState)({enabled:!1}),[we,V]=(0,q.useState)(!1),H=(0,q.useCallback)(async()=>{try{let[t,n]=await Promise.all([le(e),x(e).catch(()=>({enabled:!1}))]);ne(Array.isArray(t)?t:[]),Ce(n)}catch{}},[e]);(0,q.useEffect)(()=>{H()},[H]),(0,q.useEffect)(()=>{if(!ve)return;let t=!1;return(async()=>{for(;!t;)try{let r=await P(ve);if(t)break;if(Se(r.progress||``),r.status===`completed`){if(z(null),be(``),N(!1),r.operation===`manual-backup`)A({type:`success`,title:u(`backup.created`,{defaultValue:`备份完成`}),detail:r.result?.filename?`${r.result.filename} (${Ee(r.result.size||0)})`:``}),H();else if(r.operation===`export`)D(r.result);else if(r.operation===`restore`){let t=r.result||{};t.ok?A({type:`success`,title:u(`backup.restoreSuccess`,{defaultValue:`恢复完成`}),detail:t.api_key_status===`lost`?u(`backup.apiKeyLost`,{defaultValue:`备份来自不同平台/架构,请确认 API Key 配置是否仍然适用。`}):t.warnings?.join(`
|
|
3
|
+
`)||``,actions:t.api_key_status===`lost`?[{label:u(`backup.configApiKey`,{defaultValue:`配置 API Key`}),onClick:()=>{A(null),d(`/instances/${e}/config`)}}]:void 0}):A({type:`error`,title:t.rolled_back?u(`backup.restoreFailedRolledBack`,{defaultValue:`恢复失败 — 已自动回滚`}):u(`backup.restoreFailed`,{defaultValue:`恢复失败`}),detail:t.warnings?.join(`
|
|
4
|
+
`)||``}),H(),a?.()}break}else if(r.status===`failed`){z(null),be(``),N(!1),n(r.error||`Operation failed`,`error`);break}await new Promise(e=>setTimeout(e,1500))}catch{break}})(),()=>{t=!0}},[ve]);let U=async()=>{N(!0),m(!1);try{let t=await k(e,{include_sessions:re,scope:oe});t.job_id?(z(t.job_id),be(`manual-backup`),Se(`Queued...`)):(A({type:`success`,title:u(`backup.created`,{defaultValue:`备份完成`}),detail:`${t.filename} (${Ee(t.size)})`}),N(!1),H())}catch(e){n(e.message||u(`backup.failed`,{defaultValue:`备份失败`}),`error`),N(!1)}finally{ie(!1),se(`home`)}},W=async t=>{N(!0),v(null),ce(``);try{let n=await I(e,t);if(n.job_id)z(n.job_id),be(`restore`),Se(`Queued...`);else{if(n.ok){let t=n.warnings?.length?n.warnings.join(`
|
|
5
|
+
`):``;A({type:`success`,title:u(`backup.restoreSuccess`,{defaultValue:`恢复完成`}),detail:n.api_key_status===`lost`?u(`backup.apiKeyLost`,{defaultValue:`备份来自不同平台/架构,请确认 API Key 配置是否仍然适用。`}):t||u(`backup.restoreOk`,{defaultValue:`实例已恢复。`}),actions:n.api_key_status===`lost`?[{label:u(`backup.configApiKey`,{defaultValue:`配置 API Key`}),onClick:()=>{A(null),d(`/instances/${e}/config`)}}]:void 0}),a?.()}else A({type:`error`,title:n.rolled_back?u(`backup.restoreFailedRolledBack`,{defaultValue:`恢复失败 — 已自动回滚`}):u(`backup.restoreFailed`,{defaultValue:`恢复失败`}),detail:n.warnings?.join(`
|
|
6
|
+
`)||``});H(),N(!1)}}catch(e){n(e.message||`Restore failed`,`error`),N(!1)}},Te=async t=>{if(!(!L.trim()||!fe.trim())){N(!0);try{let r=await me({source_id:e,backup_file:t,new_id:L,new_name:fe});b(null),r.ok?(n(u(`backup.createFromBackupOk`,{defaultValue:`新实例创建成功`}),`success`),r.warnings?.length&&r.warnings.forEach(e=>n(e,`info`)),d(`/instances/${r.instance_id}/config`)):n(r.detail||u(`backup.createFromBackupFail`,{defaultValue:`创建失败`}),`error`)}catch(e){n(e.message||`Failed`,`error`)}finally{N(!1),de(``),pe(``)}}};(0,q.useEffect)(()=>{if(!R)return;let e=setTimeout(()=>he(null),5e3);return()=>clearTimeout(e)},[R]);let G=async t=>{if(!ge){_e(!0);try{await te(e,t),n(u(`backup.deleted`,{defaultValue:`已删除`}),`info`),H()}catch(e){n(e.message||`Delete failed`,`error`)}finally{_e(!1),he(null)}}},K=async()=>{N(!0),C(!1);try{let t=await ue(e,{include_sessions:w});t.job_id?(z(t.job_id),be(`export`),Se(`Queued...`)):(D(t),N(!1))}catch(e){n(e.message||`Export failed`,`error`),N(!1)}finally{ee(!1)}};function Ee(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function De(e){let t=new Date(e);return`${t.getFullYear()}/${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`}function Oe(e){return e===`auto-backup`?u(`backup.typeAuto`,{defaultValue:`自动`}):e===`pre-restore`?u(`backup.typePreRestore`,{defaultValue:`恢复前`}):u(`backup.typeManual`,{defaultValue:`手动`})}let ke=`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`,Ae=`px-4 py-2 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 transition-all duration-150`,je=`px-4 py-2 border border-[var(--border)] text-muted rounded-md text-sm font-medium hover:bg-[var(--card-hover)] hover:text-foreground transition-all duration-150`;return(0,J.jsxs)(J.Fragment,{children:[ve&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50`,children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 max-w-sm w-full mx-4 space-y-4 shadow-2xl text-center`,children:[(0,J.jsx)(`div`,{className:`flex justify-center`,children:(0,J.jsx)(`span`,{className:`w-8 h-8 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin`})}),(0,J.jsx)(`p`,{className:`text-sm text-foreground`,children:xe||u(`backup.processing`,{defaultValue:`处理中...`})}),(0,J.jsx)(`p`,{className:`text-xs text-muted`,children:u(`backup.queueNote`,{defaultValue:`任务将按顺序执行`})})]})}),p&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,onClick:()=>{m(!1),ie(!1),se(`home`)},children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold text-foreground mb-2`,children:u(`backup.createTitle`,{defaultValue:`创建备份`})}),(0,J.jsx)(`p`,{className:`text-sm text-muted mb-4`,children:u(`backup.createDesc`,{defaultValue:`备份当前实例的配置、插件和数据。`})}),(0,J.jsxs)(`div`,{className:`space-y-2 mb-4`,children:[(0,J.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,J.jsx)(`input`,{type:`radio`,name:`backup-scope`,value:`home`,checked:oe===`home`,onChange:()=>se(`home`),className:`mt-1`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:u(`backup.scopeFull`,{defaultValue:`完整备份(含运行时)`})}),(0,J.jsx)(`div`,{className:`text-xs text-[var(--muted)]`,children:u(`backup.scopeFullDesc`,{defaultValue:`包含升级后的 OpenClaw 运行时——恢复后保持当前版本`})})]})]}),(0,J.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,J.jsx)(`input`,{type:`radio`,name:`backup-scope`,value:`state`,checked:oe===`state`,onChange:()=>se(`state`),className:`mt-1`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium`,children:u(`backup.scopeState`,{defaultValue:`仅数据(更小、可移植)`})}),(0,J.jsx)(`div`,{className:`text-xs text-[var(--muted)]`,children:u(`backup.scopeStateDesc`,{defaultValue:`仅 .openclaw/ 数据——体积小,兼容官方 OpenClaw 格式`})})]})]})]}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted cursor-pointer mb-5`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:re,onChange:e=>ie(e.target.checked),className:`rounded border-[var(--border)] bg-[var(--input-bg)]`}),u(`backup.includeSessions`,{defaultValue:`包含对话历史(体积较大)`})]}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{className:`flex-1 ${je}`,onClick:()=>{m(!1),ie(!1),se(`home`)},children:u(`common:action.cancel`,{defaultValue:`取消`})}),(0,J.jsx)(`button`,{className:`flex-1 ${Ae}`,onClick:U,disabled:M,children:M?u(`backup.creating`,{defaultValue:`备份中...`}):u(`backup.create`,{defaultValue:`备份`})})]})]})}),h&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,onClick:()=>g(!1),children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-2xl shadow-2xl flex flex-col max-h-[80vh]`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(`h3`,{className:`text-base font-semibold text-foreground mb-3 flex-shrink-0`,children:[u(`backup.manageTitle`,{defaultValue:`备份管理`}),(0,J.jsxs)(`span`,{className:`text-muted font-normal`,children:[` — `,t]})]}),(0,J.jsx)(`div`,{className:`bg-[var(--input-bg)] border border-[var(--border)] rounded-lg px-4 py-3 mb-3 flex-shrink-0`,children:(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(`span`,{className:`text-muted`,children:u(`backup.autoBackup`,{defaultValue:`自动备份`})}),B.enabled&&(0,J.jsxs)(`span`,{className:`text-muted opacity-70`,children:[u(`backup.interval`,{defaultValue:`每{{h}}小时备份`,h:B.interval_hours||24}),` | `,u(`backup.keep`,{defaultValue:`保留{{n}}份`,n:B.keep_count||7})]}),B.enabled&&B.last_backup_ok===!1&&(0,J.jsxs)(`span`,{className:`text-red-400 text-xs`,children:[`(`,u(`backup.failed`,{defaultValue:`失败`}),`)`]})]}),(0,J.jsx)(`button`,{disabled:we,onClick:async t=>{t.stopPropagation(),V(!0);try{B.enabled?await ae(e,{enabled:!1}):(await ae(e,{enabled:!0,interval_hours:24,keep_count:7}),n(u(`backup.autoEnabled`,{defaultValue:`自动备份已开启`}),`success`)),await H()}catch(e){n(e.message||`Failed`,`error`)}finally{V(!1)}},className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${we?`opacity-40`:``} ${B.enabled?`bg-green-500`:`bg-[var(--border)]`}`,children:(0,J.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${B.enabled?`translate-x-4`:`translate-x-0.5`}`})})]})}),(0,J.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:j.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted py-6 text-center`,children:u(`backup.noBackups`,{defaultValue:`暂无备份`})}):(0,J.jsx)(`div`,{className:`space-y-2`,children:j.map(t=>(0,J.jsxs)(`div`,{className:`flex items-center justify-between bg-[var(--card)] border border-[var(--border)] rounded-lg px-4 py-3 hover:border-[var(--border-hover)] transition-colors duration-150`,children:[(0,J.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,J.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded bg-[var(--input-bg)] border border-[var(--border)] text-muted font-medium flex-shrink-0`,children:Oe(t.type)}),(0,J.jsx)(`span`,{className:`text-sm text-foreground truncate`,children:De(t.created_at)}),(0,J.jsx)(`span`,{className:`text-xs text-muted flex-shrink-0`,children:Ee(t.size)})]})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1 ml-3 flex-shrink-0`,children:[(0,J.jsx)(`button`,{title:u(`backup.restore`,{defaultValue:`恢复`}),className:`p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-base`,onClick:()=>{ce(``),v(t.filename)},children:`↩`}),(0,J.jsx)(`button`,{title:u(`backup.createNew`,{defaultValue:`创建新实例`}),className:`p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-base`,onClick:()=>{de(``),pe(``),b(t.filename)},children:`⊕`}),t.type!==`pre-restore`&&(0,J.jsx)(`a`,{href:T(e,t.filename),download:!0,title:u(`backup.download`,{defaultValue:`下载`}),className:`p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-base underline decoration-current underline-offset-2`,children:`⬇`}),(0,J.jsx)(`button`,{title:u(`backup.delete`,{defaultValue:`删除`}),className:`p-2 rounded-md transition-colors duration-150 text-base ${R===t.filename?`bg-red-500/20 text-red-400`:`hover:bg-red-500/10 text-muted hover:text-red-400`}`,disabled:ge,onClick:()=>{R===t.filename?G(t.filename):he(t.filename)},children:ge&&R===t.filename?(0,J.jsx)(`span`,{className:`text-xs`,children:u(`backup.deleting`,{defaultValue:`Deleting...`})}):R===t.filename?u(`backup.confirmDelete`,{defaultValue:`Confirm?`}):(0,J.jsx)(J.Fragment,{children:`🗑`})}),R===t.filename&&(0,J.jsx)(`button`,{className:`p-2 rounded-md hover:bg-[var(--card-hover)] text-muted hover:text-foreground transition-colors duration-150 text-xs`,onClick:()=>he(null),children:u(`common:action.cancel`,{defaultValue:`Cancel`})})]})]},t.filename))})}),(0,J.jsxs)(`div`,{className:`flex justify-between items-center pt-4 mt-4 border-t border-[var(--border)] flex-shrink-0`,children:[(0,J.jsx)(`button`,{className:je,onClick:()=>g(!1),children:u(`common:action.close`,{defaultValue:`关闭`})}),(0,J.jsx)(`button`,{className:Ae,onClick:()=>{g(!1),m(!0)},children:u(`backup.createNew2`,{defaultValue:`创建新备份`})})]})]})}),_&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,onClick:()=>{v(null),ce(``)},children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold text-amber-400 mb-2`,children:u(`backup.restoreTitle`,{defaultValue:`恢复将覆盖当前数据`})}),(0,J.jsx)(`p`,{className:`text-sm text-muted mb-4`,children:u(`backup.restoreDesc`,{defaultValue:`已自动创建恢复前备份,如有问题可回滚。`})}),(0,J.jsx)(`p`,{className:`text-sm text-muted mb-2`,children:u(`backup.restoreConfirmLabel`,{defaultValue:`输入实例名确认恢复:`})}),(0,J.jsx)(`input`,{type:`text`,value:F,onChange:e=>ce(e.target.value),placeholder:t,className:`${ke} mb-4 focus:ring-amber-500/60 focus:border-amber-500/60`,autoFocus:!0}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{className:`flex-1 ${je}`,onClick:()=>{v(null),ce(``)},children:u(`common:action.cancel`,{defaultValue:`取消`})}),(0,J.jsx)(`button`,{className:`flex-1 px-4 py-2 bg-red-600 text-white rounded-md text-sm font-medium hover:bg-red-700 disabled:opacity-40 transition-colors duration-150`,onClick:()=>W(_),disabled:M||F!==t,children:M?u(`backup.restoring`,{defaultValue:`恢复中...`}):u(`backup.confirmRestore`,{defaultValue:`确认恢复`})})]})]})}),y&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,onClick:()=>{b(null),de(``),pe(``)},children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold text-foreground mb-4`,children:u(`backup.createFromTitle`,{defaultValue:`从备份创建新实例`})}),(0,J.jsxs)(`div`,{className:`space-y-4 mb-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:u(`backup.newName`,{defaultValue:`新实例名称`})}),(0,J.jsx)(`input`,{type:`text`,value:fe,onChange:e=>pe(e.target.value),placeholder:u(`backup.newNamePlaceholder`,{defaultValue:`我的 Agent 副本`}),className:ke,autoFocus:!0})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:u(`backup.newId`,{defaultValue:`新实例 ID`})}),(0,J.jsx)(`input`,{type:`text`,value:L,onChange:e=>de(e.target.value),placeholder:u(`backup.newIdPlaceholder`,{defaultValue:`my-agent-copy`}),className:`${ke} font-mono text-[13px]`})]})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted opacity-70 mb-4`,children:u(`backup.createFromNote`,{defaultValue:`API Key 和 IM 凭证不会复制,需自行配置。`})}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{className:`flex-1 ${je}`,onClick:()=>{b(null),de(``),pe(``)},children:u(`common:action.cancel`,{defaultValue:`取消`})}),(0,J.jsx)(`button`,{className:`flex-1 ${Ae}`,onClick:()=>Te(y),disabled:M||!L.trim()||!fe.trim(),children:M?u(`backup.creatingInstance`,{defaultValue:`创建中...`}):u(`backup.createInstance`,{defaultValue:`创建`})})]})]})}),S&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50`,onClick:()=>C(!1),children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 max-w-md w-full mx-4 space-y-4 shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:u(`backup.exportTitle`,{defaultValue:`导出(分享)`})}),(0,J.jsx)(`p`,{className:`text-sm text-muted`,children:u(`backup.exportDesc`,{defaultValue:`生成可分享的导出包,API Key 和凭证将自动移除。`})}),(0,J.jsxs)(`div`,{className:`bg-[var(--input-bg)] border border-[var(--border)] rounded-lg p-3 space-y-1.5 text-sm text-muted`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-green-400`,children:`✓`}),u(`backup.exportConfig`,{defaultValue:`配置 (openclaw.json, 已清洗)`})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-green-400`,children:`✓`}),u(`backup.exportPlugins`,{defaultValue:`插件 (extensions)`})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-green-400`,children:`✓`}),u(`backup.exportWorkspace`,{defaultValue:`工作区 / Skills`})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`text-red-400`,children:`✗`}),u(`backup.exportNoKeys`,{defaultValue:`API Key / 凭证 — 已移除`})]})]}),(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted cursor-pointer`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>ee(e.target.checked),className:`rounded border-[var(--border)] bg-[var(--input-bg)]`}),u(`backup.exportIncludeSessions`,{defaultValue:`包含对话历史`})]}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,J.jsx)(`button`,{className:je,onClick:()=>C(!1),children:u(`common:action.cancel`,{defaultValue:`取消`})}),(0,J.jsx)(`button`,{className:Ae,onClick:K,disabled:M,children:M?u(`backup.exporting`,{defaultValue:`导出中...`}):u(`backup.exportBtn`,{defaultValue:`导出`})})]})]})}),E&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50`,children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 max-w-md w-full mx-4 space-y-4 shadow-2xl`,children:[(0,J.jsx)(`h3`,{className:`text-lg font-semibold text-green-400`,children:u(`backup.exportDone`,{defaultValue:`导出完成`})}),(0,J.jsxs)(`p`,{className:`text-sm text-muted`,children:[E.filename,` (`,Ee(E.size),`)`]}),E.warnings&&E.warnings.length>0&&(0,J.jsx)(`div`,{className:`space-y-1`,children:E.warnings.map((e,t)=>(0,J.jsx)(`p`,{className:`text-xs text-amber-400`,children:e},t))}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,J.jsx)(`a`,{href:f(e,E.filename),download:!0,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-150 inline-block text-center no-underline`,children:u(`backup.downloadExport`,{defaultValue:`下载`})}),(0,J.jsx)(`button`,{className:je,onClick:()=>D(null),children:u(`common:action.close`,{defaultValue:`关闭`})})]})]})}),O&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl`,children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold mb-2 ${O.type===`success`?`text-green-400`:`text-red-400`}`,children:O.title}),O.detail&&(0,J.jsx)(`p`,{className:`text-sm text-muted mb-4 whitespace-pre-wrap`,children:O.detail}),(0,J.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[O.actions?.map((e,t)=>(0,J.jsx)(`button`,{className:Ae,onClick:e.onClick,children:e.label},t)),(0,J.jsx)(`button`,{className:je,onClick:()=>A(null),children:u(`common:action.close`,{defaultValue:`关闭`})})]})]})})]})}function Bt({yaml:e,env:t,onYamlChange:n,onEnvChange:r}){return(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`border-b border-[var(--border)] px-4 py-2 flex items-center justify-between`,children:(0,J.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:`config.yaml`})}),(0,J.jsx)(`textarea`,{value:e,onChange:e=>n(e.target.value),className:`w-full font-mono text-[13px] p-4 min-h-[320px] focus:outline-none resize-y text-foreground bg-transparent`,spellCheck:!1})]}),(0,J.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`border-b border-[var(--border)] px-4 py-2 flex items-center justify-between`,children:(0,J.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:`.env`})}),(0,J.jsx)(`textarea`,{value:t,onChange:e=>r(e.target.value),className:`w-full font-mono text-[13px] p-4 min-h-[220px] focus:outline-none resize-y text-foreground bg-transparent`,spellCheck:!1})]})]})}function Vt(e,t){if(e==null)return`-`;let n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);return n>0?t(`instance:uptime.days`,{d:n,h:r}):r>0?t(`instance:uptime.hours`,{h:r,m:i}):t(`instance:uptime.minutes`,{m:i})}function Ht(e){return(typeof e==`string`?e.trim():``)||`app`}function Ut(...e){for(let t of e){let e=typeof t==`string`?t.trim():``;if(e)return e}return``}function Wt(e){let t=e?.upgrade;return t?.updateAvailable===!0&&typeof t.currentVersion==`string`&&typeof t.latestVersion==`string`?t:null}function Gt(e,t){return Ut((Array.isArray(e?.integrations)?e.integrations:[]).find(e=>typeof e?.kind==`string`&&e.kind.trim())?.kind,t?.integrationKind,e?.runtimeVersion?.integrationKind,t?.runtimeVersion?.integrationKind,e?.runtime?.integrationKind)}function Kt(e,t,n){let r=Gt(e,t),i=e?.capabilities?.ui?.chatPanel,a=Ge(e),o=Array.isArray(e?.provides)&&e.provides.some(e=>String(e?.protocol||``).toLowerCase()===`terminal`&&e?.terminal),s=typeof e?.embeddedUi?.url==`string`&&e.embeddedUi.url.trim().length>0,c=a||o||s||i===`iframe`||i===`inline`,l=!!t,u=!!n&&n.state!==`empty`,d=e?.capabilities?.pluginInstall===!0,f=l?`config`:u?`connections`:`logs`;return{displayKind:Ht(r||e?.definitionId||e?.definition?.id||e?.spec_id),showConfig:l,showConnections:u,showQuickConfig:d,showLogs:!0,showUsage:!0,showTerminal:o,showEmbeddedUi:s,hasChatSurface:c,fallbackTab:f}}var qt=[Ie,Le,Re,ze];function Jt(e){for(let t of qt){let n=t=>t?.find(t=>t.id===e)??null;if(t.groups)for(let e of t.groups){let t=n(e.items);if(t)return t}let r=n(t.items);if(r)return r}return null}function Yt(e,t){let n=JSON.parse(JSON.stringify(e??{})),r=W.find(e=>e.id===t);if(r){if(n.channels||={},n.plugins||={},n.plugins.entries||(n.plugins.entries={}),n.channels[t])n.channels[t].enabled=!0;else{let e={enabled:!0,...r.defaults??{}};r.fields.forEach(t=>{t.key in e||(e[t.key]=``)}),n.channels[t]=e}return n.plugins.entries[t]||(n.plugins.entries[t]={enabled:!0}),n}let i={"skill-vetter":{"skill-vetter":{enabled:!0}},"skill-finder":{"skill-finder":{enabled:!0}},"skill-browser":{"skill-browser":{enabled:!0}}};if(t in i)return n.skills||={},Object.assign(n.skills,i[t]),n;let a={};return t in a?(n.mcp||={},n.mcp.servers||(n.mcp.servers={}),Object.assign(n.mcp.servers,a[t]),n):n}function Xt(e){return e.replace(/^(https?:\/\/)(localhost|127\.0\.0\.1)(?=[:/]|$)/i,(e,t)=>`${t}${window.location.hostname}`)}function Zt(e=[]){return new Set(e.filter(e=>e.startsWith(`env.`)).map(e=>e.slice(4)))}function Qt(e,t=[]){let n=Zt(t);return n.size?e.split(`
|
|
7
|
+
`).map(e=>{let t=e.trim();if(!t||t.startsWith(`#`)||!t.includes(`=`))return e;let r=e.indexOf(`=`),i=e.slice(0,r).replace(/^export\s+/,``).trim();return n.has(i)?`${e.slice(0,r)}=***`:e}).join(`
|
|
8
|
+
`):e}function $t(e,t,n=[]){let r=Zt(n);if(!r.size)return e;let i=new Map;for(let e of t.split(`
|
|
9
|
+
`)){let t=e.trim();if(!t||t.startsWith(`#`)||!t.includes(`=`))continue;let n=e.indexOf(`=`),r=e.slice(0,n).replace(/^export\s+/,``).trim(),a=e.slice(n+1);i.set(r,a)}return e.split(`
|
|
10
|
+
`).map(e=>{let t=e.trim();if(!t||t.startsWith(`#`)||!t.includes(`=`))return e;let n=e.indexOf(`=`),a=e.slice(0,n).replace(/^export\s+/,``).trim(),o=e.slice(n+1).trim();if(!r.has(a)||o!==`***`)return e;let s=i.get(a);return s==null?e:`${e.slice(0,n)}=${s}`}).join(`
|
|
11
|
+
`)}function en(){let{id:e,tab:t}=s(),a=i(),{showToast:o}=xe(),{t:c}=r([`instance`,`common`,`data`]),[f,_]=(0,q.useState)(null),x=(0,q.useRef)(0),[S,T]=(0,q.useState)(t===`overview`?`chat`:t||`chat`),[E,k]=(0,q.useState)(null),[j,te]=(0,q.useState)(null),[ne,M]=(0,q.useState)(!1),[re,ae]=(0,q.useState)(``),[P,I]=(0,q.useState)(!1),[le,L]=(0,q.useState)(``),[ue,me]=(0,q.useState)([]),[R,he]=(0,q.useState)(`stderr`),[ge,_e]=(0,q.useState)(``),[B,Ce]=(0,q.useState)(null),[V,H]=(0,q.useState)(``),[U,W]=(0,q.useState)(!1),[Te,G]=(0,q.useState)(!1),[K,Ee]=(0,q.useState)(``),[De,Oe]=(0,q.useState)(null),[Ae,Ne]=(0,q.useState)(null),[Pe,Ie]=(0,q.useState)(!1),[Re,ze]=(0,q.useState)(!1),[Be,Ve]=(0,q.useState)(``),[He,Ue]=(0,q.useState)(``),[We,Ke]=(0,q.useState)(``),[qe,Je]=(0,q.useState)(!1),[Ye,Xe]=(0,q.useState)(!1),[Ze,Qe]=(0,q.useState)(!1),[$e,et]=(0,q.useState)(null),[tt,nt]=(0,q.useState)(!1),[rt,it]=(0,q.useState)(`im`),[at,ot]=(0,q.useState)(`general`),[Y,st]=(0,q.useState)(null),[ct,lt]=(0,q.useState)({}),[ut,dt]=(0,q.useState)(``),[ft,pt]=(0,q.useState)(``),[mt,gt]=(0,q.useState)(``),[_t,vt]=(0,q.useState)({servers:[],installed:!1,loading:!1}),[X,Z]=(0,q.useState)(null),Ct=(0,q.useRef)(!1),wt=(0,q.useRef)(!1),[Q,Tt]=(0,q.useState)(!1),Et=(0,q.useRef)(null),Dt=(0,q.useRef)(null),[Ot,kt]=(0,q.useState)(!1),At=(0,q.useRef)(null),[jt,Mt]=(0,q.useState)(null),[Nt,Pt]=(0,q.useState)(null),$=Kt(f,j,De),Ft=Gt(f,j),It=$.fallbackTab;(0,q.useEffect)(()=>{if(!Ft){Mt(null),Pt(null);return}let e=Me[Ft],t=!1;return e?.chatComponent?e.chatComponent().then(e=>{t||Mt(()=>e.default)}).catch(e=>{console.warn(`[runtime] failed to load chat component for ${Ft}:`,e)}):Mt(null),e?.configPanel?e.configPanel().then(e=>{t||Pt(()=>e.default)}).catch(e=>{console.warn(`[runtime] failed to load config panel for ${Ft}:`,e)}):Pt(null),()=>{t=!0}},[Ft]);let Ht=(0,q.useRef)(e),Ut=(0,q.useRef)(Q);Ht.current=e,Ut.current=Q,(0,q.useEffect)(()=>{tt&&e&&D(e).then(st).catch(()=>{})},[tt,e]),(0,q.useEffect)(()=>{if(!e){te(null);return}y(e).then(te).catch(()=>te(null))},[e]),(0,q.useEffect)(()=>{if(!e){Oe(null);return}let t=!1,n,r=()=>{b(e).then(e=>{t||Oe(e)}).catch(()=>{}).finally(()=>{t||(n=setTimeout(r,3e4))})};return r(),()=>{t=!0,n&&clearTimeout(n)}},[e]);let Zt=$.showConnections;(0,q.useEffect)(()=>{tt&&rt===`mcp`&&e&&(vt(e=>({...e,loading:!0})),O(e).then(e=>vt({servers:e.servers,installed:e.installed,loading:!1})).catch(()=>vt(e=>({...e,loading:!1}))))},[tt,rt,e]),(0,q.useEffect)(()=>{t&&T(t===`overview`?`chat`:t)},[t]),(0,q.useEffect)(()=>{Ot&&S===`config`&&E&&(kt(!1),I(!1),setTimeout(()=>{let e=document.getElementById(`im-channel-section`);e?e.scrollIntoView({behavior:`smooth`,block:`start`}):window.scrollTo({top:document.body.scrollHeight,behavior:`smooth`})},200))},[Ot,S,E]);let en=(0,q.useCallback)(()=>{let e=Ht.current;e&&!Ut.current&&h(e).then(e=>{_(e),e.llmError&&e.llmError.timestamp>x.current&&Date.now()-e.llmError.timestamp<6e4&&(o(`LLM ${c(`common:error`)} (${e.llmError.code}): ${e.llmError.message}`,`error`),x.current=e.llmError.timestamp)}).catch(()=>{})},[o,c]);(0,q.useEffect)(()=>{en();let e=setInterval(en,5e3);return()=>clearInterval(e)},[e,en]);let tn=f?.capabilities?.ui?.chatPanel,nn=Ge(f),rn=Array.isArray(f?.provides)?f.provides.find(e=>String(e?.protocol||``).toLowerCase()===`terminal`&&e?.terminal):null,an=typeof f?.embeddedUi?.url==`string`?Xt(f.embeddedUi.url.trim()):``,on=!!an,sn=$.hasChatSurface,cn=f?.service?.status===`running`,ln=on?an:V;(0,q.useEffect)(()=>{if(!(!e||!f)){if(nn){H(``),W(!1),G(!1);return}if(on){H(e=>(e!==an&&G(!1),an));return}if(tn!==`iframe`){H(``),W(!1),G(!1);return}C(e).then(e=>{let t=typeof e?.url==`string`?e.url.trim():``;if(!t)throw Error(`No gateway launch URL returned`);H(e=>(e!==t&&G(!1),t))}).catch(e=>{H(``),o(e?.message||c(`gatewayLaunchFailed`),`error`)})}},[an,on,e,tn,nn,cn,o,c]),(0,q.useEffect)(()=>{!e||!f||!sn&&S===`chat`&&(T(It),a(`/instances/${e}/${It}`,{replace:!0}))},[S,It,sn,e,f,a]);let un=(0,q.useRef)(!1);un.current=U,(0,q.useEffect)(()=>{if(!V||!cn){W(!1),G(!1);return}if(on){W(!0),G(!0);return}if(un.current)return;let e=!1,t=0,n=()=>{e||t>=60||(t++,fetch(V,{method:`HEAD`,credentials:`include`}).then(t=>{!e&&t.ok&&W(!0)}).catch(()=>{}))};n();let r=setInterval(n,3e3);return()=>{e=!0,clearInterval(r)}},[V,on,cn]);let[dn,fn]=(0,q.useState)({}),pn=Object.values(dn).includes(`installing`),mn=(0,q.useRef)(new Set),hn=(0,q.useRef)(o);hn.current=o;let gn=(0,q.useRef)(c);gn.current=c,(0,q.useEffect)(()=>{if(!e||!($.showQuickConfig&&(S===`config`||pn)))return;let t=!1,n=()=>{t||m(e).then(e=>{if(t)return;let n={};for(let[t,r]of Object.entries(e.plugins))n[t]=r.status;for(let t of mn.current){let r=n[t];if(r===`installed`)hn.current(gn.current(t===`feishu`?`feishu.pluginInstalled`:`weixin.pluginInstalled`),`success`),mn.current.delete(t);else if(r===`failed`||r===`not_installed`){let n=e.plugins[t]?.error;hn.current(gn.current(t===`feishu`?`feishu.pluginFailed`:`weixin.pluginFailed`)+(n?`: `+n:``),`error`),mn.current.delete(t)}}fn(n)}).catch(()=>{})};n();let r=setInterval(n,3e3);return()=>{t=!0,clearInterval(r)}},[e,S,pn,$.showQuickConfig]),(0,q.useEffect)(()=>{tt&&e&&$.showQuickConfig&&m(e).then(e=>{let t={};for(let[n,r]of Object.entries(e.plugins))t[n]=r.status;fn(t)}).catch(()=>{})},[tt,e,$.showQuickConfig]);let _n=t=>{e&&(ee(e,t).catch(()=>{}),fn(e=>({...e,[t]:`installing`})),mn.current.add(t),o(c(t===`feishu`?`feishu.installing`:`weixin.installing`),`info`))};(0,q.useEffect)(()=>{if(!ne)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[ne]),(0,q.useEffect)(()=>{S===`config`&&e&&ie(e).then(e=>{if(!j)return;let t=Dt.current;if(Dt.current=null,j.format===`yaml+env`){let t=e;At.current=t;let n={...t,env:Qt(t.env,j.secretFields)};k(n),L(``),I(!1),M(!1);return}At.current=null;let n=t?Yt(e,t):e;k(n),L(JSON.stringify(n,null,2)),M(!!t)}).catch(()=>{}),S===`usage`&&e&&g(e).then(Ce).catch(()=>{})},[S,j,e]);let vn=()=>{e&&l(e,200,R).then(e=>{me(e.lines);let t=Et.current?.parentElement;t&&t.scrollHeight-t.scrollTop-t.clientHeight<80&&setTimeout(()=>Et.current?.scrollIntoView({behavior:`smooth`}),100)}).catch(()=>{})};je(vn,3e3,S===`logs`&&!!e),(0,q.useEffect)(()=>{S===`logs`&&vn()},[R]);let yn=()=>{Ne(Date.now()+2e4),W(!1),G(!1)};(0,q.useEffect)(()=>{if(!Ae)return;let e=Ae-Date.now();if(e<=0){Ne(null);return}let t=setTimeout(()=>{Ne(null),en()},e);return()=>clearTimeout(t)},[Ae,en]);let bn=async t=>{if(e){Ee(t);try{let n=null;t===`start`&&(n=await p(e,`instance-detail`)),t===`stop`&&(n=await oe(e,`instance-detail`)),t===`restart`&&(n=await N(e,`instance-detail`),yn()),o(c(t===`start`?`action.startHint`:t===`stop`?`action.stopDone`:`action.restartHint`),t===`stop`?`success`:`info`);let r=n?.port_allocation;r&&typeof r.from==`number`&&typeof r.to==`number`&&r.from!==r.to&&o(c(`common:toast.portReallocated`,{defaultValue:`端口 {{from}} 被占用,已自动切换到 {{to}}`,from:r.from,to:r.to}),`info`),(t===`start`||t===`restart`)&&a(`/instances/${e}`),setTimeout(en,1e3)}catch(e){o(e.message||c(`common:error.operationFailed`),`error`)}finally{Ee(``)}}},xn=async()=>{if(!(!e||!f)){Ee(`upgrade`);try{await w(e,`instance-detail`),yn(),o(c(`appUpgrade.started`),`success`),setTimeout(en,1500)}catch(e){o(e.message||c(`appUpgrade.failed`),`error`)}finally{Ee(``)}}},Sn=async t=>{if(!e)return;nt(!1),Ct.current=!1;let n=t===`feishu`?`feishu`:`openclaw-weixin`,r=dn[n];if(r===`installing`){o(c(t===`feishu`?`feishu.waitingInstall`:`weixin.waitingInstall`),`info`);return}if(r!==`installed`){_n(n);return}wt.current=!1,Z({type:t,qrUrl:``,sessionKey:``,status:`loading`,message:c(`qr.gettingQr`)});try{let n=null;for(let r=0;r<3;r++){if(wt.current)return;try{if(n=t===`feishu`?await fe(e):await d(e),n?.qrcodeUrl)break}catch{r<2&&await new Promise(e=>setTimeout(e,1500))}}if(wt.current)return;if(!n?.qrcodeUrl){Z(e=>e?{...e,status:`error`,message:c(`qr.getFailed`)}:null);return}Z({type:t,qrUrl:n.qrcodeUrl,sessionKey:n.sessionKey,status:`waiting`,message:c(t===`feishu`?`qr.scanFeishu`:`qr.scanWeixin`)}),Ct.current=!0;let r=0,i=async n=>{if(!(!Ct.current||wt.current))try{let a=t===`feishu`?await F(e,n):await ce(e,n);if(wt.current)return;if(r=0,a.connected){Ct.current=!1,Z(e=>e?{...e,qrUrl:``,status:`confirmed`,message:a.message||c(`qr.loginSuccess`)}:null);return}if(a.status===`expired`){Ct.current=!1,Z(e=>e?{...e,status:`error`,message:a.message||c(`qr.expired`)}:null);return}a.status===`refreshed`&&a.qrcodeUrl?Z(e=>e?{...e,qrUrl:a.qrcodeUrl,message:c(`qr.refreshed`)}:null):a.status===`scaned`&&Z(e=>e?{...e,status:`scaned`,message:a.message||c(`qr.scaned`)}:null),setTimeout(()=>i(n),2e3)}catch{if(!Ct.current||wt.current)return;if(r+=1,r>=6){Ct.current=!1,Z(e=>e?{...e,status:`error`,message:c(`qr.pollFailed`,{defaultValue:`轮询失败,请刷新后重试`})}:null);return}setTimeout(()=>i(n),3e3)}};setTimeout(()=>i(n.sessionKey),2e3)}catch{wt.current||Z(e=>e?{...e,status:`error`,message:c(`qr.getFailed`)}:null)}},Cn=(e,t)=>{let n=0,r=()=>{try{let i=document.getElementById(`gateway-iframe`);if(!i){++n<50&&setTimeout(r,200);return}let a=i.contentDocument;if(!a||a.readyState===`loading`){++n<50&&setTimeout(r,200);return}let o=a.querySelector(`openclaw-app`);if(!o){++n<50&&setTimeout(r,200);return}if(t){if(!o.connected&&++n<50){setTimeout(r,200);return}o.handleSendChat(e)}else o.chatMessage=e}catch{document.getElementById(`gateway-iframe`)?.contentWindow?.postMessage({type:`jishu:inject-cmd`,cmd:e,send:t},`*`)}};S===`chat`?setTimeout(r,100):(Nn(`chat`),setTimeout(r,800))},wn=e=>{if(nt(!1),e===`feishu`||e===`openclaw-weixin`){Sn(e===`feishu`?`feishu`:`weixin`);return}let t=Jt(e);if(t&&t.cmd!==void 0){Cn(t.cmd,t.send!==!1);return}if(E!==null&&S===`config`){let t=Yt(E,e);k(t),L(JSON.stringify(t,null,2)),M(!0),o(c(`config.presetAdded`),`info`)}else Dt.current=e,Nn(`config`),o(c(`config.navigatingToConfig`),`info`)},Tn=e=>{k(e),j?.format===`json`&&L(JSON.stringify(e,null,2)),M(!0)},En=e=>{k(t=>({...t||{format:`yaml+env`,env:``},format:`yaml+env`,yaml:e})),M(!0)},Dn=e=>{k(t=>({...t||{format:`yaml+env`,yaml:``},format:`yaml+env`,env:e})),M(!0)},On=e=>{L(e),M(!0);try{k(JSON.parse(e)),ae(``)}catch{ae(c(`config.jsonError`))}},kn=e=>{if(!e)return`{}`;let t=JSON.parse(JSON.stringify(e)),n=t?.models?.providers;if(n&&typeof n==`object`)for(let[e,t]of Object.entries(n))e.startsWith(`js-`)&&t?.apiKey&&(t.apiKey=`(proxy token, auto-managed)`);let r=t?.[`x-jishushell`]?.proxy?.upstream;return r&&r.apiKey===``&&r.hasApiKey&&(r.apiKey=`(saved, leave empty to keep, enter new value to update)`),JSON.stringify(t,null,2)},An=e=>{let t=JSON.parse(e),n=t?.[`x-jishushell`]?.proxy?.upstream;n?.apiKey===`(saved, leave empty to keep, enter new value to update)`&&delete n.apiKey;let r=t?.models?.providers;if(r&&typeof r==`object`)for(let[e,t]of Object.entries(r))e.startsWith(`js-`)&&t?.apiKey===`(proxy token, auto-managed)`&&delete t.apiKey;return t},jn=async t=>{if(!(!e||!E||!j)){ae(``),Ie(!0);try{let n=j.format===`yaml+env`?{format:`yaml+env`,yaml:String(E.yaml||``),env:$t(String(E.env||``),At.current?.env||``,j.secretFields)}:An(P?le:JSON.stringify(E)),r=await A(e,n);if(r?.config&&(j.format===`yaml+env`?(At.current=r.config,k({...r.config,env:Qt(r.config.env,j.secretFields)}),L(``)):(k(r.config),L(JSON.stringify(r.config,null,2)))),M(!1),t)try{await N(e,`config-save`),yn(),o(c(`config.savedAndRestarted`),`success`),T(`chat`),a(`/instances/${e}`,{replace:!0})}catch(e){o(c(`config.savedButRestartFailed`,{error:e.message||``}),`error`),ae(c(`config.restartFailed`,{error:e.message||``}))}else o(c(`config.saved`),`success`);setTimeout(en,1e3)}catch(e){ae(e instanceof SyntaxError?c(`config.jsonParseError`,{error:e.message}):e.message||c(`common:error.saveFailed`))}finally{Ie(!1)}}},Mn=async()=>{if(!e||Be.trim()!==f?.name?.trim()||Q||qe)return;let t=He.trim();if(Ke(``),t){Je(!0);try{await v({sudoPassword:t})}catch(e){Ke(e?.message||c(`newInstance:sudoDialog.passwordInvalid`,{defaultValue:`sudo 密码错误,请重新输入。`})),Ue(``),Je(!1);return}Je(!1)}Ut.current=!0,Tt(!0);try{await pe(e,Ye,t?{sudoPassword:t}:void 0),a(`/`,{replace:!0})}catch(e){o(e.message||c(`common:error.deleteFailed`),`error`),Tt(!1)}},Nn=t=>{if(ne&&S===`config`&&t!==`config`){if(!window.confirm(c(`config.unsavedWarning`)))return;M(!1)}T(t),a(`/instances/${e}/${t}`,{replace:!0})};if(!f)return(0,J.jsx)(`div`,{className:`p-6 2xl:px-6 2xl:py-4 max-w-5xl xl:max-w-6xl 2xl:max-w-none mx-auto`,children:(0,J.jsxs)(`div`,{className:`animate-pulse space-y-4`,children:[(0,J.jsx)(`div`,{className:`h-6 w-48 bg-[var(--card)] rounded`}),(0,J.jsx)(`div`,{className:`h-10 w-full bg-[var(--card)] rounded`}),(0,J.jsx)(`div`,{className:`h-40 bg-[var(--card)] rounded-lg`})]})});let Pn=f.service?.status||`stopped`,Fn=Pn===`running`,In=Pn===`pending`,Ln=Pn===`failed`||Pn===`dead`,Rn=f?.capabilities?.backupRestore!==!1,zn=Wt(f),Bn=(In||Ae!=null&&Date.now()<Ae)&&!Ln,Vn=Fn,Hn=c(Bn?`common:status.starting`:Fn?`common:status.running`:Pn===`failed`?`common:status.failed`:Pn===`dead`?`common:status.crashed`:`common:status.stopped`),Un=Bn?`text-amber-400`:Fn?`text-emerald-400`:Ln?`text-red-400`:`text-muted`,Wn=Bn?`bg-amber-400 animate-pulse shadow-[0_0_6px_rgba(251,191,36,0.5)]`:Fn?`bg-emerald-500 shadow-[0_0_6px_rgba(16,185,129,0.6)]`:Ln?`bg-red-500 shadow-[0_0_6px_rgba(239,68,68,0.6)]`:`bg-[var(--muted)] opacity-40`;return(0,J.jsxs)(`div`,{className:`p-6 2xl:px-6 2xl:py-4 max-w-5xl xl:max-w-6xl 2xl:max-w-none mx-auto`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:f.name}),(0,J.jsx)(`span`,{className:`px-2 py-0.5 rounded-full border border-[var(--border)] text-[11px] text-muted uppercase tracking-[0.08em]`,children:$.displayKind}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`w-2 h-2 rounded-full ${Wn}`}),(0,J.jsx)(`span`,{className:`text-xs font-medium ${Un}`,children:Hn}),Fn&&!U&&(f?.capabilities?.ui?.chatPanel===`iframe`||on)&&(0,J.jsx)(`span`,{className:`text-[11px] text-amber-400/90`,children:c(`status.gatewayPending`)}),Zt&&e&&(0,J.jsx)(Rt,{instanceId:e})]})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S===`chat`&&!nn&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`a`,{href:ln||void 0,target:`_blank`,rel:`noopener noreferrer`,"aria-disabled":!ln,title:c(`openInWindow`),className:`p-1.5 border border-[var(--border)] rounded-md transition-all duration-150 ${ln?`text-muted hover:text-foreground hover:bg-[var(--card-hover)] cursor-pointer`:`pointer-events-none text-muted opacity-30`}`,children:(0,J.jsx)(ve,{className:`w-4 h-4`})}),(0,J.jsx)(`button`,{onClick:()=>{W(!1),G(!1)},disabled:!V,title:c(`reload`),className:`p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] disabled:opacity-30 transition-all duration-150`,children:(0,J.jsx)(z,{className:`w-4 h-4`})})]}),$.showConfig&&(0,J.jsxs)(`button`,{onClick:()=>Nn(`config`),title:c(`tab.config`),className:`p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-all duration-150 relative`,children:[(0,J.jsx)(we,{className:`w-4 h-4`}),ne&&(0,J.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 w-1.5 h-1.5 rounded-full bg-amber-400`})]}),Zt&&(0,J.jsx)(`button`,{onClick:()=>Nn(`connections`),title:c(`tab.connections`),"aria-label":c(`tab.connections`),className:`p-1.5 border rounded-md transition-all duration-150 ${S===`connections`?`border-[#0066FF]/50 bg-[#0066FF]/10 text-[#0066FF]`:`border-[var(--border)] text-muted hover:text-foreground hover:bg-[var(--card-hover)]`}`,children:(0,J.jsx)(ye,{className:`w-4 h-4`})}),$.showQuickConfig&&(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsxs)(`button`,{onClick:()=>nt(e=>!e),title:c(`quickSkill`),className:`flex items-center gap-1 px-2.5 py-1.5 border border-[#0066FF]/30 rounded-md text-xs font-medium text-[#0066FF] bg-[#0066FF]/5 hover:bg-[#0066FF]/10 transition-all duration-150`,children:[(0,J.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,J.jsx)(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})}),(0,J.jsx)(`span`,{className:`hidden sm:inline`,children:c(`quickSkill`)}),(0,J.jsx)(Se,{className:`w-3 h-3 transition-transform duration-150 ${tt?`rotate-180`:``}`})]}),tt&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>nt(!1)}),(0,J.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-80 bg-background border border-[var(--border)] rounded-lg shadow-2xl z-20 overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`flex border-b border-[var(--border)]`,children:[`im`,`skills`,`mcp`,`slash`].map(e=>{let t={im:{emoji:`💬`,label:c(`quickSkill.im`)},skills:{emoji:`⚡`,label:c(`quickSkill.skills`)},mcp:{emoji:`🔌`,label:c(`quickSkill.mcp`)},slash:{emoji:`/`,label:c(`quickSkill.slash`)}}[e];return(0,J.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),it(e)},className:`flex-1 py-2 flex flex-col items-center gap-0.5 text-[10px] font-medium transition-colors border-b-2 ${rt===e?`text-[#0066FF] border-[#0066FF] bg-[#0066FF]/5`:`text-muted border-transparent hover:text-foreground hover:bg-[var(--card-hover)]`}`,children:[(0,J.jsx)(`span`,{className:`text-sm leading-none`,children:t.emoji}),(0,J.jsx)(`span`,{children:t.label})]},e)})}),(0,J.jsxs)(`div`,{className:`max-h-[480px] overflow-y-auto`,children:[rt===`im`&&(0,J.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,J.jsxs)(`button`,{onClick:()=>wn(`feishu`),className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-[#3370FF]/30 bg-[#3370FF]/5 hover:bg-[#3370FF]/10 transition-all duration-150`,children:[(0,J.jsx)(`img`,{src:`https://s1.aigei.com/src/img/png/5a/5ad236651e0c4a6b940d2e1d2bf29749.png?imageMogr2/auto-orient/thumbnail/!282x282r/gravity/Center/crop/282x282/quality/85/%7CimageView2/2/w/282&e=2051020800&token=P7S2Xpzfz11vAkASLTkfHN7Fw-oOZBecqeJaxypL:bcW1ujPdX64WlxeEm9SpuJ5H2KY=`,alt:c(`channel.feishu`),className:`w-8 h-8 rounded-md flex-shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,J.jsxs)(`div`,{className:`text-left flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold text-[#3370FF]`,children:c(`channel.feishu`)}),(0,J.jsx)(`div`,{className:`text-[11px] text-muted mt-0.5`,children:dn.feishu===`installing`?c(`quickSkill.pluginInstalling`):dn.feishu===`installed`?Y?.im.feishu?`✓ ${c(`quickSkill.bound`)}`:c(`quickSkill.scanToBind`):c(`quickSkill.clickToInstall`)})]}),dn.feishu===`installing`&&(0,J.jsx)(`div`,{className:`w-4 h-4 border-2 border-[#3370FF]/30 border-t-[#3370FF] rounded-full animate-spin flex-shrink-0`}),dn.feishu===`installed`&&Y?.im.feishu&&(0,J.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-500/15 text-emerald-400 font-medium flex-shrink-0`,children:c(`quickSkill.bound`)})]}),(0,J.jsxs)(`button`,{onClick:()=>wn(`openclaw-weixin`),className:`w-full flex items-center gap-3 px-4 py-3 rounded-lg border border-[#07C160]/30 bg-[#07C160]/5 hover:bg-[#07C160]/10 transition-all duration-150`,children:[(0,J.jsx)(`img`,{src:`https://sgnewres.wechat.com/t/ofs-wechat/newsroom-web/res/_next/static/media/wechat-with-color.7a890de8.svg`,alt:c(`channel.weixin`),className:`w-8 h-8 rounded-md flex-shrink-0`,onError:e=>{e.target.style.display=`none`}}),(0,J.jsxs)(`div`,{className:`text-left flex-1`,children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold text-[#07C160]`,children:c(`channel.weixin`)}),(0,J.jsx)(`div`,{className:`text-[11px] text-muted mt-0.5`,children:dn[`openclaw-weixin`]===`installing`?c(`quickSkill.pluginInstalling`):dn[`openclaw-weixin`]===`installed`?Y?.im.weixin?`✓ ${c(`quickSkill.bound`)}`:c(`quickSkill.scanToBind`):c(`quickSkill.clickToInstall`)})]}),dn[`openclaw-weixin`]===`installing`&&(0,J.jsx)(`div`,{className:`w-4 h-4 border-2 border-[#07C160]/30 border-t-[#07C160] rounded-full animate-spin flex-shrink-0`}),dn[`openclaw-weixin`]===`installed`&&Y?.im.weixin&&(0,J.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-emerald-500/15 text-emerald-400 font-medium flex-shrink-0`,children:c(`quickSkill.bound`)})]}),(0,J.jsxs)(`button`,{onClick:()=>{nt(!1),Nn(`config`),kt(!0)},className:`w-full flex items-center justify-center gap-1.5 px-4 py-2 rounded-lg text-[11px] text-muted hover:text-foreground hover:bg-[var(--card-hover)] border border-dashed border-[var(--border)] transition-all duration-150`,children:[(0,J.jsx)(`span`,{children:c(`quickSkill.moreImConfig`)}),(0,J.jsx)(`svg`,{className:`w-3 h-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.5,children:(0,J.jsx)(`path`,{d:`M9 18l6-6-6-6`})})]})]}),rt===`skills`&&(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsxs)(`div`,{className:`px-3 py-2 border-b border-[var(--border)]/60 flex gap-1.5 flex-shrink-0`,children:[(0,J.jsx)(`input`,{type:`text`,value:ut,onChange:e=>dt(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ut.trim()&&(nt(!1),Cn(`安装 ${ut.trim()}`,!0),dt(``))},placeholder:c(`quickSkill.customSkillPlaceholder`),className:`flex-1 min-w-0 text-[11px] bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1 text-foreground placeholder:text-muted outline-none focus:border-[#0066FF]/60`}),(0,J.jsx)(`button`,{disabled:!ut.trim(),onClick:()=>{ut.trim()&&(nt(!1),Cn(`安装 ${ut.trim()}`,!0),dt(``))},className:`flex-shrink-0 text-[11px] px-2 py-1 rounded bg-[#0066FF]/10 text-[#0066FF] hover:bg-[#0066FF]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`quickSkill.install`)})]}),(0,J.jsxs)(`div`,{className:`flex`,style:{height:`380px`},children:[(0,J.jsxs)(`div`,{className:`flex flex-col border-r border-[var(--border)]/60 bg-[var(--card)] flex-shrink-0`,style:{width:`72px`},children:[Le.groups.map(e=>(0,J.jsxs)(`button`,{onMouseEnter:t=>{t.stopPropagation(),ot(e.id)},onClick:t=>{t.stopPropagation(),ot(e.id)},className:`flex flex-col items-center justify-center gap-0.5 py-3 px-1 text-center transition-colors border-l-2 flex-shrink-0 ${at===e.id?`border-[#0066FF] bg-[#0066FF]/5 text-foreground`:`border-transparent text-muted hover:text-foreground hover:bg-[var(--card-hover)]`}`,children:[(0,J.jsx)(`span`,{className:`text-base leading-none`,children:e.emoji}),(0,J.jsx)(`span`,{className:`text-[9px] font-medium leading-tight mt-0.5 whitespace-pre-wrap break-all`,children:c(`data:skills.group.${e.id}`,{defaultValue:e.label})})]},e.id)),(0,J.jsxs)(`button`,{onMouseEnter:e=>{e.stopPropagation(),ot(`installed`)},onClick:e=>{e.stopPropagation(),ot(`installed`)},className:`flex flex-col items-center justify-center gap-0.5 py-3 px-1 text-center transition-colors border-l-2 flex-shrink-0 ${at===`installed`?`border-[#0066FF] bg-[#0066FF]/5 text-foreground`:`border-transparent text-muted hover:text-foreground hover:bg-[var(--card-hover)]`}`,children:[(0,J.jsx)(`span`,{className:`text-base leading-none`,children:`📦`}),(0,J.jsx)(`span`,{className:`text-[9px] font-medium leading-tight mt-0.5 whitespace-pre-wrap break-all`,children:c(`quickSkill.allInstalled`)})]})]}),(0,J.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-y-auto`,children:[at===`installed`&&(()=>{if(Y===null)return(0,J.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted`,children:c(`quickSkill.loading`)});let t=Y.installedSkillDirs??[],n={};return Le.groups.forEach(e=>{e.skills.forEach(t=>{t.checkDirs?.forEach(t=>{n[t.toLowerCase()]=e.label})})}),t.length===0?(0,J.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted`,children:c(`quickSkill.noInstalled`)}):(0,J.jsx)(J.Fragment,{children:t.map(t=>{let r=n[t.toLowerCase()];return(0,J.jsxs)(`div`,{className:`w-full px-3 py-2 flex items-center gap-2 border-b border-[var(--border)]/30`,children:[(0,J.jsxs)(`button`,{className:`flex-1 min-w-0 text-left`,onClick:()=>{nt(!1),Cn(`/skill ${t} `,!1)},children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-foreground font-mono truncate`,children:t}),r&&(0,J.jsx)(`div`,{className:`text-[10px] text-muted mt-0.5`,children:r})]}),(0,J.jsx)(`span`,{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-emerald-500/15 text-emerald-400`,children:c(`quickSkill.installed`)}),(0,J.jsx)(`button`,{onClick:async()=>{if(!(!e||!window.confirm(c(`delete.skillConfirm`,{name:t}))))try{await de(e,t);let n=await D(e);st(n)}catch(e){o(e.message||c(`common:error.deleteFailed`),`error`)}},className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors`,children:c(`common:action.delete`)})]},t)})})})(),at!==`installed`&&(()=>{let t=Le.groups.find(e=>e.id===at)?.skills??[];if(t.length===0)return(0,J.jsx)(`div`,{className:`px-3 py-6 text-center text-[11px] text-muted`,children:c(`quickSkill.noSkills`)});let n=(Y?.installedSkillDirs??[]).map(e=>e.toLowerCase());return(0,J.jsx)(J.Fragment,{children:t.map(t=>{if(t.type===`hub`)return(0,J.jsxs)(`div`,{className:`w-full px-3 py-2 flex items-center gap-2 border-b border-[var(--border)]/30`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-foreground break-words`,children:c(`data:skills.${t.id}.label`,{defaultValue:t.label})}),(0,J.jsx)(`div`,{className:`text-[10px] text-muted leading-tight mt-0.5 break-words`,children:c(`data:skills.${t.id}.desc`,{defaultValue:t.desc})}),(0,J.jsx)(`div`,{className:`text-[9px] text-muted/60 leading-tight mt-0.5 break-all`,children:t.url})]}),(0,J.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),title:`在新标签页打开`,className:`flex-shrink-0 text-[11px] px-1.5 py-0.5 rounded-full font-medium bg-[var(--border)] text-muted hover:bg-[#0066FF]/15 hover:text-[#0066FF] transition-colors no-underline`,children:`🔗`})]},t.id);let r=Y!==null&&t.checkDirs.some(e=>n.includes(e.toLowerCase())),i=ct[t.id]??!1,a=Y?.installedSkillDirs?.find(e=>t.checkDirs.some(t=>t.toLowerCase()===e.toLowerCase()))??t.id;return(0,J.jsxs)(`button`,{disabled:i,onClick:()=>{if(nt(!1),r)Cn(`/skill ${a} `,!1);else{lt(e=>({...e,[t.id]:!0})),Cn(t.installMsg,t.autoInstall!==!1);let n=0,r=setInterval(async()=>{n+=5e3;try{let n=await D(e);st(n);let i=(n?.installedSkillDirs??[]).map(e=>e.toLowerCase());t.checkDirs.some(e=>i.includes(e.toLowerCase()))&&(clearInterval(r),lt(e=>({...e,[t.id]:!1})))}catch{}n>=6e4&&(clearInterval(r),lt(e=>({...e,[t.id]:!1})))},5e3)}},className:`w-full text-left px-3 py-2 hover:bg-[var(--card-hover)] transition-colors flex items-center gap-2 disabled:opacity-60 border-b border-[var(--border)]/30`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-foreground break-words`,children:c(`data:skills.${t.id}.label`,{defaultValue:t.label})}),(0,J.jsx)(`div`,{className:`text-[10px] text-muted leading-tight mt-0.5 break-words`,children:c(`data:skills.${t.id}.desc`,{defaultValue:t.desc})})]}),(0,J.jsx)(`span`,{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${i?`bg-amber-500/15 text-amber-400`:Y===null?`bg-[var(--border)] text-muted`:r?`bg-emerald-500/15 text-emerald-400`:`bg-[#0066FF]/10 text-[#0066FF]`}`,children:i?c(`quickSkill.installing`):Y===null?`…`:c(r?`quickSkill.installed`:`quickSkill.install`)}),r&&!i&&(0,J.jsx)(`button`,{onClick:async t=>{if(t.stopPropagation(),!(!e||!window.confirm(c(`delete.skillConfirm`,{name:a}))))try{await de(e,a);let t=await D(e);st(t)}catch(e){o(e.message||c(`common:error.deleteFailed`),`error`)}},className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors`,children:c(`common:action.delete`)})]},t.id)})})})()]})]})]}),rt===`mcp`&&(0,J.jsxs)(`div`,{className:`py-1`,children:[(()=>{let e=!!(Y?.mcporterInstalled||_t.installed),t=Y===null&&_t.loading;return(0,J.jsxs)(`button`,{onClick:()=>{e||(nt(!1),Cn(`安装 https://clawhub.ai/steipete/mcporter`,!0))},className:`w-full text-left px-3 py-2.5 hover:bg-[var(--card-hover)] transition-colors flex items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-foreground`,children:`MCPorter`}),(0,J.jsx)(`div`,{className:`text-[11px] text-muted leading-tight mt-0.5`,children:c(`quickSkill.mcporterDesc`)})]}),(0,J.jsx)(`span`,{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${t?`bg-[var(--border)] text-muted`:e?`bg-emerald-500/15 text-emerald-400`:`bg-[#0066FF]/10 text-[#0066FF]`}`,children:t?`…`:c(e?`quickSkill.installed`:`quickSkill.install`)})]})})(),(0,J.jsxs)(`div`,{className:`px-3 py-2 border-t border-[var(--border)]/40`,children:[(0,J.jsx)(`div`,{className:`text-[10px] text-muted mb-1.5`,children:c(`quickSkill.mcpJsonLabel`)}),(0,J.jsx)(`textarea`,{rows:3,value:ft,onChange:e=>{pt(e.target.value),gt(``)},placeholder:`{
|
|
12
|
+
"serverName": { "command": "npx", "args": [...] }
|
|
13
|
+
}`,className:`w-full text-[11px] font-mono bg-[var(--bg)] border border-[var(--border)] rounded px-2 py-1.5 text-foreground placeholder:text-muted/50 outline-none focus:border-[#0066FF]/60 resize-none`}),mt&&(0,J.jsx)(`div`,{className:`text-[10px] text-red-400 mt-1`,children:mt}),(0,J.jsx)(`button`,{disabled:!ft.trim()||!e,onClick:async()=>{let t;try{let e=JSON.parse(ft.trim());if(typeof e!=`object`||Array.isArray(e)||e===null)throw Error(`not-object`);if(t=e.mcpServers&&typeof e.mcpServers==`object`&&!Array.isArray(e.mcpServers)?e.mcpServers:e.servers&&typeof e.servers==`object`&&!Array.isArray(e.servers)?e.servers:e,Object.keys(t).length===0)throw Error(`empty`);for(let[e,n]of Object.entries(t)){if(typeof n!=`object`||Array.isArray(n)||n===null)throw Error(c(`quickSkill.mcpJsonValueNotObject`,{name:e}));let t=n;if(!t.command&&!t.baseUrl&&!t.url)throw Error(c(`quickSkill.mcpJsonMissingField`,{name:e}))}}catch(e){let t=e?.message;t===`not-object`?gt(c(`quickSkill.mcpJsonNotObject`)):t===`empty`?gt(c(`quickSkill.mcpJsonEmpty`)):t?.startsWith(`"`)?gt(t):gt(c(`quickSkill.mcpJsonParseFailed`,{error:t||``}));return}try{let n=await se(e,t);pt(``),gt(``),o(c(`quickSkill.mcpWritten`),`success`),st(e=>e&&{...e,mcporterServers:n.mcpServers}),vt(e=>({...e,loading:!0})),O(e).then(e=>vt({servers:e.servers,installed:e.installed,loading:!1})).catch(()=>vt(e=>({...e,loading:!1})))}catch(e){gt(e.message||c(`quickSkill.mcpWriteFailed`))}},className:`mt-1.5 w-full text-[11px] px-2 py-1 rounded bg-[#0066FF]/10 text-[#0066FF] hover:bg-[#0066FF]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`quickSkill.addToConfig`)})]}),(qt.find(e=>e.id===`mcp`)?.items??[]).map(t=>{let n=Object.keys(Y?.mcporterServers??{}),r=_t.servers.map(e=>e.name),i=t.mcpJson?Object.keys(t.mcpJson):[],a=i.length>0&&i.some(e=>n.includes(e)||r.includes(e));return(0,J.jsxs)(`button`,{onClick:async()=>{if(t.mcpJson&&e)try{let n=await se(e,t.mcpJson);o(c(`quickSkill.mcpAdded`,{label:t.label}),`success`),st(e=>e&&{...e,mcporterServers:n.mcpServers}),vt(e=>({...e,loading:!0})),O(e).then(e=>vt({servers:e.servers,installed:e.installed,loading:!1})).catch(()=>vt(e=>({...e,loading:!1})))}catch(e){o(e.message||c(`quickSkill.mcpAddFailed`),`error`)}else wn(t.id)},className:`w-full text-left px-3 py-2.5 hover:bg-[var(--card-hover)] transition-colors border-t border-[var(--border)]/40 flex items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-foreground`,children:c(`data:mcp.${t.id}.label`,{defaultValue:t.label})}),(0,J.jsx)(`div`,{className:`text-[11px] text-muted leading-tight mt-0.5`,children:c(`data:mcp.${t.id}.desc`,{defaultValue:t.desc})})]}),t.mcpJson&&(0,J.jsx)(`span`,{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${a?`bg-emerald-500/15 text-emerald-400`:`bg-[#0066FF]/10 text-[#0066FF]`}`,children:c(a?`quickSkill.configured`:`quickSkill.oneClickConfig`)})]},t.id)}),(()=>{let t=Y?.mcporterServers??{},n=new Set((qt.find(e=>e.id===`mcp`)?.items??[]).flatMap(e=>e.mcpJson?Object.keys(e.mcpJson):[])),r=Object.keys(t).filter(e=>!n.has(e));if(r.length===0)return null;let i={};for(let e of _t.servers)i[e.name]=e;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`px-3 pt-2 pb-0.5 text-[9px] font-semibold text-muted/60 uppercase tracking-widest border-t border-[var(--border)]/40 mt-1`,children:c(`quickSkill.mcporterConfigured`)}),r.map(n=>{let r=t[n],a=i[n],s=a?.transport??(r?.baseUrl?`HTTP ${r.baseUrl}`:r?.command?`${r.command} ${(r.args??[]).join(` `)}`.trim():``),l=a?.status===`ok`,d=a?l?`bg-emerald-500/15 text-emerald-400`:`bg-red-500/15 text-red-400`:(_t.loading,`bg-[var(--border)] text-muted`),f=_t.loading&&!a?c(`quickSkill.detecting`):a?l?a.tools?.length?c(`quickSkill.statusNormalWithTools`,{count:a.tools.length}):c(`quickSkill.statusNormal`):a.status:c(`quickSkill.configured`);return(0,J.jsxs)(`div`,{className:`w-full px-3 py-2 flex items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-xs font-semibold text-foreground font-mono`,children:n}),s&&(0,J.jsx)(`div`,{className:`text-[11px] text-muted leading-tight mt-0.5 truncate`,children:s})]}),(0,J.jsxs)(`span`,{className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium ${d} flex items-center gap-1`,children:[_t.loading&&!a&&(0,J.jsx)(`span`,{className:`w-2 h-2 border border-muted/40 border-t-muted rounded-full animate-spin`}),f]}),(0,J.jsx)(`button`,{onClick:async()=>{if(!(!e||!window.confirm(c(`delete.mcpConfirm`,{name:n}))))try{await u(e,n);let t=await D(e);st(t),vt(e=>({...e,servers:e.servers.filter(e=>e.name!==n)}))}catch(e){o(e.message||c(`common:error.deleteFailed`),`error`)}},className:`flex-shrink-0 text-[10px] px-1.5 py-0.5 rounded-full font-medium bg-red-500/10 text-red-400 hover:bg-red-500/20 transition-colors`,children:c(`common:action.delete`)})]},n)})]})})()]}),rt===`slash`&&(0,J.jsx)(`div`,{className:`py-1`,children:(qt.find(e=>e.id===`slash`)?.groups??[]).map((e,t)=>(0,J.jsxs)(`div`,{children:[t>0&&(0,J.jsx)(`div`,{className:`border-t border-[var(--border)]/40 mx-3 my-0.5`}),(0,J.jsx)(`div`,{className:`px-3 pt-1.5 pb-0.5 text-[9px] font-semibold text-muted/60 uppercase tracking-widest`,children:c(`data:slash.group.${e.label}`,{defaultValue:e.label})}),e.items.map(e=>(0,J.jsxs)(`button`,{onClick:()=>wn(e.id),className:`w-full text-left px-3 py-1 hover:bg-[var(--card-hover)] transition-colors`,children:[(0,J.jsx)(`div`,{className:`text-xs font-medium text-foreground font-mono`,children:e.label}),(0,J.jsx)(`div`,{className:`text-[11px] text-muted leading-tight`,children:c(`data:slash.${e.id}.desc`,{defaultValue:e.desc})})]},e.id))]},e.label))})]})]})]})]}),Fn||In?(0,J.jsxs)(J.Fragment,{children:[zn&&(0,J.jsx)(`button`,{onClick:xn,disabled:!!K||In,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:c(K===`upgrade`?`appUpgrade.upgrading`:`appUpgrade.action`)}),(0,J.jsx)(`button`,{onClick:()=>bn(`restart`),disabled:!!K||In,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:c(K===`restart`?`action.restarting`:`common:action.restart`)}),(0,J.jsx)(`button`,{onClick:()=>bn(`stop`),disabled:!!K,className:`px-3 py-1.5 bg-red-600 text-white rounded-md text-xs font-medium hover:bg-red-700 disabled:opacity-40 transition-all duration-200`,children:c(K===`stop`?`action.stopping`:`common:action.stop`)})]}):(0,J.jsxs)(J.Fragment,{children:[zn&&(0,J.jsx)(`button`,{onClick:xn,disabled:!!K,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:c(K===`upgrade`?`appUpgrade.upgrading`:`appUpgrade.action`)}),(0,J.jsx)(`button`,{onClick:()=>bn(`start`),disabled:!!K,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:c(K===`start`?`action.starting`:`common:action.start`)})]}),(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>Qe(!Ze),"aria-label":c(`common:action.moreActions`),className:`p-1.5 border border-[var(--border)] rounded-md text-muted hover:text-foreground hover:bg-[var(--card-hover)] transition-all duration-150`,children:(0,J.jsx)(be,{className:`w-4 h-4`})}),Ze&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`fixed inset-0 z-10`,onClick:()=>Qe(!1)}),(0,J.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 w-40 bg-background border border-[var(--border)] rounded-lg shadow-2xl py-1 z-20`,children:[(0,J.jsx)(`button`,{onClick:()=>{Qe(!1),Nn(`logs`)},className:`w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:c(`tab.logs`)}),(0,J.jsx)(`button`,{onClick:()=>{Qe(!1),Nn(`usage`)},className:`w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:c(`tab.usage`)}),Rn&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`border-t border-[var(--border)] my-1`}),(0,J.jsx)(`button`,{onClick:()=>{Qe(!1),et(`manage`)},className:`w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:c(`backup.manageMenu`,{defaultValue:`备份管理`})}),(0,J.jsx)(`button`,{onClick:()=>{Qe(!1),et(`export`)},className:`w-full text-left px-3 py-2 text-sm text-foreground hover:bg-[var(--card-hover)] transition-colors`,children:c(`backup.export`,{defaultValue:`导出(分享)`})}),(0,J.jsx)(`div`,{className:`border-t border-[var(--border)] my-1`})]}),(0,J.jsx)(`button`,{onClick:()=>{Qe(!1),ze(!0),Xe(!1)},className:`w-full text-left px-3 py-2 text-sm text-red-400 hover:bg-red-500/10 transition-colors`,children:c(`delete.title`)})]})]})]})]})]}),e&&Rn&&(0,J.jsx)(zt,{instanceId:e,instanceName:f?.name||e,showToast:o,onRestoreComplete:en,openBackup:$e===`backup`,openManage:$e===`manage`,openExport:$e===`export`,onDialogClose:()=>et(null)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-muted mb-3`,children:[(0,J.jsx)(`button`,{onClick:()=>a(`/`),className:`hover:text-foreground transition-colors`,children:c(`backToOverview`)}),(0,J.jsx)(`span`,{className:`opacity-40`,children:`·`}),(0,J.jsxs)(`span`,{children:[`📊 `,f.service?.memory_mb==null?`-`:`${f.service.memory_mb} MB`]}),(0,J.jsx)(`span`,{className:`opacity-40`,children:`·`}),(0,J.jsxs)(`span`,{children:[`⏱ `,Vt(f.service?.uptime,c)]})]}),zn&&(0,J.jsxs)(`div`,{className:`mb-3 flex flex-col gap-3 rounded-lg border border-[#0066FF]/25 bg-[#0066FF]/10 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:c(`appUpgrade.title`)}),(0,J.jsx)(`div`,{className:`mt-0.5 text-xs leading-relaxed text-muted`,children:c(`appUpgrade.description`,{currentVersion:zn.currentVersion,latestVersion:zn.latestVersion})})]}),(0,J.jsx)(`button`,{onClick:xn,disabled:!!K||In,className:`shrink-0 bg-[#0066FF] text-white px-3 py-1.5 rounded-md text-xs font-medium hover:bg-[#0066FF]/90 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-200`,children:c(K===`upgrade`?`appUpgrade.upgrading`:`appUpgrade.action`)})]}),Ln&&(0,J.jsxs)(`div`,{className:`bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-4 py-3 flex items-center justify-between mb-3`,children:[(0,J.jsx)(`span`,{children:c(`failedHint`)}),(0,J.jsx)(`button`,{onClick:()=>Nn(`logs`),className:`text-red-400 underline text-sm font-medium`,children:c(`viewLogs`)})]}),S!==`chat`&&sn&&(0,J.jsx)(`button`,{onClick:()=>Nn(`chat`),className:`flex items-center gap-1 text-xs text-[#0066FF] hover:text-[#0066FF]/80 mb-3 transition-colors`,children:c(`backToChat`)}),S===`chat`&&(()=>{let t=f?.capabilities?.ui?.chatPanel;return Ge(f)&&e?(0,J.jsx)(ht,{instanceId:e,isRunning:Vn,isPending:In,actionLoading:K,onAction:bn}):jt&&e?(0,J.jsx)(jt,{instanceId:e,instanceEpoch:f?.created_at??null}):rn&&e?(0,J.jsx)(bt,{instanceId:e,provide:rn,isRunning:Vn}):t===`iframe`||on?(0,J.jsx)(yt,{instanceId:e,gatewayLaunchUrl:V,gatewayReady:U,isRunning:Vn,isPending:In,iframeLoaded:Te,actionLoading:K,onAction:bn,onReload:()=>{W(!1),G(!1)},onIframeLoad:()=>G(!0)}):t===`inline`?(0,J.jsxs)(`div`,{className:`rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-8 text-center`,children:[(0,J.jsx)(`div`,{className:`w-5 h-5 mx-auto border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin mb-3`}),(0,J.jsx)(`div`,{className:`text-sm text-foreground/70`,children:`正在加载 Chat 组件...`})]}):(0,J.jsxs)(`div`,{className:`rounded-[22px] border border-[var(--border)] bg-[var(--card)] p-8 text-center`,children:[(0,J.jsx)(`div`,{className:`text-4xl mb-3 opacity-40`,children:`🔌`}),(0,J.jsx)(`div`,{className:`text-sm text-foreground/70 font-medium mb-1`,children:`此应用没有内置应用界面`}),(0,J.jsx)(`div`,{className:`text-xs text-muted mb-4`,children:It===`config`?`请切换到 Config tab 配置消息平台凭证,通过 IM 与应用交互。`:It===`connections`?`请切换到 Connections tab 继续配置此应用依赖的本地能力。`:`此应用没有可嵌入的应用界面,请改用日志或用量页确认运行状态。`}),(0,J.jsx)(`button`,{onClick:()=>Nn(It),className:`px-4 py-2 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 transition-all duration-200`,children:It===`config`?`打开 Config`:It===`connections`?`打开 Connections`:It===`logs`?`打开 Logs`:`打开 Usage`})]})})(),S===`config`&&E&&$.showConfig&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[ne&&(0,J.jsxs)(`div`,{className:`bg-amber-500/10 border border-amber-500/20 text-amber-400 text-sm rounded-lg px-4 py-2.5 flex items-center justify-between`,children:[(0,J.jsx)(`span`,{children:c(`config.modified`)}),(0,J.jsx)(`button`,{onClick:()=>{k(null),Promise.all([y(e),ie(e)]).then(([e,t])=>{te(e),e.format===`yaml+env`?(At.current=t,k({...t,env:Qt(t.env,e.secretFields)}),L(``)):(k(t),L(JSON.stringify(t,null,2))),M(!1)})},className:`text-xs text-amber-400 hover:underline`,children:c(`config.discard`)})]}),re&&(0,J.jsx)(`div`,{className:`bg-red-500/10 border border-red-500/20 text-red-400 text-sm rounded-lg px-4 py-2.5`,children:re}),j?.format===`json`&&(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(`button`,{onClick:()=>I(!1),className:`px-3 py-1.5 text-xs rounded-md transition-colors duration-150 ${P?`text-muted hover:bg-[var(--card-hover)]`:`bg-[#0066FF] text-white`}`,children:c(`config.form`)}),(0,J.jsx)(`button`,{onClick:()=>{L(kn(E)),I(!0)},className:`px-3 py-1.5 text-xs rounded-md transition-colors duration-150 ${P?`bg-[#0066FF] text-white`:`text-muted hover:bg-[var(--card-hover)]`}`,children:c(`config.json`)})]}),j?.format===`json`&&P?(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsxs)(`div`,{className:`bg-[#0066FF]/10 border border-[#0066FF]/20 rounded-lg px-3 py-2 text-xs text-[#0066FF]/80 space-y-1`,children:[(0,J.jsx)(`div`,{className:`font-medium text-[#0066FF]/90`,children:c(`config.jsonHelp`)}),(0,J.jsxs)(`ul`,{className:`list-disc list-inside space-y-0.5`,children:[(0,J.jsx)(`li`,{dangerouslySetInnerHTML:{__html:c(`config.jsonHelp1`)}}),(0,J.jsx)(`li`,{dangerouslySetInnerHTML:{__html:c(`config.jsonHelp2`)}}),(0,J.jsx)(`li`,{dangerouslySetInnerHTML:{__html:c(`config.jsonHelp3`)}})]})]}),(0,J.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`border-b border-[var(--border)] px-4 py-2 flex items-center justify-between`,children:(0,J.jsx)(`span`,{className:`text-xs font-medium text-muted`,children:`openclaw.json`})}),(0,J.jsx)(`textarea`,{value:le,onChange:e=>On(e.target.value),className:`w-full font-mono text-[13px] p-4 min-h-[400px] lg:min-h-[500px] focus:outline-none resize-y text-foreground bg-transparent`,spellCheck:!1})]})]}):Nt&&e?(0,J.jsx)(Nt,{config:E,onChange:Tn,instanceId:e,capabilities:f?.capabilities,isRunning:Vn}):j?.format===`yaml+env`?(0,J.jsx)(Bt,{yaml:String(E?.yaml||``),env:String(E?.env||``),onYamlChange:En,onEnvChange:Dn}):(0,J.jsx)(Fe,{config:E,onChange:Tn,instanceId:e,isRunning:Vn,pluginStatuses:dn,onInstallPlugin:_n}),(0,J.jsxs)(`div`,{className:`flex gap-2 sticky bottom-0 backdrop-blur-sm py-3 -mx-6 px-6 border-t border-[var(--border)] mt-4`,style:{background:`color-mix(in srgb, var(--background) 85%, transparent)`},children:[(0,J.jsx)(`button`,{onClick:()=>jn(!1),disabled:!ne||Pe,className:`px-4 py-2 border border-[var(--border)] text-muted rounded-md text-sm font-medium hover:bg-[var(--card-hover)] hover:text-foreground disabled:opacity-40 transition-all duration-200`,children:c(Pe?`config.saving`:`config.save`)}),(0,J.jsx)(`button`,{onClick:()=>jn(!0),disabled:Pe,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:c(Pe?`config.processing`:`config.saveAndRestart`)})]})]}),S===`logs`&&(0,J.jsx)(xt,{logs:ue,logSearch:ge,logType:R,logsEndRef:Et,onSearchChange:_e,onLogTypeChange:he,onRefresh:vn,onCopy:()=>{let e=ge?ue.filter(e=>e.toLowerCase().includes(ge.toLowerCase())):ue;navigator.clipboard.writeText(e.join(`
|
|
14
|
+
`)).then(()=>o(c(`logs.copied`),`success`)).catch(()=>o(c(`logs.copyFailed`),`error`))}}),S===`usage`&&(0,J.jsx)(St,{usage:B,onRefresh:()=>g(e).then(Ce).catch(()=>{})}),S===`connections`&&e&&(0,J.jsx)(Lt,{instanceId:e}),X&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,onClick:()=>{wt.current=!0,Ct.current=!1,Z(null)},children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-xs shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:c(X.type===`feishu`?`qr.feishuTitle`:`qr.weixinTitle`)}),(0,J.jsx)(`button`,{onClick:()=>{wt.current=!0,Ct.current=!1,Z(null)},className:`text-muted hover:text-foreground transition-colors text-lg leading-none`,children:`✕`})]}),(0,J.jsx)(`div`,{className:`flex flex-col items-center gap-3`,children:X.status===`confirmed`?(0,J.jsxs)(`div`,{className:`bg-emerald-500/10 border border-emerald-500/20 rounded-md px-4 py-5 text-center w-full`,children:[(0,J.jsx)(`div`,{className:`text-3xl mb-2`,children:`✓`}),(0,J.jsx)(`div`,{className:`text-emerald-400 font-medium text-sm`,children:X.message}),(0,J.jsx)(`p`,{className:`text-xs text-muted mt-1`,children:c(`qr.credSaved`)})]}):X.status===`loading`?(0,J.jsx)(`div`,{className:`w-48 h-48 flex items-center justify-center`,children:(0,J.jsx)(`div`,{className:`w-8 h-8 border-2 rounded-full animate-spin ${X.type===`feishu`?`border-[#3370FF]/30 border-t-[#3370FF]`:`border-[#07C160]/30 border-t-[#07C160]`}`})}):X.status===`error`?(0,J.jsxs)(`div`,{className:`bg-red-500/10 border border-red-500/20 rounded-md px-4 py-4 text-center w-full`,children:[(0,J.jsx)(`div`,{className:`text-red-400 text-sm`,children:X.message}),(0,J.jsx)(`button`,{onClick:e=>{e.stopPropagation(),Sn(X.type)},className:`mt-3 px-4 py-1.5 text-white rounded-md text-xs font-medium transition-colors ${X.type===`feishu`?`bg-[#3370FF] hover:bg-[#3370FF]/90`:`bg-[#07C160] hover:bg-[#07C160]/90`}`,children:c(`qr.retry`)})]}):(0,J.jsxs)(J.Fragment,{children:[X.qrUrl?(0,J.jsx)(ke,{value:X.qrUrl,size:192,className:`rounded-lg`}):(0,J.jsx)(`div`,{className:`w-48 h-48 flex items-center justify-center`,children:(0,J.jsx)(`div`,{className:`w-8 h-8 border-2 rounded-full animate-spin ${X.type===`feishu`?`border-[#3370FF]/30 border-t-[#3370FF]`:`border-[#07C160]/30 border-t-[#07C160]`}`})}),(0,J.jsx)(`div`,{className:`flex items-center gap-2 text-sm`,children:X.status===`scaned`?(0,J.jsxs)(`span`,{className:`font-medium ${X.type===`weixin`?`text-[#07C160]`:`text-[#3370FF]`}`,children:[`👀 `,X.message]}):(0,J.jsx)(`span`,{className:`text-muted`,children:X.message})})]})}),X.status===`confirmed`&&(0,J.jsx)(`button`,{onClick:()=>{wt.current=!0,Ct.current=!1,Z(null)},className:`mt-4 w-full py-2 bg-[#0066FF] text-white rounded-md text-sm font-medium hover:bg-[#0066FF]/90 transition-colors`,children:c(`common:action.close`)})]})}),Re&&(0,J.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4`,onClick:()=>{Q||qe||(ze(!1),Ve(``),Ue(``),Ke(``),Xe(!1))},children:(0,J.jsxs)(`div`,{className:`bg-background border border-[var(--border)] rounded-xl p-6 w-full max-w-sm shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`h3`,{className:`text-base font-semibold text-foreground mb-2`,children:c(`delete.title`)}),(0,J.jsx)(`p`,{className:`text-sm text-muted mb-4`,children:(0,J.jsx)(n,{ns:`instance`,i18nKey:`delete.warning`,values:{name:f.name},components:{strong:(0,J.jsx)(`strong`,{className:`text-foreground`})}})}),(0,J.jsx)(`p`,{className:`text-sm text-muted mb-3`,children:c(`delete.confirmHint`)}),(0,J.jsx)(`input`,{type:`text`,value:Be,onChange:e=>Ve(e.target.value),disabled:Q,className:`w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground mb-4 focus:outline-none focus:ring-1 focus:ring-red-500/60 focus:border-red-500/60 transition-colors disabled:opacity-60`,placeholder:f.name}),(0,J.jsxs)(`div`,{className:`mb-4`,children:[(0,J.jsx)(`label`,{className:`block text-sm text-muted mb-2`,children:c(`delete.sudoPassword`,{defaultValue:`sudo 密码(如本次删除涉及系统卸载)`})}),(0,J.jsx)(`input`,{type:`password`,value:He,onChange:e=>{Ue(e.target.value),Ke(``)},disabled:Q||qe,className:`w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-red-500/60 focus:border-red-500/60 transition-colors disabled:opacity-60`,placeholder:c(`delete.sudoPasswordPlaceholder`,{defaultValue:`需要提权时请输入`}),autoComplete:`current-password`}),We&&(0,J.jsx)(`p`,{className:`mt-2 text-xs text-red-400`,children:We}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:c(`delete.sudoPasswordHint`,{defaultValue:`实例删除若会触发底层应用卸载,将使用这里提供的密码执行 sudo。`})})]}),Rn&&(0,J.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-muted cursor-pointer mb-4`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:Ye,onChange:e=>Xe(e.target.checked),disabled:Q,className:`rounded border-[var(--border)] bg-[var(--input-bg)]`}),c(`delete.purgeBackups`,{defaultValue:`同时删除备份`})]}),Q&&(0,J.jsx)(`p`,{className:`text-xs text-muted mb-3`,children:c(`delete.inProgressHint`,{defaultValue:`正在删除,大实例可能需要 30 秒到 1 分钟,请勿关闭窗口。`})}),(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(`button`,{onClick:()=>{ze(!1),Ve(``),Ue(``),Ke(``),Xe(!1)},disabled:Q||qe,className:`flex-1 py-2 border border-[var(--border)] text-muted rounded-md text-sm font-medium hover:bg-[var(--card-hover)] hover:text-foreground transition-all duration-150 disabled:opacity-40 disabled:cursor-not-allowed`,children:c(`common:action.cancel`)}),(0,J.jsxs)(`button`,{onClick:Mn,disabled:Be.trim()!==f.name?.trim()||Q||qe,className:`flex-1 py-2 bg-red-600 text-white rounded-md text-sm font-medium hover:bg-red-700 disabled:opacity-40 disabled:cursor-not-allowed transition-colors inline-flex items-center justify-center gap-2`,children:[(Q||qe)&&(0,J.jsx)(`span`,{className:`w-3 h-3 border-2 border-white/40 border-t-white rounded-full animate-spin`,"aria-hidden":`true`}),Q?c(`delete.deleting`,{defaultValue:`删除中...`}):qe?c(`newInstance:sudoDialog.verifying`,{defaultValue:`验证中...`}):c(`delete.confirm`)]})]})]})})]})}export{en as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{a as t,t as n}from"./vendor-i18n-Df8aUdv8.js";import{l as r,t as i}from"./vendor-react-0L0rjmYG.js";import{l as a,xt as o}from"./api-C70Gt678.js";import{f as s,i as c,p as l}from"./index-Bs6DSbiR.js";var u=e(t(),1),d=i();function f({onLogin:e}={}){let{t}=n(`auth`),[i,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(!1),[h,g]=(0,u.useState)(``),[_,v]=(0,u.useState)(!1),y=r();return(0,d.jsxs)(`div`,{className:`min-h-screen flex items-center justify-center p-4 bg-background relative overflow-hidden`,children:[(0,d.jsx)(`div`,{className:`absolute inset-0 grid-bg`}),(0,d.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,children:(0,d.jsx)(`div`,{className:`absolute top-1/4 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] rounded-full bg-[radial-gradient(circle,rgba(0,102,255,0.08)_0%,transparent_70%)]`})}),(0,d.jsxs)(`div`,{className:`w-full max-w-sm relative z-10`,children:[(0,d.jsxs)(`div`,{className:`text-center mb-8`,children:[(0,d.jsx)(c,{className:`w-40 h-40 mx-auto mb-4 object-contain`}),(0,d.jsx)(`p`,{className:`text-sm text-muted mt-1`,children:t(`login.title`)})]}),(0,d.jsx)(`div`,{className:`bg-card border border-[var(--border)] rounded-xl backdrop-blur-xl p-6 shadow-2xl`,children:(0,d.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),g(``),v(!0);try{o((await a(i)).token),e?.(),y(`/`,{replace:!0})}catch(e){g(e.message||t(`login.failed`))}finally{v(!1)}},className:`space-y-4`,children:[h&&(0,d.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:h}),(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:t(`login.password`)}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`input`,{type:p?`text`:`password`,value:i,onChange:e=>f(e.target.value),placeholder:t(`login.placeholder`),className:`w-full bg-[var(--input-bg)] border border-[var(--border)] rounded-md px-3 py-2.5 text-sm text-foreground placeholder-[var(--muted)] focus:outline-none focus:ring-1 focus:ring-[#0066FF]/60 focus:border-[#0066FF]/60 pr-10 transition-colors duration-200`,autoFocus:!0}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>m(!p),"aria-label":t(`common:action.togglePassword`),className:`absolute right-3 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors`,children:p?(0,d.jsx)(l,{}):(0,d.jsx)(s,{})})]})]}),(0,d.jsx)(`button`,{type:`submit`,disabled:_||!i,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:_?(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,d.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin`}),t(`login.loading`)]}):t(`login.submit`)})]})}),(0,d.jsxs)(`p`,{className:`text-xs text-muted mt-6 text-center`,children:[t(`login.forgotPassword`),` `,(0,d.jsx)(`code`,{className:`text-foreground bg-card px-1 py-0.5 rounded text-[11px]`,children:`jishushell onboard --force`})]})]})]})}export{f as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{a as t,t as n}from"./vendor-i18n-Df8aUdv8.js";import{i as r,l as i,t as a}from"./vendor-react-0L0rjmYG.js";import{D as o,Et as s,Ft as ee,G as te,I as c,Lt as ne,St as l,ct as re,g as u,nt as d}from"./api-C70Gt678.js";import{r as ie}from"./index-Bs6DSbiR.js";import{i as ae,r as oe,t as se}from"./registry-sWIZsIEF.js";import{t as f}from"./setup-task-q21GnI0E.js";var p=e(t(),1),m=a();function ce({onClose:e,showToast:t}){let{t:r}=n(`newInstance`),a=i(),[o,s]=(0,p.useState)(`upload`),[te,c]=(0,p.useState)(!1),[ne,l]=(0,p.useState)(``),[d,ie]=(0,p.useState)(null),ae=(0,p.useRef)(null),[oe,se]=(0,p.useState)(``),[f,ce]=(0,p.useState)(null),[h,le]=(0,p.useState)([]),[ue,g]=(0,p.useState)(0),[_,de]=(0,p.useState)(``),[v,fe]=(0,p.useState)(``),[y,b]=(0,p.useState)(!1);function pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,63)}function me(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}let x=async()=>{if(d){c(!0),l(``);try{let e=await ee(d);se(e.temp_id);let t=await re(e.temp_id);ce(t.manifest),le(t.warnings||[]),g(t.estimated_size||0),t.manifest?.name&&(fe(t.manifest.name),y||de(pe(t.manifest.name))),s(`preview`)}catch(e){l(e.message||`Upload failed`)}finally{c(!1)}}},he=async()=>{if(!(!_||!v||!oe)){c(!0),l(``),s(`creating`);try{let e=await u({temp_id:oe,id:_,name:v});e.ok?(t(r(`import.success`,{defaultValue:`导入成功`}),`success`),e.warnings?.length&&e.warnings.forEach(e=>t(e,`info`)),a(`/instances/${e.instance_id}/config`)):(l(e.detail||r(`import.failed`,{defaultValue:`导入失败`})),s(`preview`))}catch(e){l(e.message||`Import failed`),s(`preview`)}finally{c(!1)}}},ge=`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(0,m.jsxs)(`div`,{className:`space-y-4`,children:[ne&&(0,m.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:ne}),o===`upload`&&(0,m.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-5 space-y-4`,children:[(0,m.jsx)(`div`,{className:`text-xs text-muted bg-card border border-[var(--border)] rounded-md p-3`,children:r(`import.uploadDesc`,{defaultValue:`上传 .tar.gz 文件(支持 JishuShell 导出包、备份包、OpenClaw 官方备份)`})}),(0,m.jsx)(`input`,{ref:ae,type:`file`,accept:`.tar.gz,.tgz`,onChange:e=>ie(e.target.files?.[0]||null),className:`hidden`}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>ae.current?.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:d?(0,m.jsxs)(`span`,{className:`text-foreground truncate`,children:[d.name,` (`,(d.size/1024/1024).toFixed(1),`MB)`]}):r(`import.selectFile`,{defaultValue:`点击选择 .tar.gz 文件`})})]}),o===`preview`&&f&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-5 space-y-4`,children:[(0,m.jsxs)(`div`,{className:`bg-[var(--input-bg)] border border-[var(--border)] rounded-lg p-4 space-y-2 text-sm`,children:[(0,m.jsxs)(`div`,{className:`flex justify-between`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:r(`import.name`,{defaultValue:`名称`})}),(0,m.jsx)(`span`,{className:`text-foreground`,children:f.name||`-`})]}),(0,m.jsxs)(`div`,{className:`flex justify-between`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:r(`import.type`,{defaultValue:`类型`})}),(0,m.jsx)(`span`,{className:`text-foreground`,children:f.type||`unknown`})]}),(0,m.jsxs)(`div`,{className:`flex justify-between`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:r(`import.size`,{defaultValue:`大小`})}),(0,m.jsx)(`span`,{className:`text-foreground`,children:me(ue)})]}),(0,m.jsxs)(`div`,{className:`flex justify-between`,children:[(0,m.jsx)(`span`,{className:`text-muted`,children:r(`import.platform`,{defaultValue:`平台`})}),(0,m.jsxs)(`span`,{className:`text-foreground`,children:[f.platform||`-`,` / `,f.arch||`-`]})]}),f.has_sessions===!1&&(0,m.jsx)(`div`,{className:`text-amber-400 text-xs`,children:r(`import.noSessions`,{defaultValue:`不含对话历史`})})]}),h.length>0&&(0,m.jsx)(`div`,{className:`space-y-1`,children:h.map((e,t)=>(0,m.jsx)(`p`,{className:`text-xs text-amber-400`,children:e},t))}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:r(`name.label`,{defaultValue:`应用名称`})}),(0,m.jsx)(`input`,{type:`text`,value:v,onChange:e=>{fe(e.target.value),y||de(pe(e.target.value))},className:ge})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:r(`id.label`,{defaultValue:`应用 ID`})}),(0,m.jsx)(`input`,{type:`text`,value:_,onChange:e=>{de(e.target.value),b(!0)},className:`${ge} font-mono text-[13px]`})]})]}),(0,m.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:he,disabled:!_||!v||te,children:r(`import.create`,{defaultValue:`创建应用`})})]}),o===`upload`&&(0,m.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:x,disabled:!d||te,children:te?(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin`}),r(`import.uploading`,{defaultValue:`上传中...`})]}):r(`import.upload`,{defaultValue:`上传并预览`})}),o===`creating`&&(0,m.jsxs)(`div`,{className:`flex items-center justify-center py-8 gap-3`,children:[(0,m.jsx)(`span`,{className:`w-4 h-4 border-2 border-[#0066FF]/30 border-t-[#0066FF] rounded-full animate-spin`}),(0,m.jsx)(`span`,{className:`text-sm text-muted`,children:r(`import.creating`,{defaultValue:`正在创建应用...`})})]})]})}var h=`jishushell:new-instance:create-flow`,le=7200*1e3,ue={sourceKey:``,status:`idle`,taskId:``,expectedSpecId:``,seenEventCount:0,progress:null,logs:[],lastError:``},g={status:`idle`,taskId:``,progress:null,logs:[],lastError:``},_=[{id:`openclaw`,icon:`🦞`,labelKey:`group.openclaw`,descKey:`groupDesc.openclaw`},{id:`hermes`,icon:`🧠`,iconImage:`/logos/hermes.png`,labelKey:`group.hermes`,descKey:`groupDesc.hermes`},{id:`ollama`,icon:`🦙`,iconImage:`/logos/ollama.png`,labelKey:`group.ollama`,descKey:`groupDesc.ollama`},{id:`custom`,icon:`🧩`,labelKey:`group.custom`,descKey:`groupDesc.custom`}],de=[{id:`builtin`,labelKey:`source.builtin`}],v=`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`;function fe(){if(typeof window>`u`)return null;try{let e=window.sessionStorage.getItem(h);if(!e)return null;let t=JSON.parse(e);return!t||typeof t!=`object`?null:t.customSourceMode===`remote`||!(t.templateInstall?.status===`running`&&t.templateInstall?.taskId&&t.pendingCreate)?(window.sessionStorage.removeItem(h),null):t}catch{return null}}function y(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,63)}function b(e){return e.trim().toLowerCase()}function pe(e){return`${typeof e.progress==`number`&&e.progress>0?`[${e.progress}%] `:``}${e.message}`}function me(e,t){return e?typeof e.seenEventCount==`number`&&e.seenEventCount>0?e.seenEventCount:e.logs.filter(e=>!!e&&e!==t).length:0}function x(e,t,n){return[...e.length===1&&e[0]===n?[]:e,t].slice(-40)}function he(e){for(let t=e.length-1;t>=0;--t){let n=e[t]?.trim()??``;if(/^(curl|sudo|su)\b/.test(n))return n}return``}function ge(e,t){let n=y(e);if(!n)return``;if(!t.has(n))return n;for(let e=1;e<1e4;e+=1){let r=`-${e}`,i=`${n.slice(0,Math.max(1,63-r.length))}${r}`;if(!t.has(i))return i}return n}function _e(e,t,n){let r=y(e);if(!r)return``;let i=y(t?.create.defaultId||t?.id||``);return ge(i?r===i||r.startsWith(`${i}-`)?r:`${i}-${r}`:r,n)}function ve(e,t){let n=e.trim();if(!n)return``;let r=b(n);if(!t.has(r))return n;for(let e=1;e<1e4;e+=1){let r=`${n}-${e}`;if(!t.has(b(r)))return r}return n}function ye(e){return e?.code===`INSTANCE_ALREADY_RUNNING`?!0:/already running|已在运行/i.test(e?.message||``)}function be(e){return e?.code===`TASK_NOT_FOUND`?!0:/task not found|未找到.*任务/i.test(e?.message||``)}function xe(e,t){let n=t.find(t=>t.id===e);if(n)return n.integrationKinds.includes(`openclaw`)?{mode:`openclaw`,id:n.id}:n.integrationKinds.includes(`hermes`)?{mode:`hermes`,id:n.id}:n.ui.sortGroup===`models`?{mode:`ollama`,id:n.id}:{mode:`custom`,id:n.id};if(e===`openclaw`){let e=t.find(e=>e.integrationKinds.includes(`openclaw`));if(e)return{mode:`openclaw`,id:e.id}}if(e===`hermes`||e===`hermes-agent`){let e=t.find(e=>e.integrationKinds.includes(`hermes`));if(e)return{mode:`hermes`,id:e.id}}if(e===`ollama`){let e=t.find(e=>e.ui.sortGroup===`models`&&/^ollama(?:[-_]|$)/i.test(e.id));if(e)return{mode:`ollama`,id:e.id}}return null}function Se(e,t){let n=e=>t.find(t=>t.id===e)??null;return e===`openclaw`?n(`openclaw-container`)??t.find(e=>e.integrationKinds.includes(`openclaw`)&&e.id!==`openclaw-binary`&&!e.id.startsWith(`openclaw-with-`))??t.find(e=>e.integrationKinds.includes(`openclaw`))??null:e===`hermes`?n(`hermes-container`)??t.find(e=>e.integrationKinds.includes(`hermes`))??null:n(`ollama-binary`)??t.find(e=>e.ui.sortGroup===`models`&&/^ollama(?:[-_]|$)/i.test(e.id))??null}function S(){let{t:e}=n(`newInstance`),[t]=r(),a=(0,p.useRef)(fe()),ee=t.get(`app`)??``,re=a.current?.selectedMode??`openclaw`,{runtimes:u}=ae(),[y,S]=(0,p.useState)(re),[C,Ce]=(0,p.useState)(a.current?.customSourceMode??`builtin`),[w,T]=(0,p.useState)(a.current?.selectedCatalogId??``),[E,we]=(0,p.useState)(null),[Te,Ee]=(0,p.useState)(null),[De,Oe]=(0,p.useState)({}),[ke,D]=(0,p.useState)({}),[O,Ae]=(0,p.useState)([]),[je,Me]=(0,p.useState)(!1),[Ne,Pe]=(0,p.useState)(``),[k,Fe]=(0,p.useState)(a.current?.appSpecUrl??``),[A,j]=(0,p.useState)(a.current?.templateInstall??ue),[M,N]=(0,p.useState)(a.current?.pendingCreate??null),[Ie,Le]=(0,p.useState)(null),[Re,P]=(0,p.useState)(``),[ze,F]=(0,p.useState)(``),[I,Be]=(0,p.useState)(!1),[L,Ve]=(0,p.useState)(a.current?.name??``),[R,He]=(0,p.useState)(a.current?.nameEdited??!1),[z,Ue]=(0,p.useState)(a.current?.id??``),[B,We]=(0,p.useState)(a.current?.idEdited??!1),[V,Ge]=(0,p.useState)(a.current?.description??``),[Ke,qe]=(0,p.useState)([]),[Je,H]=(0,p.useState)(``),[Ye,U]=(0,p.useState)(!1),Xe=t.get(`import`)===`true`,Ze=i(),{showToast:W}=ie(),Qe=(0,p.useRef)({name:``,id:``}),$e=(0,p.useRef)(``),et=(0,p.useRef)(!1),tt=(0,p.useRef)(!1),nt={agents:O.filter(e=>e.ui.sortGroup===`agents`),models:O.filter(e=>e.ui.sortGroup===`models`),apps:O.filter(e=>e.ui.sortGroup===`apps`)},G=y===`custom`&&C===`builtin`?nt.apps:[],K=y===`custom`?C===`remote`?null:G.find(e=>e.id===w)??G[0]??null:Se(y,O),q=K?.integrationKinds.includes(`hermes`)?`hermes`:K?.integrationKinds.includes(`openclaw`)?`openclaw`:null,J=q?u.find(e=>e.kind===q)??se.find(e=>e.kind===q)??null:null,Y=y===`custom`&&C===`remote`,rt=e(Y?`groupDesc.remote`:_.find(e=>e.id===y)?.descKey||`groupDesc.custom`),it=new Set(K?.create.fields.map(e=>e.name)??[]),at=Y||it.has(`name`),ot=Y||it.has(`id`),st=Y||it.has(`description`),X=Y?`remote:${k.trim()}`:K?`builtin:${K.id}`:``,ct=(0,p.useCallback)(()=>{te().then(we).catch(()=>{})},[]);(0,p.useEffect)(()=>{d().then(qe).catch(()=>{}),ct(),Me(!0),o().then(e=>{Ae(e.filter(e=>e.source===`builtin`)),Pe(``)}).catch(t=>{Pe(t?.message||e(`catalog.loadFailed`))}).finally(()=>{Me(!1)})},[ct,e]),(0,p.useEffect)(()=>{if(O.length&&!tt.current){let e=a.current?.selectedCatalogId??``,t=a.current?.selectedMode,n=ee?xe(ee,O):null,r=e?O.find(t=>t.id===e):null;n?(S(n.mode),T(n.id),Ce(n.mode===`custom`?`builtin`:C)):r&&t&&(S(t),T(r.id)),tt.current=!0}},[O,C,ee]),(0,p.useEffect)(()=>{if(y!==`custom`||C!==`builtin`)return;let e=nt.apps;e.length&&(e.some(e=>e.id===w)||T(e[0].id))},[C,nt,w,y]),(0,p.useEffect)(()=>{if(et.current||!E||!J||u.length===0||J.isInstalled(E))return;et.current=!0;let e=u.find(e=>(e.kind===`openclaw`||e.kind===`hermes`)&&e.isInstalled(E));if(e&&q&&e.kind!==q){let t=O.find(t=>t.integrationKinds.includes(e.kind));t&&(S(e.kind===`hermes`?`hermes`:`openclaw`),T(t.id))}},[O,u,q,J,E]),(0,p.useEffect)(()=>{if(!(typeof window>`u`)){if(A.status===`running`&&A.taskId&&M){let e={selectedMode:y,customSourceMode:C,selectedCatalogId:w,appSpecUrl:k,name:L,nameEdited:R,id:z,idEdited:B,description:V,templateInstall:A,pendingCreate:M};window.sessionStorage.setItem(h,JSON.stringify(e));return}window.sessionStorage.removeItem(h)}},[k,C,V,z,B,L,R,M,w,y,A]);let lt=new Set(Ke.map(e=>typeof e?.id==`string`?e.id:``).filter(Boolean)),ut=new Set(Ke.map(e=>typeof e?.name==`string`?e.name:``).filter(Boolean).map(e=>b(e))),Z=K?ge(K.create.defaultId||K.id,lt):``,dt=K?ve(K.name||K.id,ut):``;(0,p.useEffect)(()=>{if(Y||!K||!Z||!dt)return;let e=Qe.current,t=!R||!!e.name&&L===e.name,n=!B&&!R||!!e.id&&z===e.id;t&&L!==dt&&(Ve(dt),He(!1)),n&&z!==Z&&(Ue(Z),We(!1)),Qe.current={name:dt,id:Z}},[z,B,Y,L,R,K,Z,dt]);let Q=z.trim(),ft=b(L),pt=ft?Ke.find(e=>typeof e?.name==`string`&&b(e.name)===ft):null,mt=Q?Ke.find(e=>e?.id===Q):null,ht=pt?e(`name.duplicate`,{name:L.trim(),id:pt.id,defaultValue:`应用名称“{{name}}”已存在(ID: {{id}})`}):mt?e(`id.duplicate`,{id:Q,defaultValue:`应用 ID“{{id}}”已存在`}):``,gt=A.status===`running`&&A.sourceKey===X,_t=Ye||gt,$=gt?e(`install.waitingCompletion`,{defaultValue:`当前模板正在安装中,请等待安装完成`}):``,vt=ht||Je,yt=async t=>{if(Te)return;H(``),Ee(t.kind),Oe(e=>({...e,[t.kind]:{message:`准备安装...`,tone:`progress`}}));let n=e(`runtime.waitingLogs`,{defaultValue:`等待安装日志...`});D(e=>({...e,[t.kind]:{status:`running`,taskId:``,progress:null,logs:[n],lastError:``}}));try{let e=await oe(t);e?.taskId&&(D(r=>({...r,[t.kind]:{...r[t.kind]??g,status:`running`,taskId:e.taskId??``,logs:r[t.kind]?.logs?.length?r[t.kind].logs:[n],lastError:``}})),await f(e.taskId,{maxDurationMs:le,onEvent:r=>{Oe(e=>({...e,[t.kind]:r})),D(i=>({...i,[t.kind]:{...i[t.kind]??g,status:r.tone===`error`?`error`:r.tone===`success`?`done`:`running`,taskId:e.taskId??``,progress:typeof r.progress==`number`&&r.progress>0?r.progress:i[t.kind]?.progress??null,logs:x(i[t.kind]?.logs??[n],pe(r),n),lastError:r.tone===`error`?r.message:``}}))}})),ct(),D(e=>({...e,[t.kind]:{...e[t.kind]??g,status:`done`,progress:100}})),W(`${t.displayName} 安装完成`,`success`)}catch(e){let r=e?.message||`${t.displayName} 安装失败`;H(r),D(e=>({...e,[t.kind]:{...e[t.kind]??g,status:`error`,lastError:r,logs:x(e[t.kind]?.logs??[n],r,n)}})),W(r,`error`)}finally{Ee(null),setTimeout(()=>{Oe(e=>({...e,[t.kind]:null}))},3e3)}},bt=e=>{H(``),Ve(e),He(!0),B||Ue(_e(e,K,lt))},xt=e=>{S(e),H(``)},St=()=>{if(!Q||!L.trim())throw Error(e(`install.identityRequired`,{defaultValue:`请先确认应用名称和应用 ID`}));if(Y){if(!k.trim())throw Error(e(`source.urlRequired`));return{flow:{sourceKey:X,targetId:Q,name:L.trim(),description:V},payload:{source:{kind:`remote-url`,url:k.trim()},requestedInstanceId:Q,name:L.trim(),description:V},needsSudoPrompt:!0}}if(!K)throw Error(Ne||e(`catalog.none`));if(J&&!J.isInstalled(E))throw Error(e(`runtime.installFirst`,{name:J.displayName}));return{flow:{sourceKey:X,targetId:Q,name:L.trim(),description:V},payload:{source:{kind:`builtin`,specId:K.id},requestedInstanceId:Q,name:L.trim(),description:V},needsSudoPrompt:K.install.requiresSudo!==`never`}},Ct=(0,p.useCallback)(async(t,n,r)=>{let i=e(`install.waitingLogs`),a=me(r,i);j({sourceKey:t.sourceKey,status:`running`,taskId:r?.taskId??``,expectedSpecId:r?.expectedSpecId??``,seenEventCount:a,progress:r?.progress??null,logs:r?.logs?.length?r.logs:[i],lastError:``});let o=r?.taskId??``,s=r?.expectedSpecId??``;try{if(!o){if(!n)throw Error(e(`install.missingTask`,{defaultValue:`未找到可恢复的安装任务,请重新点击创建应用`}));let r=await l(n);o=r.taskId,s=r.expectedSpecId??``,j(n=>({...n,sourceKey:t.sourceKey,taskId:o,expectedSpecId:s,logs:r.reused?[...n.logs,e(`install.reusedTask`)].slice(-40):n.logs}))}try{await f(o,{maxDurationMs:le,pollIntervalMs:400,initialSeenCount:a,onEvent:(e,t)=>{j(n=>({...n,progress:typeof e.progress==`number`&&e.progress>0?e.progress:n.progress,seenEventCount:Math.max(n.seenEventCount,t?.seenCount??n.seenEventCount),logs:x(n.logs,pe(e),i)}))}})}catch(n){if(!be(n))throw n;if(!(await c(t.targetId).catch(()=>null))?.id)throw Error(e(`install.taskStateLost`));j(t=>({...t,logs:[...t.logs,e(`install.taskRecovered`)].slice(-40)}))}if(!(await c(t.targetId).catch(()=>null))?.id)throw Error(e(`install.notFoundAfterInstall`));return j(e=>({...e,sourceKey:t.sourceKey,status:`done`,progress:100})),t.targetId}catch(n){let r=n?.message||e(`install.failed`,{defaultValue:`模板安装失败`});throw j(n=>{let a=x(n.logs,r,i),o=he(a);return{...n,sourceKey:t.sourceKey,status:`error`,lastError:o?e(`install.manualRequired`):r,logs:a}}),Error(r)}},[e]),wt=(0,p.useCallback)(()=>{I||(Le(null),P(``),F(``))},[I]),Tt=(0,p.useCallback)(async t=>{try{await s(t.targetId,`new-instance`)}catch(e){if(!ye(e))throw e}N(null),j(ue),W(e(`create.startedSuccess`,{name:t.name||t.targetId,defaultValue:`应用 {{name}} 创建成功并已启动`}),`success`),Ze(`/instances/${t.targetId}/chat`)},[Ze,W,e]),Et=(0,p.useCallback)(async()=>{if(!Ie||I)return;if(!Re){F(e(`sudoDialog.passwordRequired`,{defaultValue:`请输入 sudo 密码。`}));return}H(``),F(``);let t=Ie,n=Re.trim();Be(!0);try{await ne({sudoPassword:n})}catch(t){F(t?.message||e(`sudoDialog.passwordInvalid`,{defaultValue:`sudo 密码错误,请重新输入。`})),P(``),Be(!1);return}Le(null),P(``),F(``),U(!0),Be(!1);try{N(t.flow),await Ct(t.flow,{...t.payload,sudoPassword:n}),await Tt(t.flow)}catch(t){N(null),H(t?.message||e(`failed`))}finally{U(!1)}},[Ct,Tt,Re,Ie,I,e]);return(0,p.useEffect)(()=>{M&&(Ye||A.status!==`running`||!A.taskId||$e.current!==A.taskId&&($e.current=A.taskId,(async()=>{H(``),U(!0);try{await Ct(M,void 0,A),await Tt(M)}catch(t){N(null),H(t?.message||e(`failed`))}finally{$e.current=``,U(!1)}})()))},[Ye,Ct,M,Tt,e,A]),Xe?(0,m.jsxs)(`div`,{className:`p-6 max-w-lg mx-auto`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:e(`import.title`,{defaultValue:`导入实例`})}),(0,m.jsx)(`p`,{className:`text-sm text-muted mt-0.5`,children:e(`import.subtitle`,{defaultValue:`从文件导入 OpenClaw 实例`})})]}),(0,m.jsx)(ce,{onClose:()=>Ze(`/instances/new`),showToast:W})]}):(0,m.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:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:e(`title`)}),(0,m.jsx)(`p`,{className:`text-sm text-muted mt-0.5`,children:e(`subtitle`)})]}),(0,m.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),!(!Q||!L.trim())){if(ht){H(ht);return}if($){H($);return}H(``);try{let{flow:e,payload:t,needsSudoPrompt:n}=St();if(n){P(``),F(``),Le({flow:e,payload:t});return}U(!0),N(e),await Ct(e,t),await Tt(e)}catch(t){N(null),H(t?.message||e(`failed`))}finally{U(!1)}}},className:`space-y-5`,children:[vt&&(0,m.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:vt}),(0,m.jsxs)(`div`,{className:`bg-card border border-[var(--border)] rounded-xl p-6 space-y-5`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`kind.label`)}),(0,m.jsx)(`div`,{className:`overflow-x-auto pb-1`,children:(0,m.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:_.filter(e=>e.id===`custom`?nt.apps.length>0||Y:e.id===`openclaw`?!!Se(`openclaw`,O):e.id===`hermes`?!!Se(`hermes`,O):!!Se(`ollama`,O)).map(t=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>xt(t.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 ${y===t.id?`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:[t.iconImage?(0,m.jsx)(`img`,{src:t.iconImage,alt:``,"aria-hidden":`true`,className:`h-5 w-5 object-contain`}):(0,m.jsx)(`span`,{className:`text-base leading-none`,children:t.icon}),(0,m.jsx)(`span`,{children:e(t.labelKey)})]},t.id))})}),(0,m.jsx)(`p`,{className:`text-xs text-muted mt-2 leading-5`,children:rt})]}),(K||y===`custom`)&&(Y?(0,m.jsxs)(`div`,{className:`space-y-3`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`source.label`)}),(0,m.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] bg-[var(--input-bg)] p-4 space-y-2`,children:[(0,m.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:e(`source.url`)}),(0,m.jsx)(`p`,{className:`text-xs text-muted leading-5`,children:e(`source.urlHint`)})]})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`source.url`)}),(0,m.jsx)(`input`,{type:`url`,value:k,onChange:e=>{H(``),Fe(e.target.value)},placeholder:e(`source.urlPlaceholder`),className:v})]})]}):(0,m.jsxs)(`div`,{className:`space-y-3`,children:[y===`custom`&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`source.label`)}),(0,m.jsx)(`div`,{className:`inline-flex rounded-xl border border-[var(--border)] bg-[var(--input-bg)] p-1 gap-1`,children:de.map(t=>(0,m.jsx)(`button`,{type:`button`,onClick:()=>Ce(t.id),className:`rounded-lg px-4 py-2 text-sm font-medium transition-all ${C===t.id?`bg-[#0066FF] text-white shadow-[0_8px_24px_rgba(0,102,255,0.18)]`:`text-muted hover:bg-[var(--card-hover)] hover:text-foreground`}`,children:e(t.labelKey)},t.id))})]}),(0,m.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] space-y-3`,children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted`,children:e(y===`custom`?`catalog.label`:`template.label`)}),je?(0,m.jsx)(`div`,{className:`text-sm text-muted`,children:e(`catalog.loading`)}):y===`custom`&&G.length===0?(0,m.jsx)(`div`,{className:`text-sm text-amber-400`,children:Ne||e(`catalog.none`)}):y===`custom`&&G.length>4?(0,m.jsx)(`select`,{value:K?.id??``,onChange:e=>T(e.target.value),className:`${v} appearance-none`,children:G.map(e=>(0,m.jsx)(`option`,{value:e.id,className:`bg-background text-foreground`,children:e.name},e.id))}):y===`custom`?(0,m.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:G.map(e=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>T(e.id),className:`rounded-lg border px-3 py-3 text-left transition-colors ${K?.id===e.id?`border-[#0066FF]/50 bg-[#0066FF]/8`:`border-[var(--border)] hover:bg-[var(--card-hover)]`}`,children:[(0,m.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.name}),(0,m.jsx)(`div`,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description||e.id})]},e.id))}):null,K&&(0,m.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] bg-background/50 px-4 py-3 space-y-2`,children:[(0,m.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:K.name}),(0,m.jsx)(`p`,{className:`text-xs text-muted mt-1 leading-5`,children:K.description||K.id})]})}),K.install.requiresSudo!==`never`&&(0,m.jsx)(`p`,{className:`text-xs text-amber-300`,children:K.install.requiresSudo===`always`?e(`catalog.requiresSudoAlways`,{defaultValue:`该安装流程需要 sudo 提权。`}):e(`catalog.requiresSudoMaybe`,{defaultValue:`该安装流程可能会请求 sudo,取决于宿主机当前环境。`})})]})]})]})),J&&(()=>{if(!J)return null;let t=J.isInstalled(E),n=Te===J.kind,r=De[J.kind];return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`runtime.label`)}),(0,m.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] p-4 bg-[var(--input-bg)] space-y-3`,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsxs)(`div`,{className:`text-sm font-medium text-foreground flex items-center gap-2`,children:[J.displayName,!t&&(0,m.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:e(`runtime.notInstalled`)})]}),(0,m.jsx)(`p`,{className:`text-xs text-muted mt-1`,children:e(J.description)}),J.installHint&&!t&&(0,m.jsx)(`p`,{className:`text-xs text-muted mt-2`,children:e(J.installHint)})]}),t&&(0,m.jsx)(`span`,{className:`text-xs text-emerald-400 font-medium`,children:e(`runtime.ready`)})]}),!t&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>yt(J),disabled:!!Te,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:n?(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin`}),e(`runtime.installing`)]}):Te?e(`runtime.waitingOtherInstall`):e(`runtime.install`,{name:J.displayName})}),r?.message&&(0,m.jsxs)(`div`,{className:`text-[11px] font-mono text-muted truncate`,title:r.message,children:[typeof r.progress==`number`&&r.progress>0?`[${r.progress}%] `:``,r.message]}),(ke[J.kind]?.logs?.length??0)>0&&(0,m.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] bg-background/60 px-3 py-3 space-y-2`,children:[(0,m.jsx)(`div`,{className:`text-xs text-muted`,children:e(`runtime.logs`,{defaultValue:`安装日志`})}),(0,m.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:ke[J.kind]?.logs.map((e,t)=>(0,m.jsx)(`div`,{children:e},`${J.kind}-${t}-${e}`))}),ke[J.kind]?.lastError&&(0,m.jsx)(`p`,{className:`text-xs text-red-400`,children:ke[J.kind]?.lastError})]})]})]})})(),(at||ot)&&(0,m.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1.1fr_0.9fr]`,children:[at&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`name.label`)}),(0,m.jsx)(`input`,{type:`text`,value:L,onChange:e=>bt(e.target.value),placeholder:e(`name.placeholder`),className:v,autoFocus:!0})]}),ot&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`id.label`)}),(0,m.jsx)(`input`,{type:`text`,value:z,onChange:e=>{H(``),Ue(e.target.value),We(!0)},placeholder:e(`id.placeholder`),className:`${v} font-mono text-[13px]`}),(0,m.jsx)(`p`,{className:`text-xs text-muted mt-1`,children:L&&!z?(0,m.jsx)(`span`,{className:`text-amber-400`,children:e(`id.invalid`)}):e(`id.hint`)})]})]}),st&&(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`description.label`)}),(0,m.jsx)(`input`,{type:`text`,value:V,onChange:e=>{H(``),Ge(e.target.value)},placeholder:e(`description.placeholder`),className:v})]})]}),$&&(0,m.jsx)(`p`,{className:`text-xs text-amber-400`,children:$}),(0,m.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,m.jsx)(`button`,{type:`submit`,disabled:_t||!Q||!L.trim()||!!ht||!!$||!Y&&!K||Y&&!k.trim(),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:_t?(0,m.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin`}),$?e(`install.installing`,{defaultValue:`安装中...`}):e(`loading`)]}):e(`submit`)})}),X&&(t=>{if(!(A.sourceKey===t&&(A.status!==`idle`||A.logs.length>0)))return null;let n=he(A.logs);return(0,m.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] bg-background/60 px-3 py-3 space-y-2`,children:[(0,m.jsx)(`div`,{className:`text-xs text-muted`,children:e(`install.logs`,{defaultValue:`安装日志`})}),(0,m.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:A.logs.map((e,t)=>(0,m.jsx)(`div`,{children:e},`${t}-${e}`))}),A.lastError&&(0,m.jsx)(`p`,{className:`text-xs text-red-400`,children:A.lastError}),n&&(0,m.jsxs)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 space-y-1`,children:[(0,m.jsx)(`p`,{className:`text-[11px] text-amber-200`,children:e(`install.manualCommandLabel`,{defaultValue:`请在终端执行以下命令后,再重新点击创建应用:`})}),(0,m.jsx)(`pre`,{className:`font-mono text-[11px] text-amber-50 whitespace-pre-wrap break-all`,children:n})]})]})})(X)]}),Ie&&(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4`,onClick:wt,children:(0,m.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:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:e(`sudoDialog.title`,{defaultValue:`输入 sudo 密码以继续安装应用`})}),(0,m.jsx)(`p`,{className:`mt-1 text-xs text-muted leading-relaxed`,children:e(`sudoDialog.body`,{defaultValue:`当前安装步骤需要 sudo 提权。密码只会用于这次安装请求,不会写入应用配置或任务日志。`})})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:`block text-sm font-medium text-muted mb-1.5`,children:e(`sudoDialog.passwordLabel`,{defaultValue:`sudo 密码`})}),(0,m.jsx)(`input`,{type:`password`,value:Re,onChange:e=>{P(e.target.value),F(``)},placeholder:e(`sudoDialog.passwordPlaceholder`,{defaultValue:`输入当前用户的 sudo 密码`}),className:v,disabled:I,autoFocus:!0}),ze&&(0,m.jsx)(`p`,{className:`mt-2 text-xs text-red-400`,children:ze})]}),(0,m.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[(0,m.jsx)(`button`,{type:`button`,onClick:wt,disabled:I,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:e(`sudoDialog.cancel`,{defaultValue:`取消`})}),(0,m.jsx)(`button`,{type:`button`,onClick:Et,disabled:I,className:`px-3 py-1.5 text-xs rounded-md bg-[#0066FF] text-white hover:bg-[#0066FF]/90 transition-colors`,children:I?e(`sudoDialog.verifying`,{defaultValue:`验证中...`}):e(`sudoDialog.confirm`,{defaultValue:`继续安装`})})]})]})})]})}export{S as default};
|
package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-BABo9VOC.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./vendor-i18n-Df8aUdv8.js";import{t}from"./vendor-react-0L0rjmYG.js";import{d as n,o as r}from"./index-Bs6DSbiR.js";import{d as i}from"./ApiKeyField-Ce5d1xna.js";var a=t();function o({title:t,description:o,apiKeyHint:s,selectedProviderId:c,onSelectProvider:l}){let{t:u}=e(`instance`),d=(e,t)=>{l(e),window.open(t,`_blank`,`noopener,noreferrer`)};return(0,a.jsxs)(`div`,{className:`rounded-lg border border-[var(--border)] bg-[var(--input-bg)]/40 p-3`,children:[(0,a.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-[0.18em] text-[#0066FF]`,children:t}),(0,a.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted`,children:o}),(0,a.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:i.map(e=>{let t=e.providerId===c;return(0,a.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>d(e.providerId,e.purchaseUrl),className:[`inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-all`,t?`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:[(0,a.jsx)(`span`,{children:u(`recommendedProviderLabel.${e.providerId}`,{defaultValue:e.label})}),(0,a.jsx)(n,{className:`h-3 w-3`})]},e.providerId)})}),(0,a.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:[(0,a.jsx)(r,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-400`}),(0,a.jsx)(`p`,{className:`text-[11px] leading-5 text-muted`,children:s})]})]})}export{o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{a as t,t as n}from"./vendor-i18n-Df8aUdv8.js";import{t as r}from"./vendor-react-0L0rjmYG.js";import{At as i,Mt as a,O as o,S as s,Z as c,at as l,bt as u,f as d,it as f,lt as p,nt as m,rt as h,s as g,t as _,xt as v,z as y}from"./api-C70Gt678.js";import{f as b,g as x,n as S,p as C,u as w}from"./index-Bs6DSbiR.js";import{t as T,u as E}from"./ApiKeyField-Ce5d1xna.js";import{t as D}from"./setup-task-q21GnI0E.js";import{t as O}from"./ProviderRecommendations-BABo9VOC.js";var k=e(t(),1),A=r();function j(e){return e.icon===`openclaw`?`/logos/openclaw.svg`:e.icon===`hermes`?`/logos/hermes.png`:e.icon===`ollama`?`/logos/ollama.png`:null}function M(e){return typeof e!=`number`||e<=0?``:e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}function N(e){if(e==null)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString()}function P({showToast:e}){let{t}=n(`settings`),[r,a]=(0,k.useState)([]),[o,s]=(0,k.useState)(null),[l,u]=(0,k.useState)(!0),[f,p]=(0,k.useState)(``),[m,g]=(0,k.useState)(!1),[_,v]=(0,k.useState)(``),[y,b]=(0,k.useState)({}),[S,C]=(0,k.useState)(null),[T,E]=(0,k.useState)(!1),O=(0,k.useRef)(new Set),P=(0,k.useCallback)(async(e=!1)=>{e&&u(!0);try{let e=await h();return a(e.apps),s(e.lastCheckedAt),p(``),e.apps}catch(e){return p(e?.message||t(`integrations.loadFailed`)),[]}finally{e&&u(!1)}},[t]),F=(0,k.useCallback)(async(n,r,i)=>{if(!(!r||O.current.has(r))){O.current.add(r),v(n),b(e=>({...e,[n]:{message:t(i===`uninstall`?`integrations.uninstalling`:`integrations.installing`),progress:null,tone:`progress`}}));try{e(await D(r,{onEvent:e=>{b(t=>({...t,[n]:{message:e.message,progress:typeof e.progress==`number`?e.progress:t[n]?.progress??null,tone:e.tone}}))}})||t(i===`uninstall`?`integrations.uninstalled`:`integrations.installed`),`success`)}catch(r){let i=r?.message||t(`integrations.operationFailed`);b(e=>({...e,[n]:{message:i,progress:e[n]?.progress??null,tone:`error`}})),e(i,`error`)}finally{O.current.delete(r),v(e=>e===n?``:e),await P()}}},[P,e,t]);(0,k.useEffect)(()=>{let e=!1;return P(!0).then(t=>{if(!e)for(let e of t)e.status.currentTaskId&&F(e.id,e.status.currentTaskId,e.status.currentTaskKind??`install`)}),()=>{e=!0}},[P,F]);let I=async()=>{g(!0);try{let n=await d();s(n.checkedAt),await P(),e(t(`integrations.checkComplete`),`success`)}catch(n){e(n?.message||t(`integrations.checkFailed`),`error`)}finally{g(!1)}},L=(e,n)=>n.manualCommand?(C({title:t(`integrations.manualTitle`,{name:e.name}),reason:n.manualReason||n.message,command:n.manualCommand}),!0):!1,R=async n=>{v(n.id),C(null);try{let e=await c(n.id);await F(n.id,e.taskId,`install`)}catch(r){let i=r;L(n,i)||e(i.message||t(`integrations.operationFailed`),`error`),v(``)}},z=async n=>{if(window.confirm(t(`integrations.confirmUninstall`,{name:n.name}))){v(n.id),C(null);try{let e=await i(n.id);await F(n.id,e.taskId,`uninstall`)}catch(r){let i=r;L(n,i)||e(i.message||t(`integrations.operationFailed`),`error`),v(``)}}},B=async()=>{S&&(await navigator.clipboard.writeText(S.command),E(!0),window.setTimeout(()=>E(!1),2e3))},V=N(o);return(0,A.jsxs)(`section`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:t(`integrations.title`)}),(0,A.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t(`integrations.desc`)}),V&&(0,A.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:t(`integrations.lastChecked`,{time:V})})]}),(0,A.jsxs)(`button`,{type:`button`,onClick:I,disabled:m||l,className:`inline-flex items-center justify-center gap-1.5 rounded-md border border-[var(--border)] px-3 py-1.5 text-xs font-medium hover:bg-[var(--input-bg)] disabled:opacity-40`,children:[(0,A.jsx)(x,{className:`h-3.5 w-3.5 ${m?`animate-spin`:``}`}),t(m?`integrations.checking`:`integrations.checkUpdates`)]})]}),S&&(0,A.jsxs)(`div`,{className:`mt-4 rounded-lg border border-amber-500/30 bg-amber-500/10 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h3`,{className:`text-sm font-medium text-amber-300`,children:S.title}),(0,A.jsx)(`p`,{className:`mt-1 text-xs text-amber-200/80`,children:S.reason})]}),(0,A.jsx)(`button`,{type:`button`,className:`text-xs text-muted hover:text-foreground`,onClick:()=>C(null),children:t(`integrations.dismiss`)})]}),(0,A.jsxs)(`div`,{className:`mt-3 flex items-start gap-2`,children:[(0,A.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-black/30 px-3 py-2 text-xs text-amber-100`,children:S.command}),(0,A.jsxs)(`button`,{type:`button`,onClick:B,className:`inline-flex shrink-0 items-center gap-1 rounded border border-amber-500/30 px-2 py-2 text-xs text-amber-200 hover:bg-amber-500/10`,children:[(0,A.jsx)(w,{className:`h-3.5 w-3.5`}),t(T?`integrations.copied`:`integrations.copy`)]})]})]}),l?(0,A.jsx)(`div`,{className:`py-8 text-center text-sm text-muted`,children:t(`integrations.loading`)}):f?(0,A.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-sm text-red-400`,children:f}):(0,A.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-3`,children:r.map(e=>{let n=y[e.id],r=_===e.id||!!e.status.currentTaskId,i=j(e),a=M(e.diskSpaceMB),o=e.status.installed&&e.status.updateAvailable===!0&&e.actions.update;return(0,A.jsxs)(`article`,{className:`flex min-h-52 flex-col rounded-lg border border-[var(--border)] bg-[var(--input-bg)]/30 p-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i?(0,A.jsx)(`img`,{src:i,alt:``,className:`h-9 w-9 rounded-md object-contain`}):(0,A.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-md bg-[#0066FF]/10 text-sm font-semibold text-[#0066FF]`,children:e.name.slice(0,1)}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`font-medium text-foreground`,children:e.name}),e.required&&(0,A.jsx)(`span`,{className:`rounded bg-[#0066FF]/10 px-1.5 py-0.5 text-[10px] text-[#66a3ff]`,children:t(`integrations.required`)})]}),(0,A.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2 text-xs`,children:[(0,A.jsx)(`span`,{className:e.status.installed?`text-emerald-400`:`text-muted`,children:e.status.installed?t(`integrations.statusInstalled`):t(`integrations.statusNotInstalled`)}),e.status.version&&(0,A.jsxs)(`span`,{className:`font-mono text-muted`,children:[`v`,e.status.version.replace(/^v/,``)]}),a&&(0,A.jsx)(`span`,{className:`text-muted`,children:a})]})]})]}),(0,A.jsx)(`p`,{className:`mt-3 flex-1 text-xs leading-relaxed text-muted`,children:e.description}),n&&(0,A.jsxs)(`div`,{className:`mt-3 rounded-md px-2.5 py-2 text-xs ${n.tone===`error`?`bg-red-500/10 text-red-400`:`bg-[#0066FF]/10 text-[#66a3ff]`}`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:n.message}),n.progress!=null&&(0,A.jsxs)(`span`,{className:`font-mono`,children:[n.progress,`%`]})]}),n.progress!=null&&(0,A.jsx)(`div`,{className:`mt-1.5 h-1 overflow-hidden rounded-full bg-black/20`,children:(0,A.jsx)(`div`,{className:`h-full bg-current transition-all`,style:{width:`${Math.max(0,Math.min(100,n.progress))}%`}})})]}),(0,A.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-[var(--border)] pt-3`,children:[!e.status.installed&&e.actions.install&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>R(e),disabled:r,className:`rounded-md bg-[#0066FF] px-3 py-1.5 text-xs font-medium text-white hover:bg-[#0066FF]/90 disabled:opacity-40`,children:t(r?`integrations.installing`:`integrations.install`)}),o&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>R(e),disabled:r,className:`rounded-md bg-[#0066FF] px-3 py-1.5 text-xs font-medium text-white hover:bg-[#0066FF]/90 disabled:opacity-40`,children:t(r?`integrations.installing`:`integrations.update`)}),e.status.installed&&e.status.updateAvailable===!1&&(0,A.jsx)(`span`,{className:`self-center text-xs text-emerald-400`,children:t(`integrations.upToDate`)}),e.status.installed&&e.actions.uninstall&&!e.required&&(0,A.jsx)(`button`,{type:`button`,onClick:()=>z(e),disabled:r,className:`rounded-md border border-red-500/30 px-3 py-1.5 text-xs text-red-400 hover:bg-red-500/10 disabled:opacity-40`,children:t(r?`integrations.uninstalling`:`integrations.uninstall`)})]})]},e.id)})})]})}function F({showToast:e}){let{t}=n(`settings`),{t:r}=n(`instance`),{t:i}=n(`common`),[o,c]=(0,k.useState)([]),[l,d]=(0,k.useState)(!0),[m,h]=(0,k.useState)(null),[g,v]=(0,k.useState)(!1),[b,x]=(0,k.useState)(!1),[S,C]=(0,k.useState)(null),[w,D]=(0,k.useState)([]),[j,M]=(0,k.useState)(``),[N,P]=(0,k.useState)(``),[F,I]=(0,k.useState)(``),[L,R]=(0,k.useState)(``),[z,B]=(0,k.useState)(``),[V,H]=(0,k.useState)(!1),[U,W]=(0,k.useState)([]),[ee,te]=(0,k.useState)(`idle`),[G,K]=(0,k.useState)({name:``,baseUrl:``,api:`openai-completions`,apiKey:``,authHeader:``,selectedModelId:``}),[ne,re]=(0,k.useState)(`idle`),q=(0,k.useCallback)(()=>{d(!0),f().then(c).catch(()=>c([])).finally(()=>d(!1))},[]);(0,k.useEffect)(()=>{q()},[q]);let J=`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`,Y=`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`,ie=()=>{h(null),M(``),P(``),I(``),R(``),B(``),W([]),D([]),v(!0)},ae=e=>{v(!1),D([]),K({name:e.name||e.id,baseUrl:e.baseUrl,api:e.api,apiKey:``,authHeader:e.authHeader||``,selectedModelId:e.selectedModelId||``}),h(e.id)},X=()=>{v(!1),h(null),D([]),M(``),P(``),I(``),R(``),B(``),W([])},oe=(0,k.useCallback)(e=>{let t=E.find(t=>t.id===e);M(e),I(t?.baseUrl||``),R(``),W([])},[]),se=async()=>{if(!j){e(t(`llm.presetRequired`),`error`);return}let n=E.find(e=>e.id===j),r=n.local===!0;if(!r&&!N.trim()){e(t(`llm.apiKeyRequired`),`error`);return}if(r&&!F.trim()&&!n.baseUrl){e(t(`llm.baseUrlRequired`),`error`);return}let a=o.map(e=>e.id),s=z.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),c=s?`${j}-${s}`:j;if(a.includes(c)){if(s){e(t(`llm.aliasConflict`),`error`);return}let n=2;for(;a.includes(`${j}-${n}`);)n++;c=`${j}-${n}`}let l=z.trim()?`${n.label} (${z.trim()})`:n.label,u=U.length>0?U.map(e=>({id:e.id,name:e.id,contextWindow:0})):n.models,d=L||u[0]?.id||``;!r&&N.trim()&&ee!==`valid`&&e(i(`llm.saveWithoutValidation`),`error`),x(!0);try{await _({id:c,name:l,baseUrl:(r?F.trim():void 0)||n.baseUrl,api:n.api,apiKey:N||void 0,authHeader:n.authHeader?`x-api-key`:void 0,models:u,selectedModelId:d}),e(t(`llm.added`),`success`),X(),q()}catch(n){e(n.message||t(`llm.saveFailed`),`error`)}finally{x(!1)}},ce=async(n,r={})=>{if(!j)return;let i=E.find(e=>e.id===j),a=i.authHeader?`x-api-key`:`Authorization`,o=i.local===!0&&F.trim()?F.trim():i.baseUrl,s=n??N;H(!0);try{let{models:n}=await p(o,s,a,i.id,i.api);W(n),n.length>0&&R(e=>e||n[0].id),r.silentSuccess||e(t(`llm.modelsFetched`,{count:n.length}),`success`)}catch(n){e(n.message||t(`llm.modelsFetchFailed`),`error`)}finally{H(!1)}},le=async()=>{if(m){if(!G.baseUrl.trim()){e(t(`llm.baseUrlRequired`),`error`);return}G.apiKey.trim()&&ne!==`valid`&&e(i(`llm.saveWithoutValidation`),`error`),x(!0);try{await a(m,{name:G.name||m,baseUrl:G.baseUrl.trim(),api:G.api,apiKey:G.apiKey||void 0,authHeader:G.authHeader||void 0,selectedModelId:G.selectedModelId||void 0}),e(t(`llm.updated`),`success`),X(),q()}catch(n){e(n.message||t(`llm.saveFailed`),`error`)}finally{x(!1)}}},ue=async n=>{if(window.confirm(t(`llm.confirmDelete`,{id:n})))try{await s(n),e(t(`llm.deleted`),`success`),q()}catch(n){e(n.message||t(`llm.deleteFailed`),`error`)}},de=async n=>{try{await u(n),e(t(`llm.defaultSet`,{id:n}),`success`),q()}catch(t){e(t.message,`error`)}},fe=async n=>{C(n);try{let{models:r}=await y(n);D(r),e(t(`llm.modelsFetched`,{count:r.length}),`success`)}catch(n){e(n.message||t(`llm.modelsFetchFailed`),`error`)}finally{C(null)}},pe=[...new Set(E.map(e=>e.group))],Z=E.find(e=>e.id===j),me=Z?.local===!0,Q=U.length>0?U.map(e=>({id:e.id,label:e.id})):(Z?.models||[]).map(e=>({id:e.id,label:`${e.name} (${Math.round(e.contextWindow/1e3)}K)`})),he=(0,A.jsxs)(`div`,{className:`mt-3 border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--input-bg)]/40`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`llm.addTitle`)}),(0,A.jsxs)(`div`,{className:`space-y-3`,children:[(0,A.jsx)(O,{title:t(`llm.recommendedTitle`),description:t(`llm.recommendedDescription`),apiKeyHint:t(`llm.apiKeyHint`),selectedProviderId:j,onSelectProvider:oe}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.presetLabel`)}),(0,A.jsxs)(`select`,{value:j,onChange:e=>oe(e.target.value),className:Y,children:[(0,A.jsx)(`option`,{value:``,children:t(`llm.presetPlaceholder`)}),pe.map(e=>(0,A.jsx)(`optgroup`,{label:r(`configForm.providerGroup.${e}`,{defaultValue:e}),children:E.filter(t=>t.group===e).map(e=>(0,A.jsx)(`option`,{value:e.id,children:r(`configForm.providerLabel.${e.id}`,{defaultValue:e.label})},e.id))},e))]})]}),j&&(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.alias`)}),(0,A.jsx)(`input`,{value:z,onChange:e=>B(e.target.value),placeholder:t(`llm.aliasPlaceholder`),className:J}),(0,A.jsx)(`p`,{className:`text-[11px] text-muted mt-0.5`,children:t(`llm.aliasHint`)})]}),j&&!me&&(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.fieldApiKey`)}),(0,A.jsx)(T,{value:N,saved:!1,onChange:e=>P(e),baseUrl:Z?.local===!0&&F.trim()?F.trim():Z?.baseUrl||``,api:Z?.api||``,authHeader:Z?.authHeader?`x-api-key`:void 0,providerId:j,placeholder:t(`llm.apiKeyPlaceholder`),onModels:e=>{W(e),e.length>0&&R(t=>t||e[0].id)},onStateChange:te,selectedModelId:L})]}),j&&me&&(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.fieldBaseUrl`)}),(0,A.jsxs)(`div`,{className:`flex gap-2`,children:[(0,A.jsx)(`input`,{value:F,onChange:e=>I(e.target.value),className:`${J} flex-1`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>{ce()},disabled:V,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(V?`llm.fetchingModels`:`llm.fetchModels`)})]})]}),j&&Q.length>0&&(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`label`,{className:`block text-xs text-muted mb-1`,children:[t(`llm.fieldModel`),U.length>0&&(0,A.jsxs)(`span`,{className:`ml-1 text-green-500 text-[10px]`,children:[`(`,U.length,` `,t(`llm.liveModels`),`)`]})]}),(0,A.jsx)(`select`,{value:L||Q[0]?.id||``,onChange:e=>R(e.target.value),className:Y,children:Q.map(e=>(0,A.jsx)(`option`,{value:e.id,children:e.label},e.id))})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,A.jsx)(`button`,{onClick:se,disabled:b,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:t(b?`llm.saving`:`llm.save`)}),(0,A.jsx)(`button`,{onClick:X,className:`px-4 py-1.5 border border-[var(--border)] rounded-md text-sm hover:bg-[var(--input-bg)] transition-all`,children:t(`llm.cancel`)})]})]}),$=o.find(e=>e.id===m),ge=(0,A.jsxs)(`div`,{className:`mt-3 border border-[var(--border)] rounded-lg p-4 space-y-3 bg-[var(--input-bg)]/40`,children:[(0,A.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`llm.editTitle`,{id:m})}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,A.jsxs)(`div`,{className:`col-span-2`,children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.fieldName`)}),(0,A.jsx)(`input`,{value:G.name,onChange:e=>K(t=>({...t,name:e.target.value})),placeholder:t(`llm.fieldNamePlaceholder`),className:J})]}),(0,A.jsxs)(`div`,{className:`col-span-2`,children:[(0,A.jsxs)(`label`,{className:`block text-xs text-muted mb-1`,children:[t(`llm.fieldBaseUrl`),` *`]}),(0,A.jsx)(`input`,{value:G.baseUrl,onChange:e=>K(t=>({...t,baseUrl:e.target.value})),placeholder:`https://api.openai.com`,className:J})]}),(0,A.jsxs)(`div`,{className:`col-span-2 sm:col-span-1`,children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.fieldApi`)}),(0,A.jsxs)(`select`,{value:G.api,onChange:e=>K(t=>({...t,api:e.target.value})),className:Y,children:[(0,A.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Completions`}),(0,A.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,A.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`}),(0,A.jsx)(`option`,{value:`google-generative-ai`,children:`Google Generative AI`}),(0,A.jsx)(`option`,{value:`ollama`,children:`Ollama`})]})]}),(0,A.jsxs)(`div`,{className:`col-span-2 sm:col-span-1`,children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.fieldAuthHeader`)}),(0,A.jsx)(`input`,{value:G.authHeader,onChange:e=>K(t=>({...t,authHeader:e.target.value})),placeholder:`Authorization`,className:J})]}),(0,A.jsxs)(`div`,{className:`col-span-2`,children:[(0,A.jsxs)(`label`,{className:`block text-xs text-muted mb-1`,children:[t(`llm.fieldApiKey`),$?.hasApiKey?` (${t(`llm.apiKeyConfigured`)})`:``]}),(0,A.jsx)(T,{value:G.apiKey,saved:!!$?.hasApiKey,onChange:e=>K(t=>({...t,apiKey:e})),baseUrl:G.baseUrl.trim(),api:G.api,authHeader:G.authHeader||void 0,providerId:m||void 0,placeholder:$?.hasApiKey?t(`llm.apiKeyLeaveBlank`):t(`llm.apiKeyPlaceholder`),onModels:e=>{D(e),e.length>0&&K(t=>({...t,selectedModelId:t.selectedModelId||e[0].id}))},onStateChange:re,selectedModelId:G.selectedModelId})]}),(0,A.jsxs)(`div`,{className:`col-span-2`,children:[(0,A.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:t(`llm.fieldModel`)}),w.length>0?(0,A.jsxs)(`select`,{value:G.selectedModelId,onChange:e=>K(t=>({...t,selectedModelId:e.target.value})),className:Y,children:[(0,A.jsx)(`option`,{value:``,children:t(`llm.noModel`)}),w.map(e=>(0,A.jsx)(`option`,{value:e.id,children:e.id},e.id))]}):(0,A.jsx)(`input`,{value:G.selectedModelId,onChange:e=>K(t=>({...t,selectedModelId:e.target.value})),placeholder:`gpt-4o`,className:J})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,A.jsx)(`button`,{onClick:le,disabled:b,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:t(b?`llm.saving`:`llm.save`)}),(0,A.jsx)(`button`,{onClick:X,className:`px-4 py-1.5 border border-[var(--border)] rounded-md text-sm hover:bg-[var(--input-bg)] transition-all`,children:t(`llm.cancel`)})]})]});return(0,A.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:t(`llm.title`)}),(0,A.jsx)(`p`,{className:`text-xs text-muted mt-0.5`,children:t(`llm.desc`)})]}),!g&&!m&&(0,A.jsxs)(`button`,{onClick:ie,className:`px-3 py-1.5 bg-[#0066FF] text-white rounded-md text-xs font-medium hover:bg-[#0066FF]/90 transition-all`,children:[`+ `,t(`llm.add`)]})]}),g&&he,l?(0,A.jsx)(`p`,{className:`text-sm text-muted py-3`,children:t(`llm.loading`)}):o.length===0&&!g?(0,A.jsx)(`p`,{className:`text-sm text-muted py-3`,children:t(`llm.empty`)}):(0,A.jsx)(`div`,{className:`space-y-2 mt-2`,children:o.map(e=>(0,A.jsxs)(`div`,{className:`border rounded-lg p-3 transition-all ${e.isDefault?`border-[#0066FF]/40 bg-[#0066FF]/5`:`border-[var(--border)]`}`,children:[(0,A.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,A.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.name||e.id}),e.isDefault&&(0,A.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 bg-[#0066FF]/15 text-[#0066FF] rounded font-medium`,children:t(`llm.default`)}),(0,A.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 bg-[var(--input-bg)] text-muted rounded`,children:e.api}),e.hasApiKey&&(0,A.jsx)(`span`,{className:`text-[10px] text-green-500`,children:`🔑`})]}),(0,A.jsx)(`p`,{className:`text-xs text-muted truncate mt-0.5`,children:e.baseUrl}),e.selectedModelId&&(0,A.jsxs)(`p`,{className:`text-xs text-muted mt-0.5`,children:[t(`llm.model`),`: `,(0,A.jsx)(`span`,{className:`font-mono`,children:e.selectedModelId})]})]}),(0,A.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0`,children:[!e.isDefault&&(0,A.jsx)(`button`,{onClick:()=>de(e.id),className:`px-2 py-1 text-xs border border-[var(--border)] rounded hover:bg-[var(--input-bg)] transition-all`,children:t(`llm.setDefault`)}),(0,A.jsx)(`button`,{onClick:()=>{ae(e),fe(e.id)},disabled:S===e.id,className:`px-2 py-1 text-xs border border-[var(--border)] rounded hover:bg-[var(--input-bg)] transition-all disabled:opacity-40`,children:S===e.id?`...`:t(`llm.edit`)}),(0,A.jsx)(`button`,{onClick:()=>ue(e.id),disabled:o.length<=1,title:o.length<=1?t(`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:t(`llm.delete`)})]})]}),m===e.id&&ge,S===null&&w.length>0&&m!==e.id&&(0,A.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-[var(--border)]`,children:[(0,A.jsxs)(`p`,{className:`text-xs text-muted mb-1`,children:[t(`llm.availableModels`),` (`,w.length,`)`]}),(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1 max-h-20 overflow-y-auto`,children:w.map(e=>(0,A.jsx)(`span`,{className:`text-[11px] font-mono px-1.5 py-0.5 bg-[var(--input-bg)] rounded`,children:e.id},e.id))})]})]},e.id))})]})}function I(){let{t:e}=n(`settings`),{system:t,showToast:r}=S(),[i,a]=(0,k.useState)(``),[s,c]=(0,k.useState)(``),[u,d]=(0,k.useState)(!1),[f,p]=(0,k.useState)([]),[h,_]=(0,k.useState)(!1),[y,x]=(0,k.useState)(!1),[w,T]=(0,k.useState)(!1);(0,k.useEffect)(()=>{_(!0),l().then(p).catch(()=>{}).finally(()=>_(!1)),m().then(async e=>{try{let t=await Promise.all(e.map(e=>o(e.id).catch(()=>({enabled:!1})))),n=e.length>0&&t.every(e=>e?.enabled);T(n)}catch{}}).catch(()=>{})},[]);let E=async t=>{t.preventDefault();try{let t=await g(i,s);t.token&&v(t.token),r(e(`password.updated`),`success`),a(``),c(``)}catch(t){r(t.message||e(`password.failed`),`error`)}},D=`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(0,A.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:[(0,A.jsxs)(`div`,{className:`mb-5`,children:[(0,A.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:e(`title`)}),(0,A.jsx)(`p`,{className:`text-sm text-muted mt-0.5`,children:e(`subtitle`)})]}),(0,A.jsxs)(`div`,{className:`space-y-4`,children:[(0,A.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:e(`proxy.title`)}),(0,A.jsx)(`p`,{className:`text-sm text-muted mt-1`,children:e(`proxy.desc`)})]}),(0,A.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:e(`proxy.status`)})]}),(0,A.jsx)(F,{showToast:r}),(0,A.jsx)(P,{showToast:r}),(0,A.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-3`,children:e(`password.title`)}),(0,A.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`block text-sm text-muted mb-1.5`,children:e(`password.current`)}),(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`input`,{type:u?`text`:`password`,value:i,onChange:e=>a(e.target.value),placeholder:e(`password.currentPlaceholder`),className:`${D} pr-9`}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>d(!u),"aria-label":e(`common:action.togglePassword`),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted hover:text-foreground transition-colors`,children:u?(0,A.jsx)(C,{className:`w-3.5 h-3.5`}):(0,A.jsx)(b,{className:`w-3.5 h-3.5`})})]})]}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`label`,{className:`block text-sm text-muted mb-1.5`,children:e(`password.new`)}),(0,A.jsx)(`input`,{type:u?`text`:`password`,value:s,onChange:e=>c(e.target.value),placeholder:e(`password.newPlaceholder`),className:D})]}),(0,A.jsx)(`button`,{type:`submit`,disabled:!i||s.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:e(`password.submit`)})]})]}),t&&(0,A.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-3`,children:e(`system.title`)}),(0,A.jsxs)(`div`,{className:`space-y-3`,children:[[{label:e(`system.cpuUsage`),value:`${t.cpu_percent}%`,percent:t.cpu_percent,warn:t.cpu_percent>90,color:`bg-[#0066FF]`},{label:e(`system.memory`),value:`${t.memory.used_mb}MB / ${t.memory.total_mb}MB (${t.memory.percent}%)`,percent:t.memory.percent,warn:!1,color:`bg-[#00D4AA]`},{label:e(`system.disk`),value:`${t.disk.used_gb}GB / ${t.disk.total_gb}GB (${t.disk.percent}%)`,percent:t.disk.percent,warn:t.disk.percent>90,color:`bg-[#0066FF]`}].map(e=>(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex justify-between text-sm mb-1.5`,children:[(0,A.jsx)(`span`,{className:`text-muted`,children:e.label}),(0,A.jsx)(`span`,{className:`font-medium font-mono text-[13px] ${e.warn?`text-red-400`:`text-foreground`}`,children:e.value})]}),(0,A.jsx)(`div`,{className:`w-full bg-[var(--input-bg)] rounded-full h-1.5`,children:(0,A.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${e.warn?`bg-red-500`:e.color}`,style:{width:`${e.percent}%`}})})]},e.label)),t.temperature&&(0,A.jsxs)(`div`,{className:`flex justify-between text-sm pt-2 border-t border-[var(--border)]`,children:[(0,A.jsx)(`span`,{className:`text-muted`,children:e(`system.cpuTemp`)}),(0,A.jsxs)(`span`,{className:`font-medium font-mono text-[13px] text-foreground`,children:[t.temperature,`°C`]})]})]})]}),(0,A.jsxs)(`div`,{className:`bg-[var(--card)] border border-[var(--border)] rounded-xl p-4`,children:[(0,A.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-2`,children:e(`about.title`)}),(0,A.jsxs)(`div`,{className:`text-sm text-muted space-y-1`,children:[(0,A.jsxs)(`p`,{children:[e(`about.coreVersion`),`: `,(0,A.jsx)(`span`,{className:`font-mono`,children:t?.core_version||`-`})]}),(0,A.jsxs)(`p`,{children:[e(`about.panelVersion`),`: `,(0,A.jsx)(`span`,{className:`font-mono`,children:`0.7.3`})]})]})]})]})]})}export{I as default};
|