jishushell 0.6.5 → 0.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/anythingllm-container.yaml +15 -170
- package/apps/browserless-chromium-container.yaml +15 -10
- package/apps/filebrowser-container.yaml +14 -9
- package/apps/hermes-container.yaml +23 -2
- package/apps/jishu-kb-container.yaml +29 -161
- package/apps/ollama-binary.yaml +32 -28
- package/apps/ollama-cpu-container.yaml +5 -0
- package/apps/ollama-with-hollama-binary.yaml +33 -28
- package/apps/openclaw-binary.yaml +34 -10
- package/apps/openclaw-container.yaml +31 -7
- package/apps/openclaw-with-ollama-container.yaml +8 -2
- package/apps/openclaw-with-searxng-container.yaml +18 -6
- package/apps/searxng-container.yaml +11 -6
- package/apps/weknora-container.yaml +21 -21
- package/dependencies/jishushell-panel-0.6.18.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 +17 -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 +23 -19
- package/dist/config.js +60 -49
- 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 +18 -18
- package/dist/install.js.map +1 -1
- 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/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 +51 -30
- 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 +10 -4
- package/dist/routes/instances.js +323 -541
- 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.js +315 -213
- 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 +308 -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 +104 -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 +495 -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 +467 -0
- package/dist/services/app-common/lifecycle-service.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 +126 -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 +9 -0
- package/dist/services/app-common/spec-materializer.js +361 -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 +759 -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 +517 -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 +50 -0
- package/dist/services/capabilities/contract.js +129 -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 +114 -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/connections/admin.d.ts +80 -0
- package/dist/services/connections/admin.js +327 -0
- package/dist/services/connections/admin.js.map +1 -0
- package/dist/services/connections/apply.d.ts +110 -0
- package/dist/services/connections/apply.js +444 -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/suggestions.d.ts +27 -0
- package/dist/services/connections/suggestions.js +124 -0
- package/dist/services/connections/suggestions.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/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/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/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 +231 -0
- package/dist/services/instances/manager.js +1348 -0
- package/dist/services/instances/manager.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/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 +1669 -0
- package/dist/services/integrations/hermes/integration.js.map +1 -0
- package/dist/services/integrations/index.d.ts +40 -0
- package/dist/services/integrations/index.js +59 -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 +177 -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 +22 -0
- package/dist/services/integrations/jishukb/integration.js +189 -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 +424 -0
- package/dist/services/integrations/openclaw/integration.js +4402 -0
- package/dist/services/integrations/openclaw/integration.js.map +1 -0
- package/dist/services/integrations/openclaw/jishukb-shim.d.ts +48 -0
- package/dist/services/integrations/openclaw/jishukb-shim.js +750 -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 +46 -0
- package/dist/services/integrations/openclaw/mcporter.js +112 -0
- package/dist/services/integrations/openclaw/mcporter.js.map +1 -0
- package/dist/services/integrations/openclaw/routes.d.ts +21 -0
- package/dist/services/integrations/openclaw/routes.js +1191 -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 +469 -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 +307 -0
- package/dist/services/repair/runtime-repair.js.map +1 -0
- package/dist/services/runtime/driver-registry.d.ts +21 -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 +260 -0
- package/dist/services/runtime/drivers/nomad.js +3092 -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/types.d.ts +22 -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 +525 -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 +2768 -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/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 +710 -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 +331 -45
- package/dist/utils/instance-lock.d.ts +2 -2
- package/dist/utils/instance-lock.js +2 -2
- package/install/jishu-install.sh +107 -26
- 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/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/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-NKcbHjNz.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/Dashboard-Da1fL38t.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/HermesChatPanel-DZvmYsoh.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/HermesConfigForm-BLUWlKwm.js +4 -0
- package/node_modules/jishushell-panel/output/public/assets/InitPassword-BAKsshzk.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/InstanceDetail-Dgyc_TX5.js +14 -0
- package/node_modules/jishushell-panel/output/public/assets/Login-DHeOmwI8.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/NewInstance-CIy0cYtp.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/ProviderRecommendations-H0ByEYF0.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/Settings-DAT-UMfP.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/Setup-g3uckFYR.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/WeixinLoginPanel-D-T6BxkQ.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-DnnqTf7s.css +1 -0
- package/node_modules/jishushell-panel/output/public/assets/index-ERt6_ngA.js +23 -0
- package/node_modules/jishushell-panel/output/public/assets/registry-DF93EzIb.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-DeoThIQn.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/vendor-i18n-CS8DFbkQ.js +1 -0
- package/node_modules/jishushell-panel/output/public/assets/vendor-react-Cc84NArf.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 +11 -2
- 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 +127 -25
- 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 +41 -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/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
package/dist/routes/instances.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { getServiceManagerType } from "../config.js";
|
|
2
|
-
import { assertNotLocked } from "../services/backup-manager.js";
|
|
3
|
-
import * as
|
|
2
|
+
import { assertNotLocked } from "../services/backup/backup-manager.js";
|
|
3
|
+
import * as appService from "../services/app-common/service.js";
|
|
4
|
+
import * as appLifecycle from "../services/app-common/lifecycle-service.js";
|
|
4
5
|
import { cleanupInstance as cleanupProxyInstance, getLastProxyError, invalidateConfigCache, } from "../services/llm-proxy/instance-proxy.js";
|
|
5
|
-
import { createInstance, isInstanceAdminError, validateId, } from "../services/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { createInstance, isInstanceAdminError, validateId, } from "../services/instances/admin.js";
|
|
7
|
+
import { cloneInstance, isInstanceCloneError } from "../services/instances/clone.js";
|
|
8
|
+
import { getConnectionStatus, getConnectionSummary, isConnectionAdminError, replaceConnections, } from "../services/connections/admin.js";
|
|
9
|
+
import { getAppConfigMeta, isAppConfigAdminError, readAppConfig, writeAppConfig, } from "../services/instances/config-admin.js";
|
|
10
|
+
import { augmentInstanceMetadata, getInstanceCapabilities, resolvePrimaryIntegrationKind, } from "../services/runtime/instance.js";
|
|
11
|
+
import { getIntegration, hasIntegration } from "../services/integrations/index.js";
|
|
12
|
+
import { invalidateExecutionOwner } from "../services/app-common/execution-owner.js";
|
|
13
|
+
import { markRuntimeRepairRestartApplied } from "../services/repair/runtime-repair.js";
|
|
14
|
+
import { getCapabilityHtmlRewriter } from "../services/capability-proxy/html-rewriters/index.js";
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
|
+
import { assertTerminalSessionOwner, getTerminalSession, getTerminalSessionEvents, sendTerminalSessionInput, startTerminalSession, stopTerminalSession, subscribeTerminalSession, } from "../services/app-common/terminal-session-manager.js";
|
|
17
|
+
import { refreshInstanceStatus } from "../services/app-common/status-refresh.js";
|
|
14
18
|
import { writeSecretFile } from "../utils/fs.js";
|
|
15
19
|
import { Readable } from "node:stream";
|
|
16
20
|
export { validateId };
|
|
17
21
|
// Hop-by-hop headers that must not be forwarded by a proxy (RFC 2616 §13.5.1).
|
|
18
|
-
// Exported for
|
|
22
|
+
// Exported for integration-owned route modules that implement their own HTTP proxies.
|
|
19
23
|
export const HOP_BY_HOP = new Set([
|
|
20
24
|
"connection", "keep-alive", "proxy-authenticate", "proxy-authorization",
|
|
21
25
|
"te", "trailer", "transfer-encoding", "upgrade",
|
|
@@ -77,7 +81,7 @@ function rewriteCapabilityLocation(basePath, canonicalBasePath, pathname, search
|
|
|
77
81
|
: joinProxyPath(basePath, pathname);
|
|
78
82
|
return `${rewrittenPath}${search}${hash}`;
|
|
79
83
|
}
|
|
80
|
-
function joinUpstreamPath(basePath, suffix) {
|
|
84
|
+
export function joinUpstreamPath(basePath, suffix) {
|
|
81
85
|
const normalizedBase = typeof basePath === "string" && basePath.trim()
|
|
82
86
|
? (basePath.startsWith("/") ? basePath : `/${basePath}`)
|
|
83
87
|
: "/";
|
|
@@ -90,244 +94,49 @@ function shouldRewriteProxyResponse(contentType) {
|
|
|
90
94
|
const value = (contentType ?? "").toLowerCase();
|
|
91
95
|
return value.includes("text/html") || value.includes("text/css");
|
|
92
96
|
}
|
|
93
|
-
function
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"(function(){",
|
|
99
|
-
`var P=${escapedProxyBase};`,
|
|
100
|
-
"var _WS=self.WebSocket;",
|
|
101
|
-
"if(typeof _WS!=='function')return;",
|
|
102
|
-
"self.WebSocket=function(url,protocols){",
|
|
103
|
-
"try{var p=new URL(url,self.location.origin);",
|
|
104
|
-
"if(p.host===self.location.host&&!p.pathname.startsWith('/api/')){",
|
|
105
|
-
"var s=self.location.protocol==='https:'?'wss:':'ws:';",
|
|
106
|
-
"url=s+'//'+self.location.host+P+p.pathname+p.search;",
|
|
107
|
-
"}}catch(_e){}",
|
|
108
|
-
"return protocols!==undefined?new _WS(url,protocols):new _WS(url);",
|
|
109
|
-
"};",
|
|
110
|
-
"self.WebSocket.prototype=_WS.prototype;",
|
|
111
|
-
"self.WebSocket.CONNECTING=_WS.CONNECTING;",
|
|
112
|
-
"self.WebSocket.OPEN=_WS.OPEN;",
|
|
113
|
-
"self.WebSocket.CLOSING=_WS.CLOSING;",
|
|
114
|
-
"self.WebSocket.CLOSED=_WS.CLOSED;",
|
|
115
|
-
"})();",
|
|
116
|
-
].join(""));
|
|
117
|
-
// 1) Set baseURL in localStorage so the debugger's HTTP API calls go through
|
|
118
|
-
// the capability proxy.
|
|
119
|
-
// 2) Monkey-patch WebSocket in the page and any same-origin workers so that
|
|
120
|
-
// Browserless connections targeting the panel origin (e.g.
|
|
121
|
-
// ws://panel:8090/?launch=...) are rewritten through the capability proxy.
|
|
122
|
-
return [
|
|
123
|
-
"<script>(function(){",
|
|
124
|
-
// --- localStorage apiSettings.baseURL ---
|
|
125
|
-
// Browserless reads `state.apiSettings.baseURL` (a NESTED object); writing
|
|
126
|
-
// a flat `state.baseURL` is silently ignored, and the SPA falls back to
|
|
127
|
-
// `window.location.origin` (no proxy prefix) — producing connect URLs like
|
|
128
|
-
// `ws://panel:8090/?launch=...` that bypass the capability proxy.
|
|
129
|
-
"try{var key='browserless-debugger:'+window.location.origin+window.location.pathname;",
|
|
130
|
-
"var raw=window.localStorage.getItem(key)||'{}';",
|
|
131
|
-
"var state={};try{state=JSON.parse(raw)||{}}catch(_e){}",
|
|
132
|
-
`var base=new URL(${escapedPath},window.location.origin);`,
|
|
133
|
-
"var token=new URL(window.location.href).searchParams.get('token');",
|
|
134
|
-
"if(token)base.searchParams.set('token',token);",
|
|
135
|
-
"var settings=(state&&typeof state.apiSettings==='object'&&state.apiSettings)?state.apiSettings:{};",
|
|
136
|
-
"settings.baseURL=base.href;",
|
|
137
|
-
"state.apiSettings=settings;",
|
|
138
|
-
"window.localStorage.setItem(key,JSON.stringify(state));",
|
|
139
|
-
"}catch(_e){}",
|
|
140
|
-
// --- WebSocket monkey-patch ---
|
|
141
|
-
"var _WS=window.WebSocket;",
|
|
142
|
-
`var _base=${escapedProxyBase};`,
|
|
143
|
-
"window.WebSocket=function(url,protocols){",
|
|
144
|
-
"try{var p=new URL(url,window.location.origin);",
|
|
145
|
-
"if(p.host===window.location.host&&!p.pathname.startsWith('/api/')){",
|
|
146
|
-
"var s=window.location.protocol==='https:'?'wss:':'ws:';",
|
|
147
|
-
"url=s+'//'+window.location.host+_base+p.pathname+p.search;",
|
|
148
|
-
"}}catch(_e){}",
|
|
149
|
-
"return protocols!==undefined?new _WS(url,protocols):new _WS(url);",
|
|
150
|
-
"};",
|
|
151
|
-
"window.WebSocket.prototype=_WS.prototype;",
|
|
152
|
-
"window.WebSocket.CONNECTING=_WS.CONNECTING;",
|
|
153
|
-
"window.WebSocket.OPEN=_WS.OPEN;",
|
|
154
|
-
"window.WebSocket.CLOSING=_WS.CLOSING;",
|
|
155
|
-
"window.WebSocket.CLOSED=_WS.CLOSED;",
|
|
156
|
-
// --- Worker monkey-patch ---
|
|
157
|
-
"var _Worker=window.Worker;",
|
|
158
|
-
`var _workerPrelude=${escapedWorkerPrelude};`,
|
|
159
|
-
"function shouldWrapWorker(url){",
|
|
160
|
-
"try{var p=new URL(String(url),window.location.href);",
|
|
161
|
-
"return p.protocol==='blob:'||p.protocol==='data:'||p.origin===window.location.origin;",
|
|
162
|
-
"}catch(_e){return false;}",
|
|
163
|
-
"}",
|
|
164
|
-
"function wrapWorker(url,options){",
|
|
165
|
-
"if(typeof _Worker!=='function'||!shouldWrapWorker(url))return url;",
|
|
166
|
-
"try{var resolved=new URL(String(url),window.location.href).href;",
|
|
167
|
-
"var isModule=!!(options&&options.type==='module');",
|
|
168
|
-
"var source=isModule?_workerPrelude+'\\nimport '+JSON.stringify(resolved)+';':_workerPrelude+'\\nimportScripts('+JSON.stringify(resolved)+');';",
|
|
169
|
-
"return URL.createObjectURL(new Blob([source],{type:'text/javascript'}));",
|
|
170
|
-
"}catch(_e){return url;}",
|
|
171
|
-
"}",
|
|
172
|
-
"if(typeof _Worker==='function'){",
|
|
173
|
-
"window.Worker=function(url,options){",
|
|
174
|
-
"var wrapped=wrapWorker(url,options);",
|
|
175
|
-
"return options!==undefined?new _Worker(wrapped,options):new _Worker(wrapped);",
|
|
176
|
-
"};",
|
|
177
|
-
"window.Worker.prototype=_Worker.prototype;",
|
|
178
|
-
"}",
|
|
179
|
-
"})();</script>",
|
|
180
|
-
].join("");
|
|
181
|
-
}
|
|
182
|
-
const JISHU_KB_PRELOAD_SESSION_LIMIT = 50;
|
|
183
|
-
const JISHU_KB_PRELOAD_MESSAGE_LIMIT = 20;
|
|
184
|
-
const JISHU_KB_PRELOAD_TIMEOUT_MS = 5_000;
|
|
185
|
-
const JISHU_KB_PRELOAD_GLOBAL = "__JISHU_KB_PRELOADED_SESSIONS__";
|
|
186
|
-
function trimString(value) {
|
|
187
|
-
return typeof value === "string" ? value.trim() : "";
|
|
188
|
-
}
|
|
189
|
-
function parseJishuKbConversationId(value) {
|
|
190
|
-
if (typeof value === "number") {
|
|
191
|
-
return Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
97
|
+
function capabilityProxyCleanupToken(parts) {
|
|
98
|
+
const hash = createHash("sha256");
|
|
99
|
+
for (const part of parts) {
|
|
100
|
+
hash.update(part ?? "");
|
|
101
|
+
hash.update("\0");
|
|
192
102
|
}
|
|
193
|
-
|
|
194
|
-
if (!/^\d+$/.test(raw))
|
|
195
|
-
return null;
|
|
196
|
-
const parsed = Number(raw);
|
|
197
|
-
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
|
|
198
|
-
}
|
|
199
|
-
function parseJishuKbTimestamp(value) {
|
|
200
|
-
const numeric = typeof value === "number" ? value : Number(value);
|
|
201
|
-
return Number.isFinite(numeric) ? numeric : 0;
|
|
103
|
+
return hash.digest("hex").slice(0, 32);
|
|
202
104
|
}
|
|
203
|
-
function
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return
|
|
212
|
-
|
|
213
|
-
return undefined;
|
|
214
|
-
try {
|
|
215
|
-
const parsed = JSON.parse(value);
|
|
216
|
-
return Array.isArray(parsed) ? parsed : undefined;
|
|
217
|
-
}
|
|
218
|
-
catch {
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
105
|
+
function hasCookieValue(cookieHeader, name, expectedValue) {
|
|
106
|
+
return cookieHeader
|
|
107
|
+
.split(";")
|
|
108
|
+
.map((part) => part.trim())
|
|
109
|
+
.some((part) => {
|
|
110
|
+
const eq = part.indexOf("=");
|
|
111
|
+
if (eq < 0)
|
|
112
|
+
return false;
|
|
113
|
+
return part.slice(0, eq) === name && part.slice(eq + 1) === expectedValue;
|
|
114
|
+
});
|
|
221
115
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
116
|
+
export async function resolveHttpCapability(instanceId, capabilityName) {
|
|
117
|
+
const capability = appService
|
|
118
|
+
.getProvidedCapabilitiesForApp(instanceId)
|
|
119
|
+
.find((entry) => entry.capability === capabilityName);
|
|
120
|
+
if (!capability)
|
|
121
|
+
throw new Error(`Capability '${capabilityName}' not found`);
|
|
122
|
+
if (capability.visibility === "internal") {
|
|
123
|
+
throw new Error(`Capability '${capabilityName}' is not externally accessible`);
|
|
226
124
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return () => parentSignal.removeEventListener("abort", abort);
|
|
230
|
-
}
|
|
231
|
-
async function fetchJsonWithTimeout(upstreamOrigin, relativePath, parentSignal) {
|
|
232
|
-
const controller = new AbortController();
|
|
233
|
-
const cleanupAbort = relayAbort(parentSignal, controller);
|
|
234
|
-
const timer = setTimeout(() => controller.abort(new Error("timeout")), JISHU_KB_PRELOAD_TIMEOUT_MS);
|
|
235
|
-
try {
|
|
236
|
-
const response = await fetch(new URL(relativePath, `${upstreamOrigin}/`).toString(), {
|
|
237
|
-
headers: { accept: "application/json" },
|
|
238
|
-
signal: controller.signal,
|
|
239
|
-
});
|
|
240
|
-
if (!response.ok) {
|
|
241
|
-
const detail = (await response.text()).slice(0, 200);
|
|
242
|
-
throw new Error(`${relativePath} -> ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
243
|
-
}
|
|
244
|
-
return await response.json();
|
|
125
|
+
if (capability.protocol !== "http" && capability.protocol !== "https") {
|
|
126
|
+
throw new Error(`Capability '${capabilityName}' does not use HTTP(S)`);
|
|
245
127
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
128
|
+
const runtimePort = appService.resolveRuntimeCapabilityPort(instanceId, capabilityName);
|
|
129
|
+
if (typeof runtimePort !== "number" || runtimePort < 1) {
|
|
130
|
+
throw new Error(`Capability '${capabilityName}' has no resolved port`);
|
|
249
131
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const conversationLists = await Promise.all(kbIds.map(async (kbId) => {
|
|
259
|
-
const query = new URLSearchParams({ kb_id: kbId }).toString();
|
|
260
|
-
const rows = await fetchJsonWithTimeout(upstreamOrigin, `/api/conversations?${query}`, parentSignal);
|
|
261
|
-
return Array.isArray(rows)
|
|
262
|
-
? rows.map((row) => ({
|
|
263
|
-
...row,
|
|
264
|
-
kb_id: trimString(row?.kb_id) || kbId,
|
|
265
|
-
}))
|
|
266
|
-
: [];
|
|
267
|
-
}));
|
|
268
|
-
const selected = conversationLists
|
|
269
|
-
.flat()
|
|
270
|
-
.sort((left, right) => parseJishuKbTimestamp(right.updated_at) - parseJishuKbTimestamp(left.updated_at))
|
|
271
|
-
.slice(0, JISHU_KB_PRELOAD_SESSION_LIMIT);
|
|
272
|
-
const hydrated = await Promise.all(selected.map(async (conversation) => {
|
|
273
|
-
const conversationId = parseJishuKbConversationId(conversation.id);
|
|
274
|
-
const kbId = trimString(conversation.kb_id);
|
|
275
|
-
if (!conversationId || !kbId) {
|
|
276
|
-
console.warn("[cap-proxy] skipping jishukb conversation preload with unsupported id/kb", {
|
|
277
|
-
id: conversation.id,
|
|
278
|
-
kbId,
|
|
279
|
-
});
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
const messages = await fetchJsonWithTimeout(upstreamOrigin, `/api/conversations/${encodeURIComponent(String(conversationId))}/messages`, parentSignal);
|
|
283
|
-
const normalizedMessages = (Array.isArray(messages) ? messages : [])
|
|
284
|
-
.map((message) => {
|
|
285
|
-
const role = parseJishuKbRole(message?.role);
|
|
286
|
-
const content = typeof message?.content === "string" ? message.content : "";
|
|
287
|
-
if (!role || !content)
|
|
288
|
-
return null;
|
|
289
|
-
const cites = parseJishuKbCitations(message?.citations);
|
|
290
|
-
return cites?.length
|
|
291
|
-
? { role, content, cites }
|
|
292
|
-
: { role, content };
|
|
293
|
-
})
|
|
294
|
-
.filter((message) => message !== null)
|
|
295
|
-
.slice(-JISHU_KB_PRELOAD_MESSAGE_LIMIT);
|
|
296
|
-
return {
|
|
297
|
-
id: conversationId,
|
|
298
|
-
kb: kbId,
|
|
299
|
-
title: trimString(conversation.title) || "Untitled",
|
|
300
|
-
msgs: normalizedMessages,
|
|
301
|
-
_syncedMsgIdx: normalizedMessages.length,
|
|
302
|
-
};
|
|
303
|
-
}));
|
|
304
|
-
return hydrated
|
|
305
|
-
.filter((session) => session !== null)
|
|
306
|
-
.sort((left, right) => left.id - right.id);
|
|
307
|
-
}
|
|
308
|
-
function jishuKbConversationBootstrap(preloadedSessions) {
|
|
309
|
-
const serialized = JSON.stringify(preloadedSessions);
|
|
310
|
-
const globalName = JSON.stringify(JISHU_KB_PRELOAD_GLOBAL);
|
|
311
|
-
return [
|
|
312
|
-
"<script>(function(){",
|
|
313
|
-
"try{",
|
|
314
|
-
`var incoming=${serialized};`,
|
|
315
|
-
`window[${globalName}]=incoming;`,
|
|
316
|
-
"var current=[];",
|
|
317
|
-
"try{var raw=window.localStorage.getItem('jkb_sess');current=raw?JSON.parse(raw):[];}catch(_e){current=[];}",
|
|
318
|
-
"if(!Array.isArray(current))current=[];",
|
|
319
|
-
"var seen=Object.create(null);",
|
|
320
|
-
"var merged=[];",
|
|
321
|
-
"function key(entry){return String(entry&&entry.kb||'')+'::'+String(entry&&entry.id||'');}",
|
|
322
|
-
"function push(entry){if(!entry||typeof entry!=='object')return;var k=key(entry);if(seen[k])return;seen[k]=1;merged.push(entry);}",
|
|
323
|
-
"incoming.forEach(push);",
|
|
324
|
-
"current.forEach(push);",
|
|
325
|
-
"merged.sort(function(a,b){return Number(a&&a.id||0)-Number(b&&b.id||0);});",
|
|
326
|
-
`if(merged.length>${JISHU_KB_PRELOAD_SESSION_LIMIT})merged=merged.slice(-${JISHU_KB_PRELOAD_SESSION_LIMIT});`,
|
|
327
|
-
"window.localStorage.setItem('jkb_sess',JSON.stringify(merged));",
|
|
328
|
-
"}catch(_e){}",
|
|
329
|
-
"})();</script>",
|
|
330
|
-
].join("");
|
|
132
|
+
const upstreamHost = await appService.getHostForAppPort(instanceId, runtimePort);
|
|
133
|
+
const proxyBase = capabilityProxyPath(instanceId, capabilityName);
|
|
134
|
+
const canonicalProxyBase = canonicalCapabilityProxyBase(proxyBase, capability.path);
|
|
135
|
+
return {
|
|
136
|
+
capability,
|
|
137
|
+
targetBaseUrl: `${capability.protocol}://${appService.urlHost(upstreamHost)}:${runtimePort}`,
|
|
138
|
+
proxyUrl: canonicalProxyBase,
|
|
139
|
+
};
|
|
331
140
|
}
|
|
332
141
|
/**
|
|
333
142
|
* Inject a tiny <script> that monkey-patches `fetch`, `XMLHttpRequest.open`,
|
|
@@ -697,7 +506,7 @@ function isTerminalProvide(provide) {
|
|
|
697
506
|
return !!provide && String(provide.protocol).toLowerCase() === "terminal" && !!provide.terminal;
|
|
698
507
|
}
|
|
699
508
|
function resolveTerminalProvide(instanceId, capability) {
|
|
700
|
-
const provide =
|
|
509
|
+
const provide = appService
|
|
701
510
|
.getProvidedCapabilitiesForApp(instanceId)
|
|
702
511
|
.find((entry) => entry.capability === capability);
|
|
703
512
|
if (!provide)
|
|
@@ -727,12 +536,12 @@ async function proxyProvidedCapability(req, reply) {
|
|
|
727
536
|
const idErr = validateId(req.params.id);
|
|
728
537
|
if (idErr)
|
|
729
538
|
return reply.status(400).send({ detail: idErr });
|
|
730
|
-
const rawInst =
|
|
539
|
+
const rawInst = appService.getInstance(req.params.id);
|
|
731
540
|
if (!rawInst)
|
|
732
541
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
733
|
-
if (!
|
|
542
|
+
if (!appService.getInstanceInstallRecord(req.params.id))
|
|
734
543
|
return reply.status(404).send({ detail: "App not found" });
|
|
735
|
-
const capabilities =
|
|
544
|
+
const capabilities = appService.getProvidedCapabilitiesForApp(req.params.id);
|
|
736
545
|
const capability = capabilities.find((entry) => entry.capability === req.params.capability);
|
|
737
546
|
if (!capability) {
|
|
738
547
|
return reply.status(404).send({ detail: `Capability '${req.params.capability}' not found` });
|
|
@@ -743,15 +552,24 @@ async function proxyProvidedCapability(req, reply) {
|
|
|
743
552
|
if (capability.protocol !== "http" && capability.protocol !== "https") {
|
|
744
553
|
return reply.status(400).send({ detail: `Capability '${req.params.capability}' does not use HTTP(S)` });
|
|
745
554
|
}
|
|
746
|
-
// Resolve the runtime
|
|
747
|
-
//
|
|
748
|
-
|
|
749
|
-
|
|
555
|
+
// Resolve only the canonical runtime hostPort. AppSpec declared ports are
|
|
556
|
+
// template metadata; using them here would route users to the wrong
|
|
557
|
+
// instance after reallocation or migration drift.
|
|
558
|
+
let runtimePort;
|
|
559
|
+
try {
|
|
560
|
+
runtimePort = appService.resolveRuntimeCapabilityPort(req.params.id, req.params.capability) ?? undefined;
|
|
561
|
+
}
|
|
562
|
+
catch (error) {
|
|
563
|
+
if (appService.isCanonicalRuntimePortRequiredError(error)) {
|
|
564
|
+
return reply.status(error.statusCode || 409).send({ detail: error.message, code: error.code });
|
|
565
|
+
}
|
|
566
|
+
throw error;
|
|
567
|
+
}
|
|
750
568
|
if (typeof runtimePort !== "number" || runtimePort < 1) {
|
|
751
569
|
return reply.status(500).send({ detail: `Capability '${req.params.capability}' has no resolved port` });
|
|
752
570
|
}
|
|
753
|
-
const upstreamHost = await
|
|
754
|
-
const upstreamOrigin = `${capability.protocol}://${
|
|
571
|
+
const upstreamHost = await appService.getHostForAppPort(req.params.id, runtimePort);
|
|
572
|
+
const upstreamOrigin = `${capability.protocol}://${appService.urlHost(upstreamHost)}:${runtimePort}`;
|
|
755
573
|
const wildcardSuffix = typeof req.params["*"] === "string" ? req.params["*"] : "";
|
|
756
574
|
const proxyBasePath = capabilityProxyPath(req.params.id, req.params.capability);
|
|
757
575
|
const querySuffix = req.raw.url?.includes("?") ? req.raw.url.slice(req.raw.url.indexOf("?")) : "";
|
|
@@ -914,18 +732,14 @@ async function proxyProvidedCapability(req, reply) {
|
|
|
914
732
|
reply.header("pragma", "no-cache");
|
|
915
733
|
reply.header("expires", "0");
|
|
916
734
|
let extraHeadHtml = "";
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
catch (error) {
|
|
926
|
-
console.warn("[cap-proxy] jishukb conversation preload skipped:", error);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
735
|
+
const htmlRewriter = getCapabilityHtmlRewriter(capability);
|
|
736
|
+
extraHeadHtml += (await htmlRewriter?.buildHeadHtml({
|
|
737
|
+
instanceId: req.params.id,
|
|
738
|
+
capability,
|
|
739
|
+
upstreamOrigin,
|
|
740
|
+
signal: upstreamAbort.signal,
|
|
741
|
+
willInjectHtml,
|
|
742
|
+
})) ?? "";
|
|
929
743
|
// Inject a generic fetch/XHR monkey-patch for all capability-proxied
|
|
930
744
|
// HTML pages. SPA frameworks like SvelteKit compile absolute API paths
|
|
931
745
|
// (e.g. `/api/v1/...`, `/ollama/...`) into JS bundles at build time.
|
|
@@ -934,24 +748,37 @@ async function proxyProvidedCapability(req, reply) {
|
|
|
934
748
|
// intercepts fetch() and XMLHttpRequest.open() and rewrites same-origin
|
|
935
749
|
// absolute paths that do NOT already start with the proxy prefix.
|
|
936
750
|
extraHeadHtml += capabilityProxyBootstrap(proxyBasePath);
|
|
937
|
-
|
|
938
|
-
//
|
|
939
|
-
//
|
|
940
|
-
//
|
|
941
|
-
//
|
|
942
|
-
//
|
|
751
|
+
const rawBody = await upstream.text();
|
|
752
|
+
// First-visit/content-change cleanup: if the browser still has a stale
|
|
753
|
+
// ServiceWorker registered from an earlier panel build (which would
|
|
754
|
+
// intercept this navigation and serve cached HTML *without* the
|
|
755
|
+
// bootstrap patches), emit Clear-Site-Data so the browser drops the SW
|
|
756
|
+
// + its cache and reloads through the proxy. We mark the success with a
|
|
757
|
+
// long-lived cookie scoped to the proxy path to avoid a reload loop.
|
|
758
|
+
// The cookie value is tied to the upstream HTML bytes and validators,
|
|
759
|
+
// not a fixed boolean, so same-tag image rebuilds such as jishu-kb:0.1.1
|
|
760
|
+
// can still trigger one fresh cleanup after the embedded UI changes.
|
|
943
761
|
// Gate to HTML only — JS/CSS sub-resources also flow through this branch
|
|
944
762
|
// now that we rewrite JS bundles, and emitting Clear-Site-Data on a JS
|
|
945
763
|
// response would clear storage mid-page-load.
|
|
946
764
|
if (willInjectHtml) {
|
|
765
|
+
const cleanupToken = capabilityProxyCleanupToken([
|
|
766
|
+
req.params.id,
|
|
767
|
+
req.params.capability,
|
|
768
|
+
upstreamOrigin,
|
|
769
|
+
upstreamContentType,
|
|
770
|
+
upstream.headers.get("etag"),
|
|
771
|
+
upstream.headers.get("last-modified"),
|
|
772
|
+
upstream.headers.get("content-length"),
|
|
773
|
+
rawBody,
|
|
774
|
+
]);
|
|
947
775
|
const cookieHeader = (req.headers.cookie || "").toString();
|
|
948
|
-
const swCleaned =
|
|
776
|
+
const swCleaned = hasCookieValue(cookieHeader, "cap_proxy_sw_clean", cleanupToken);
|
|
949
777
|
if (!swCleaned) {
|
|
950
778
|
reply.header("Clear-Site-Data", '"cache", "storage"');
|
|
951
|
-
reply.header("Set-Cookie", `cap_proxy_sw_clean
|
|
779
|
+
reply.header("Set-Cookie", `cap_proxy_sw_clean=${cleanupToken}; Path=${proxyBasePath}; Max-Age=2592000; SameSite=Lax`);
|
|
952
780
|
}
|
|
953
781
|
}
|
|
954
|
-
const rawBody = await upstream.text();
|
|
955
782
|
reply.raw.off("close", onClientClose);
|
|
956
783
|
const rewritten = rewriteProxyTextBody(rawBody, upstreamContentType, proxyBasePath, extraHeadHtml);
|
|
957
784
|
return reply.send(rewritten);
|
|
@@ -970,25 +797,6 @@ async function proxyProvidedCapability(req, reply) {
|
|
|
970
797
|
return reply.status(502).send({ detail: error?.message || `Failed to proxy capability '${req.params.capability}'` });
|
|
971
798
|
}
|
|
972
799
|
}
|
|
973
|
-
export async function ensureControlUiAllowedOrigin(instanceId, origin) {
|
|
974
|
-
const normalizedOrigin = origin.trim();
|
|
975
|
-
if (!normalizedOrigin)
|
|
976
|
-
return false;
|
|
977
|
-
const config = instanceManager.getStoredConfig(instanceId);
|
|
978
|
-
if (!config)
|
|
979
|
-
return false;
|
|
980
|
-
const gateway = config.gateway ??= {};
|
|
981
|
-
const controlUi = gateway.controlUi ??= {};
|
|
982
|
-
const existing = Array.isArray(controlUi.allowedOrigins)
|
|
983
|
-
? controlUi.allowedOrigins.map((value) => String(value))
|
|
984
|
-
: [];
|
|
985
|
-
const normalized = new Set(existing.map((value) => value.trim().toLowerCase()).filter(Boolean));
|
|
986
|
-
if (normalized.has("*") || normalized.has(normalizedOrigin.toLowerCase()))
|
|
987
|
-
return false;
|
|
988
|
-
controlUi.allowedOrigins = [...existing.filter((value) => value.trim()), normalizedOrigin];
|
|
989
|
-
await instanceManager.saveConfig(instanceId, config);
|
|
990
|
-
return true;
|
|
991
|
-
}
|
|
992
800
|
// Resolve service manager once at route registration, re-resolve on config change
|
|
993
801
|
let _svc = null;
|
|
994
802
|
let _svcType = "";
|
|
@@ -996,80 +804,36 @@ export async function getSvc() {
|
|
|
996
804
|
const currentType = getServiceManagerType();
|
|
997
805
|
if (_svc && _svcType === currentType)
|
|
998
806
|
return _svc;
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
807
|
+
if (currentType !== "nomad") {
|
|
808
|
+
// Step 13: process-manager / host-mode legacy runtime is unsupported.
|
|
809
|
+
throw new Error(`service_manager='${currentType}' is no longer supported. ` +
|
|
810
|
+
"Only 'nomad' runtimes are accepted on the runtime path. " +
|
|
811
|
+
"Run `jishushell migrate legacy` to convert legacy instances.");
|
|
812
|
+
}
|
|
813
|
+
_svc = await import("../services/runtime/drivers/nomad.js");
|
|
1002
814
|
_svcType = currentType;
|
|
1003
815
|
return _svc;
|
|
1004
816
|
}
|
|
1005
|
-
function
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
return false;
|
|
1011
|
-
if (identity.driver === "app-job")
|
|
1012
|
-
return true;
|
|
1013
|
-
return identity.driver === "local-model" && !!getInstanceBackedInstalledApp(identity.id);
|
|
1014
|
-
}
|
|
1015
|
-
function shouldUseAppManagerForId(instanceId, identity) {
|
|
1016
|
-
return shouldUseAppManager(identity) || (!identity && !!getInstanceBackedInstalledApp(instanceId));
|
|
1017
|
-
}
|
|
1018
|
-
function hasRuntimeIdentity(instanceId) {
|
|
1019
|
-
return resolveRuntimeIdentity(instanceId) != null
|
|
1020
|
-
|| !!instanceManager.getInstance(instanceId)
|
|
1021
|
-
|| !!getInstanceBackedInstalledApp(instanceId);
|
|
817
|
+
function getLifecycleActionSource(req) {
|
|
818
|
+
const raw = req.headers["x-jishushell-action-source"];
|
|
819
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
820
|
+
const source = typeof value === "string" ? value.trim() : "";
|
|
821
|
+
return /^[a-z0-9._:-]{1,80}$/i.test(source) ? source : "unknown";
|
|
1022
822
|
}
|
|
1023
|
-
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
if (cached !== undefined)
|
|
1029
|
-
return Promise.resolve(cached);
|
|
1030
|
-
const identity = resolveRuntimeIdentity(instanceId);
|
|
1031
|
-
const statusPromise = shouldUseAppManagerForId(instanceId, identity)
|
|
1032
|
-
? instanceManager.getAppStatus(instanceId).then((data) => ({
|
|
1033
|
-
status: data.status,
|
|
1034
|
-
pid: data.pid,
|
|
1035
|
-
uptime: data.uptime,
|
|
1036
|
-
memory_mb: data.memory_mb,
|
|
1037
|
-
cpu_percent: data.cpu_percent,
|
|
1038
|
-
}))
|
|
1039
|
-
: Promise.resolve(svc.getStatus(instanceId));
|
|
1040
|
-
return statusPromise.then((data) => {
|
|
1041
|
-
statusCache.set(instanceId, data);
|
|
1042
|
-
return data;
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
export async function restartRunningInstanceForControlUiOrigin(instanceId, origin) {
|
|
1046
|
-
const inFlight = controlUiRestartInFlight.get(instanceId);
|
|
1047
|
-
if (inFlight)
|
|
1048
|
-
return inFlight;
|
|
1049
|
-
const task = (async () => {
|
|
1050
|
-
const svc = await getSvc();
|
|
1051
|
-
const status = await svc.getStatus(instanceId);
|
|
1052
|
-
if (status.status !== "running")
|
|
1053
|
-
return;
|
|
1054
|
-
const result = await svc.restartInstance(instanceId);
|
|
1055
|
-
statusCache.delete(instanceId);
|
|
1056
|
-
if (!result.ok) {
|
|
1057
|
-
console.warn(`[gateway-launch] failed to auto-restart ${instanceId} after allowing origin ${origin}:`, result.error || "unknown error");
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
console.log(`[gateway-launch] auto-restarted ${instanceId} after allowing origin ${origin}`);
|
|
1061
|
-
})().finally(() => {
|
|
1062
|
-
controlUiRestartInFlight.delete(instanceId);
|
|
823
|
+
export async function getCachedStatus(_svc, instanceId, reason) {
|
|
824
|
+
const snapshot = await refreshInstanceStatus(instanceId, {
|
|
825
|
+
reason,
|
|
826
|
+
force: true,
|
|
827
|
+
minIntervalMs: 0,
|
|
1063
828
|
});
|
|
1064
|
-
|
|
1065
|
-
return task;
|
|
829
|
+
return snapshot?.service ?? { status: "unknown", pid: null, uptime: null, memory_mb: null, cpu_percent: null };
|
|
1066
830
|
}
|
|
1067
831
|
export async function instanceRoutes(app) {
|
|
1068
832
|
// List
|
|
1069
833
|
app.get("/api/instances", async () => {
|
|
1070
834
|
const svc = await getSvc();
|
|
1071
|
-
const instances =
|
|
1072
|
-
const statuses = await Promise.all(instances.map(inst => getCachedStatus(svc, inst.id).catch(() => ({ status: "unknown" }))));
|
|
835
|
+
const instances = appService.listInstances();
|
|
836
|
+
const statuses = await Promise.all(instances.map(inst => getCachedStatus(svc, inst.id, "api-list").catch(() => ({ status: "unknown", pid: null, uptime: null, memory_mb: null, cpu_percent: null }))));
|
|
1073
837
|
return Promise.all(instances.map(async (inst, i) => ({
|
|
1074
838
|
...(await augmentInstanceMetadata(inst.id, inst)),
|
|
1075
839
|
service: statuses[i],
|
|
@@ -1097,16 +861,51 @@ export async function instanceRoutes(app) {
|
|
|
1097
861
|
return reply.status(409).send({ detail: e.message });
|
|
1098
862
|
}
|
|
1099
863
|
});
|
|
864
|
+
app.post("/api/instances/:id/clone", async (req, reply) => {
|
|
865
|
+
const sourceIdError = validateId(req.params.id);
|
|
866
|
+
if (sourceIdError)
|
|
867
|
+
return reply.status(400).send({ detail: sourceIdError });
|
|
868
|
+
const targetId = typeof req.body?.id === "string" ? req.body.id : "";
|
|
869
|
+
const targetIdError = validateId(targetId);
|
|
870
|
+
if (targetIdError)
|
|
871
|
+
return reply.status(400).send({ detail: targetIdError });
|
|
872
|
+
const name = typeof req.body?.name === "string" ? req.body.name.trim() : "";
|
|
873
|
+
if (!name || name.length > 256) {
|
|
874
|
+
return reply.status(400).send({ detail: "Name must be 1-256 characters" });
|
|
875
|
+
}
|
|
876
|
+
if (typeof req.body?.description === "string" && req.body.description.length > 2048) {
|
|
877
|
+
return reply.status(400).send({ detail: "Description must be at most 2048 characters" });
|
|
878
|
+
}
|
|
879
|
+
try {
|
|
880
|
+
const result = await cloneInstance({
|
|
881
|
+
sourceInstanceId: req.params.id,
|
|
882
|
+
targetId,
|
|
883
|
+
name,
|
|
884
|
+
description: req.body?.description,
|
|
885
|
+
cloneOptions: req.body?.clone_options,
|
|
886
|
+
});
|
|
887
|
+
return reply.status(201).send(result);
|
|
888
|
+
}
|
|
889
|
+
catch (error) {
|
|
890
|
+
if (isInstanceCloneError(error)) {
|
|
891
|
+
return reply.status(error.statusCode).send({
|
|
892
|
+
detail: error.message,
|
|
893
|
+
...(error.code ? { code: error.code } : {}),
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
throw error;
|
|
897
|
+
}
|
|
898
|
+
});
|
|
1100
899
|
// Get
|
|
1101
900
|
app.get("/api/instances/:id", async (req, reply) => {
|
|
1102
901
|
const idErr = validateId(req.params.id);
|
|
1103
902
|
if (idErr)
|
|
1104
903
|
return reply.status(400).send({ detail: idErr });
|
|
1105
904
|
const svc = await getSvc();
|
|
1106
|
-
const inst =
|
|
905
|
+
const inst = appService.getInstance(req.params.id);
|
|
1107
906
|
if (!inst)
|
|
1108
907
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
1109
|
-
const status = await getCachedStatus(svc, req.params.id);
|
|
908
|
+
const status = await getCachedStatus(svc, req.params.id, "api-detail");
|
|
1110
909
|
return {
|
|
1111
910
|
...(await augmentInstanceMetadata(req.params.id, inst)),
|
|
1112
911
|
service: status,
|
|
@@ -1130,11 +929,11 @@ export async function instanceRoutes(app) {
|
|
|
1130
929
|
catch (e) {
|
|
1131
930
|
return reply.status(e.statusCode || 409).send({ detail: e.message });
|
|
1132
931
|
}
|
|
1133
|
-
const inst =
|
|
932
|
+
const inst = appService.updateInstance(req.params.id, req.body.name, req.body.description);
|
|
1134
933
|
if (!inst)
|
|
1135
934
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
1136
|
-
|
|
1137
|
-
return inst;
|
|
935
|
+
invalidateExecutionOwner(req.params.id);
|
|
936
|
+
return augmentInstanceMetadata(req.params.id, inst);
|
|
1138
937
|
});
|
|
1139
938
|
// Delete
|
|
1140
939
|
app.delete("/api/instances/:id", async (req, reply) => {
|
|
@@ -1147,61 +946,35 @@ export async function instanceRoutes(app) {
|
|
|
1147
946
|
catch (e) {
|
|
1148
947
|
return reply.status(e.statusCode || 409).send({ detail: e.message });
|
|
1149
948
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
949
|
+
const purgeBackups = req.query.purge_backups === "true";
|
|
950
|
+
const sudoPassword = typeof req.body?.sudoPassword === "string" && req.body.sudoPassword.trim()
|
|
951
|
+
? req.body.sudoPassword
|
|
952
|
+
: undefined;
|
|
953
|
+
const result = await appLifecycle.deleteManagedInstance(req.params.id, {
|
|
954
|
+
purgeBackups,
|
|
955
|
+
...(sudoPassword ? { exec: { sudoPassword } } : {}),
|
|
956
|
+
});
|
|
957
|
+
if (!result.ok) {
|
|
958
|
+
const status = result.code === "TASK_BUSY"
|
|
959
|
+
? 409
|
|
960
|
+
: result.code === "APP_NOT_FOUND" || result.code === "INSTANCE_NOT_FOUND"
|
|
961
|
+
? 404
|
|
962
|
+
: 400;
|
|
963
|
+
return reply.status(status).send({
|
|
964
|
+
detail: result.error,
|
|
965
|
+
...(result.code ? { code: result.code } : {}),
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
invalidateExecutionOwner(req.params.id);
|
|
969
|
+
cleanupProxyInstance(req.params.id);
|
|
970
|
+
if (result.taskId) {
|
|
1163
971
|
return reply.status(202).send({
|
|
1164
972
|
ok: true,
|
|
1165
973
|
taskId: result.taskId,
|
|
1166
|
-
...result.reused ? { reused: true } : {},
|
|
974
|
+
...(result.reused ? { reused: true } : {}),
|
|
1167
975
|
});
|
|
1168
976
|
}
|
|
1169
|
-
|
|
1170
|
-
let stopFailed = false;
|
|
1171
|
-
try {
|
|
1172
|
-
await svc.stopInstance(req.params.id, true);
|
|
1173
|
-
}
|
|
1174
|
-
catch {
|
|
1175
|
-
try {
|
|
1176
|
-
await svc.stopInstance(req.params.id);
|
|
1177
|
-
}
|
|
1178
|
-
catch {
|
|
1179
|
-
stopFailed = true;
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
// Also stop any legacy process-manager process that might be lingering
|
|
1183
|
-
try {
|
|
1184
|
-
const { getLegacyStatus, stopInstance: stopLegacy } = await import("../services/process-manager.js");
|
|
1185
|
-
if ((await getLegacyStatus(req.params.id)).status === "running") {
|
|
1186
|
-
await stopLegacy(req.params.id);
|
|
1187
|
-
stopFailed = false;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
catch { /* ignore */ }
|
|
1191
|
-
statusCache.delete(req.params.id);
|
|
1192
|
-
invalidateRuntimeIdentity(req.params.id);
|
|
1193
|
-
cleanupProxyInstance(req.params.id);
|
|
1194
|
-
const purgeBackups = req.query.purge_backups === "true";
|
|
1195
|
-
const result = await instanceManager.deleteInstance(req.params.id, purgeBackups);
|
|
1196
|
-
if (!result.ok && result.warnings?.some(w => w.includes("not found"))) {
|
|
1197
|
-
return reply.status(404).send({ detail: "Instance not found" });
|
|
1198
|
-
}
|
|
1199
|
-
const warnings = result.warnings ? [...result.warnings] : [];
|
|
1200
|
-
if (stopFailed) {
|
|
1201
|
-
console.warn(`[instances] Delete ${req.params.id}: service stop failed, orphaned processes may remain`);
|
|
1202
|
-
warnings.push("Service stop did not complete; verify no orphaned processes remain.");
|
|
1203
|
-
}
|
|
1204
|
-
return { ok: result.ok, warnings: warnings.length ? warnings : undefined };
|
|
977
|
+
return { ok: true, warnings: result.warnings?.length ? result.warnings : undefined };
|
|
1205
978
|
});
|
|
1206
979
|
// Config
|
|
1207
980
|
app.get("/api/instances/:id/config-meta", async (req, reply) => {
|
|
@@ -1245,15 +1018,20 @@ export async function instanceRoutes(app) {
|
|
|
1245
1018
|
const idErr = validateId(req.params.id);
|
|
1246
1019
|
if (idErr)
|
|
1247
1020
|
return reply.status(400).send({ detail: idErr });
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1021
|
+
let status;
|
|
1022
|
+
try {
|
|
1023
|
+
status = await appLifecycle.getManagedStatus(req.params.id);
|
|
1024
|
+
}
|
|
1025
|
+
catch (error) {
|
|
1026
|
+
if (appService.isCanonicalRuntimePortRequiredError(error)) {
|
|
1027
|
+
return reply.status(error.statusCode || 409).send({ detail: error.message, code: error.code });
|
|
1028
|
+
}
|
|
1029
|
+
throw error;
|
|
1252
1030
|
}
|
|
1253
|
-
if (
|
|
1254
|
-
return
|
|
1031
|
+
if (!status) {
|
|
1032
|
+
return reply.status(404).send({ detail: "Instance not found" });
|
|
1255
1033
|
}
|
|
1256
|
-
return
|
|
1034
|
+
return status;
|
|
1257
1035
|
});
|
|
1258
1036
|
app.post("/api/instances/:id/service/start", async (req, reply) => {
|
|
1259
1037
|
const idErr = validateId(req.params.id);
|
|
@@ -1265,21 +1043,18 @@ export async function instanceRoutes(app) {
|
|
|
1265
1043
|
catch (e) {
|
|
1266
1044
|
return reply.status(e.statusCode || 409).send({ detail: e.message });
|
|
1267
1045
|
}
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
: await svc.startInstance(req.params.id);
|
|
1276
|
-
statusCache.delete(req.params.id);
|
|
1277
|
-
invalidateRuntimeIdentity(req.params.id);
|
|
1046
|
+
const actionSource = getLifecycleActionSource(req);
|
|
1047
|
+
console.log(`[lifecycle] start requested for ${req.params.id} source=${actionSource}`);
|
|
1048
|
+
const controlUiOrigin = inferRequestOrigin(req);
|
|
1049
|
+
const result = controlUiOrigin
|
|
1050
|
+
? await appLifecycle.startInstance(req.params.id, { controlUiOrigin })
|
|
1051
|
+
: await appLifecycle.startInstance(req.params.id);
|
|
1052
|
+
invalidateExecutionOwner(req.params.id);
|
|
1278
1053
|
if (!result.ok) {
|
|
1279
1054
|
const resultRecord = result;
|
|
1280
1055
|
// Surface the phase tag so the UI can highlight where the start
|
|
1281
1056
|
// pipeline failed (running_check / home_conflict / port_alloc /
|
|
1282
|
-
//
|
|
1057
|
+
// port allocation / submit). Legacy clients that only read `detail`
|
|
1283
1058
|
// keep working.
|
|
1284
1059
|
const payload = { detail: result.error };
|
|
1285
1060
|
if (resultRecord.phase)
|
|
@@ -1290,6 +1065,9 @@ export async function instanceRoutes(app) {
|
|
|
1290
1065
|
payload.taskId = resultRecord.taskId;
|
|
1291
1066
|
if (resultRecord.code)
|
|
1292
1067
|
payload.code = resultRecord.code;
|
|
1068
|
+
if (resultRecord.code === "INSTANCE_NOT_FOUND") {
|
|
1069
|
+
return reply.status(404).send(payload);
|
|
1070
|
+
}
|
|
1293
1071
|
// Honor the structured ConnectionError statusCode (412 / 409 / 400)
|
|
1294
1072
|
// when present so the UI can distinguish missing-required from
|
|
1295
1073
|
// ambiguous-prefix from invalid-binding without parsing the message.
|
|
@@ -1298,7 +1076,7 @@ export async function instanceRoutes(app) {
|
|
|
1298
1076
|
: 400;
|
|
1299
1077
|
return reply.status(statusCode).send(payload);
|
|
1300
1078
|
}
|
|
1301
|
-
|
|
1079
|
+
markRuntimeRepairRestartApplied(req.params.id);
|
|
1302
1080
|
return result;
|
|
1303
1081
|
});
|
|
1304
1082
|
app.post("/api/instances/:id/service/stop", async (req, reply) => {
|
|
@@ -1311,18 +1089,14 @@ export async function instanceRoutes(app) {
|
|
|
1311
1089
|
catch (e) {
|
|
1312
1090
|
return reply.status(e.statusCode || 409).send({ detail: e.message });
|
|
1313
1091
|
}
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1092
|
+
const actionSource = getLifecycleActionSource(req);
|
|
1093
|
+
console.log(`[lifecycle] stop requested for ${req.params.id} source=${actionSource}`);
|
|
1094
|
+
const result = await appLifecycle.stopInstance(req.params.id);
|
|
1095
|
+
invalidateExecutionOwner(req.params.id);
|
|
1096
|
+
if (!result.ok) {
|
|
1097
|
+
const statusCode = result.code === "INSTANCE_NOT_FOUND" ? 404 : 400;
|
|
1098
|
+
return reply.status(statusCode).send({ detail: result.error, ...(result.code ? { code: result.code } : {}) });
|
|
1318
1099
|
}
|
|
1319
|
-
const result = shouldUseAppManagerForId(req.params.id, identity)
|
|
1320
|
-
? await instanceManager.stopApp(req.params.id)
|
|
1321
|
-
: await svc.stopInstance(req.params.id);
|
|
1322
|
-
statusCache.delete(req.params.id);
|
|
1323
|
-
invalidateRuntimeIdentity(req.params.id);
|
|
1324
|
-
if (!result.ok)
|
|
1325
|
-
return reply.status(400).send({ detail: result.error });
|
|
1326
1100
|
return result;
|
|
1327
1101
|
});
|
|
1328
1102
|
app.post("/api/instances/:id/service/restart", async (req, reply) => {
|
|
@@ -1335,19 +1109,21 @@ export async function instanceRoutes(app) {
|
|
|
1335
1109
|
catch (e) {
|
|
1336
1110
|
return reply.status(e.statusCode || 409).send({ detail: e.message });
|
|
1337
1111
|
}
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1112
|
+
const actionSource = getLifecycleActionSource(req);
|
|
1113
|
+
console.log(`[lifecycle] restart requested for ${req.params.id} source=${actionSource}`);
|
|
1114
|
+
const controlUiOrigin = inferRequestOrigin(req);
|
|
1115
|
+
const result = controlUiOrigin
|
|
1116
|
+
? await appLifecycle.restartInstance(req.params.id, { controlUiOrigin })
|
|
1117
|
+
: await appLifecycle.restartInstance(req.params.id);
|
|
1118
|
+
invalidateExecutionOwner(req.params.id);
|
|
1119
|
+
if (!result.ok) {
|
|
1120
|
+
const statusCode = result.code === "INSTANCE_NOT_FOUND" ? 404 : 400;
|
|
1121
|
+
return reply.status(statusCode).send({
|
|
1122
|
+
detail: result.error || "Unknown error",
|
|
1123
|
+
...(result.code ? { code: result.code } : {}),
|
|
1124
|
+
});
|
|
1342
1125
|
}
|
|
1343
|
-
|
|
1344
|
-
? await instanceManager.restartApp(req.params.id)
|
|
1345
|
-
: await svc.restartInstance(req.params.id);
|
|
1346
|
-
statusCache.delete(req.params.id);
|
|
1347
|
-
invalidateRuntimeIdentity(req.params.id);
|
|
1348
|
-
if (!result.ok)
|
|
1349
|
-
return reply.status(400).send({ detail: result.error || "Unknown error" });
|
|
1350
|
-
await acknowledgeRuntimeRestartAdvisory(req.params.id);
|
|
1126
|
+
markRuntimeRepairRestartApplied(req.params.id);
|
|
1351
1127
|
return result;
|
|
1352
1128
|
});
|
|
1353
1129
|
// ── Pairing ──────────────────────────────────────────────────────────────
|
|
@@ -1359,7 +1135,7 @@ export async function instanceRoutes(app) {
|
|
|
1359
1135
|
const idErr = validateId(req.params.id);
|
|
1360
1136
|
if (idErr)
|
|
1361
1137
|
return reply.status(400).send({ detail: idErr });
|
|
1362
|
-
const inst =
|
|
1138
|
+
const inst = appService.getInstance(req.params.id);
|
|
1363
1139
|
if (!inst) {
|
|
1364
1140
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
1365
1141
|
}
|
|
@@ -1367,10 +1143,13 @@ export async function instanceRoutes(app) {
|
|
|
1367
1143
|
if (!capabilities.pairing.list) {
|
|
1368
1144
|
return reply.status(501).send({ detail: "Pairing list is not supported for this runtime" });
|
|
1369
1145
|
}
|
|
1370
|
-
const
|
|
1146
|
+
const integrationKind = resolvePrimaryIntegrationKind(inst);
|
|
1147
|
+
if (!integrationKind) {
|
|
1148
|
+
return reply.status(501).send({ detail: "Pairing list is not supported for this runtime" });
|
|
1149
|
+
}
|
|
1371
1150
|
const svc = await getSvc();
|
|
1372
|
-
// Pure
|
|
1373
|
-
const cmd = await
|
|
1151
|
+
// Pure integration dispatch — no hardcoded kind fallback.
|
|
1152
|
+
const cmd = await getIntegration(integrationKind).buildPairingListCommand(req.params.id);
|
|
1374
1153
|
const result = await svc.exec(req.params.id, cmd, 15_000);
|
|
1375
1154
|
return { output: result.stdout + result.stderr, exitCode: result.exitCode };
|
|
1376
1155
|
});
|
|
@@ -1378,7 +1157,7 @@ export async function instanceRoutes(app) {
|
|
|
1378
1157
|
const idErr = validateId(req.params.id);
|
|
1379
1158
|
if (idErr)
|
|
1380
1159
|
return reply.status(400).send({ detail: idErr });
|
|
1381
|
-
const inst =
|
|
1160
|
+
const inst = appService.getInstance(req.params.id);
|
|
1382
1161
|
if (!inst) {
|
|
1383
1162
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
1384
1163
|
}
|
|
@@ -1393,8 +1172,11 @@ export async function instanceRoutes(app) {
|
|
|
1393
1172
|
if (!code || !PAIRING_CODE_RE.test(code)) {
|
|
1394
1173
|
return reply.status(400).send({ detail: "Invalid pairing code: must be 4-16 uppercase alphanumeric characters" });
|
|
1395
1174
|
}
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1175
|
+
const integrationKind = resolvePrimaryIntegrationKind(inst);
|
|
1176
|
+
if (!integrationKind) {
|
|
1177
|
+
return reply.status(501).send({ detail: "Pairing approve is not supported for this runtime" });
|
|
1178
|
+
}
|
|
1179
|
+
const cmd = await getIntegration(integrationKind).buildPairingApproveCommand(req.params.id, {
|
|
1398
1180
|
channel,
|
|
1399
1181
|
code,
|
|
1400
1182
|
notify,
|
|
@@ -1406,11 +1188,11 @@ export async function instanceRoutes(app) {
|
|
|
1406
1188
|
}
|
|
1407
1189
|
return { ok: true, output: (result.stdout + result.stderr).trim() };
|
|
1408
1190
|
});
|
|
1409
|
-
//
|
|
1191
|
+
// Integration chat (inline chat panel for runtimes that expose an OpenAI-compat
|
|
1410
1192
|
// HTTP chat completion endpoint and declare chatPanel="inline" in their
|
|
1411
1193
|
// capability profile — currently only Hermes).
|
|
1412
1194
|
//
|
|
1413
|
-
// Flow: panel JWT auth → read per-instance API_SERVER_KEY from
|
|
1195
|
+
// Flow: panel JWT auth → read per-instance API_SERVER_KEY from integration-home/.env →
|
|
1414
1196
|
// read allocated host port from runtime.ports → POST forward to
|
|
1415
1197
|
// http://127.0.0.1:<port>/v1/chat/completions.
|
|
1416
1198
|
//
|
|
@@ -1431,46 +1213,57 @@ export async function instanceRoutes(app) {
|
|
|
1431
1213
|
const idErr = validateId(req.params.id);
|
|
1432
1214
|
if (idErr)
|
|
1433
1215
|
return reply.status(400).send({ detail: idErr });
|
|
1434
|
-
const rawInst =
|
|
1216
|
+
const rawInst = appService.getInstance(req.params.id);
|
|
1435
1217
|
if (!rawInst)
|
|
1436
1218
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
1437
|
-
// getInstance returns raw instance.json without `capabilities` (
|
|
1438
|
-
//
|
|
1439
|
-
// read the
|
|
1219
|
+
// getInstance returns raw instance.json without `capabilities` (those are
|
|
1220
|
+
// synthesized by the integration layer). Use augmentInstanceMetadata so we
|
|
1221
|
+
// read the integration's live defaultCapabilities.
|
|
1440
1222
|
const inst = await augmentInstanceMetadata(req.params.id, rawInst);
|
|
1223
|
+
const integrationKind = resolvePrimaryIntegrationKind(inst);
|
|
1441
1224
|
// Only runtimes declaring chatPanel="inline" are supported here
|
|
1442
|
-
const chatPanel = inst?.capabilities?.
|
|
1225
|
+
const chatPanel = inst?.capabilities?.ui?.chatPanel;
|
|
1443
1226
|
if (chatPanel !== "inline") {
|
|
1444
1227
|
return reply.status(400).send({
|
|
1445
|
-
detail: `Runtime "${
|
|
1228
|
+
detail: `Runtime "${integrationKind ?? "generic"}" does not support inline chat (chatPanel=${chatPanel})`,
|
|
1446
1229
|
});
|
|
1447
1230
|
}
|
|
1448
|
-
//
|
|
1449
|
-
// var name or endpoint path. Any
|
|
1231
|
+
// Integration-owned dispatch: the route no longer hardcodes Hermes's env
|
|
1232
|
+
// var name or endpoint path. Any integration that declares chatPanel
|
|
1450
1233
|
// "inline" MUST also supply `inlineChatDescriptor` (api key env var +
|
|
1451
1234
|
// optional path/header/timeout) so this forwarder can reach its agent.
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1235
|
+
if (!integrationKind) {
|
|
1236
|
+
return reply.status(500).send({
|
|
1237
|
+
detail: `Instance "${req.params.id}" has no integration identity but declared chatPanel=inline`,
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
const integration = getIntegration(integrationKind);
|
|
1241
|
+
const desc = integration.inlineChatDescriptor;
|
|
1455
1242
|
if (!desc) {
|
|
1456
1243
|
return reply.status(500).send({
|
|
1457
|
-
detail: `Runtime "${
|
|
1244
|
+
detail: `Runtime "${integrationKind}" declares chatPanel=inline but no inlineChatDescriptor`,
|
|
1458
1245
|
});
|
|
1459
1246
|
}
|
|
1460
1247
|
// Resolve host port from the persisted RuntimeSpec.ports[] allocation.
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1248
|
+
let hostPort = 0;
|
|
1249
|
+
let gwHost = "127.0.0.1";
|
|
1250
|
+
try {
|
|
1251
|
+
hostPort = appService.getPrimaryHostPort(req.params.id);
|
|
1252
|
+
gwHost = await appService.getPrimaryHostForInstance(req.params.id);
|
|
1253
|
+
}
|
|
1254
|
+
catch (error) {
|
|
1255
|
+
if (appService.isCanonicalRuntimePortRequiredError(error)) {
|
|
1256
|
+
return reply.status(error.statusCode || 409).send({ detail: error.message, code: error.code });
|
|
1257
|
+
}
|
|
1258
|
+
throw error;
|
|
1466
1259
|
}
|
|
1467
|
-
// Agent API key lives in the
|
|
1260
|
+
// Agent API key lives in the integration-managed secretEnv file. Integration
|
|
1468
1261
|
// declares which env var holds it (Hermes → API_SERVER_KEY).
|
|
1469
1262
|
const secretEnv = inst?.paths?.secretEnv;
|
|
1470
1263
|
if (!secretEnv) {
|
|
1471
1264
|
return reply.status(500).send({ detail: "Instance has no secretEnv path" });
|
|
1472
1265
|
}
|
|
1473
|
-
const envVars =
|
|
1266
|
+
const envVars = appService.parseEnvFile(secretEnv);
|
|
1474
1267
|
const apiKey = envVars[desc.apiKeyEnvVar] || "";
|
|
1475
1268
|
if (!apiKey) {
|
|
1476
1269
|
return reply.status(500).send({
|
|
@@ -1481,7 +1274,7 @@ export async function instanceRoutes(app) {
|
|
|
1481
1274
|
const authHeader = desc.authHeader ?? "Authorization";
|
|
1482
1275
|
const authScheme = desc.authScheme ?? "Bearer ";
|
|
1483
1276
|
// Upstream budget: the Hermes call itself still gets a hard ceiling so
|
|
1484
|
-
// a wedged container can't hold the connection forever.
|
|
1277
|
+
// a wedged container can't hold the connection forever. Integration can
|
|
1485
1278
|
// extend this via inlineChatDescriptor.timeoutMs; default is 30 min
|
|
1486
1279
|
// which comfortably covers multi-step tool loops.
|
|
1487
1280
|
const upstreamTimeoutMs = desc.timeoutMs ?? 30 * 60_000;
|
|
@@ -1490,8 +1283,7 @@ export async function instanceRoutes(app) {
|
|
|
1490
1283
|
// on modern Linux (Debian 12, Ubuntu 22.04+) that's frequently `::1`
|
|
1491
1284
|
// rather than `127.0.0.1` — so a hardcoded IPv4 fetch() returns
|
|
1492
1285
|
// ECONNREFUSED and the user sees "Failed to reach agent".
|
|
1493
|
-
const
|
|
1494
|
-
const target = `http://${instanceManager.urlHost(gwHost)}:${hostPort}${endpointPath}`;
|
|
1286
|
+
const target = `http://${appService.urlHost(gwHost)}:${hostPort}${endpointPath}`;
|
|
1495
1287
|
// Hijack the response so we own the raw socket — lets us flush SSE
|
|
1496
1288
|
// headers + heartbeats before the upstream fetch resolves.
|
|
1497
1289
|
reply.hijack();
|
|
@@ -1557,7 +1349,7 @@ export async function instanceRoutes(app) {
|
|
|
1557
1349
|
const idErr = validateId(req.params.id);
|
|
1558
1350
|
if (idErr)
|
|
1559
1351
|
return reply.status(400).send({ detail: idErr });
|
|
1560
|
-
if (!
|
|
1352
|
+
if (!appService.getInstance(req.params.id)) {
|
|
1561
1353
|
return reply.status(404).send({ detail: "Instance not found" });
|
|
1562
1354
|
}
|
|
1563
1355
|
try {
|
|
@@ -1657,20 +1449,16 @@ export async function instanceRoutes(app) {
|
|
|
1657
1449
|
const idErr = validateId(req.params.id);
|
|
1658
1450
|
if (idErr)
|
|
1659
1451
|
return reply.status(400).send({ detail: idErr });
|
|
1660
|
-
const svc = await getSvc();
|
|
1661
|
-
const identity = resolveRuntimeIdentity(req.params.id);
|
|
1662
|
-
if (!identity && !hasRuntimeIdentity(req.params.id)) {
|
|
1663
|
-
return reply.status(404).send({ detail: "Instance not found" });
|
|
1664
|
-
}
|
|
1665
1452
|
const logType = req.query.log_type || "stderr";
|
|
1666
1453
|
if (logType !== "stdout" && logType !== "stderr") {
|
|
1667
1454
|
return reply.status(400).send({ detail: "log_type must be stdout or stderr" });
|
|
1668
1455
|
}
|
|
1669
1456
|
const MAX_LOG_LINES = 5000;
|
|
1670
1457
|
const lines = Math.min(parseInt(req.query.lines || "100", 10) || 100, MAX_LOG_LINES);
|
|
1671
|
-
const logLines =
|
|
1672
|
-
|
|
1673
|
-
|
|
1458
|
+
const logLines = await appLifecycle.getManagedLogs(req.params.id, lines, logType);
|
|
1459
|
+
if (!logLines) {
|
|
1460
|
+
return reply.status(404).send({ detail: "Instance not found" });
|
|
1461
|
+
}
|
|
1674
1462
|
return { lines: logLines };
|
|
1675
1463
|
});
|
|
1676
1464
|
// Admin: re-encrypt all instance secrets with current AES key
|
|
@@ -1678,12 +1466,12 @@ export async function instanceRoutes(app) {
|
|
|
1678
1466
|
const { getAesKey, getJwtSecret } = await import("../config.js");
|
|
1679
1467
|
const { scryptSync, createDecipheriv, createCipheriv, randomBytes } = await import("crypto");
|
|
1680
1468
|
const { readFileSync, existsSync: fsExistsSync } = await import("fs");
|
|
1681
|
-
const instances =
|
|
1469
|
+
const instances = appService.listInstances();
|
|
1682
1470
|
const results = [];
|
|
1683
1471
|
const currentKey = getAesKey();
|
|
1684
1472
|
const legacyKey = scryptSync(getJwtSecret(), "jishushell-apikey-v1", 32);
|
|
1685
1473
|
for (const inst of instances) {
|
|
1686
|
-
const envFiles =
|
|
1474
|
+
const envFiles = appService.getRuntimeEnvFiles(inst.id);
|
|
1687
1475
|
const providerEnvFile = envFiles[0]?.replace(/model\.env$/, "provider.env");
|
|
1688
1476
|
if (!providerEnvFile || !fsExistsSync(providerEnvFile)) {
|
|
1689
1477
|
results.push({ id: inst.id, status: "skipped", error: "no provider.env" });
|
|
@@ -1750,7 +1538,7 @@ export async function instanceRoutes(app) {
|
|
|
1750
1538
|
});
|
|
1751
1539
|
// ── Docker image check & pull ───────────────────────────────────────────
|
|
1752
1540
|
// Generic Docker operations used by NewInstance UI to verify / pull runtime
|
|
1753
|
-
// images before creating an instance. Framework-level (not
|
|
1541
|
+
// images before creating an instance. Framework-level (not integration-scoped)
|
|
1754
1542
|
// because every container runtime shares the same docker CLI here.
|
|
1755
1543
|
app.get("/api/docker/image-check", async (req, reply) => {
|
|
1756
1544
|
const image = req.query.image;
|
|
@@ -1795,7 +1583,7 @@ export async function instanceRoutes(app) {
|
|
|
1795
1583
|
return reply.status(500).send({ detail: `Failed to pull image: ${e.message}` });
|
|
1796
1584
|
}
|
|
1797
1585
|
});
|
|
1798
|
-
// ── Connections REST API
|
|
1586
|
+
// ── Connections REST API ────────────────────────────────────────────────
|
|
1799
1587
|
/** GET /api/instances/:id/connections — view spec.requires + bindings. */
|
|
1800
1588
|
app.get("/api/instances/:id/connections", async (req, reply) => {
|
|
1801
1589
|
try {
|
|
@@ -1846,11 +1634,11 @@ export async function instanceRoutes(app) {
|
|
|
1846
1634
|
});
|
|
1847
1635
|
// ── Suggestions API (PR 6) ─────────────────────────────────────────────
|
|
1848
1636
|
app.get("/api/suggestions", async () => {
|
|
1849
|
-
const { computeSuggestions } = await import("../services/suggestions.js");
|
|
1637
|
+
const { computeSuggestions } = await import("../services/connections/suggestions.js");
|
|
1850
1638
|
return { suggestions: computeSuggestions() };
|
|
1851
1639
|
});
|
|
1852
1640
|
app.post("/api/suggestions/:id/apply", async (req, reply) => {
|
|
1853
|
-
const { computeSuggestions } = await import("../services/suggestions.js");
|
|
1641
|
+
const { computeSuggestions } = await import("../services/connections/suggestions.js");
|
|
1854
1642
|
const all = computeSuggestions();
|
|
1855
1643
|
const target = all.find((s) => s.id === req.params.id);
|
|
1856
1644
|
if (!target) {
|
|
@@ -1859,26 +1647,22 @@ export async function instanceRoutes(app) {
|
|
|
1859
1647
|
// Apply by issuing the equivalent PUT /connections — read current
|
|
1860
1648
|
// bindings, splice in the new one for `slot`, persist via the
|
|
1861
1649
|
// transactor.
|
|
1862
|
-
const meta =
|
|
1650
|
+
const meta = appService.getInstance(target.consumerInstanceId);
|
|
1863
1651
|
if (!meta)
|
|
1864
1652
|
return reply.status(404).send({ detail: "Consumer instance not found" });
|
|
1865
|
-
// Resolve consumer spec
|
|
1866
|
-
//
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
consumerSpec = loadCapabilitySpecForLegacyInstance(meta);
|
|
1879
|
-
if (!consumerSpec) {
|
|
1880
|
-
return reply.status(404).send({ detail: "No capability spec for legacy instance" });
|
|
1881
|
-
}
|
|
1653
|
+
// Resolve consumer spec from canonical sources only. The suggestion
|
|
1654
|
+
// target is an instance id; AppSpec id is only the template identity.
|
|
1655
|
+
const appData = appService.getInstanceInstallRecord(target.consumerInstanceId);
|
|
1656
|
+
let consumerSpec = appData?.spec ?? null;
|
|
1657
|
+
if (!consumerSpec) {
|
|
1658
|
+
const { readCanonicalSpecForInstance } = await import("../services/app-common/instance-store.js");
|
|
1659
|
+
consumerSpec = readCanonicalSpecForInstance(target.consumerInstanceId);
|
|
1660
|
+
}
|
|
1661
|
+
if (!consumerSpec) {
|
|
1662
|
+
return reply.status(409).send({
|
|
1663
|
+
detail: "Instance has no canonical AppSpec; run `jishushell migrate legacy --yes` first",
|
|
1664
|
+
code: "INSTANCE_NEEDS_MIGRATION",
|
|
1665
|
+
});
|
|
1882
1666
|
}
|
|
1883
1667
|
const newConnections = {
|
|
1884
1668
|
...(meta.connections ?? {}),
|
|
@@ -1888,11 +1672,11 @@ export async function instanceRoutes(app) {
|
|
|
1888
1672
|
capability: target.candidate.capability,
|
|
1889
1673
|
},
|
|
1890
1674
|
};
|
|
1891
|
-
const { applyConnections } = await import("../services/
|
|
1675
|
+
const { applyConnections } = await import("../services/connections/transactor.js");
|
|
1892
1676
|
const safeJson = await import("../utils/safe-json.js");
|
|
1893
1677
|
const fs = await import("fs");
|
|
1894
1678
|
const path = await import("path");
|
|
1895
|
-
const instancePath =
|
|
1679
|
+
const instancePath = appService.instanceMetaPath(target.consumerInstanceId);
|
|
1896
1680
|
const readInstanceJson = async () => (safeJson.safeReadJson(instancePath, `instance:${target.consumerInstanceId}`) ?? {});
|
|
1897
1681
|
const saveInstanceJson = async (_id, mutator) => {
|
|
1898
1682
|
const cur = (safeJson.safeReadJson(instancePath, `instance:${target.consumerInstanceId}`) ?? {});
|
|
@@ -1904,17 +1688,22 @@ export async function instanceRoutes(app) {
|
|
|
1904
1688
|
}
|
|
1905
1689
|
safeJson.safeWriteJson(instancePath, mutator(cur));
|
|
1906
1690
|
};
|
|
1907
|
-
let
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1691
|
+
let integration = null;
|
|
1692
|
+
const hasIntegrationMetadata = Array.isArray(meta.integrations)
|
|
1693
|
+
&& meta.integrations.length > 0;
|
|
1694
|
+
if (hasIntegrationMetadata) {
|
|
1695
|
+
const integrationKind = resolvePrimaryIntegrationKind(meta);
|
|
1696
|
+
if (!integrationKind || !hasIntegration(integrationKind)) {
|
|
1697
|
+
return reply.status(409).send({
|
|
1698
|
+
detail: "Instance is missing canonical integration identity; run migration or repair first",
|
|
1699
|
+
code: "INSTANCE_NEEDS_MIGRATION",
|
|
1700
|
+
});
|
|
1914
1701
|
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1702
|
+
const resolvedIntegration = getIntegration(integrationKind);
|
|
1703
|
+
integration =
|
|
1704
|
+
typeof resolvedIntegration.applyConnectionEnv === "function"
|
|
1705
|
+
? resolvedIntegration
|
|
1706
|
+
: null;
|
|
1918
1707
|
}
|
|
1919
1708
|
try {
|
|
1920
1709
|
const result = await applyConnections({
|
|
@@ -1923,7 +1712,7 @@ export async function instanceRoutes(app) {
|
|
|
1923
1712
|
newConnections,
|
|
1924
1713
|
saveInstanceJson,
|
|
1925
1714
|
readInstanceJson,
|
|
1926
|
-
|
|
1715
|
+
integration,
|
|
1927
1716
|
});
|
|
1928
1717
|
return { ok: true, applied: target.id, resolved: result.resolved.length };
|
|
1929
1718
|
}
|
|
@@ -1935,7 +1724,7 @@ export async function instanceRoutes(app) {
|
|
|
1935
1724
|
}
|
|
1936
1725
|
});
|
|
1937
1726
|
app.post("/api/suggestions/:id/dismiss", async (req, reply) => {
|
|
1938
|
-
const { dismissSuggestion } = await import("../services/suggestions.js");
|
|
1727
|
+
const { dismissSuggestion } = await import("../services/connections/suggestions.js");
|
|
1939
1728
|
try {
|
|
1940
1729
|
await dismissSuggestion(req.params.id);
|
|
1941
1730
|
return { ok: true };
|
|
@@ -1944,12 +1733,5 @@ export async function instanceRoutes(app) {
|
|
|
1944
1733
|
return reply.status(400).send({ detail: e?.message ?? "Invalid suggestion id" });
|
|
1945
1734
|
}
|
|
1946
1735
|
});
|
|
1947
|
-
try {
|
|
1948
|
-
const { registerOpenclawRoutes } = await import("./openclaw-routes.js");
|
|
1949
|
-
registerOpenclawRoutes(app);
|
|
1950
|
-
}
|
|
1951
|
-
catch (err) {
|
|
1952
|
-
console.error("[instances] openclaw route registration failed:", err);
|
|
1953
|
-
}
|
|
1954
1736
|
}
|
|
1955
1737
|
//# sourceMappingURL=instances.js.map
|