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
|
@@ -1,1215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenClaw App-type Manager
|
|
3
|
-
*
|
|
4
|
-
* Encapsulates ALL logic specific to the "openclaw" app type:
|
|
5
|
-
* - Instance directory layout (openclaw-home/.openclaw/openclaw.json)
|
|
6
|
-
* - defaultRuntime / starterConfig builders
|
|
7
|
-
* - Config load / save (openclaw.json + env files)
|
|
8
|
-
* - IM channel plugin installation (Feishu, WeChat, …)
|
|
9
|
-
* - Feishu / WeChat credential persistence
|
|
10
|
-
* - Pre-start validation and Docker config patching
|
|
11
|
-
*
|
|
12
|
-
* nomad-manager.ts owns the Nomad task/job spec builders; it imports
|
|
13
|
-
* getOpenclawHome / getOpenclawConfigPath etc. from here.
|
|
14
|
-
*
|
|
15
|
-
* Generic utilities (port allocation, listInstances, …) are imported
|
|
16
|
-
* from instance-manager.ts which is the public facade kept for backward
|
|
17
|
-
* compatibility with all existing callers.
|
|
18
|
-
*/
|
|
19
|
-
import { execFile, execFileSync } from "child_process";
|
|
20
|
-
import { randomBytes } from "crypto";
|
|
21
|
-
import { chmodSync, chownSync, copyFileSync, cpSync, existsSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, } from "fs";
|
|
22
|
-
import { userInfo } from "os";
|
|
23
|
-
import { dirname, join, resolve } from "path";
|
|
24
|
-
import { INSTANCES_DIR, JISHUSHELL_HOME, getInstanceDir, getMaxAppMemoryMB, instanceMetaPath, } from "../../config.js";
|
|
25
|
-
import { inspectDockerImage, toDockerInspectUserError } from "../../utils/docker-inspect.js";
|
|
26
|
-
import { safeReadJson, safeWriteJson } from "../../utils/safe-json.js";
|
|
27
|
-
import { ensureDirContainer, writeConfigFile } from "../../utils/fs.js";
|
|
28
|
-
import { compileTaskRuntime } from "./app-compiler.js";
|
|
29
|
-
import { getInstance, listInstances, resolveServiceUser, chownToServiceUser, getRuntimeEnvFiles, getRuntimeEnv, updateEnvFile, defaultGatewayPort, releasePort, inferProviderApiKeyEnvName, notifyConfigChange, getGatewayPort, getInstanceRuntime, } from "../instance-manager.js";
|
|
30
|
-
import { decryptApiKey } from "../llm-proxy/encryption.js";
|
|
31
|
-
import { getDefaultLlmProvider, normalizeProviderApi } from "../llm-proxy/providers.js";
|
|
32
|
-
// ── OpenClaw-specific constants ──────────────────────────────────────────────
|
|
33
|
-
export const INSTANCE_OPENCLAW_HOME_DIRNAME = "openclaw-home";
|
|
34
|
-
export const INSTANCE_MODEL_ENV_FILENAME = "model.env";
|
|
35
|
-
const OPENCLAW_STATE_DIRNAME = ".openclaw";
|
|
36
|
-
const OPENCLAW_CONFIG_FILENAME = "openclaw.json";
|
|
37
|
-
// ── Private utilities ────────────────────────────────────────────────────────
|
|
38
|
-
function normalizePath(p) {
|
|
39
|
-
return resolve(p.replace(/^~/, userInfo().homedir));
|
|
40
|
-
}
|
|
41
|
-
function deepMerge(base, overlay) {
|
|
42
|
-
if (typeof base !== "object" || base === null ||
|
|
43
|
-
typeof overlay !== "object" || overlay === null ||
|
|
44
|
-
Array.isArray(base) || Array.isArray(overlay)) {
|
|
45
|
-
return structuredClone(overlay);
|
|
46
|
-
}
|
|
47
|
-
const merged = structuredClone(base);
|
|
48
|
-
for (const key of Object.keys(overlay)) {
|
|
49
|
-
merged[key] = key in merged ? deepMerge(merged[key], overlay[key]) : structuredClone(overlay[key]);
|
|
50
|
-
}
|
|
51
|
-
return merged;
|
|
52
|
-
}
|
|
53
|
-
function loadJson(path) {
|
|
54
|
-
try {
|
|
55
|
-
return JSON.parse(readFileSync(path, "utf-8"));
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
console.warn(`[openclaw] Failed to parse ${path}: ${e.message}`);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// ── Path helpers ─────────────────────────────────────────────────────────────
|
|
63
|
-
export function defaultOpenclawHome(instanceId) {
|
|
64
|
-
return join(getInstanceDir(instanceId), INSTANCE_OPENCLAW_HOME_DIRNAME);
|
|
65
|
-
}
|
|
66
|
-
export function defaultModelEnvFile(instanceId) {
|
|
67
|
-
return join(getInstanceDir(instanceId), INSTANCE_MODEL_ENV_FILENAME);
|
|
68
|
-
}
|
|
69
|
-
export function getOpenclawHome(instanceId) {
|
|
70
|
-
const meta = getInstance(instanceId);
|
|
71
|
-
return meta?.openclaw_home || defaultOpenclawHome(instanceId);
|
|
72
|
-
}
|
|
73
|
-
export function openclawStateDir(instanceId) {
|
|
74
|
-
return join(getOpenclawHome(instanceId), OPENCLAW_STATE_DIRNAME);
|
|
75
|
-
}
|
|
76
|
-
function legacyOpenclawConfigPath(instanceId) {
|
|
77
|
-
return join(getOpenclawHome(instanceId), OPENCLAW_CONFIG_FILENAME);
|
|
78
|
-
}
|
|
79
|
-
function openclawConfigPathInternal(instanceId) {
|
|
80
|
-
return join(openclawStateDir(instanceId), OPENCLAW_CONFIG_FILENAME);
|
|
81
|
-
}
|
|
82
|
-
export function getOpenclawConfigPath(instanceId) {
|
|
83
|
-
return openclawConfigPathInternal(instanceId);
|
|
84
|
-
}
|
|
85
|
-
export function getLegacyOpenclawConfigPath(instanceId) {
|
|
86
|
-
return legacyOpenclawConfigPath(instanceId);
|
|
87
|
-
}
|
|
88
|
-
function resolveExistingConfigPath(instanceId) {
|
|
89
|
-
const runtimePath = openclawConfigPathInternal(instanceId);
|
|
90
|
-
if (existsSync(runtimePath))
|
|
91
|
-
return runtimePath;
|
|
92
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
93
|
-
if (existsSync(legacyPath))
|
|
94
|
-
return legacyPath;
|
|
95
|
-
return runtimePath;
|
|
96
|
-
}
|
|
97
|
-
export function getChannelExtensionsDir(instanceId) {
|
|
98
|
-
return join(getOpenclawHome(instanceId), OPENCLAW_STATE_DIRNAME, "extensions");
|
|
99
|
-
}
|
|
100
|
-
export function getStockExtensionsDir() {
|
|
101
|
-
return join(JISHUSHELL_HOME, "packages", "openclaw", "lib", "node_modules", "openclaw", "extensions");
|
|
102
|
-
}
|
|
103
|
-
// ── OpenClaw binary resolution ───────────────────────────────────────────────
|
|
104
|
-
function resolveOpenclawBin() {
|
|
105
|
-
const candidates = [
|
|
106
|
-
join(JISHUSHELL_HOME, "packages", "openclaw", "bin", "openclaw"),
|
|
107
|
-
"/usr/local/bin/openclaw",
|
|
108
|
-
"/usr/bin/openclaw",
|
|
109
|
-
];
|
|
110
|
-
for (const p of candidates) {
|
|
111
|
-
if (existsSync(p)) {
|
|
112
|
-
try {
|
|
113
|
-
execFileSync("chmod", ["+x", p], { timeout: 3000 });
|
|
114
|
-
}
|
|
115
|
-
catch { /* best effort */ }
|
|
116
|
-
try {
|
|
117
|
-
const real = realpathSync(p);
|
|
118
|
-
if (real !== p) {
|
|
119
|
-
try {
|
|
120
|
-
execFileSync("chmod", ["+x", real], { timeout: 3000 });
|
|
121
|
-
}
|
|
122
|
-
catch { /* best effort */ }
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
catch { /* best effort */ }
|
|
126
|
-
return p;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return candidates[0];
|
|
130
|
-
}
|
|
131
|
-
export function getResolvedOpenclawBin() {
|
|
132
|
-
return resolveOpenclawBin();
|
|
133
|
-
}
|
|
134
|
-
// ── Runtime / config builders ────────────────────────────────────────────────
|
|
135
|
-
async function buildDefaultRuntime(instanceId, openclawHome) {
|
|
136
|
-
const port = await defaultGatewayPort(instanceId);
|
|
137
|
-
const svcUser = resolveServiceUser();
|
|
138
|
-
return {
|
|
139
|
-
runtime: {
|
|
140
|
-
command: resolveOpenclawBin(),
|
|
141
|
-
args: ["gateway", "run", "--port", String(port), "--allow-unconfigured"],
|
|
142
|
-
cwd: openclawHome,
|
|
143
|
-
user: svcUser?.username ?? userInfo().username,
|
|
144
|
-
env_files: [defaultModelEnvFile(instanceId)],
|
|
145
|
-
env: {
|
|
146
|
-
OPENCLAW_GATEWAY_PORT: String(port),
|
|
147
|
-
NODE_OPTIONS: "--max-old-space-size=2048",
|
|
148
|
-
},
|
|
149
|
-
resources: { CPU: 1000, MemoryMB: 2048 },
|
|
150
|
-
},
|
|
151
|
-
allocatedPort: port,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
export function buildStarterConfig() {
|
|
155
|
-
const dp = getDefaultLlmProvider();
|
|
156
|
-
let providerName = "minimax";
|
|
157
|
-
let providerConfig = {
|
|
158
|
-
baseUrl: "https://api.minimaxi.com/v1",
|
|
159
|
-
api: "openai-completions",
|
|
160
|
-
models: [{ id: "MiniMax-M2.7", name: "MiniMax M2.7", contextWindow: 204800 }],
|
|
161
|
-
};
|
|
162
|
-
let defaultModel = "minimax/MiniMax-M2.7";
|
|
163
|
-
if (dp?.id) {
|
|
164
|
-
providerName = dp.id;
|
|
165
|
-
providerConfig = {
|
|
166
|
-
baseUrl: dp.baseUrl,
|
|
167
|
-
api: normalizeProviderApi(dp.api),
|
|
168
|
-
...(dp.authHeader ? { authHeader: true } : {}),
|
|
169
|
-
models: dp.models || [],
|
|
170
|
-
};
|
|
171
|
-
const modelId = dp.selectedModelId || dp.models?.[0]?.id || "";
|
|
172
|
-
defaultModel = `${providerName}/${modelId}`;
|
|
173
|
-
}
|
|
174
|
-
const config = {
|
|
175
|
-
models: { providers: { [providerName]: providerConfig } },
|
|
176
|
-
agents: { defaults: { model: defaultModel, models: { [defaultModel]: {} } } },
|
|
177
|
-
channels: {},
|
|
178
|
-
gateway: {
|
|
179
|
-
mode: "local",
|
|
180
|
-
auth: { mode: "token", token: randomBytes(24).toString("hex") },
|
|
181
|
-
controlUi: { dangerouslyDisableDeviceAuth: true },
|
|
182
|
-
},
|
|
183
|
-
plugins: { entries: { feishu: { enabled: false } } },
|
|
184
|
-
};
|
|
185
|
-
if (dp?.id) {
|
|
186
|
-
config["x-jishushell"] = {
|
|
187
|
-
proxy: {
|
|
188
|
-
upstream: {
|
|
189
|
-
providerId: dp.id,
|
|
190
|
-
baseUrl: dp.baseUrl,
|
|
191
|
-
api: normalizeProviderApi(dp.api),
|
|
192
|
-
authHeader: dp.authHeader === true || typeof dp.authHeader === "string",
|
|
193
|
-
models: dp.models || [],
|
|
194
|
-
selectedModelId: dp.selectedModelId || dp.models?.[0]?.id || "",
|
|
195
|
-
hasApiKey: !!dp.apiKey,
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
return config;
|
|
201
|
-
}
|
|
202
|
-
// backward-compat alias used by existing callers
|
|
203
|
-
export { buildStarterConfig as starterConfig };
|
|
204
|
-
// ── Config loading ───────────────────────────────────────────────────────────
|
|
205
|
-
function loadEffectiveConfig(instanceId) {
|
|
206
|
-
const runtimePath = openclawConfigPathInternal(instanceId);
|
|
207
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
208
|
-
const rExists = existsSync(runtimePath);
|
|
209
|
-
const lExists = existsSync(legacyPath);
|
|
210
|
-
if (rExists && lExists) {
|
|
211
|
-
const legacy = loadJson(legacyPath);
|
|
212
|
-
const runtime = loadJson(runtimePath);
|
|
213
|
-
if (legacy && runtime)
|
|
214
|
-
return deepMerge(legacy, runtime);
|
|
215
|
-
return runtime || legacy || null;
|
|
216
|
-
}
|
|
217
|
-
if (rExists)
|
|
218
|
-
return loadJson(runtimePath);
|
|
219
|
-
if (lExists)
|
|
220
|
-
return loadJson(legacyPath);
|
|
221
|
-
return null;
|
|
222
|
-
}
|
|
223
|
-
// ── Provider key helpers ─────────────────────────────────────────────────────
|
|
224
|
-
function hasConfiguredValue(value) {
|
|
225
|
-
if (typeof value === "string")
|
|
226
|
-
return value.trim().length > 0;
|
|
227
|
-
if (typeof value === "object" && value !== null)
|
|
228
|
-
return Object.keys(value).length > 0;
|
|
229
|
-
return value != null;
|
|
230
|
-
}
|
|
231
|
-
function injectProviderApiKeys(instanceId, config) {
|
|
232
|
-
const merged = structuredClone(config);
|
|
233
|
-
const runtimeEnv = getRuntimeEnv(instanceId);
|
|
234
|
-
const providers = merged.models?.providers || {};
|
|
235
|
-
for (const [providerId, provider] of Object.entries(providers)) {
|
|
236
|
-
if (typeof provider !== "object" || provider === null)
|
|
237
|
-
continue;
|
|
238
|
-
const p = provider;
|
|
239
|
-
p.api = normalizeProviderApi(typeof p.api === "string" ? p.api : undefined);
|
|
240
|
-
const apiKey = runtimeEnv[inferProviderApiKeyEnvName(providerId)];
|
|
241
|
-
if (apiKey)
|
|
242
|
-
p.apiKey = apiKey;
|
|
243
|
-
}
|
|
244
|
-
return merged;
|
|
245
|
-
}
|
|
246
|
-
function applyFeishuDebugAccessDefaults(channel) {
|
|
247
|
-
if (channel.enabled === false)
|
|
248
|
-
return;
|
|
249
|
-
if (!hasConfiguredValue(channel.appId))
|
|
250
|
-
return;
|
|
251
|
-
if (!hasConfiguredValue(channel.appSecret))
|
|
252
|
-
return;
|
|
253
|
-
let dmPolicy = channel.dmPolicy;
|
|
254
|
-
if (typeof dmPolicy !== "string" || !dmPolicy.trim()) {
|
|
255
|
-
channel.dmPolicy = "open";
|
|
256
|
-
dmPolicy = "open";
|
|
257
|
-
}
|
|
258
|
-
if (dmPolicy !== "open")
|
|
259
|
-
return;
|
|
260
|
-
if (!("resolveSenderNames" in channel))
|
|
261
|
-
channel.resolveSenderNames = false;
|
|
262
|
-
let accounts = channel.accounts;
|
|
263
|
-
if (typeof accounts !== "object" || accounts === null) {
|
|
264
|
-
accounts = {};
|
|
265
|
-
channel.accounts = accounts;
|
|
266
|
-
}
|
|
267
|
-
let defaultAccount = accounts.default;
|
|
268
|
-
if (typeof defaultAccount !== "object" || defaultAccount === null) {
|
|
269
|
-
defaultAccount = {};
|
|
270
|
-
accounts.default = defaultAccount;
|
|
271
|
-
}
|
|
272
|
-
if (!("resolveSenderNames" in defaultAccount))
|
|
273
|
-
defaultAccount.resolveSenderNames = false;
|
|
274
|
-
const allowFrom = channel.allowFrom;
|
|
275
|
-
if (Array.isArray(allowFrom)) {
|
|
276
|
-
const normalized = allowFrom.map((e) => String(e).trim()).filter(Boolean);
|
|
277
|
-
if (!normalized.includes("*"))
|
|
278
|
-
normalized.push("*");
|
|
279
|
-
channel.allowFrom = normalized;
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
channel.allowFrom = ["*"];
|
|
283
|
-
}
|
|
284
|
-
function prepareConfigForSave(instanceId, config) {
|
|
285
|
-
const configToWrite = structuredClone(config);
|
|
286
|
-
delete configToWrite["x-jishushell"];
|
|
287
|
-
const envUpdates = {};
|
|
288
|
-
const providers = configToWrite.models?.providers || {};
|
|
289
|
-
const envFiles = getRuntimeEnvFiles(instanceId);
|
|
290
|
-
const channels = configToWrite.channels || {};
|
|
291
|
-
const plugins = configToWrite.plugins ??= {};
|
|
292
|
-
const pluginEntries = plugins.entries ??= {};
|
|
293
|
-
for (const [providerId, provider] of Object.entries(providers)) {
|
|
294
|
-
if (typeof provider !== "object" || provider === null)
|
|
295
|
-
continue;
|
|
296
|
-
const p = provider;
|
|
297
|
-
p.api = normalizeProviderApi(typeof p.api === "string" ? p.api : undefined);
|
|
298
|
-
if (!("apiKey" in p))
|
|
299
|
-
continue;
|
|
300
|
-
if (typeof p.baseUrl === "string" && p.baseUrl.includes("/proxy/"))
|
|
301
|
-
continue;
|
|
302
|
-
const apiKey = p.apiKey;
|
|
303
|
-
delete p.apiKey;
|
|
304
|
-
if (envFiles.length) {
|
|
305
|
-
envUpdates[inferProviderApiKeyEnvName(providerId)] = decryptRuntimeProviderApiKey(apiKey);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
p.apiKey = apiKey;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
for (const [channelId, channel] of Object.entries(channels)) {
|
|
312
|
-
if (typeof channel !== "object" || channel === null)
|
|
313
|
-
continue;
|
|
314
|
-
const ch = channel;
|
|
315
|
-
if (channelId === "feishu" || channelId === "lark")
|
|
316
|
-
applyFeishuDebugAccessDefaults(ch);
|
|
317
|
-
let pluginEntry = pluginEntries[channelId];
|
|
318
|
-
if (pluginEntry == null) {
|
|
319
|
-
pluginEntry = {};
|
|
320
|
-
pluginEntries[channelId] = pluginEntry;
|
|
321
|
-
}
|
|
322
|
-
if (typeof pluginEntry === "object") {
|
|
323
|
-
pluginEntry.enabled = ch.enabled !== false;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return [configToWrite, envUpdates];
|
|
327
|
-
}
|
|
328
|
-
function decryptRuntimeProviderApiKey(apiKey) {
|
|
329
|
-
const value = String(apiKey || "");
|
|
330
|
-
return value.startsWith("enc:") ? decryptApiKey(value) : value;
|
|
331
|
-
}
|
|
332
|
-
function decryptRuntimeProviderEnv(env) {
|
|
333
|
-
for (const [key, value] of Object.entries(env)) {
|
|
334
|
-
if (!key.endsWith("_API_KEY"))
|
|
335
|
-
continue;
|
|
336
|
-
if (!String(value || "").startsWith("enc:"))
|
|
337
|
-
continue;
|
|
338
|
-
env[key] = decryptApiKey(value);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
// ── IM channel plugin helpers ────────────────────────────────────────────────
|
|
342
|
-
const CHANNEL_EXT_DIR_ALIAS = {
|
|
343
|
-
feishu: "openclaw-lark",
|
|
344
|
-
lark: "openclaw-lark",
|
|
345
|
-
};
|
|
346
|
-
export const CHANNEL_PLUGIN_MAP = {
|
|
347
|
-
feishu: "@larksuite/openclaw-lark",
|
|
348
|
-
lark: "@larksuite/openclaw-lark",
|
|
349
|
-
telegram: "@openclaw/telegram",
|
|
350
|
-
discord: "@openclaw/discord",
|
|
351
|
-
slack: "@openclaw/slack",
|
|
352
|
-
whatsapp: "@openclaw/whatsapp",
|
|
353
|
-
signal: "@openclaw/signal",
|
|
354
|
-
line: "@openclaw/line",
|
|
355
|
-
msteams: "@openclaw/msteams",
|
|
356
|
-
"openclaw-weixin": "@tencent-weixin/openclaw-weixin",
|
|
357
|
-
};
|
|
358
|
-
const IM_PLUGIN_ENTRY_IDS = new Set([
|
|
359
|
-
...Object.keys(CHANNEL_PLUGIN_MAP),
|
|
360
|
-
...Object.values(CHANNEL_EXT_DIR_ALIAS),
|
|
361
|
-
]);
|
|
362
|
-
export function stripImBindings(config) {
|
|
363
|
-
if (config?.channels)
|
|
364
|
-
delete config.channels;
|
|
365
|
-
const entries = config?.plugins?.entries;
|
|
366
|
-
if (entries && typeof entries === "object") {
|
|
367
|
-
for (const key of Object.keys(entries)) {
|
|
368
|
-
if (IM_PLUGIN_ENTRY_IDS.has(key))
|
|
369
|
-
delete entries[key];
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
export function isChannelPluginInstalled(instanceId, channelId) {
|
|
374
|
-
const extDirName = CHANNEL_EXT_DIR_ALIAS[channelId] || channelId;
|
|
375
|
-
const stockExtDir = getStockExtensionsDir();
|
|
376
|
-
if (existsSync(join(getChannelExtensionsDir(instanceId), extDirName)))
|
|
377
|
-
return true;
|
|
378
|
-
if (existsSync(join(stockExtDir, extDirName)))
|
|
379
|
-
return true;
|
|
380
|
-
if (extDirName !== channelId && existsSync(join(stockExtDir, channelId)))
|
|
381
|
-
return true;
|
|
382
|
-
// OpenClaw's npm-backed plugin store lives at
|
|
383
|
-
// `<home>/.openclaw/npm/node_modules/<pkg>`. The CLI refuses to reinstall
|
|
384
|
-
// when that path is present ("plugin already exists ... delete it first"),
|
|
385
|
-
// even if the per-instance extensions/<name> dir is missing (e.g. the
|
|
386
|
-
// first install was interrupted, or the dir was manually cleaned). Treat
|
|
387
|
-
// the npm path as authoritative so re-saves stay idempotent.
|
|
388
|
-
const pkg = CHANNEL_PLUGIN_MAP[channelId];
|
|
389
|
-
if (pkg) {
|
|
390
|
-
const npmPath = join(getOpenclawHome(instanceId), OPENCLAW_STATE_DIRNAME, "npm", "node_modules", ...pkg.split("/"));
|
|
391
|
-
if (existsSync(npmPath))
|
|
392
|
-
return true;
|
|
393
|
-
}
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
export async function installChannelPlugin(instanceId, channelId) {
|
|
397
|
-
const pkg = CHANNEL_PLUGIN_MAP[channelId];
|
|
398
|
-
if (!pkg)
|
|
399
|
-
throw new Error(`Unknown channel: ${channelId}`);
|
|
400
|
-
if (isChannelPluginInstalled(instanceId, channelId))
|
|
401
|
-
return;
|
|
402
|
-
const openclawHome = getOpenclawHome(instanceId);
|
|
403
|
-
const extensionsDir = getChannelExtensionsDir(instanceId);
|
|
404
|
-
const { getNomadDriver } = await import("../../config.js");
|
|
405
|
-
if (getNomadDriver() === "docker") {
|
|
406
|
-
await installChannelPluginViaDocker(instanceId, channelId, pkg, extensionsDir);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
const openclawBin = resolveOpenclawBin();
|
|
410
|
-
const nodeBinDir = dirname(process.execPath);
|
|
411
|
-
const childPath = [nodeBinDir, process.env.PATH].filter(Boolean).join(":");
|
|
412
|
-
const proxyEnvKeys = [
|
|
413
|
-
"http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY",
|
|
414
|
-
"no_proxy", "NO_PROXY", "NODE_EXTRA_CA_CERTS", "NODE_TLS_REJECT_UNAUTHORIZED",
|
|
415
|
-
];
|
|
416
|
-
const proxyEnv = {};
|
|
417
|
-
for (const key of proxyEnvKeys) {
|
|
418
|
-
if (process.env[key])
|
|
419
|
-
proxyEnv[key] = process.env[key];
|
|
420
|
-
}
|
|
421
|
-
const childEnv = {
|
|
422
|
-
PATH: childPath,
|
|
423
|
-
HOME: process.env.HOME,
|
|
424
|
-
LANG: process.env.LANG,
|
|
425
|
-
OPENCLAW_HOME: openclawHome,
|
|
426
|
-
...proxyEnv,
|
|
427
|
-
};
|
|
428
|
-
const MAX_ATTEMPTS = 3;
|
|
429
|
-
const RETRY_DELAY_MS = 5_000;
|
|
430
|
-
const attemptInstall = () => new Promise((res, rej) => {
|
|
431
|
-
execFile(openclawBin, ["plugins", "install", pkg], { cwd: openclawHome, env: childEnv, timeout: 300_000 }, (err, stdout, stderr) => {
|
|
432
|
-
if (err && !isChannelPluginInstalled(instanceId, channelId)) {
|
|
433
|
-
const msg = [stderr?.trim(), stdout?.trim(), err.message].filter(Boolean).join(" | ");
|
|
434
|
-
console.error(`[openclaw-plugins] ${pkg} exit code ${err.code ?? "?"}`);
|
|
435
|
-
try {
|
|
436
|
-
if (existsSync(extensionsDir)) {
|
|
437
|
-
for (const entry of readdirSync(extensionsDir)) {
|
|
438
|
-
if (entry.startsWith(".openclaw-install-stage-")) {
|
|
439
|
-
rmSync(join(extensionsDir, entry), { recursive: true, force: true });
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
catch { /* best effort */ }
|
|
445
|
-
rej(new Error(msg));
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
res();
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
console.log(`[openclaw-plugins] Installing ${pkg} for ${channelId} (host)...`);
|
|
453
|
-
let lastErr;
|
|
454
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
455
|
-
try {
|
|
456
|
-
await attemptInstall();
|
|
457
|
-
const extDirName = CHANNEL_EXT_DIR_ALIAS[channelId] || channelId;
|
|
458
|
-
const installedExtDir = join(extensionsDir, extDirName);
|
|
459
|
-
if (existsSync(installedExtDir)) {
|
|
460
|
-
ensureDirContainer(installedExtDir);
|
|
461
|
-
try {
|
|
462
|
-
for (const entry of readdirSync(installedExtDir, { withFileTypes: true })) {
|
|
463
|
-
if (entry.isDirectory())
|
|
464
|
-
ensureDirContainer(join(installedExtDir, entry.name));
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
catch { /* best effort */ }
|
|
468
|
-
}
|
|
469
|
-
ensureDirContainer(extensionsDir);
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
catch (err) {
|
|
473
|
-
lastErr = err;
|
|
474
|
-
const isFetchError = /fetch failed/i.test(err.message ?? "");
|
|
475
|
-
if (isFetchError && attempt < MAX_ATTEMPTS) {
|
|
476
|
-
console.warn(`[openclaw-plugins] ${pkg} install attempt ${attempt}/${MAX_ATTEMPTS} failed, retrying...`);
|
|
477
|
-
await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
|
|
478
|
-
continue;
|
|
479
|
-
}
|
|
480
|
-
break;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
throw lastErr;
|
|
484
|
-
}
|
|
485
|
-
async function installChannelPluginViaDocker(instanceId, channelId, pkg, extensionsDir) {
|
|
486
|
-
const { exec } = await import("../nomad-manager.js");
|
|
487
|
-
const MAX_ATTEMPTS = 3;
|
|
488
|
-
const RETRY_DELAY_MS = 5_000;
|
|
489
|
-
console.log(`[openclaw-plugins] Installing ${pkg} for ${channelId} via docker exec (${instanceId})...`);
|
|
490
|
-
let lastErr;
|
|
491
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
492
|
-
try {
|
|
493
|
-
const result = await exec(instanceId, ["openclaw", "plugins", "install", pkg], 300_000);
|
|
494
|
-
if (result.exitCode !== 0 && !isChannelPluginInstalled(instanceId, channelId)) {
|
|
495
|
-
const msg = [result.stderr?.trim(), result.stdout?.trim()].filter(Boolean).join(" | ");
|
|
496
|
-
throw new Error(msg || `openclaw plugins install exited with code ${result.exitCode}`);
|
|
497
|
-
}
|
|
498
|
-
console.log(`[openclaw-plugins] ${pkg} installed via docker`);
|
|
499
|
-
const extDirName = CHANNEL_EXT_DIR_ALIAS[channelId] || channelId;
|
|
500
|
-
const installedExtDir = join(extensionsDir, extDirName);
|
|
501
|
-
if (existsSync(installedExtDir)) {
|
|
502
|
-
ensureDirContainer(installedExtDir);
|
|
503
|
-
try {
|
|
504
|
-
for (const entry of readdirSync(installedExtDir, { withFileTypes: true })) {
|
|
505
|
-
if (entry.isDirectory())
|
|
506
|
-
ensureDirContainer(join(installedExtDir, entry.name));
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
catch { /* best effort */ }
|
|
510
|
-
}
|
|
511
|
-
ensureDirContainer(extensionsDir);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
catch (err) {
|
|
515
|
-
lastErr = err;
|
|
516
|
-
if (/not running/i.test(err.message ?? "")) {
|
|
517
|
-
throw new Error("请先启动实例后再安装插件(Docker 模式下插件需在容器内安装)");
|
|
518
|
-
}
|
|
519
|
-
const isTransient = /fetch failed|ECONNREFUSED/i.test(err.message ?? "");
|
|
520
|
-
if (isTransient && attempt < MAX_ATTEMPTS) {
|
|
521
|
-
await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
throw lastErr;
|
|
528
|
-
}
|
|
529
|
-
// ── Public config API ────────────────────────────────────────────────────────
|
|
530
|
-
export function getConfig(instanceId) {
|
|
531
|
-
const config = loadEffectiveConfig(instanceId);
|
|
532
|
-
if (!config)
|
|
533
|
-
return null;
|
|
534
|
-
const meta = getInstance(instanceId);
|
|
535
|
-
if (meta?.["x-jishushell"])
|
|
536
|
-
config["x-jishushell"] = meta["x-jishushell"];
|
|
537
|
-
return injectProviderApiKeys(instanceId, config);
|
|
538
|
-
}
|
|
539
|
-
export function getStoredConfig(instanceId) {
|
|
540
|
-
const config = loadEffectiveConfig(instanceId);
|
|
541
|
-
if (!config)
|
|
542
|
-
return null;
|
|
543
|
-
const meta = getInstance(instanceId);
|
|
544
|
-
if (meta?.["x-jishushell"])
|
|
545
|
-
config["x-jishushell"] = meta["x-jishushell"];
|
|
546
|
-
return config;
|
|
547
|
-
}
|
|
548
|
-
export function saveConfig(instanceId, config) {
|
|
549
|
-
const configPath = openclawConfigPathInternal(instanceId);
|
|
550
|
-
if (!existsSync(getInstanceDir(instanceId)))
|
|
551
|
-
return false;
|
|
552
|
-
if (!existsSync(configPath)) {
|
|
553
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
554
|
-
ensureDirContainer(dirname(configPath));
|
|
555
|
-
if (existsSync(legacyPath))
|
|
556
|
-
copyFileSync(legacyPath, configPath);
|
|
557
|
-
}
|
|
558
|
-
if (config["x-jishushell"]) {
|
|
559
|
-
const metaPath = instanceMetaPath(instanceId);
|
|
560
|
-
if (existsSync(metaPath)) {
|
|
561
|
-
const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
|
|
562
|
-
meta["x-jishushell"] = config["x-jishushell"];
|
|
563
|
-
safeWriteJson(metaPath, meta);
|
|
564
|
-
chownToServiceUser(metaPath);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
const [configToWrite, envUpdates] = prepareConfigForSave(instanceId, config);
|
|
568
|
-
if (configToWrite.plugins?.entries?.["openclaw-lark"]?.enabled) {
|
|
569
|
-
const stockExtDir = getStockExtensionsDir();
|
|
570
|
-
const stockFeishu = join(stockExtDir, "feishu");
|
|
571
|
-
const stockOcl = join(stockExtDir, "openclaw-lark");
|
|
572
|
-
const instanceOcl = join(getChannelExtensionsDir(instanceId), "openclaw-lark");
|
|
573
|
-
if (existsSync(stockFeishu) && !existsSync(stockOcl) && !existsSync(instanceOcl)) {
|
|
574
|
-
configToWrite.plugins.entries.feishu = { enabled: true };
|
|
575
|
-
delete configToWrite.plugins.entries["openclaw-lark"];
|
|
576
|
-
}
|
|
577
|
-
else if (existsSync(stockFeishu)) {
|
|
578
|
-
configToWrite.plugins.entries.feishu = { enabled: false };
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
if (existsSync(configPath)) {
|
|
582
|
-
try {
|
|
583
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
584
|
-
if (existing.plugins?.installs) {
|
|
585
|
-
configToWrite.plugins ??= {};
|
|
586
|
-
configToWrite.plugins.installs = { ...existing.plugins.installs, ...configToWrite.plugins?.installs };
|
|
587
|
-
}
|
|
588
|
-
if (existing.plugins?.entries && configToWrite.plugins?.entries) {
|
|
589
|
-
for (const [key, val] of Object.entries(configToWrite.plugins.entries)) {
|
|
590
|
-
const old = existing.plugins.entries[key];
|
|
591
|
-
if (val && typeof val === "object" && !Array.isArray(val) && old && typeof old === "object") {
|
|
592
|
-
configToWrite.plugins.entries[key] = { ...old, ...val };
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
if (existing.channels && configToWrite.channels) {
|
|
597
|
-
for (const [key, val] of Object.entries(configToWrite.channels)) {
|
|
598
|
-
const old = existing.channels[key];
|
|
599
|
-
if (val && typeof val === "object" && !Array.isArray(val) && old && typeof old === "object") {
|
|
600
|
-
configToWrite.channels[key] = { ...old, ...val };
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
catch { /* best effort */ }
|
|
606
|
-
}
|
|
607
|
-
if (existsSync(configPath))
|
|
608
|
-
copyFileSync(configPath, configPath + ".bak");
|
|
609
|
-
const configJson = JSON.stringify(configToWrite, null, 2);
|
|
610
|
-
ensureDirContainer(dirname(configPath));
|
|
611
|
-
writeConfigFile(configPath + ".tmp", configJson);
|
|
612
|
-
JSON.parse(readFileSync(configPath + ".tmp", "utf-8"));
|
|
613
|
-
renameSync(configPath + ".tmp", configPath);
|
|
614
|
-
chownToServiceUser(configPath);
|
|
615
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
616
|
-
if (existsSync(legacyPath))
|
|
617
|
-
copyFileSync(legacyPath, legacyPath + ".bak");
|
|
618
|
-
writeConfigFile(legacyPath + ".tmp", configJson);
|
|
619
|
-
JSON.parse(readFileSync(legacyPath + ".tmp", "utf-8"));
|
|
620
|
-
renameSync(legacyPath + ".tmp", legacyPath);
|
|
621
|
-
chownToServiceUser(legacyPath);
|
|
622
|
-
if (Object.keys(envUpdates).length) {
|
|
623
|
-
const envFiles = getRuntimeEnvFiles(instanceId);
|
|
624
|
-
if (envFiles.length)
|
|
625
|
-
updateEnvFile(envFiles[0], envUpdates);
|
|
626
|
-
}
|
|
627
|
-
notifyConfigChange(instanceId);
|
|
628
|
-
return true;
|
|
629
|
-
}
|
|
630
|
-
// ── Credential management ────────────────────────────────────────────────────
|
|
631
|
-
const FEISHU_APP_ID_RE = /^cli_[a-zA-Z0-9]{8,64}$/;
|
|
632
|
-
export function saveFeishuCredentials(instanceId, creds) {
|
|
633
|
-
if (!FEISHU_APP_ID_RE.test(creds.appId)) {
|
|
634
|
-
throw new Error(`Invalid Feishu appId format: expected cli_<alnum> (got "${creds.appId}")`);
|
|
635
|
-
}
|
|
636
|
-
if (!creds.appSecret || typeof creds.appSecret !== "string" || creds.appSecret.length < 4) {
|
|
637
|
-
throw new Error("Invalid Feishu appSecret: must be a non-empty string");
|
|
638
|
-
}
|
|
639
|
-
const configPath = openclawConfigPathInternal(instanceId);
|
|
640
|
-
const config = safeReadJson(configPath, "feishu-creds") || {};
|
|
641
|
-
config.plugins ??= {};
|
|
642
|
-
config.plugins.entries ??= {};
|
|
643
|
-
config.plugins.entries.feishu = { enabled: false };
|
|
644
|
-
config.plugins.entries["openclaw-lark"] = { enabled: true };
|
|
645
|
-
config.channels ??= {};
|
|
646
|
-
config.channels.feishu = {
|
|
647
|
-
...config.channels.feishu,
|
|
648
|
-
enabled: true,
|
|
649
|
-
appId: creds.appId,
|
|
650
|
-
appSecret: creds.appSecret,
|
|
651
|
-
domain: creds.domain,
|
|
652
|
-
dmPolicy: "open",
|
|
653
|
-
allowFrom: ["*"],
|
|
654
|
-
};
|
|
655
|
-
safeWriteJson(configPath, config);
|
|
656
|
-
chownToServiceUser(configPath);
|
|
657
|
-
console.log(`[openclaw] Feishu credentials saved for ${instanceId}, domain=${creds.domain}`);
|
|
658
|
-
}
|
|
659
|
-
const SAFE_ACCOUNT_ID_RE = /^[a-zA-Z0-9@._-]{1,128}$/;
|
|
660
|
-
export function saveWeixinCredentials(instanceId, creds) {
|
|
661
|
-
if (!creds.accountId || !SAFE_ACCOUNT_ID_RE.test(creds.accountId) || creds.accountId.includes("..")) {
|
|
662
|
-
throw new Error(`Invalid accountId: must be 1-128 chars of [a-zA-Z0-9@._-] without '..'`);
|
|
663
|
-
}
|
|
664
|
-
const home = getOpenclawHome(instanceId);
|
|
665
|
-
const stateDir = join(home, OPENCLAW_STATE_DIRNAME, "openclaw-weixin");
|
|
666
|
-
const accountsDir = join(stateDir, "accounts");
|
|
667
|
-
ensureDirContainer(accountsDir);
|
|
668
|
-
const credObj = {
|
|
669
|
-
token: creds.token,
|
|
670
|
-
baseUrl: creds.baseUrl,
|
|
671
|
-
userId: creds.userId,
|
|
672
|
-
savedAt: new Date().toISOString(),
|
|
673
|
-
};
|
|
674
|
-
safeWriteJson(join(accountsDir, `${creds.accountId}.json`), credObj);
|
|
675
|
-
safeWriteJson(join(accountsDir, "default.json"), credObj);
|
|
676
|
-
chownToServiceUser(join(accountsDir, `${creds.accountId}.json`), join(accountsDir, "default.json"));
|
|
677
|
-
const indexPath = join(stateDir, "accounts.json");
|
|
678
|
-
let index = [];
|
|
679
|
-
try {
|
|
680
|
-
index = JSON.parse(readFileSync(indexPath, "utf-8"));
|
|
681
|
-
}
|
|
682
|
-
catch { /* start fresh */ }
|
|
683
|
-
if (!Array.isArray(index))
|
|
684
|
-
index = [];
|
|
685
|
-
if (!index.includes(creds.accountId))
|
|
686
|
-
index.push(creds.accountId);
|
|
687
|
-
safeWriteJson(indexPath, index);
|
|
688
|
-
const configPath = openclawConfigPathInternal(instanceId);
|
|
689
|
-
const config = safeReadJson(configPath, "weixin-creds") || {};
|
|
690
|
-
config.plugins ??= {};
|
|
691
|
-
config.plugins.entries ??= {};
|
|
692
|
-
config.plugins.entries["openclaw-weixin"] ??= {};
|
|
693
|
-
config.plugins.entries["openclaw-weixin"].enabled = true;
|
|
694
|
-
config.channels ??= {};
|
|
695
|
-
config.channels["openclaw-weixin"] ??= {};
|
|
696
|
-
config.channels["openclaw-weixin"].enabled = true;
|
|
697
|
-
const normalizedId = creds.accountId.replace(/[@.]/g, "-");
|
|
698
|
-
const accounts = config.channels["openclaw-weixin"].accounts ??= {};
|
|
699
|
-
accounts[creds.accountId] = { enabled: true };
|
|
700
|
-
if (normalizedId !== creds.accountId)
|
|
701
|
-
accounts[normalizedId] = { enabled: true };
|
|
702
|
-
accounts["default"] = { enabled: true };
|
|
703
|
-
if (!config.channels["openclaw-weixin"].defaultAccount) {
|
|
704
|
-
config.channels["openclaw-weixin"].defaultAccount = "default";
|
|
705
|
-
}
|
|
706
|
-
safeWriteJson(configPath, config);
|
|
707
|
-
chownToServiceUser(configPath);
|
|
708
|
-
console.log(`[openclaw] WeChat credentials saved for ${instanceId}, account=${creds.accountId}`);
|
|
709
|
-
}
|
|
710
|
-
export function getWeixinAccounts(instanceId) {
|
|
711
|
-
const home = getOpenclawHome(instanceId);
|
|
712
|
-
const stateDir = join(home, OPENCLAW_STATE_DIRNAME, "openclaw-weixin");
|
|
713
|
-
const accountsDir = join(stateDir, "accounts");
|
|
714
|
-
if (!existsSync(accountsDir))
|
|
715
|
-
return [];
|
|
716
|
-
let indexedIds = [];
|
|
717
|
-
try {
|
|
718
|
-
indexedIds = JSON.parse(readFileSync(join(stateDir, "accounts.json"), "utf-8"));
|
|
719
|
-
}
|
|
720
|
-
catch { /* fallback */ }
|
|
721
|
-
const results = [];
|
|
722
|
-
for (const f of readdirSync(accountsDir)) {
|
|
723
|
-
if (!f.endsWith(".json"))
|
|
724
|
-
continue;
|
|
725
|
-
const id = f.replace(/\.json$/, "");
|
|
726
|
-
if (indexedIds.length > 0 && !indexedIds.includes(id))
|
|
727
|
-
continue;
|
|
728
|
-
if (id === "default")
|
|
729
|
-
continue;
|
|
730
|
-
try {
|
|
731
|
-
const data = JSON.parse(readFileSync(join(accountsDir, f), "utf-8"));
|
|
732
|
-
results.push({ accountId: id, userId: data.userId, savedAt: data.savedAt });
|
|
733
|
-
}
|
|
734
|
-
catch { /* skip */ }
|
|
735
|
-
}
|
|
736
|
-
return results;
|
|
737
|
-
}
|
|
738
|
-
// ── Docker config patching ───────────────────────────────────────────────────
|
|
739
|
-
export function patchJsproxyBaseUrl(configPath) {
|
|
740
|
-
try {
|
|
741
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
742
|
-
const patched = raw.replace(/http:\/\/127\.0\.0\.1:(\d+)\/proxy/g, `http://host.docker.internal:$1/proxy`);
|
|
743
|
-
if (patched !== raw) {
|
|
744
|
-
writeConfigFile(configPath, patched);
|
|
745
|
-
console.log(`[openclaw] Patched jsproxy baseUrl in ${configPath}`);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
catch (e) {
|
|
749
|
-
console.warn(`[openclaw] Failed to patch jsproxy baseUrl in ${configPath}: ${e.message}`);
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
export function patchDockerBridgeGatewayBind(configPath) {
|
|
753
|
-
try {
|
|
754
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
755
|
-
const parsed = JSON.parse(raw);
|
|
756
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
757
|
-
return;
|
|
758
|
-
const gatewayRaw = parsed.gateway;
|
|
759
|
-
const gateway = gatewayRaw && typeof gatewayRaw === "object" && !Array.isArray(gatewayRaw)
|
|
760
|
-
? gatewayRaw
|
|
761
|
-
: (parsed.gateway = {});
|
|
762
|
-
const bind = typeof gateway.bind === "string" ? gateway.bind.trim() : "";
|
|
763
|
-
if (bind && bind !== "loopback")
|
|
764
|
-
return;
|
|
765
|
-
gateway.bind = "lan";
|
|
766
|
-
const next = JSON.stringify(parsed, null, 2);
|
|
767
|
-
const output = raw.endsWith("\n") ? `${next}\n` : next;
|
|
768
|
-
if (output === raw)
|
|
769
|
-
return;
|
|
770
|
-
writeConfigFile(configPath, output);
|
|
771
|
-
console.log(`[openclaw] Normalized gateway.bind to "lan" in ${configPath}`);
|
|
772
|
-
}
|
|
773
|
-
catch (e) {
|
|
774
|
-
console.warn(`[openclaw] Failed to patch gateway.bind in ${configPath}: ${e.message}`);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
// ── prepareStart ─────────────────────────────────────────────────────────────
|
|
778
|
-
export async function prepareStartOpenClaw(instanceId) {
|
|
779
|
-
const { getNomadDriver, getOpenclawDockerImage } = await import("../../config.js");
|
|
780
|
-
const { DOCKER_IMAGE_RE, MAX_DOCKER_IMAGE_NAME_LEN } = await import("../nomad-manager.js");
|
|
781
|
-
const configPath = getOpenclawConfigPath(instanceId);
|
|
782
|
-
if (!existsSync(configPath)) {
|
|
783
|
-
return { ok: false, error: "Config file not found" };
|
|
784
|
-
}
|
|
785
|
-
if (getNomadDriver() === "docker") {
|
|
786
|
-
const stateDir = dirname(configPath);
|
|
787
|
-
ensureDirContainer(stateDir);
|
|
788
|
-
try {
|
|
789
|
-
for (const entry of readdirSync(stateDir, { withFileTypes: true })) {
|
|
790
|
-
if (entry.isDirectory()) {
|
|
791
|
-
const sub = join(stateDir, entry.name);
|
|
792
|
-
ensureDirContainer(sub);
|
|
793
|
-
try {
|
|
794
|
-
for (const child of readdirSync(sub, { withFileTypes: true })) {
|
|
795
|
-
if (child.isDirectory())
|
|
796
|
-
ensureDirContainer(join(sub, child.name));
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
catch { /* ignore */ }
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
catch { /* ignore */ }
|
|
804
|
-
if (existsSync(configPath))
|
|
805
|
-
chmodSync(configPath, 0o644);
|
|
806
|
-
patchDockerBridgeGatewayBind(configPath);
|
|
807
|
-
patchJsproxyBaseUrl(configPath);
|
|
808
|
-
const image = getOpenclawDockerImage();
|
|
809
|
-
if (!DOCKER_IMAGE_RE.test(image) || image.length > MAX_DOCKER_IMAGE_NAME_LEN) {
|
|
810
|
-
return { ok: false, error: `Invalid Docker image name: "${image}"` };
|
|
811
|
-
}
|
|
812
|
-
const imageCheck = inspectDockerImage(image, { timeout: 10000 });
|
|
813
|
-
if (!imageCheck.ok) {
|
|
814
|
-
const inspectError = toDockerInspectUserError(image, imageCheck);
|
|
815
|
-
if (imageCheck.reason !== "not_found") {
|
|
816
|
-
return {
|
|
817
|
-
ok: false,
|
|
818
|
-
error: inspectError.message,
|
|
819
|
-
code: inspectError.code,
|
|
820
|
-
statusCode: inspectError.statusCode,
|
|
821
|
-
};
|
|
822
|
-
}
|
|
823
|
-
console.log(`[openclaw] Docker image ${image} not found, starting background pull...`);
|
|
824
|
-
try {
|
|
825
|
-
const setupManager = await import("../setup-manager.js");
|
|
826
|
-
const result = setupManager.startBuildSlimOpenclawImage(image);
|
|
827
|
-
return {
|
|
828
|
-
ok: false,
|
|
829
|
-
error: `${inspectError.message} Pull started in background.`,
|
|
830
|
-
code: inspectError.code,
|
|
831
|
-
statusCode: 202,
|
|
832
|
-
building: true,
|
|
833
|
-
taskId: result.taskId,
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
catch (e) {
|
|
837
|
-
return { ok: false, error: `Docker image ${image} not available: ${e.message}` };
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
return { ok: true };
|
|
842
|
-
}
|
|
843
|
-
// ── createOpenclawInstance ────────────────────────────────────────────────────
|
|
844
|
-
export async function createOpenclawInstance(instanceId, name, description, options) {
|
|
845
|
-
const { appSpec, cloneFrom, openclawHome: customHome, cloneOptions } = options;
|
|
846
|
-
const d = getInstanceDir(instanceId);
|
|
847
|
-
if (existsSync(d))
|
|
848
|
-
throw new Error(`Instance '${instanceId}' already exists`);
|
|
849
|
-
const home = customHome ? normalizePath(customHome) : defaultOpenclawHome(instanceId);
|
|
850
|
-
if (customHome) {
|
|
851
|
-
const resolved = resolve(home);
|
|
852
|
-
if (!resolved.startsWith(JISHUSHELL_HOME) && !resolved.startsWith("/home/")) {
|
|
853
|
-
throw new Error(`openclaw_home must be under ${JISHUSHELL_HOME} or /home/`);
|
|
854
|
-
}
|
|
855
|
-
const parentDir = dirname(resolved);
|
|
856
|
-
if (existsSync(parentDir)) {
|
|
857
|
-
const realParent = realpathSync(parentDir);
|
|
858
|
-
if (!realParent.startsWith(JISHUSHELL_HOME) && !realParent.startsWith("/home/")) {
|
|
859
|
-
throw new Error(`openclaw_home parent resolves outside allowed paths (symlink detected)`);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
const shared = listInstances().filter((inst) => normalizePath(inst.openclaw_home || defaultOpenclawHome(inst.id)) === normalizePath(home));
|
|
863
|
-
if (shared.length) {
|
|
864
|
-
throw new Error(`OpenClaw home '${home}' is already used by instance(s): ${shared.map((i) => i.id).join(", ")}`);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
if (existsSync(home)) {
|
|
868
|
-
try {
|
|
869
|
-
const entries = readdirSync(home);
|
|
870
|
-
if (entries.length > 0) {
|
|
871
|
-
throw new Error(`OpenClaw home directory '${home}' already exists and is not empty. Remove it manually or choose a different path.`);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
catch (e) {
|
|
875
|
-
if (e.message.includes("not empty"))
|
|
876
|
-
throw e;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
ensureDirContainer(d);
|
|
880
|
-
try {
|
|
881
|
-
const parentGid = statSync(INSTANCES_DIR).gid;
|
|
882
|
-
chownSync(d, -1, parentGid);
|
|
883
|
-
}
|
|
884
|
-
catch { /* non-root */ }
|
|
885
|
-
ensureDirContainer(home);
|
|
886
|
-
ensureDirContainer(join(home, OPENCLAW_STATE_DIRNAME));
|
|
887
|
-
const { runtime: baseRuntime, allocatedPort } = await buildDefaultRuntime(instanceId, home);
|
|
888
|
-
let runtime = baseRuntime;
|
|
889
|
-
if (appSpec) {
|
|
890
|
-
const serviceTask = appSpec.tasks.find((t) => t.role === "service");
|
|
891
|
-
if (serviceTask) {
|
|
892
|
-
const compiled = compileTaskRuntime(serviceTask, instanceId);
|
|
893
|
-
runtime = { ...baseRuntime, ...compiled };
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
try {
|
|
897
|
-
const meta = {
|
|
898
|
-
id: instanceId,
|
|
899
|
-
name,
|
|
900
|
-
description,
|
|
901
|
-
openclaw_home: home,
|
|
902
|
-
runtime,
|
|
903
|
-
created_at: new Date().toISOString(),
|
|
904
|
-
...(appSpec ? { app_id: appSpec.app_id ?? appSpec.id } : {}),
|
|
905
|
-
};
|
|
906
|
-
safeWriteJson(instanceMetaPath(instanceId), meta);
|
|
907
|
-
const envFiles = (runtime.env_files || []).map((p) => normalizePath(p));
|
|
908
|
-
for (const ef of envFiles) {
|
|
909
|
-
if (!existsSync(ef))
|
|
910
|
-
writeConfigFile(ef, "");
|
|
911
|
-
}
|
|
912
|
-
try {
|
|
913
|
-
const runtimeUser = runtime.user;
|
|
914
|
-
if (runtimeUser && runtimeUser !== userInfo().username) {
|
|
915
|
-
for (const ef of envFiles) {
|
|
916
|
-
execFileSync("chown", [runtimeUser, ef], { timeout: 5000 });
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
catch { /* ignore */ }
|
|
921
|
-
const configPath = openclawConfigPathInternal(instanceId);
|
|
922
|
-
ensureDirContainer(dirname(configPath));
|
|
923
|
-
if (cloneFrom && !existsSync(configPath)) {
|
|
924
|
-
const srcConfig = resolveExistingConfigPath(cloneFrom);
|
|
925
|
-
if (existsSync(srcConfig)) {
|
|
926
|
-
try {
|
|
927
|
-
const cloned = JSON.parse(readFileSync(srcConfig, "utf-8"));
|
|
928
|
-
const providers = cloned?.models?.providers;
|
|
929
|
-
if (providers) {
|
|
930
|
-
for (const [pid, prov] of Object.entries(providers)) {
|
|
931
|
-
if (typeof prov?.baseUrl === "string" && prov.baseUrl.includes("/proxy/")) {
|
|
932
|
-
delete providers[pid];
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
const dm = cloned?.agents?.defaults?.model;
|
|
937
|
-
if (typeof dm === "string" && (dm.startsWith("jsproxy/") || dm.startsWith("js-"))) {
|
|
938
|
-
delete cloned.agents.defaults.model;
|
|
939
|
-
}
|
|
940
|
-
stripImBindings(cloned);
|
|
941
|
-
const subdirs = ["extensions", "workspace"];
|
|
942
|
-
if (cloneOptions?.include_memory !== false) {
|
|
943
|
-
const memDir = join(dirname(srcConfig), "memory");
|
|
944
|
-
if (existsSync(memDir))
|
|
945
|
-
subdirs.push("memory");
|
|
946
|
-
}
|
|
947
|
-
if (cloneOptions?.include_sessions) {
|
|
948
|
-
const sessDir = join(dirname(srcConfig), "agents");
|
|
949
|
-
if (existsSync(sessDir))
|
|
950
|
-
subdirs.push("agents");
|
|
951
|
-
}
|
|
952
|
-
for (const subdir of subdirs) {
|
|
953
|
-
const srcDir = join(dirname(srcConfig), subdir);
|
|
954
|
-
const dstDir = join(dirname(configPath), subdir);
|
|
955
|
-
if (existsSync(srcDir) && !existsSync(dstDir)) {
|
|
956
|
-
try {
|
|
957
|
-
cpSync(srcDir, dstDir, { recursive: true });
|
|
958
|
-
}
|
|
959
|
-
catch { /* best effort */ }
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
writeConfigFile(configPath, JSON.stringify(cloned, null, 2));
|
|
963
|
-
const srcMetaPath = join(getInstanceDir(cloneFrom), "instance.json");
|
|
964
|
-
if (existsSync(srcMetaPath)) {
|
|
965
|
-
try {
|
|
966
|
-
const srcMeta = JSON.parse(readFileSync(srcMetaPath, "utf-8"));
|
|
967
|
-
const srcXj = srcMeta?.["x-jishushell"];
|
|
968
|
-
if (srcXj?.proxy?.upstream) {
|
|
969
|
-
const dstXj = { proxy: { upstream: { ...srcXj.proxy.upstream } } };
|
|
970
|
-
delete dstXj.proxy.upstream.apiKey;
|
|
971
|
-
const metaPathDst = instanceMetaPath(instanceId);
|
|
972
|
-
if (existsSync(metaPathDst)) {
|
|
973
|
-
const dstMeta = JSON.parse(readFileSync(metaPathDst, "utf-8"));
|
|
974
|
-
dstMeta["x-jishushell"] = dstXj;
|
|
975
|
-
writeConfigFile(metaPathDst, JSON.stringify(dstMeta, null, 2));
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
catch { /* ignore */ }
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
catch {
|
|
983
|
-
copyFileSync(srcConfig, configPath);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
if (!existsSync(configPath)) {
|
|
988
|
-
writeConfigFile(configPath, JSON.stringify(buildStarterConfig(), null, 2));
|
|
989
|
-
const dp = getDefaultLlmProvider();
|
|
990
|
-
if (dp?.apiKey && dp?.id && envFiles.length) {
|
|
991
|
-
const envKey = inferProviderApiKeyEnvName(dp.id);
|
|
992
|
-
updateEnvFile(envFiles[0], { [envKey]: decryptRuntimeProviderApiKey(dp.apiKey) });
|
|
993
|
-
const providerEnv = join(dirname(envFiles[0]), "provider.env");
|
|
994
|
-
updateEnvFile(providerEnv, { UPSTREAM_API_KEY: dp.apiKey });
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
if (appSpec?.openclaw?.config_defaults && existsSync(configPath)) {
|
|
998
|
-
try {
|
|
999
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
1000
|
-
const defaults = appSpec.openclaw.config_defaults;
|
|
1001
|
-
for (const [key, value] of Object.entries(defaults)) {
|
|
1002
|
-
if (typeof value === "object" && value !== null && !Array.isArray(value) && typeof existing[key] === "object" && existing[key] !== null) {
|
|
1003
|
-
existing[key] = { ...existing[key], ...value };
|
|
1004
|
-
}
|
|
1005
|
-
else {
|
|
1006
|
-
existing[key] = value;
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
writeConfigFile(configPath, JSON.stringify(existing, null, 2));
|
|
1010
|
-
}
|
|
1011
|
-
catch { /* ignore */ }
|
|
1012
|
-
}
|
|
1013
|
-
if (appSpec?.openclaw?.skills && Array.isArray(appSpec.openclaw.skills)) {
|
|
1014
|
-
try {
|
|
1015
|
-
const skillsDir = join(dirname(configPath), "skills");
|
|
1016
|
-
ensureDirContainer(skillsDir);
|
|
1017
|
-
const skillMeta = join(skillsDir, ".app-skills.json");
|
|
1018
|
-
safeWriteJson(skillMeta, { app_id: appSpec.app_id ?? appSpec.id, skills: appSpec.openclaw.skills });
|
|
1019
|
-
}
|
|
1020
|
-
catch { /* ignore */ }
|
|
1021
|
-
}
|
|
1022
|
-
if (cloneFrom && envFiles.length) {
|
|
1023
|
-
const srcEnvFiles = getRuntimeEnvFiles(cloneFrom);
|
|
1024
|
-
const srcEnvFile = srcEnvFiles[0];
|
|
1025
|
-
const dstEnvFile = envFiles[0];
|
|
1026
|
-
if (srcEnvFile) {
|
|
1027
|
-
const srcProvider = join(dirname(srcEnvFile), "provider.env");
|
|
1028
|
-
const dstProvider = join(dirname(dstEnvFile), "provider.env");
|
|
1029
|
-
if (existsSync(srcProvider) && !existsSync(dstProvider)) {
|
|
1030
|
-
copyFileSync(srcProvider, dstProvider);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
try {
|
|
1035
|
-
const { bootstrapInstanceProxy } = await import("../llm-proxy/instance-proxy.js");
|
|
1036
|
-
await bootstrapInstanceProxy(instanceId);
|
|
1037
|
-
}
|
|
1038
|
-
catch (e) {
|
|
1039
|
-
console.warn(`[openclaw] Proxy bootstrap for ${instanceId} deferred: ${e.message}`);
|
|
1040
|
-
}
|
|
1041
|
-
const svcUser = resolveServiceUser();
|
|
1042
|
-
if (svcUser) {
|
|
1043
|
-
try {
|
|
1044
|
-
execFileSync("chown", ["-R", `${svcUser.uid}:${svcUser.gid}`, d], { timeout: 10_000 });
|
|
1045
|
-
if (!home.startsWith(d + "/") && existsSync(home)) {
|
|
1046
|
-
execFileSync("chown", ["-R", `${svcUser.uid}:${svcUser.gid}`, home], { timeout: 10_000 });
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
catch (e) {
|
|
1050
|
-
console.warn(`[openclaw] chown for ${instanceId} failed:`, e.message);
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
return meta;
|
|
1054
|
-
}
|
|
1055
|
-
finally {
|
|
1056
|
-
releasePort(allocatedPort);
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
// ── Nomad task & secrets for OpenClaw ──────────────────────────────────────
|
|
1060
|
-
import { getOpenclawDockerImage, } from "../../config.js";
|
|
1061
|
-
import { DEFAULT_PIDS_LIMIT, DEFAULT_RESOURCES, DEFAULT_ARGS, DEFAULT_USER, DEFAULT_CWD, DEFAULT_ENV, MAX_CPU_MHZ, VALID_USER_RE, resolveUidGid, normalizeDockerResources, nomadGet, nomadPut, jobId, } from "../nomad-manager.js";
|
|
1062
|
-
function buildOpenclawRuntime(instanceId) {
|
|
1063
|
-
const runtime = getInstanceRuntime(instanceId);
|
|
1064
|
-
const openclawHome = getOpenclawHome(instanceId);
|
|
1065
|
-
if (runtime.user && !VALID_USER_RE.test(runtime.user)) {
|
|
1066
|
-
throw new Error(`Invalid runtime user: ${runtime.user}`);
|
|
1067
|
-
}
|
|
1068
|
-
const command = runtime.command || "/usr/bin/openclaw";
|
|
1069
|
-
let args = runtime.args;
|
|
1070
|
-
if (!Array.isArray(args))
|
|
1071
|
-
args = [...DEFAULT_ARGS];
|
|
1072
|
-
else
|
|
1073
|
-
args = args.map(String);
|
|
1074
|
-
const env = { ...DEFAULT_ENV };
|
|
1075
|
-
Object.assign(env, getRuntimeEnv(instanceId));
|
|
1076
|
-
decryptRuntimeProviderEnv(env);
|
|
1077
|
-
delete env.JSPROXY_API_KEY;
|
|
1078
|
-
env.OPENCLAW_HOME = openclawHome;
|
|
1079
|
-
env.OPENCLAW_INSTANCE_ID = instanceId;
|
|
1080
|
-
const resources = { ...DEFAULT_RESOURCES };
|
|
1081
|
-
for (const [key, value] of Object.entries(runtime.resources || {})) {
|
|
1082
|
-
if (value != null)
|
|
1083
|
-
resources[key] = Number(value);
|
|
1084
|
-
}
|
|
1085
|
-
resources.CPU = Math.max(1, Math.min(resources.CPU, MAX_CPU_MHZ));
|
|
1086
|
-
resources.MemoryMB = Math.max(1, Math.min(resources.MemoryMB, getMaxAppMemoryMB()));
|
|
1087
|
-
return {
|
|
1088
|
-
command: String(command),
|
|
1089
|
-
args,
|
|
1090
|
-
user: runtime.user || DEFAULT_USER,
|
|
1091
|
-
cwd: runtime.cwd || DEFAULT_CWD,
|
|
1092
|
-
env,
|
|
1093
|
-
resources,
|
|
1094
|
-
image: runtime.image ?? null,
|
|
1095
|
-
};
|
|
1096
|
-
}
|
|
1097
|
-
export function buildNomadTaskOpenClaw(instanceId, runtime, safeJobId) {
|
|
1098
|
-
const openclawHome = getOpenclawHome(instanceId);
|
|
1099
|
-
const image = runtime.image || getOpenclawDockerImage();
|
|
1100
|
-
const volumes = [`${openclawHome}:${openclawHome}:rw`];
|
|
1101
|
-
const containerEnv = { ...runtime.env };
|
|
1102
|
-
containerEnv.HOME = openclawHome;
|
|
1103
|
-
if (!containerEnv.OPENCLAW_STATE_DIR) {
|
|
1104
|
-
containerEnv.OPENCLAW_STATE_DIR = `${openclawHome}/.openclaw`;
|
|
1105
|
-
}
|
|
1106
|
-
containerEnv.npm_config_prefix = `${openclawHome}/.npm-global`;
|
|
1107
|
-
containerEnv.PIP_USER = "1";
|
|
1108
|
-
containerEnv.PYTHONUSERBASE = `${openclawHome}/.local`;
|
|
1109
|
-
containerEnv.NODE_ENV = "production";
|
|
1110
|
-
containerEnv.NODE_PATH = [
|
|
1111
|
-
`${openclawHome}/.npm-global/lib/node_modules`,
|
|
1112
|
-
"/app/node_modules",
|
|
1113
|
-
].join(":");
|
|
1114
|
-
containerEnv.PATH = [
|
|
1115
|
-
`${openclawHome}/.npm-global/bin`,
|
|
1116
|
-
`${openclawHome}/.local/bin`,
|
|
1117
|
-
`${openclawHome}/go/bin`,
|
|
1118
|
-
`${openclawHome}/.cargo/bin`,
|
|
1119
|
-
"/usr/local/sbin",
|
|
1120
|
-
"/usr/local/bin",
|
|
1121
|
-
"/usr/sbin",
|
|
1122
|
-
"/usr/bin",
|
|
1123
|
-
"/sbin",
|
|
1124
|
-
"/bin",
|
|
1125
|
-
].join(":");
|
|
1126
|
-
const runtimeArgs = [...(runtime.args || [])];
|
|
1127
|
-
const gatewayPort = getGatewayPort(instanceId);
|
|
1128
|
-
const normalizedResources = normalizeDockerResources(instanceId, runtime);
|
|
1129
|
-
return {
|
|
1130
|
-
Name: "gateway",
|
|
1131
|
-
Driver: "docker",
|
|
1132
|
-
User: resolveUidGid(runtime.user),
|
|
1133
|
-
Config: {
|
|
1134
|
-
image,
|
|
1135
|
-
force_pull: false,
|
|
1136
|
-
args: runtimeArgs,
|
|
1137
|
-
work_dir: openclawHome,
|
|
1138
|
-
volumes,
|
|
1139
|
-
extra_hosts: ["host.docker.internal:host-gateway"],
|
|
1140
|
-
cap_drop: ["ALL"],
|
|
1141
|
-
security_opt: ["no-new-privileges"],
|
|
1142
|
-
pids_limit: DEFAULT_PIDS_LIMIT,
|
|
1143
|
-
readonly_rootfs: true,
|
|
1144
|
-
mounts: [
|
|
1145
|
-
{ type: "tmpfs", target: "/tmp", tmpfs_options: { size: 536870912 } },
|
|
1146
|
-
{ type: "tmpfs", target: "/var/tmp", tmpfs_options: { size: 67108864 } },
|
|
1147
|
-
{ type: "tmpfs", target: "/run", tmpfs_options: { size: 52428800 } },
|
|
1148
|
-
],
|
|
1149
|
-
},
|
|
1150
|
-
Env: containerEnv,
|
|
1151
|
-
Resources: {
|
|
1152
|
-
...normalizedResources,
|
|
1153
|
-
Networks: [{ ReservedPorts: [{ Label: "gateway", Value: gatewayPort }] }],
|
|
1154
|
-
},
|
|
1155
|
-
LogConfig: { MaxFiles: 3, MaxFileSizeMB: 10 },
|
|
1156
|
-
Templates: [{
|
|
1157
|
-
DestPath: "secrets/instance.env",
|
|
1158
|
-
Envvars: true,
|
|
1159
|
-
EmbeddedTmpl: [
|
|
1160
|
-
`{{ if nomadVarExists "nomad/jobs/${safeJobId}/openclaw/gateway" }}`,
|
|
1161
|
-
`JSPROXY_API_KEY={{ with nomadVar "nomad/jobs/${safeJobId}/openclaw/gateway" }}{{ .JSPROXY_API_KEY }}{{ end }}`,
|
|
1162
|
-
`{{ end }}`,
|
|
1163
|
-
].join("\n"),
|
|
1164
|
-
ChangeMode: "restart",
|
|
1165
|
-
}],
|
|
1166
|
-
};
|
|
1167
|
-
}
|
|
1168
|
-
export async function writeNomadSecretsOpenClaw(instanceId) {
|
|
1169
|
-
const jid = jobId(instanceId);
|
|
1170
|
-
const ns = "default";
|
|
1171
|
-
const varPath = `nomad/jobs/${jid}/openclaw/gateway`;
|
|
1172
|
-
const encodedPath = encodeURIComponent(varPath);
|
|
1173
|
-
const env = getRuntimeEnv(instanceId);
|
|
1174
|
-
const proxyToken = env.JSPROXY_API_KEY || "";
|
|
1175
|
-
if (!proxyToken)
|
|
1176
|
-
return;
|
|
1177
|
-
const items = { JSPROXY_API_KEY: proxyToken };
|
|
1178
|
-
const MAX_ATTEMPTS = 3;
|
|
1179
|
-
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
1180
|
-
let cas = 0;
|
|
1181
|
-
try {
|
|
1182
|
-
const existing = await nomadGet(`/v1/var/${encodedPath}?namespace=${ns}`);
|
|
1183
|
-
if (existing.ok) {
|
|
1184
|
-
const data = await existing.json();
|
|
1185
|
-
cas = data.ModifyIndex || 0;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
catch { /* variable may not exist yet — cas=0 creates a new one */ }
|
|
1189
|
-
const resp = await nomadPut(`/v1/var/${encodedPath}?cas=${cas}&namespace=${ns}`, {
|
|
1190
|
-
Namespace: ns,
|
|
1191
|
-
Path: varPath,
|
|
1192
|
-
Items: items,
|
|
1193
|
-
});
|
|
1194
|
-
if (resp.ok)
|
|
1195
|
-
return;
|
|
1196
|
-
const text = await resp.text();
|
|
1197
|
-
if (resp.status === 409 && attempt < MAX_ATTEMPTS - 1) {
|
|
1198
|
-
await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
|
|
1199
|
-
continue;
|
|
1200
|
-
}
|
|
1201
|
-
throw new Error(`Failed to write Nomad Variables for ${instanceId}` +
|
|
1202
|
-
` (attempt ${attempt + 1}/${MAX_ATTEMPTS}): HTTP ${resp.status} ${text}`);
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
// ── AppTypeManager export ──────────────────────────────────────────────────
|
|
1206
|
-
export const openclawManager = {
|
|
1207
|
-
appType: "openclaw",
|
|
1208
|
-
createInstance: createOpenclawInstance,
|
|
1209
|
-
prepareStart: prepareStartOpenClaw,
|
|
1210
|
-
writeNomadSecrets: writeNomadSecretsOpenClaw,
|
|
1211
|
-
buildNomadTask: buildNomadTaskOpenClaw,
|
|
1212
|
-
nomadTaskGroupName: () => "openclaw",
|
|
1213
|
-
buildRuntime: buildOpenclawRuntime,
|
|
1214
|
-
};
|
|
1215
|
-
//# sourceMappingURL=openclaw-manager.js.map
|