jishushell 0.5.22 → 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 +20 -177
- package/apps/browserless-chromium-container.yaml +17 -12
- package/apps/filebrowser-container.yaml +22 -9
- package/apps/hermes-container.yaml +23 -2
- package/apps/jishu-kb-container.yaml +152 -0
- 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 +33 -8
- package/apps/openclaw-with-ollama-container.yaml +8 -2
- package/apps/openclaw-with-searxng-container.yaml +18 -6
- package/apps/searxng-container.yaml +12 -7
- package/apps/weknora-container.yaml +29 -23
- package/dependencies/jishushell-panel-0.6.18.tgz +0 -0
- package/dist/cli/app.js +494 -192
- package/dist/cli/app.js.map +1 -1
- package/dist/cli/backup.js +112 -139
- package/dist/cli/backup.js.map +1 -1
- package/dist/cli/core.d.ts +30 -0
- package/dist/cli/core.js +1415 -0
- package/dist/cli/core.js.map +1 -0
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.js +50 -61
- 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.d.ts +1 -18
- package/dist/cli/llm.js +103 -83
- 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 +26 -2
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +53 -44
- package/dist/config.js +216 -146
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -4
- package/dist/constants.js.map +1 -1
- package/dist/control.d.ts +7 -7
- package/dist/control.js +32 -24
- package/dist/control.js.map +1 -1
- package/dist/core.d.ts +5 -0
- package/dist/core.js +6 -0
- package/dist/core.js.map +1 -0
- package/dist/install.d.ts +3 -10
- package/dist/install.js +118 -43
- package/dist/install.js.map +1 -1
- package/dist/routes/apps.d.ts +1 -1
- package/dist/routes/apps.js +100 -234
- package/dist/routes/apps.js.map +1 -1
- package/dist/routes/auth.d.ts +1 -3
- package/dist/routes/auth.js +7 -14
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/backup.js +137 -334
- package/dist/routes/backup.js.map +1 -1
- package/dist/routes/external-mounts.d.ts +1 -1
- package/dist/routes/external-mounts.js +7 -7
- 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 +11 -4
- package/dist/routes/instances.js +482 -923
- 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.d.ts +2 -0
- package/dist/routes/llm-proxy.js +294 -0
- package/dist/routes/llm-proxy.js.map +1 -0
- package/dist/routes/llm.d.ts +1 -1
- package/dist/routes/llm.js +25 -75
- package/dist/routes/llm.js.map +1 -1
- package/dist/routes/setup.js +93 -93
- package/dist/routes/setup.js.map +1 -1
- package/dist/routes/system.js +248 -54
- package/dist/routes/system.js.map +1 -1
- package/dist/routes/webdav.d.ts +1 -1
- package/dist/routes/webdav.js +2 -2
- package/dist/routes/webdav.js.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +343 -312
- 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.d.ts +54 -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.d.ts +24 -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/adapters.js +5 -4
- package/dist/services/llm-proxy/adapters.js.map +1 -1
- package/dist/services/llm-proxy/index.d.ts +8 -105
- package/dist/services/llm-proxy/index.js +12 -889
- package/dist/services/llm-proxy/index.js.map +1 -1
- package/dist/services/llm-proxy/instance-proxy.d.ts +61 -0
- package/dist/services/llm-proxy/instance-proxy.js +702 -0
- package/dist/services/llm-proxy/instance-proxy.js.map +1 -0
- 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.d.ts +21 -0
- package/dist/services/llm-proxy/providers.js +88 -0
- package/dist/services/llm-proxy/providers.js.map +1 -0
- package/dist/services/llm-proxy/proxy-runtime.d.ts +12 -0
- package/dist/services/llm-proxy/proxy-runtime.js +65 -0
- package/dist/services/llm-proxy/proxy-runtime.js.map +1 -0
- package/dist/services/llm-proxy/sse.d.ts +13 -3
- package/dist/services/llm-proxy/sse.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 +27 -51
- 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 -110
- package/dist/services/runtime/instance.js.map +1 -1
- package/dist/services/runtime/job-id.d.ts +9 -0
- package/dist/services/runtime/job-id.js +15 -0
- package/dist/services/runtime/job-id.js.map +1 -0
- 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 +23 -511
- 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.d.ts +100 -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 +8 -4
- package/dist/services/telemetry/activation.js +12 -8
- package/dist/services/telemetry/activation.js.map +1 -1
- package/dist/services/telemetry/device-fingerprint.js +6 -1
- package/dist/services/telemetry/device-fingerprint.js.map +1 -1
- package/dist/services/telemetry/heartbeat.d.ts +8 -4
- package/dist/services/telemetry/heartbeat.js +12 -8
- 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 +361 -72
- package/dist/utils/docker-inspect.d.ts +19 -0
- package/dist/utils/docker-inspect.js +74 -0
- package/dist/utils/docker-inspect.js.map +1 -0
- package/dist/utils/instance-lock.d.ts +2 -2
- package/dist/utils/instance-lock.js +2 -2
- package/dist/utils/sudo-askpass.d.ts +23 -0
- package/dist/utils/sudo-askpass.js +83 -0
- package/dist/utils/sudo-askpass.js.map +1 -0
- package/install/jishu-install.sh +627 -109
- package/install/jishu-uninstall.sh +48 -12
- package/install/post-install.sh +316 -93
- package/install/post-uninstall.sh +99 -9
- package/node_modules/@fastify/accept-negotiator/LICENSE +22 -0
- package/node_modules/@fastify/accept-negotiator/README.md +52 -0
- package/node_modules/@fastify/accept-negotiator/index.js +170 -0
- package/node_modules/@fastify/accept-negotiator/package.json +77 -0
- package/node_modules/@fastify/accept-negotiator/types/index.d.ts +17 -0
- package/node_modules/@fastify/ajv-compiler/.gitattributes +2 -0
- package/node_modules/@fastify/ajv-compiler/.github/.stale.yml +21 -0
- package/node_modules/@fastify/ajv-compiler/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/ajv-compiler/.github/tests_checker.yml +8 -0
- package/node_modules/@fastify/ajv-compiler/.github/workflows/ci.yml +33 -0
- package/node_modules/@fastify/ajv-compiler/LICENSE +23 -0
- package/node_modules/@fastify/ajv-compiler/README.md +237 -0
- package/node_modules/@fastify/ajv-compiler/benchmark/small-object.mjs +37 -0
- package/node_modules/@fastify/ajv-compiler/eslint.config.js +6 -0
- package/node_modules/@fastify/ajv-compiler/index.js +53 -0
- package/node_modules/@fastify/ajv-compiler/lib/default-ajv-options.js +14 -0
- package/node_modules/@fastify/ajv-compiler/lib/serializer-compiler.js +27 -0
- package/node_modules/@fastify/ajv-compiler/lib/validator-compiler.js +58 -0
- package/node_modules/@fastify/ajv-compiler/package.json +84 -0
- package/node_modules/@fastify/ajv-compiler/standalone.js +44 -0
- package/node_modules/@fastify/ajv-compiler/test/.gitkeep +0 -0
- package/node_modules/@fastify/ajv-compiler/test/duplicated-id-compile.test.js +55 -0
- package/node_modules/@fastify/ajv-compiler/test/index.test.js +307 -0
- package/node_modules/@fastify/ajv-compiler/test/plugins.test.js +246 -0
- package/node_modules/@fastify/ajv-compiler/test/serialization.test.js +279 -0
- package/node_modules/@fastify/ajv-compiler/test/standalone.test.js +203 -0
- package/node_modules/@fastify/ajv-compiler/types/index.d.ts +87 -0
- package/node_modules/@fastify/ajv-compiler/types/index.test-d.ts +302 -0
- package/node_modules/@fastify/error/.gitattributes +2 -0
- package/node_modules/@fastify/error/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/error/.github/workflows/ci.yml +28 -0
- package/node_modules/@fastify/error/LICENSE +21 -0
- package/node_modules/@fastify/error/README.md +140 -0
- package/node_modules/@fastify/error/benchmarks/create.js +9 -0
- package/node_modules/@fastify/error/benchmarks/instantiate.js +18 -0
- package/node_modules/@fastify/error/benchmarks/no-stack.js +13 -0
- package/node_modules/@fastify/error/benchmarks/toString.js +11 -0
- package/node_modules/@fastify/error/eslint.config.js +6 -0
- package/node_modules/@fastify/error/index.js +100 -0
- package/node_modules/@fastify/error/package.json +75 -0
- package/node_modules/@fastify/error/test/index.test.js +232 -0
- package/node_modules/@fastify/error/test/instanceof.test.js +263 -0
- package/node_modules/@fastify/error/types/index.d.ts +49 -0
- package/node_modules/@fastify/error/types/index.test-d.ts +92 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc +1 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/.gitattributes +2 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml +28 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/LICENSE +21 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/README.md +128 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/eslint.config.js +6 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/index.js +8 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/package.json +71 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/standalone.js +58 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/test/duplicate-schema.test.js +26 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/test/plugin.test.js +78 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/test/standalone.test.js +230 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/types/index.d.ts +41 -0
- package/node_modules/@fastify/fast-json-stringify-compiler/types/index.test-d.ts +142 -0
- package/node_modules/@fastify/forwarded/LICENSE +24 -0
- package/node_modules/@fastify/forwarded/README.md +43 -0
- package/node_modules/@fastify/forwarded/index.js +59 -0
- package/node_modules/@fastify/forwarded/package.json +74 -0
- package/node_modules/@fastify/forwarded/types/index.d.ts +14 -0
- package/node_modules/@fastify/merge-json-schemas/.gitattributes +2 -0
- package/node_modules/@fastify/merge-json-schemas/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/merge-json-schemas/.github/workflows/ci.yml +23 -0
- package/node_modules/@fastify/merge-json-schemas/LICENSE +21 -0
- package/node_modules/@fastify/merge-json-schemas/README.md +119 -0
- package/node_modules/@fastify/merge-json-schemas/eslint.config.js +6 -0
- package/node_modules/@fastify/merge-json-schemas/index.js +357 -0
- package/node_modules/@fastify/merge-json-schemas/lib/errors.js +36 -0
- package/node_modules/@fastify/merge-json-schemas/lib/resolvers.js +127 -0
- package/node_modules/@fastify/merge-json-schemas/package.json +67 -0
- package/node_modules/@fastify/merge-json-schemas/test/additional-items.test.js +164 -0
- package/node_modules/@fastify/merge-json-schemas/test/additional-properties.test.js +129 -0
- package/node_modules/@fastify/merge-json-schemas/test/all-of.test.js +43 -0
- package/node_modules/@fastify/merge-json-schemas/test/any-of.test.js +81 -0
- package/node_modules/@fastify/merge-json-schemas/test/const.test.js +58 -0
- package/node_modules/@fastify/merge-json-schemas/test/contains.test.js +55 -0
- package/node_modules/@fastify/merge-json-schemas/test/custom-resolvers.test.js +50 -0
- package/node_modules/@fastify/merge-json-schemas/test/default-resolver.test.js +111 -0
- package/node_modules/@fastify/merge-json-schemas/test/default.test.js +50 -0
- package/node_modules/@fastify/merge-json-schemas/test/definitions.test.js +46 -0
- package/node_modules/@fastify/merge-json-schemas/test/defs.test.js +46 -0
- package/node_modules/@fastify/merge-json-schemas/test/dependencies.test.js +75 -0
- package/node_modules/@fastify/merge-json-schemas/test/dependent-required.test.js +75 -0
- package/node_modules/@fastify/merge-json-schemas/test/dependent-schemas.test.js +76 -0
- package/node_modules/@fastify/merge-json-schemas/test/enum.test.js +44 -0
- package/node_modules/@fastify/merge-json-schemas/test/exclusive-maximum.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/exclusive-minimum.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/format.test.js +36 -0
- package/node_modules/@fastify/merge-json-schemas/test/id.test.js +22 -0
- package/node_modules/@fastify/merge-json-schemas/test/if-then-else.test.js +550 -0
- package/node_modules/@fastify/merge-json-schemas/test/items.test.js +152 -0
- package/node_modules/@fastify/merge-json-schemas/test/max-items.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/max-length.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/max-properties.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/maximum.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/merge-schema.test.js +29 -0
- package/node_modules/@fastify/merge-json-schemas/test/min-items.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/min-length.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/min-properties.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/minimum.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/multiple-of.test.js +36 -0
- package/node_modules/@fastify/merge-json-schemas/test/not.test.js +29 -0
- package/node_modules/@fastify/merge-json-schemas/test/nullable.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/one-of.test.js +144 -0
- package/node_modules/@fastify/merge-json-schemas/test/properties.test.js +312 -0
- package/node_modules/@fastify/merge-json-schemas/test/property-names.test.js +49 -0
- package/node_modules/@fastify/merge-json-schemas/test/required.test.js +30 -0
- package/node_modules/@fastify/merge-json-schemas/test/type.test.js +52 -0
- package/node_modules/@fastify/merge-json-schemas/test/unique-items.test.js +38 -0
- package/node_modules/@fastify/merge-json-schemas/test/utils.js +9 -0
- package/node_modules/@fastify/merge-json-schemas/types/index.d.ts +61 -0
- package/node_modules/@fastify/merge-json-schemas/types/index.test-d.ts +52 -0
- package/node_modules/@fastify/proxy-addr/.gitattributes +2 -0
- package/node_modules/@fastify/proxy-addr/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/proxy-addr/.github/stale.yml +21 -0
- package/node_modules/@fastify/proxy-addr/.github/workflows/ci.yml +28 -0
- package/node_modules/@fastify/proxy-addr/LICENSE +24 -0
- package/node_modules/@fastify/proxy-addr/README.md +141 -0
- package/node_modules/@fastify/proxy-addr/benchmark/compiling.js +50 -0
- package/node_modules/@fastify/proxy-addr/benchmark/index.js +30 -0
- package/node_modules/@fastify/proxy-addr/benchmark/kind.js +57 -0
- package/node_modules/@fastify/proxy-addr/benchmark/matching.js +78 -0
- package/node_modules/@fastify/proxy-addr/eslint.config.js +6 -0
- package/node_modules/@fastify/proxy-addr/index.js +331 -0
- package/node_modules/@fastify/proxy-addr/package.json +73 -0
- package/node_modules/@fastify/proxy-addr/test/all.test.js +55 -0
- package/node_modules/@fastify/proxy-addr/test/base.test.js +365 -0
- package/node_modules/@fastify/proxy-addr/test/compile.test.js +58 -0
- package/node_modules/@fastify/proxy-addr/types/index.d.ts +18 -0
- package/node_modules/@fastify/proxy-addr/types/index.test-d.ts +27 -0
- package/node_modules/@fastify/send/.gitattributes +2 -0
- package/node_modules/@fastify/send/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/send/.github/workflows/ci.yml +28 -0
- package/node_modules/@fastify/send/HISTORY.md +521 -0
- package/node_modules/@fastify/send/LICENSE +23 -0
- package/node_modules/@fastify/send/README.md +310 -0
- package/node_modules/@fastify/send/benchmarks/collapseLeadingSlashes.js +13 -0
- package/node_modules/@fastify/send/benchmarks/containsDotFile.js +15 -0
- package/node_modules/@fastify/send/benchmarks/isUtf8MimeType.js +23 -0
- package/node_modules/@fastify/send/benchmarks/normalizeList.js +14 -0
- package/node_modules/@fastify/send/benchmarks/parseBytesRange.js +15 -0
- package/node_modules/@fastify/send/eslint.config.js +6 -0
- package/node_modules/@fastify/send/examples/index.html +1 -0
- package/node_modules/@fastify/send/examples/simple.js +15 -0
- package/node_modules/@fastify/send/index.js +28 -0
- package/node_modules/@fastify/send/lib/collapseLeadingSlashes.js +25 -0
- package/node_modules/@fastify/send/lib/containsDotFile.js +23 -0
- package/node_modules/@fastify/send/lib/contentRange.js +18 -0
- package/node_modules/@fastify/send/lib/createHtmlDocument.js +29 -0
- package/node_modules/@fastify/send/lib/createHttpError.js +23 -0
- package/node_modules/@fastify/send/lib/isUtf8MimeType.js +12 -0
- package/node_modules/@fastify/send/lib/normalizeList.js +28 -0
- package/node_modules/@fastify/send/lib/parseBytesRange.js +133 -0
- package/node_modules/@fastify/send/lib/parseTokenList.js +46 -0
- package/node_modules/@fastify/send/lib/send.js +729 -0
- package/node_modules/@fastify/send/package.json +81 -0
- package/node_modules/@fastify/send/test/collapseLeadingSlashes.test.js +22 -0
- package/node_modules/@fastify/send/test/containsDotFile.test.js +18 -0
- package/node_modules/@fastify/send/test/fixtures/.hidden.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/.mine/.hidden.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/.mine/name.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/do..ts.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/empty.txt +0 -0
- package/node_modules/@fastify/send/test/fixtures/images/node-js.png +0 -0
- package/node_modules/@fastify/send/test/fixtures/name.d/name.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/name.dir/name.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/name.html +1 -0
- package/node_modules/@fastify/send/test/fixtures/name.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/no_ext +1 -0
- package/node_modules/@fastify/send/test/fixtures/nums.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/pets/.hidden.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/pets/index.html +3 -0
- package/node_modules/@fastify/send/test/fixtures/snow /342/230/203/index.html +0 -0
- package/node_modules/@fastify/send/test/fixtures/some thing.txt +1 -0
- package/node_modules/@fastify/send/test/fixtures/thing.html.html +1 -0
- package/node_modules/@fastify/send/test/fixtures/tobi.html +1 -0
- package/node_modules/@fastify/send/test/isUtf8MimeType.test.js +22 -0
- package/node_modules/@fastify/send/test/mime.test.js +56 -0
- package/node_modules/@fastify/send/test/normalizeList.test.js +28 -0
- package/node_modules/@fastify/send/test/parseBytesRange.test.js +103 -0
- package/node_modules/@fastify/send/test/send.1.test.js +646 -0
- package/node_modules/@fastify/send/test/send.2.test.js +977 -0
- package/node_modules/@fastify/send/test/send.3.test.js +133 -0
- package/node_modules/@fastify/send/test/utils.js +36 -0
- package/node_modules/@fastify/send/types/index.d.ts +167 -0
- package/node_modules/@fastify/send/types/index.test-d.ts +67 -0
- package/node_modules/@fastify/static/.gitattributes +5 -0
- package/node_modules/@fastify/static/.github/dependabot.yml +13 -0
- package/node_modules/@fastify/static/.github/workflows/ci.yml +33 -0
- package/node_modules/@fastify/static/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/@fastify/static/LICENSE +21 -0
- package/node_modules/@fastify/static/README.md +538 -0
- package/node_modules/@fastify/static/eslint.config.js +7 -0
- package/node_modules/@fastify/static/example/public/.hidden/sample.json +1 -0
- package/node_modules/@fastify/static/example/public/images/sample.jpg +0 -0
- package/node_modules/@fastify/static/example/public/index.css +9 -0
- package/node_modules/@fastify/static/example/public/index.html +11 -0
- package/node_modules/@fastify/static/example/public/index.js +8 -0
- package/node_modules/@fastify/static/example/public2/test.css +4 -0
- package/node_modules/@fastify/static/example/public2/test.html +8 -0
- package/node_modules/@fastify/static/example/server-benchmark.js +39 -0
- package/node_modules/@fastify/static/example/server-compress.js +15 -0
- package/node_modules/@fastify/static/example/server-dir-list.js +38 -0
- package/node_modules/@fastify/static/example/server-hidden-file.js +15 -0
- package/node_modules/@fastify/static/example/server.js +13 -0
- package/node_modules/@fastify/static/index.js +726 -0
- package/node_modules/@fastify/static/lib/dirList.js +225 -0
- package/node_modules/@fastify/static/package.json +89 -0
- package/node_modules/@fastify/static/test/content-type/binary +0 -0
- package/node_modules/@fastify/static/test/content-type/binary.br +1 -0
- package/node_modules/@fastify/static/test/content-type/index.css +0 -0
- package/node_modules/@fastify/static/test/content-type/index.css.br +1 -0
- package/node_modules/@fastify/static/test/content-type/index.html +5 -0
- package/node_modules/@fastify/static/test/content-type/index.html.br +0 -0
- package/node_modules/@fastify/static/test/content-type/sample.jpg +0 -0
- package/node_modules/@fastify/static/test/content-type/test.txt +0 -0
- package/node_modules/@fastify/static/test/content-type/test.txt.br +1 -0
- package/node_modules/@fastify/static/test/content-type.test.js +144 -0
- package/node_modules/@fastify/static/test/dir-list.test.js +820 -0
- package/node_modules/@fastify/static/test/static/.example +1 -0
- package/node_modules/@fastify/static/test/static/100%.txt +1 -0
- package/node_modules/@fastify/static/test/static/a .md +1 -0
- package/node_modules/@fastify/static/test/static/deep/path/for/test/index.html +5 -0
- package/node_modules/@fastify/static/test/static/deep/path/for/test/purpose/foo.html +5 -0
- package/node_modules/@fastify/static/test/static/foo.html +3 -0
- package/node_modules/@fastify/static/test/static/foobar.html +3 -0
- package/node_modules/@fastify/static/test/static/index.css +0 -0
- package/node_modules/@fastify/static/test/static/index.html +5 -0
- package/node_modules/@fastify/static/test/static/shallow/sample.jpg +0 -0
- package/node_modules/@fastify/static/test/static-dotfiles/.aaa +0 -0
- package/node_modules/@fastify/static/test/static-dotfiles/dir/index.html +0 -0
- package/node_modules/@fastify/static/test/static-dotfiles/test.txt +0 -0
- package/node_modules/@fastify/static/test/static-encode/[...]/a .md +1 -0
- package/node_modules/@fastify/static/test/static-filtered/bar.private +1 -0
- package/node_modules/@fastify/static/test/static-filtered/deep/path/to/baz.html +3 -0
- package/node_modules/@fastify/static/test/static-filtered/deep/path/to/baz.private +1 -0
- package/node_modules/@fastify/static/test/static-filtered/index.html +3 -0
- package/node_modules/@fastify/static/test/static-hidden/.hidden/sample.json +1 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/all-three.html +5 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/all-three.html.br +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/all-three.html.gz +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/baz.json +3 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/dir/index.html +5 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/dir/index.html.br +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/dir-gz/index.html +5 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/dir-gz/index.html.gz +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/empty/.gitkeep +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/gzip-only.html +3 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/gzip-only.html.gz +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/index.html +5 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/index.html.br +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/sample.jpg +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/sample.jpg.br +0 -0
- package/node_modules/@fastify/static/test/static-pre-compressed/uncompressed.html +3 -0
- package/node_modules/@fastify/static/test/static-symbolic-link/origin/subdir/subdir/index.html +3 -0
- package/node_modules/@fastify/static/test/static.test.js +4115 -0
- package/node_modules/@fastify/static/test/static2/bar.html +3 -0
- package/node_modules/@fastify/static/test/static2/index.html +3 -0
- package/node_modules/@fastify/static/types/index.d.ts +136 -0
- package/node_modules/@fastify/static/types/index.test-d.ts +240 -0
- package/node_modules/@lukeed/ms/dist/index.js +37 -0
- package/node_modules/@lukeed/ms/dist/index.min.js +1 -0
- package/node_modules/@lukeed/ms/dist/index.mjs +34 -0
- package/node_modules/@lukeed/ms/index.d.ts +2 -0
- package/node_modules/@lukeed/ms/license +9 -0
- package/node_modules/@lukeed/ms/package.json +48 -0
- package/node_modules/@lukeed/ms/readme.md +133 -0
- package/node_modules/@pinojs/redact/.github/dependabot.yml +13 -0
- package/node_modules/@pinojs/redact/.github/workflows/ci.yml +48 -0
- package/node_modules/@pinojs/redact/.github/workflows/publish-release.yml +43 -0
- package/node_modules/@pinojs/redact/LICENSE +21 -0
- package/node_modules/@pinojs/redact/README.md +350 -0
- package/node_modules/@pinojs/redact/benchmarks/basic.js +184 -0
- package/node_modules/@pinojs/redact/eslint.config.js +1 -0
- package/node_modules/@pinojs/redact/index.d.ts +52 -0
- package/node_modules/@pinojs/redact/index.js +529 -0
- package/node_modules/@pinojs/redact/index.test-d.ts +22 -0
- package/node_modules/@pinojs/redact/package.json +37 -0
- package/node_modules/@pinojs/redact/scripts/sync-version.mjs +20 -0
- package/node_modules/@pinojs/redact/test/actual-redact-comparison.test.js +211 -0
- package/node_modules/@pinojs/redact/test/index.test.js +824 -0
- package/node_modules/@pinojs/redact/test/integration.test.js +390 -0
- package/node_modules/@pinojs/redact/test/multiple-wildcards.test.js +227 -0
- package/node_modules/@pinojs/redact/test/prototype-pollution.test.js +223 -0
- package/node_modules/@pinojs/redact/test/selective-clone.test.js +115 -0
- package/node_modules/@pinojs/redact/tsconfig.json +19 -0
- package/node_modules/abstract-logging/Readme.md +47 -0
- package/node_modules/abstract-logging/index.js +18 -0
- package/node_modules/abstract-logging/package.json +25 -0
- package/node_modules/abstract-logging/test.js +17 -0
- package/node_modules/ajv/.runkit_example.js +23 -0
- package/node_modules/ajv/LICENSE +22 -0
- package/node_modules/ajv/README.md +207 -0
- package/node_modules/ajv/dist/2019.d.ts +19 -0
- package/node_modules/ajv/dist/2019.js +61 -0
- package/node_modules/ajv/dist/2019.js.map +1 -0
- package/node_modules/ajv/dist/2020.d.ts +19 -0
- package/node_modules/ajv/dist/2020.js +55 -0
- package/node_modules/ajv/dist/2020.js.map +1 -0
- package/node_modules/ajv/dist/ajv.d.ts +18 -0
- package/node_modules/ajv/dist/ajv.js +50 -0
- package/node_modules/ajv/dist/ajv.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/code.d.ts +40 -0
- package/node_modules/ajv/dist/compile/codegen/code.js +156 -0
- package/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/index.js +697 -0
- package/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js +143 -0
- package/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/node_modules/ajv/dist/compile/errors.d.ts +13 -0
- package/node_modules/ajv/dist/compile/errors.js +123 -0
- package/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/node_modules/ajv/dist/compile/index.d.ts +80 -0
- package/node_modules/ajv/dist/compile/index.js +242 -0
- package/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/parse.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js +350 -0
- package/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.d.ts +4 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js +236 -0
- package/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -0
- package/node_modules/ajv/dist/compile/jtd/types.d.ts +6 -0
- package/node_modules/ajv/dist/compile/jtd/types.js +14 -0
- package/node_modules/ajv/dist/compile/jtd/types.js.map +1 -0
- package/node_modules/ajv/dist/compile/names.d.ts +20 -0
- package/node_modules/ajv/dist/compile/names.js +28 -0
- package/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/node_modules/ajv/dist/compile/ref_error.d.ts +6 -0
- package/node_modules/ajv/dist/compile/ref_error.js +12 -0
- package/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/node_modules/ajv/dist/compile/resolve.d.ts +12 -0
- package/node_modules/ajv/dist/compile/resolve.js +155 -0
- package/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/node_modules/ajv/dist/compile/rules.d.ts +28 -0
- package/node_modules/ajv/dist/compile/rules.js +26 -0
- package/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/node_modules/ajv/dist/compile/util.d.ts +40 -0
- package/node_modules/ajv/dist/compile/util.js +178 -0
- package/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/applicability.d.ts +6 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js +19 -0
- package/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.d.ts +4 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js +50 -0
- package/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/dataType.d.ts +17 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js +203 -0
- package/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/defaults.d.ts +2 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
- package/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/index.d.ts +42 -0
- package/node_modules/ajv/dist/compile/validate/index.js +520 -0
- package/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/keyword.d.ts +8 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js +124 -0
- package/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/node_modules/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js +81 -0
- package/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/node_modules/ajv/dist/core.d.ts +174 -0
- package/node_modules/ajv/dist/core.js +618 -0
- package/node_modules/ajv/dist/core.js.map +1 -0
- package/node_modules/ajv/dist/jtd.d.ts +47 -0
- package/node_modules/ajv/dist/jtd.js +72 -0
- package/node_modules/ajv/dist/jtd.js.map +1 -0
- package/node_modules/ajv/dist/refs/data.json +13 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js +28 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts +2 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +30 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map +1 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/dist/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/dist/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/dist/refs/jtd-schema.d.ts +3 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js +118 -0
- package/node_modules/ajv/dist/refs/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/runtime/equal.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/equal.js +7 -0
- package/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/node_modules/ajv/dist/runtime/parseJson.d.ts +18 -0
- package/node_modules/ajv/dist/runtime/parseJson.js +185 -0
- package/node_modules/ajv/dist/runtime/parseJson.js.map +1 -0
- package/node_modules/ajv/dist/runtime/quote.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/quote.js +30 -0
- package/node_modules/ajv/dist/runtime/quote.js.map +1 -0
- package/node_modules/ajv/dist/runtime/re2.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/re2.js +6 -0
- package/node_modules/ajv/dist/runtime/re2.js.map +1 -0
- package/node_modules/ajv/dist/runtime/timestamp.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/timestamp.js +42 -0
- package/node_modules/ajv/dist/runtime/timestamp.js.map +1 -0
- package/node_modules/ajv/dist/runtime/ucs2length.d.ts +5 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js +24 -0
- package/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
- package/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/node_modules/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/node_modules/ajv/dist/runtime/validation_error.js +11 -0
- package/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/node_modules/ajv/dist/standalone/index.d.ts +6 -0
- package/node_modules/ajv/dist/standalone/index.js +90 -0
- package/node_modules/ajv/dist/standalone/index.js.map +1 -0
- package/node_modules/ajv/dist/standalone/instance.d.ts +12 -0
- package/node_modules/ajv/dist/standalone/instance.js +35 -0
- package/node_modules/ajv/dist/standalone/instance.js.map +1 -0
- package/node_modules/ajv/dist/types/index.d.ts +183 -0
- package/node_modules/ajv/dist/types/index.js +3 -0
- package/node_modules/ajv/dist/types/index.js.map +1 -0
- package/node_modules/ajv/dist/types/json-schema.d.ts +125 -0
- package/node_modules/ajv/dist/types/json-schema.js +3 -0
- package/node_modules/ajv/dist/types/json-schema.js.map +1 -0
- package/node_modules/ajv/dist/types/jtd-schema.d.ts +174 -0
- package/node_modules/ajv/dist/types/jtd-schema.js +3 -0
- package/node_modules/ajv/dist/types/jtd-schema.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +49 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +106 -0
- package/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js +23 -0
- package/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +7 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js +95 -0
- package/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +21 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +85 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +11 -0
- package/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
- package/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js +44 -0
- package/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js +52 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js +30 -0
- package/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js +26 -0
- package/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +60 -0
- package/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +75 -0
- package/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +12 -0
- package/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js +54 -0
- package/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +38 -0
- package/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +13 -0
- package/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/code.d.ts +17 -0
- package/node_modules/ajv/dist/vocabularies/code.js +131 -0
- package/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/id.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js +10 -0
- package/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js +16 -0
- package/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js +122 -0
- package/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js +104 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js +9 -0
- package/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js +23 -0
- package/node_modules/ajv/dist/vocabularies/draft2020.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/draft7.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js +17 -0
- package/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +30 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +51 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js +9 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +16 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +10 -0
- package/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/errors.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/errors.js +3 -0
- package/node_modules/ajv/dist/vocabularies/errors.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/format.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
- package/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/format/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js +6 -0
- package/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js +71 -0
- package/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js +24 -0
- package/node_modules/ajv/dist/vocabularies/jtd/elements.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js +43 -0
- package/node_modules/ajv/dist/vocabularies/jtd/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js +20 -0
- package/node_modules/ajv/dist/vocabularies/jtd/error.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js +29 -0
- package/node_modules/ajv/dist/vocabularies/jtd/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js +25 -0
- package/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js +15 -0
- package/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +22 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js +149 -0
- package/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts +4 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js +67 -0
- package/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +10 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js +69 -0
- package/node_modules/ajv/dist/vocabularies/jtd/type.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js +12 -0
- package/node_modules/ajv/dist/vocabularies/jtd/union.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js +51 -0
- package/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/metadata.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js +18 -0
- package/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/next.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/next.js +8 -0
- package/node_modules/ajv/dist/vocabularies/next.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js +7 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +40 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +65 -0
- package/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.d.ts +6 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js +25 -0
- package/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +5 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +12 -0
- package/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js +48 -0
- package/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.d.ts +16 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js +15 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +11 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +27 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts +3 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +24 -0
- package/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +26 -0
- package/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js +33 -0
- package/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.d.ts +8 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js +79 -0
- package/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +9 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +64 -0
- package/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/node_modules/ajv/lib/2019.ts +81 -0
- package/node_modules/ajv/lib/2020.ts +75 -0
- package/node_modules/ajv/lib/ajv.ts +70 -0
- package/node_modules/ajv/lib/compile/codegen/code.ts +169 -0
- package/node_modules/ajv/lib/compile/codegen/index.ts +852 -0
- package/node_modules/ajv/lib/compile/codegen/scope.ts +215 -0
- package/node_modules/ajv/lib/compile/errors.ts +184 -0
- package/node_modules/ajv/lib/compile/index.ts +324 -0
- package/node_modules/ajv/lib/compile/jtd/parse.ts +411 -0
- package/node_modules/ajv/lib/compile/jtd/serialize.ts +277 -0
- package/node_modules/ajv/lib/compile/jtd/types.ts +16 -0
- package/node_modules/ajv/lib/compile/names.ts +27 -0
- package/node_modules/ajv/lib/compile/ref_error.ts +13 -0
- package/node_modules/ajv/lib/compile/resolve.ts +149 -0
- package/node_modules/ajv/lib/compile/rules.ts +50 -0
- package/node_modules/ajv/lib/compile/util.ts +213 -0
- package/node_modules/ajv/lib/compile/validate/applicability.ts +22 -0
- package/node_modules/ajv/lib/compile/validate/boolSchema.ts +47 -0
- package/node_modules/ajv/lib/compile/validate/dataType.ts +230 -0
- package/node_modules/ajv/lib/compile/validate/defaults.ts +32 -0
- package/node_modules/ajv/lib/compile/validate/index.ts +582 -0
- package/node_modules/ajv/lib/compile/validate/keyword.ts +171 -0
- package/node_modules/ajv/lib/compile/validate/subschema.ts +135 -0
- package/node_modules/ajv/lib/core.ts +892 -0
- package/node_modules/ajv/lib/jtd.ts +132 -0
- package/node_modules/ajv/lib/refs/data.json +13 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts +28 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json +53 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json +57 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json +39 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts +30 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json +48 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json +17 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json +51 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json +14 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json +37 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json +15 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json +90 -0
- package/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json +55 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-06.json +137 -0
- package/node_modules/ajv/lib/refs/json-schema-draft-07.json +151 -0
- package/node_modules/ajv/lib/refs/json-schema-secure.json +88 -0
- package/node_modules/ajv/lib/refs/jtd-schema.ts +130 -0
- package/node_modules/ajv/lib/runtime/equal.ts +7 -0
- package/node_modules/ajv/lib/runtime/parseJson.ts +177 -0
- package/node_modules/ajv/lib/runtime/quote.ts +31 -0
- package/node_modules/ajv/lib/runtime/re2.ts +6 -0
- package/node_modules/ajv/lib/runtime/timestamp.ts +46 -0
- package/node_modules/ajv/lib/runtime/ucs2length.ts +20 -0
- package/node_modules/ajv/lib/runtime/uri.ts +6 -0
- package/node_modules/ajv/lib/runtime/validation_error.ts +13 -0
- package/node_modules/ajv/lib/standalone/index.ts +100 -0
- package/node_modules/ajv/lib/standalone/instance.ts +36 -0
- package/node_modules/ajv/lib/types/index.ts +244 -0
- package/node_modules/ajv/lib/types/json-schema.ts +187 -0
- package/node_modules/ajv/lib/types/jtd-schema.ts +273 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts +56 -0
- package/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +118 -0
- package/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +22 -0
- package/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/applicator/contains.ts +109 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts +112 -0
- package/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts +11 -0
- package/node_modules/ajv/lib/vocabularies/applicator/if.ts +80 -0
- package/node_modules/ajv/lib/vocabularies/applicator/index.ts +53 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items.ts +59 -0
- package/node_modules/ajv/lib/vocabularies/applicator/items2020.ts +36 -0
- package/node_modules/ajv/lib/vocabularies/applicator/not.ts +38 -0
- package/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts +82 -0
- package/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts +91 -0
- package/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/applicator/properties.ts +57 -0
- package/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts +50 -0
- package/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts +13 -0
- package/node_modules/ajv/lib/vocabularies/code.ts +168 -0
- package/node_modules/ajv/lib/vocabularies/core/id.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/core/index.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/core/ref.ts +129 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/index.ts +113 -0
- package/node_modules/ajv/lib/vocabularies/discriminator/types.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/draft2020.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/draft7.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts +31 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts +51 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/index.ts +9 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts +14 -0
- package/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts +10 -0
- package/node_modules/ajv/lib/vocabularies/errors.ts +18 -0
- package/node_modules/ajv/lib/vocabularies/format/format.ts +120 -0
- package/node_modules/ajv/lib/vocabularies/format/index.ts +6 -0
- package/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts +89 -0
- package/node_modules/ajv/lib/vocabularies/jtd/elements.ts +32 -0
- package/node_modules/ajv/lib/vocabularies/jtd/enum.ts +45 -0
- package/node_modules/ajv/lib/vocabularies/jtd/error.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/jtd/index.ts +37 -0
- package/node_modules/ajv/lib/vocabularies/jtd/metadata.ts +24 -0
- package/node_modules/ajv/lib/vocabularies/jtd/nullable.ts +21 -0
- package/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts +15 -0
- package/node_modules/ajv/lib/vocabularies/jtd/properties.ts +184 -0
- package/node_modules/ajv/lib/vocabularies/jtd/ref.ts +76 -0
- package/node_modules/ajv/lib/vocabularies/jtd/type.ts +75 -0
- package/node_modules/ajv/lib/vocabularies/jtd/union.ts +12 -0
- package/node_modules/ajv/lib/vocabularies/jtd/values.ts +58 -0
- package/node_modules/ajv/lib/vocabularies/metadata.ts +17 -0
- package/node_modules/ajv/lib/vocabularies/next.ts +8 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/index.ts +7 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts +47 -0
- package/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +85 -0
- package/node_modules/ajv/lib/vocabularies/validation/const.ts +28 -0
- package/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts +23 -0
- package/node_modules/ajv/lib/vocabularies/validation/enum.ts +54 -0
- package/node_modules/ajv/lib/vocabularies/validation/index.ts +49 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitContains.ts +16 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitItems.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitLength.ts +30 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts +42 -0
- package/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +26 -0
- package/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts +34 -0
- package/node_modules/ajv/lib/vocabularies/validation/pattern.ts +39 -0
- package/node_modules/ajv/lib/vocabularies/validation/required.ts +98 -0
- package/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts +79 -0
- package/node_modules/ajv/package.json +127 -0
- package/node_modules/ajv-formats/LICENSE +21 -0
- package/node_modules/ajv-formats/README.md +125 -0
- package/node_modules/ajv-formats/dist/formats.d.ts +9 -0
- package/node_modules/ajv-formats/dist/formats.js +208 -0
- package/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/node_modules/ajv-formats/dist/index.d.ts +15 -0
- package/node_modules/ajv-formats/dist/index.js +37 -0
- package/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/node_modules/ajv-formats/dist/limit.d.ts +10 -0
- package/node_modules/ajv-formats/dist/limit.js +69 -0
- package/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/node_modules/ajv-formats/package.json +74 -0
- package/node_modules/ajv-formats/src/formats.ts +269 -0
- package/node_modules/ajv-formats/src/index.ts +62 -0
- package/node_modules/ajv-formats/src/limit.ts +99 -0
- package/node_modules/atomic-sleep/.travis.yml +11 -0
- package/node_modules/atomic-sleep/LICENSE +22 -0
- package/node_modules/atomic-sleep/index.js +38 -0
- package/node_modules/atomic-sleep/package.json +37 -0
- package/node_modules/atomic-sleep/readme.md +58 -0
- package/node_modules/atomic-sleep/test.js +47 -0
- package/node_modules/avvio/.borp.yaml +2 -0
- package/node_modules/avvio/.gitattributes +2 -0
- package/node_modules/avvio/.github/dependabot.yml +13 -0
- package/node_modules/avvio/.github/release-drafter.yml +4 -0
- package/node_modules/avvio/.github/workflows/ci.yml +33 -0
- package/node_modules/avvio/LICENSE +24 -0
- package/node_modules/avvio/README.md +700 -0
- package/node_modules/avvio/boot.js +621 -0
- package/node_modules/avvio/eslint.config.js +6 -0
- package/node_modules/avvio/examples/example.js +72 -0
- package/node_modules/avvio/index.d.ts +95 -0
- package/node_modules/avvio/lib/create-promise.js +45 -0
- package/node_modules/avvio/lib/debug.js +19 -0
- package/node_modules/avvio/lib/errors.js +38 -0
- package/node_modules/avvio/lib/execute-with-thenable.js +36 -0
- package/node_modules/avvio/lib/get-plugin-name.js +34 -0
- package/node_modules/avvio/lib/is-bundled-or-typescript-plugin.js +23 -0
- package/node_modules/avvio/lib/is-promise-like.js +17 -0
- package/node_modules/avvio/lib/plugin.js +279 -0
- package/node_modules/avvio/lib/symbols.js +26 -0
- package/node_modules/avvio/lib/thenify.js +60 -0
- package/node_modules/avvio/lib/time-tree.js +200 -0
- package/node_modules/avvio/lib/validate-plugin.js +26 -0
- package/node_modules/avvio/package.json +74 -0
- package/node_modules/avvio/test/after-and-ready.test.js +903 -0
- package/node_modules/avvio/test/after-pass-through.test.js +33 -0
- package/node_modules/avvio/test/after-self-promise.test.js +20 -0
- package/node_modules/avvio/test/after-throw.test.js +26 -0
- package/node_modules/avvio/test/after-use-after.test.js +87 -0
- package/node_modules/avvio/test/async-await.test.js +323 -0
- package/node_modules/avvio/test/await-after.test.js +448 -0
- package/node_modules/avvio/test/await-self.test.js +31 -0
- package/node_modules/avvio/test/await-use.test.js +295 -0
- package/node_modules/avvio/test/basic.test.js +459 -0
- package/node_modules/avvio/test/callbacks.test.js +116 -0
- package/node_modules/avvio/test/catch-override-exception.test.js +27 -0
- package/node_modules/avvio/test/chainable.test.js +70 -0
- package/node_modules/avvio/test/close.test.js +562 -0
- package/node_modules/avvio/test/errors.test.js +26 -0
- package/node_modules/avvio/test/esm.mjs +12 -0
- package/node_modules/avvio/test/esm.test.js +8 -0
- package/node_modules/avvio/test/events-listeners.test.js +23 -0
- package/node_modules/avvio/test/expose.test.js +76 -0
- package/node_modules/avvio/test/fixtures/dummy.txt +1 -0
- package/node_modules/avvio/test/fixtures/esm.mjs +3 -0
- package/node_modules/avvio/test/fixtures/plugin-no-next.js +5 -0
- package/node_modules/avvio/test/gh-issues/bug-205.test.js +17 -0
- package/node_modules/avvio/test/lib/create-promise.test.js +56 -0
- package/node_modules/avvio/test/lib/execute-with-thenable.test.js +86 -0
- package/node_modules/avvio/test/lib/get-plugin-name.test.js +67 -0
- package/node_modules/avvio/test/lib/is-bundled-or-typescript-plugin.test.js +20 -0
- package/node_modules/avvio/test/lib/is-promise-like.test.js +20 -0
- package/node_modules/avvio/test/lib/thenify.test.js +140 -0
- package/node_modules/avvio/test/lib/time-tree.test.js +391 -0
- package/node_modules/avvio/test/lib/validate-plugin.test.js +19 -0
- package/node_modules/avvio/test/load-plugin.test.js +132 -0
- package/node_modules/avvio/test/no-done.test.js +19 -0
- package/node_modules/avvio/test/on-ready-timeout-await.test.js +33 -0
- package/node_modules/avvio/test/override.test.js +385 -0
- package/node_modules/avvio/test/plugin-loaded-so-far.test.js +81 -0
- package/node_modules/avvio/test/plugin-name.test.js +58 -0
- package/node_modules/avvio/test/plugin-timeout-await.test.js +33 -0
- package/node_modules/avvio/test/plugin-timeout.test.js +227 -0
- package/node_modules/avvio/test/pretty-print.test.js +76 -0
- package/node_modules/avvio/test/reentrant.test.js +126 -0
- package/node_modules/avvio/test/symbol-async-dispose.test.js +28 -0
- package/node_modules/avvio/test/to-json.test.js +130 -0
- package/node_modules/avvio/test/twice-done.test.js +23 -0
- package/node_modules/avvio/test/types/index.ts +412 -0
- package/node_modules/avvio/test/types/tsconfig.json +9 -0
- package/node_modules/balanced-match/LICENSE.md +23 -0
- package/node_modules/balanced-match/README.md +57 -0
- package/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
- package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
- package/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/balanced-match/dist/esm/index.js.map +1 -0
- package/node_modules/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/balanced-match/package.json +68 -0
- package/node_modules/brace-expansion/LICENSE +23 -0
- package/node_modules/brace-expansion/README.md +94 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +6 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js +201 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
- package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts +6 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
- package/node_modules/brace-expansion/dist/esm/index.js +197 -0
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
- package/node_modules/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/brace-expansion/package.json +64 -0
- package/node_modules/content-disposition/LICENSE +22 -0
- package/node_modules/content-disposition/README.md +141 -0
- package/node_modules/content-disposition/index.js +536 -0
- package/node_modules/content-disposition/package.json +40 -0
- package/node_modules/cookie/LICENSE +24 -0
- package/node_modules/cookie/README.md +295 -0
- package/node_modules/cookie/dist/index.d.ts +148 -0
- package/node_modules/cookie/dist/index.js +350 -0
- package/node_modules/cookie/dist/index.js.map +1 -0
- package/node_modules/cookie/package.json +47 -0
- package/node_modules/depd/History.md +103 -0
- package/node_modules/depd/LICENSE +22 -0
- package/node_modules/depd/Readme.md +280 -0
- package/node_modules/depd/index.js +538 -0
- package/node_modules/depd/lib/browser/index.js +77 -0
- package/node_modules/depd/package.json +45 -0
- package/node_modules/dequal/dist/index.js +86 -0
- package/node_modules/dequal/dist/index.min.js +1 -0
- package/node_modules/dequal/dist/index.mjs +84 -0
- package/node_modules/dequal/index.d.ts +1 -0
- package/node_modules/dequal/license +21 -0
- package/node_modules/dequal/lite/index.d.ts +1 -0
- package/node_modules/dequal/lite/index.js +31 -0
- package/node_modules/dequal/lite/index.min.js +1 -0
- package/node_modules/dequal/lite/index.mjs +29 -0
- package/node_modules/dequal/package.json +57 -0
- package/node_modules/dequal/readme.md +112 -0
- package/node_modules/escape-html/LICENSE +24 -0
- package/node_modules/escape-html/Readme.md +43 -0
- package/node_modules/escape-html/index.js +78 -0
- package/node_modules/escape-html/package.json +24 -0
- package/node_modules/fast-decode-uri-component/.travis.yml +12 -0
- package/node_modules/fast-decode-uri-component/LICENSE +23 -0
- package/node_modules/fast-decode-uri-component/README.md +43 -0
- package/node_modules/fast-decode-uri-component/bench.js +35 -0
- package/node_modules/fast-decode-uri-component/index.js +115 -0
- package/node_modules/fast-decode-uri-component/package.json +33 -0
- package/node_modules/fast-decode-uri-component/test.js +32 -0
- package/node_modules/fast-deep-equal/LICENSE +21 -0
- package/node_modules/fast-deep-equal/README.md +96 -0
- package/node_modules/fast-deep-equal/es6/index.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/index.js +72 -0
- package/node_modules/fast-deep-equal/es6/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/es6/react.js +79 -0
- package/node_modules/fast-deep-equal/index.d.ts +4 -0
- package/node_modules/fast-deep-equal/index.js +46 -0
- package/node_modules/fast-deep-equal/package.json +61 -0
- package/node_modules/fast-deep-equal/react.d.ts +2 -0
- package/node_modules/fast-deep-equal/react.js +53 -0
- package/node_modules/fast-json-stringify/.gitattributes +2 -0
- package/node_modules/fast-json-stringify/.github/dependabot.yml +13 -0
- package/node_modules/fast-json-stringify/.github/workflows/ci.yml +33 -0
- package/node_modules/fast-json-stringify/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/fast-json-stringify/LICENSE +22 -0
- package/node_modules/fast-json-stringify/README.md +742 -0
- package/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js +116 -0
- package/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js +339 -0
- package/node_modules/fast-json-stringify/benchmark/bench-thread.js +33 -0
- package/node_modules/fast-json-stringify/benchmark/bench.js +391 -0
- package/node_modules/fast-json-stringify/build/build-schema-validator.js +26 -0
- package/node_modules/fast-json-stringify/eslint.config.js +9 -0
- package/node_modules/fast-json-stringify/examples/example.js +81 -0
- package/node_modules/fast-json-stringify/examples/server.js +42 -0
- package/node_modules/fast-json-stringify/index.js +1312 -0
- package/node_modules/fast-json-stringify/lib/location.js +24 -0
- package/node_modules/fast-json-stringify/lib/merge-schemas.js +9 -0
- package/node_modules/fast-json-stringify/lib/schema-validator.js +1134 -0
- package/node_modules/fast-json-stringify/lib/serializer.js +141 -0
- package/node_modules/fast-json-stringify/lib/standalone.js +34 -0
- package/node_modules/fast-json-stringify/lib/validator.js +96 -0
- package/node_modules/fast-json-stringify/package.json +89 -0
- package/node_modules/fast-json-stringify/test/additionalProperties.test.js +332 -0
- package/node_modules/fast-json-stringify/test/allof.test.js +751 -0
- package/node_modules/fast-json-stringify/test/any.test.js +231 -0
- package/node_modules/fast-json-stringify/test/anyof.test.js +812 -0
- package/node_modules/fast-json-stringify/test/array.test.js +688 -0
- package/node_modules/fast-json-stringify/test/asNumber.test.js +13 -0
- package/node_modules/fast-json-stringify/test/basic.test.js +400 -0
- package/node_modules/fast-json-stringify/test/bigint.test.js +76 -0
- package/node_modules/fast-json-stringify/test/clean-cache.test.js +47 -0
- package/node_modules/fast-json-stringify/test/const.test.js +314 -0
- package/node_modules/fast-json-stringify/test/date.test.js +639 -0
- package/node_modules/fast-json-stringify/test/debug-mode.test.js +142 -0
- package/node_modules/fast-json-stringify/test/defaults.test.js +376 -0
- package/node_modules/fast-json-stringify/test/enum.test.js +37 -0
- package/node_modules/fast-json-stringify/test/fix-604.test.js +25 -0
- package/node_modules/fast-json-stringify/test/fixtures/.keep +0 -0
- package/node_modules/fast-json-stringify/test/if-then-else.test.js +540 -0
- package/node_modules/fast-json-stringify/test/inferType.test.js +92 -0
- package/node_modules/fast-json-stringify/test/infinity.test.js +55 -0
- package/node_modules/fast-json-stringify/test/integer.test.js +194 -0
- package/node_modules/fast-json-stringify/test/invalidSchema.test.js +38 -0
- package/node_modules/fast-json-stringify/test/issue-479.test.js +57 -0
- package/node_modules/fast-json-stringify/test/issue-793.test.js +107 -0
- package/node_modules/fast-json-stringify/test/issue-794.test.js +177 -0
- package/node_modules/fast-json-stringify/test/issue-836.test.js +183 -0
- package/node_modules/fast-json-stringify/test/json-add-comma.test.js +57 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md +10 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json +54 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js +12 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json +70 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js +12 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json +70 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js +12 -0
- package/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js +31 -0
- package/node_modules/fast-json-stringify/test/missing-values.test.js +88 -0
- package/node_modules/fast-json-stringify/test/multi-type-serializer.test.js +19 -0
- package/node_modules/fast-json-stringify/test/nestedObjects.test.js +63 -0
- package/node_modules/fast-json-stringify/test/nullable.test.js +543 -0
- package/node_modules/fast-json-stringify/test/oneof.test.js +510 -0
- package/node_modules/fast-json-stringify/test/patternProperties.test.js +168 -0
- package/node_modules/fast-json-stringify/test/recursion.test.js +245 -0
- package/node_modules/fast-json-stringify/test/ref.json +12 -0
- package/node_modules/fast-json-stringify/test/ref.test.js +2077 -0
- package/node_modules/fast-json-stringify/test/regex.test.js +32 -0
- package/node_modules/fast-json-stringify/test/required.test.js +204 -0
- package/node_modules/fast-json-stringify/test/requiresAjv.test.js +50 -0
- package/node_modules/fast-json-stringify/test/sanitize.test.js +141 -0
- package/node_modules/fast-json-stringify/test/sanitize2.test.js +18 -0
- package/node_modules/fast-json-stringify/test/sanitize3.test.js +17 -0
- package/node_modules/fast-json-stringify/test/sanitize4.test.js +16 -0
- package/node_modules/fast-json-stringify/test/sanitize5.test.js +16 -0
- package/node_modules/fast-json-stringify/test/sanitize6.test.js +22 -0
- package/node_modules/fast-json-stringify/test/sanitize7.test.js +68 -0
- package/node_modules/fast-json-stringify/test/side-effect.test.js +196 -0
- package/node_modules/fast-json-stringify/test/standalone-mode.test.js +219 -0
- package/node_modules/fast-json-stringify/test/string.test.js +84 -0
- package/node_modules/fast-json-stringify/test/surrogate.test.js +67 -0
- package/node_modules/fast-json-stringify/test/toJSON.test.js +203 -0
- package/node_modules/fast-json-stringify/test/typebox.test.js +36 -0
- package/node_modules/fast-json-stringify/test/typesArray.test.js +550 -0
- package/node_modules/fast-json-stringify/test/unknownFormats.test.js +27 -0
- package/node_modules/fast-json-stringify/test/webpack.test.js +50 -0
- package/node_modules/fast-json-stringify/types/index.d.ts +231 -0
- package/node_modules/fast-json-stringify/types/index.tst.ts +259 -0
- package/node_modules/fast-querystring/LICENSE +25 -0
- package/node_modules/fast-querystring/README.md +114 -0
- package/node_modules/fast-querystring/lib/index.d.ts +14 -0
- package/node_modules/fast-querystring/lib/index.js +20 -0
- package/node_modules/fast-querystring/lib/internals/querystring.js +96 -0
- package/node_modules/fast-querystring/lib/parse.js +126 -0
- package/node_modules/fast-querystring/lib/stringify.js +69 -0
- package/node_modules/fast-querystring/package.json +56 -0
- package/node_modules/fast-uri/.gitattributes +2 -0
- package/node_modules/fast-uri/.github/dependabot.yml +13 -0
- package/node_modules/fast-uri/.github/workflows/ci.yml +106 -0
- package/node_modules/fast-uri/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +24 -0
- package/node_modules/fast-uri/LICENSE +30 -0
- package/node_modules/fast-uri/README.md +152 -0
- package/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/node_modules/fast-uri/benchmark/package.json +17 -0
- package/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/node_modules/fast-uri/eslint.config.js +6 -0
- package/node_modules/fast-uri/index.js +406 -0
- package/node_modules/fast-uri/lib/schemes.js +267 -0
- package/node_modules/fast-uri/lib/utils.js +443 -0
- package/node_modules/fast-uri/package.json +68 -0
- package/node_modules/fast-uri/test/ajv.test.js +43 -0
- package/node_modules/fast-uri/test/equal.test.js +117 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
- package/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/node_modules/fast-uri/test/parse.test.js +323 -0
- package/node_modules/fast-uri/test/resolve.test.js +87 -0
- package/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +39 -0
- package/node_modules/fast-uri/test/security.test.js +133 -0
- package/node_modules/fast-uri/test/serialize.test.js +151 -0
- package/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/node_modules/fast-uri/test/uri-js.test.js +912 -0
- package/node_modules/fast-uri/test/util.test.js +38 -0
- package/node_modules/fast-uri/tsconfig.json +9 -0
- package/node_modules/fast-uri/types/index.d.ts +60 -0
- package/node_modules/fast-uri/types/index.test-d.ts +17 -0
- package/node_modules/fastify/.borp.yaml +3 -0
- package/node_modules/fastify/.markdownlint-cli2.yaml +22 -0
- package/node_modules/fastify/.prettierignore +1 -0
- package/node_modules/fastify/GOVERNANCE.md +4 -0
- package/node_modules/fastify/LICENSE +21 -0
- package/node_modules/fastify/PROJECT_CHARTER.md +126 -0
- package/node_modules/fastify/README.md +423 -0
- package/node_modules/fastify/SECURITY.md +220 -0
- package/node_modules/fastify/SPONSORS.md +24 -0
- package/node_modules/fastify/build/build-error-serializer.js +35 -0
- package/node_modules/fastify/build/build-validation.js +169 -0
- package/node_modules/fastify/build/sync-version.js +11 -0
- package/node_modules/fastify/docs/Guides/Benchmarking.md +60 -0
- package/node_modules/fastify/docs/Guides/Database.md +321 -0
- package/node_modules/fastify/docs/Guides/Delay-Accepting-Requests.md +608 -0
- package/node_modules/fastify/docs/Guides/Detecting-When-Clients-Abort.md +172 -0
- package/node_modules/fastify/docs/Guides/Ecosystem.md +730 -0
- package/node_modules/fastify/docs/Guides/Fluent-Schema.md +127 -0
- package/node_modules/fastify/docs/Guides/Getting-Started.md +620 -0
- package/node_modules/fastify/docs/Guides/Index.md +43 -0
- package/node_modules/fastify/docs/Guides/Migration-Guide-V3.md +287 -0
- package/node_modules/fastify/docs/Guides/Migration-Guide-V4.md +267 -0
- package/node_modules/fastify/docs/Guides/Migration-Guide-V5.md +727 -0
- package/node_modules/fastify/docs/Guides/Plugins-Guide.md +520 -0
- package/node_modules/fastify/docs/Guides/Prototype-Poisoning.md +383 -0
- package/node_modules/fastify/docs/Guides/Recommendations.md +378 -0
- package/node_modules/fastify/docs/Guides/Serverless.md +604 -0
- package/node_modules/fastify/docs/Guides/Style-Guide.md +246 -0
- package/node_modules/fastify/docs/Guides/Testing.md +481 -0
- package/node_modules/fastify/docs/Guides/Write-Plugin.md +103 -0
- package/node_modules/fastify/docs/Guides/Write-Type-Provider.md +34 -0
- package/node_modules/fastify/docs/Reference/ContentTypeParser.md +271 -0
- package/node_modules/fastify/docs/Reference/Decorators.md +436 -0
- package/node_modules/fastify/docs/Reference/Encapsulation.md +194 -0
- package/node_modules/fastify/docs/Reference/Errors.md +377 -0
- package/node_modules/fastify/docs/Reference/HTTP2.md +94 -0
- package/node_modules/fastify/docs/Reference/Hooks.md +958 -0
- package/node_modules/fastify/docs/Reference/Index.md +73 -0
- package/node_modules/fastify/docs/Reference/LTS.md +86 -0
- package/node_modules/fastify/docs/Reference/Lifecycle.md +99 -0
- package/node_modules/fastify/docs/Reference/Logging.md +268 -0
- package/node_modules/fastify/docs/Reference/Middleware.md +79 -0
- package/node_modules/fastify/docs/Reference/Plugins.md +245 -0
- package/node_modules/fastify/docs/Reference/Principles.md +73 -0
- package/node_modules/fastify/docs/Reference/Reply.md +1001 -0
- package/node_modules/fastify/docs/Reference/Request.md +295 -0
- package/node_modules/fastify/docs/Reference/Routes.md +802 -0
- package/node_modules/fastify/docs/Reference/Server.md +2389 -0
- package/node_modules/fastify/docs/Reference/Type-Providers.md +256 -0
- package/node_modules/fastify/docs/Reference/TypeScript.md +1729 -0
- package/node_modules/fastify/docs/Reference/Validation-and-Serialization.md +1130 -0
- package/node_modules/fastify/docs/Reference/Warnings.md +58 -0
- package/node_modules/fastify/docs/index.md +24 -0
- package/node_modules/fastify/docs/resources/encapsulation_context.drawio +1 -0
- package/node_modules/fastify/docs/resources/encapsulation_context.svg +3 -0
- package/node_modules/fastify/eslint.config.js +35 -0
- package/node_modules/fastify/examples/asyncawait.js +38 -0
- package/node_modules/fastify/examples/benchmark/body.json +3 -0
- package/node_modules/fastify/examples/benchmark/hooks-benchmark-async-await.js +44 -0
- package/node_modules/fastify/examples/benchmark/hooks-benchmark.js +52 -0
- package/node_modules/fastify/examples/benchmark/parser.js +47 -0
- package/node_modules/fastify/examples/benchmark/simple.js +30 -0
- package/node_modules/fastify/examples/benchmark/webstream.js +27 -0
- package/node_modules/fastify/examples/hooks.js +91 -0
- package/node_modules/fastify/examples/http2.js +39 -0
- package/node_modules/fastify/examples/https.js +38 -0
- package/node_modules/fastify/examples/parser.js +53 -0
- package/node_modules/fastify/examples/plugin.js +12 -0
- package/node_modules/fastify/examples/route-prefix.js +38 -0
- package/node_modules/fastify/examples/shared-schema.js +38 -0
- package/node_modules/fastify/examples/simple-stream.js +20 -0
- package/node_modules/fastify/examples/simple.js +32 -0
- package/node_modules/fastify/examples/simple.mjs +27 -0
- package/node_modules/fastify/examples/typescript-server.ts +79 -0
- package/node_modules/fastify/examples/use-plugin.js +29 -0
- package/node_modules/fastify/fastify.d.ts +253 -0
- package/node_modules/fastify/fastify.js +985 -0
- package/node_modules/fastify/integration/server.js +29 -0
- package/node_modules/fastify/integration/test.sh +23 -0
- package/node_modules/fastify/lib/config-validator.js +1266 -0
- package/node_modules/fastify/lib/content-type-parser.js +413 -0
- package/node_modules/fastify/lib/content-type.js +160 -0
- package/node_modules/fastify/lib/context.js +98 -0
- package/node_modules/fastify/lib/decorate.js +152 -0
- package/node_modules/fastify/lib/error-handler.js +173 -0
- package/node_modules/fastify/lib/error-serializer.js +134 -0
- package/node_modules/fastify/lib/error-status.js +14 -0
- package/node_modules/fastify/lib/errors.js +516 -0
- package/node_modules/fastify/lib/four-oh-four.js +190 -0
- package/node_modules/fastify/lib/handle-request.js +195 -0
- package/node_modules/fastify/lib/head-route.js +45 -0
- package/node_modules/fastify/lib/hooks.js +429 -0
- package/node_modules/fastify/lib/initial-config-validation.js +37 -0
- package/node_modules/fastify/lib/logger-factory.js +136 -0
- package/node_modules/fastify/lib/logger-pino.js +68 -0
- package/node_modules/fastify/lib/noop-set.js +10 -0
- package/node_modules/fastify/lib/plugin-override.js +90 -0
- package/node_modules/fastify/lib/plugin-utils.js +169 -0
- package/node_modules/fastify/lib/promise.js +23 -0
- package/node_modules/fastify/lib/reply.js +1030 -0
- package/node_modules/fastify/lib/req-id-gen-factory.js +52 -0
- package/node_modules/fastify/lib/request.js +387 -0
- package/node_modules/fastify/lib/route.js +686 -0
- package/node_modules/fastify/lib/schema-controller.js +164 -0
- package/node_modules/fastify/lib/schemas.js +207 -0
- package/node_modules/fastify/lib/server.js +441 -0
- package/node_modules/fastify/lib/symbols.js +71 -0
- package/node_modules/fastify/lib/validation.js +280 -0
- package/node_modules/fastify/lib/warnings.js +57 -0
- package/node_modules/fastify/lib/wrap-thenable.js +84 -0
- package/node_modules/fastify/package.json +225 -0
- package/node_modules/fastify/scripts/validate-ecosystem-links.js +179 -0
- package/node_modules/fastify/test/404s.test.js +2035 -0
- package/node_modules/fastify/test/500s.test.js +422 -0
- package/node_modules/fastify/test/allow-unsafe-regex.test.js +92 -0
- package/node_modules/fastify/test/als.test.js +65 -0
- package/node_modules/fastify/test/async-await.test.js +705 -0
- package/node_modules/fastify/test/async-dispose.test.js +20 -0
- package/node_modules/fastify/test/async_hooks.test.js +52 -0
- package/node_modules/fastify/test/body-limit.test.js +224 -0
- package/node_modules/fastify/test/buffer.test.js +74 -0
- package/node_modules/fastify/test/build/error-serializer.test.js +36 -0
- package/node_modules/fastify/test/build/version.test.js +14 -0
- package/node_modules/fastify/test/build-certificate.js +109 -0
- package/node_modules/fastify/test/bundler/README.md +29 -0
- package/node_modules/fastify/test/bundler/esbuild/bundler-test.js +32 -0
- package/node_modules/fastify/test/bundler/esbuild/package.json +10 -0
- package/node_modules/fastify/test/bundler/esbuild/src/fail-plugin-version.js +14 -0
- package/node_modules/fastify/test/bundler/esbuild/src/index.js +9 -0
- package/node_modules/fastify/test/bundler/webpack/bundler-test.js +32 -0
- package/node_modules/fastify/test/bundler/webpack/package.json +11 -0
- package/node_modules/fastify/test/bundler/webpack/src/fail-plugin-version.js +14 -0
- package/node_modules/fastify/test/bundler/webpack/src/index.js +9 -0
- package/node_modules/fastify/test/bundler/webpack/webpack.config.js +15 -0
- package/node_modules/fastify/test/case-insensitive.test.js +102 -0
- package/node_modules/fastify/test/chainable.test.js +40 -0
- package/node_modules/fastify/test/child-logger-factory.test.js +128 -0
- package/node_modules/fastify/test/client-timeout.test.js +38 -0
- package/node_modules/fastify/test/close-pipelining.test.js +78 -0
- package/node_modules/fastify/test/close.test.js +706 -0
- package/node_modules/fastify/test/conditional-pino.test.js +47 -0
- package/node_modules/fastify/test/connection-timeout.test.js +42 -0
- package/node_modules/fastify/test/constrained-routes.test.js +1138 -0
- package/node_modules/fastify/test/content-length.test.js +174 -0
- package/node_modules/fastify/test/content-parser.test.js +739 -0
- package/node_modules/fastify/test/content-type.test.js +181 -0
- package/node_modules/fastify/test/context-config.test.js +164 -0
- package/node_modules/fastify/test/custom-http-server.test.js +118 -0
- package/node_modules/fastify/test/custom-parser-async.test.js +59 -0
- package/node_modules/fastify/test/custom-parser.0.test.js +701 -0
- package/node_modules/fastify/test/custom-parser.1.test.js +266 -0
- package/node_modules/fastify/test/custom-parser.2.test.js +91 -0
- package/node_modules/fastify/test/custom-parser.3.test.js +208 -0
- package/node_modules/fastify/test/custom-parser.4.test.js +218 -0
- package/node_modules/fastify/test/custom-parser.5.test.js +130 -0
- package/node_modules/fastify/test/custom-querystring-parser.test.js +129 -0
- package/node_modules/fastify/test/decorator.test.js +1330 -0
- package/node_modules/fastify/test/delete.test.js +344 -0
- package/node_modules/fastify/test/diagnostics-channel/404.test.js +49 -0
- package/node_modules/fastify/test/diagnostics-channel/async-delay-request.test.js +65 -0
- package/node_modules/fastify/test/diagnostics-channel/async-request.test.js +64 -0
- package/node_modules/fastify/test/diagnostics-channel/error-before-handler.test.js +35 -0
- package/node_modules/fastify/test/diagnostics-channel/error-request.test.js +53 -0
- package/node_modules/fastify/test/diagnostics-channel/error-status.test.js +123 -0
- package/node_modules/fastify/test/diagnostics-channel/init.test.js +50 -0
- package/node_modules/fastify/test/diagnostics-channel/sync-delay-request.test.js +49 -0
- package/node_modules/fastify/test/diagnostics-channel/sync-request-reply.test.js +51 -0
- package/node_modules/fastify/test/diagnostics-channel/sync-request.test.js +54 -0
- package/node_modules/fastify/test/encapsulated-child-logger-factory.test.js +69 -0
- package/node_modules/fastify/test/encapsulated-error-handler.test.js +237 -0
- package/node_modules/fastify/test/esm/errorCodes.test.mjs +10 -0
- package/node_modules/fastify/test/esm/esm.test.mjs +13 -0
- package/node_modules/fastify/test/esm/index.test.js +8 -0
- package/node_modules/fastify/test/esm/named-exports.mjs +14 -0
- package/node_modules/fastify/test/esm/other.mjs +8 -0
- package/node_modules/fastify/test/esm/plugin.mjs +8 -0
- package/node_modules/fastify/test/fastify-instance.test.js +300 -0
- package/node_modules/fastify/test/find-route.test.js +152 -0
- package/node_modules/fastify/test/fluent-schema.test.js +209 -0
- package/node_modules/fastify/test/genReqId.test.js +426 -0
- package/node_modules/fastify/test/handler-context.test.js +45 -0
- package/node_modules/fastify/test/handler-timeout.test.js +367 -0
- package/node_modules/fastify/test/has-route.test.js +88 -0
- package/node_modules/fastify/test/header-overflow.test.js +55 -0
- package/node_modules/fastify/test/helper.js +496 -0
- package/node_modules/fastify/test/hooks-async.test.js +1099 -0
- package/node_modules/fastify/test/hooks.on-listen.test.js +1162 -0
- package/node_modules/fastify/test/hooks.on-ready.test.js +421 -0
- package/node_modules/fastify/test/hooks.test.js +3578 -0
- package/node_modules/fastify/test/http-methods/copy.test.js +35 -0
- package/node_modules/fastify/test/http-methods/custom-http-methods.test.js +114 -0
- package/node_modules/fastify/test/http-methods/get.test.js +412 -0
- package/node_modules/fastify/test/http-methods/head.test.js +263 -0
- package/node_modules/fastify/test/http-methods/lock.test.js +108 -0
- package/node_modules/fastify/test/http-methods/mkcalendar.test.js +143 -0
- package/node_modules/fastify/test/http-methods/mkcol.test.js +35 -0
- package/node_modules/fastify/test/http-methods/move.test.js +42 -0
- package/node_modules/fastify/test/http-methods/propfind.test.js +136 -0
- package/node_modules/fastify/test/http-methods/proppatch.test.js +105 -0
- package/node_modules/fastify/test/http-methods/report.test.js +142 -0
- package/node_modules/fastify/test/http-methods/search.test.js +233 -0
- package/node_modules/fastify/test/http-methods/trace.test.js +21 -0
- package/node_modules/fastify/test/http-methods/unlock.test.js +38 -0
- package/node_modules/fastify/test/http2/closing.test.js +270 -0
- package/node_modules/fastify/test/http2/constraint.test.js +109 -0
- package/node_modules/fastify/test/http2/head.test.js +34 -0
- package/node_modules/fastify/test/http2/plain.test.js +68 -0
- package/node_modules/fastify/test/http2/secure-with-fallback.test.js +113 -0
- package/node_modules/fastify/test/http2/secure.test.js +67 -0
- package/node_modules/fastify/test/http2/unknown-http-method.test.js +34 -0
- package/node_modules/fastify/test/https/custom-https-server.test.js +58 -0
- package/node_modules/fastify/test/https/https.test.js +136 -0
- package/node_modules/fastify/test/imports.test.js +17 -0
- package/node_modules/fastify/test/inject.test.js +502 -0
- package/node_modules/fastify/test/input-validation.js +335 -0
- package/node_modules/fastify/test/internals/all.test.js +38 -0
- package/node_modules/fastify/test/internals/content-type-parser.test.js +111 -0
- package/node_modules/fastify/test/internals/context.test.js +31 -0
- package/node_modules/fastify/test/internals/decorator.test.js +156 -0
- package/node_modules/fastify/test/internals/errors.test.js +982 -0
- package/node_modules/fastify/test/internals/handle-request.test.js +270 -0
- package/node_modules/fastify/test/internals/hook-runner.test.js +449 -0
- package/node_modules/fastify/test/internals/hooks.test.js +96 -0
- package/node_modules/fastify/test/internals/initial-config.test.js +383 -0
- package/node_modules/fastify/test/internals/logger.test.js +163 -0
- package/node_modules/fastify/test/internals/plugin.test.js +170 -0
- package/node_modules/fastify/test/internals/promise.test.js +63 -0
- package/node_modules/fastify/test/internals/reply-serialize.test.js +714 -0
- package/node_modules/fastify/test/internals/reply.test.js +1920 -0
- package/node_modules/fastify/test/internals/req-id-gen-factory.test.js +133 -0
- package/node_modules/fastify/test/internals/request-validate.test.js +1402 -0
- package/node_modules/fastify/test/internals/request.test.js +506 -0
- package/node_modules/fastify/test/internals/schema-controller-perf.test.js +40 -0
- package/node_modules/fastify/test/internals/server.test.js +91 -0
- package/node_modules/fastify/test/internals/validation.test.js +352 -0
- package/node_modules/fastify/test/issue-4959.test.js +118 -0
- package/node_modules/fastify/test/keep-alive-timeout.test.js +42 -0
- package/node_modules/fastify/test/listen.1.test.js +154 -0
- package/node_modules/fastify/test/listen.2.test.js +113 -0
- package/node_modules/fastify/test/listen.3.test.js +83 -0
- package/node_modules/fastify/test/listen.4.test.js +168 -0
- package/node_modules/fastify/test/listen.5.test.js +122 -0
- package/node_modules/fastify/test/logger/instantiation.test.js +341 -0
- package/node_modules/fastify/test/logger/logger-test-utils.js +47 -0
- package/node_modules/fastify/test/logger/logging.test.js +460 -0
- package/node_modules/fastify/test/logger/options.test.js +579 -0
- package/node_modules/fastify/test/logger/request.test.js +292 -0
- package/node_modules/fastify/test/logger/response.test.js +183 -0
- package/node_modules/fastify/test/logger/tap-parallel-not-ok +0 -0
- package/node_modules/fastify/test/max-requests-per-socket.test.js +113 -0
- package/node_modules/fastify/test/middleware.test.js +37 -0
- package/node_modules/fastify/test/noop-set.test.js +19 -0
- package/node_modules/fastify/test/nullable-validation.test.js +187 -0
- package/node_modules/fastify/test/options.error-handler.test.js +5 -0
- package/node_modules/fastify/test/options.test.js +5 -0
- package/node_modules/fastify/test/output-validation.test.js +140 -0
- package/node_modules/fastify/test/patch.error-handler.test.js +5 -0
- package/node_modules/fastify/test/patch.test.js +5 -0
- package/node_modules/fastify/test/plugin.1.test.js +230 -0
- package/node_modules/fastify/test/plugin.2.test.js +314 -0
- package/node_modules/fastify/test/plugin.3.test.js +287 -0
- package/node_modules/fastify/test/plugin.4.test.js +504 -0
- package/node_modules/fastify/test/plugin.helper.js +8 -0
- package/node_modules/fastify/test/plugin.name.display.js +10 -0
- package/node_modules/fastify/test/post-empty-body.test.js +38 -0
- package/node_modules/fastify/test/pretty-print.test.js +366 -0
- package/node_modules/fastify/test/promises.test.js +125 -0
- package/node_modules/fastify/test/proto-poisoning.test.js +145 -0
- package/node_modules/fastify/test/put.error-handler.test.js +5 -0
- package/node_modules/fastify/test/put.test.js +5 -0
- package/node_modules/fastify/test/register.test.js +184 -0
- package/node_modules/fastify/test/reply-code.test.js +148 -0
- package/node_modules/fastify/test/reply-early-hints.test.js +100 -0
- package/node_modules/fastify/test/reply-error.test.js +815 -0
- package/node_modules/fastify/test/reply-trailers.test.js +445 -0
- package/node_modules/fastify/test/reply-web-stream-locked.test.js +37 -0
- package/node_modules/fastify/test/request-error.test.js +624 -0
- package/node_modules/fastify/test/request-header-host.test.js +339 -0
- package/node_modules/fastify/test/request-id.test.js +118 -0
- package/node_modules/fastify/test/request-port.test.js +72 -0
- package/node_modules/fastify/test/request-timeout.test.js +53 -0
- package/node_modules/fastify/test/route-hooks.test.js +635 -0
- package/node_modules/fastify/test/route-prefix.test.js +904 -0
- package/node_modules/fastify/test/route-shorthand.test.js +48 -0
- package/node_modules/fastify/test/route.1.test.js +259 -0
- package/node_modules/fastify/test/route.2.test.js +100 -0
- package/node_modules/fastify/test/route.3.test.js +213 -0
- package/node_modules/fastify/test/route.4.test.js +127 -0
- package/node_modules/fastify/test/route.5.test.js +211 -0
- package/node_modules/fastify/test/route.6.test.js +306 -0
- package/node_modules/fastify/test/route.7.test.js +406 -0
- package/node_modules/fastify/test/route.8.test.js +225 -0
- package/node_modules/fastify/test/router-options.test.js +1108 -0
- package/node_modules/fastify/test/same-shape.test.js +124 -0
- package/node_modules/fastify/test/schema-examples.test.js +661 -0
- package/node_modules/fastify/test/schema-feature.test.js +2198 -0
- package/node_modules/fastify/test/schema-serialization.test.js +1171 -0
- package/node_modules/fastify/test/schema-special-usage.test.js +1348 -0
- package/node_modules/fastify/test/schema-validation.test.js +1593 -0
- package/node_modules/fastify/test/scripts/validate-ecosystem-links.test.js +339 -0
- package/node_modules/fastify/test/serialize-response.test.js +186 -0
- package/node_modules/fastify/test/server.test.js +347 -0
- package/node_modules/fastify/test/set-error-handler.test.js +69 -0
- package/node_modules/fastify/test/skip-reply-send.test.js +317 -0
- package/node_modules/fastify/test/stream-serializers.test.js +40 -0
- package/node_modules/fastify/test/stream.1.test.js +94 -0
- package/node_modules/fastify/test/stream.2.test.js +129 -0
- package/node_modules/fastify/test/stream.3.test.js +198 -0
- package/node_modules/fastify/test/stream.4.test.js +176 -0
- package/node_modules/fastify/test/stream.5.test.js +188 -0
- package/node_modules/fastify/test/sync-routes.test.js +32 -0
- package/node_modules/fastify/test/throw.test.js +359 -0
- package/node_modules/fastify/test/toolkit.js +63 -0
- package/node_modules/fastify/test/trust-proxy.test.js +274 -0
- package/node_modules/fastify/test/type-provider.test.js +22 -0
- package/node_modules/fastify/test/types/content-type-parser.test-d.ts +72 -0
- package/node_modules/fastify/test/types/decorate-request-reply.test-d.ts +18 -0
- package/node_modules/fastify/test/types/dummy-plugin.ts +9 -0
- package/node_modules/fastify/test/types/errors.test-d.ts +90 -0
- package/node_modules/fastify/test/types/fastify.test-d.ts +352 -0
- package/node_modules/fastify/test/types/hooks.test-d.ts +550 -0
- package/node_modules/fastify/test/types/import.ts +2 -0
- package/node_modules/fastify/test/types/instance.test-d.ts +588 -0
- package/node_modules/fastify/test/types/logger.test-d.ts +277 -0
- package/node_modules/fastify/test/types/plugin.test-d.ts +97 -0
- package/node_modules/fastify/test/types/register.test-d.ts +237 -0
- package/node_modules/fastify/test/types/reply.test-d.ts +254 -0
- package/node_modules/fastify/test/types/request.test-d.ts +188 -0
- package/node_modules/fastify/test/types/route.test-d.ts +553 -0
- package/node_modules/fastify/test/types/schema.test-d.ts +135 -0
- package/node_modules/fastify/test/types/serverFactory.test-d.ts +37 -0
- package/node_modules/fastify/test/types/type-provider.test-d.ts +1213 -0
- package/node_modules/fastify/test/types/using.test-d.ts +17 -0
- package/node_modules/fastify/test/upgrade.test.js +52 -0
- package/node_modules/fastify/test/url-rewriting.test.js +122 -0
- package/node_modules/fastify/test/use-semicolon-delimiter.test.js +168 -0
- package/node_modules/fastify/test/validation-error-handling.test.js +900 -0
- package/node_modules/fastify/test/versioned-routes.test.js +603 -0
- package/node_modules/fastify/test/web-api.test.js +616 -0
- package/node_modules/fastify/test/wrap-thenable.test.js +30 -0
- package/node_modules/fastify/types/content-type-parser.d.ts +75 -0
- package/node_modules/fastify/types/context.d.ts +22 -0
- package/node_modules/fastify/types/errors.d.ts +92 -0
- package/node_modules/fastify/types/hooks.d.ts +875 -0
- package/node_modules/fastify/types/instance.d.ts +609 -0
- package/node_modules/fastify/types/logger.d.ts +107 -0
- package/node_modules/fastify/types/plugin.d.ts +44 -0
- package/node_modules/fastify/types/register.d.ts +42 -0
- package/node_modules/fastify/types/reply.d.ts +81 -0
- package/node_modules/fastify/types/request.d.ts +95 -0
- package/node_modules/fastify/types/route.d.ts +199 -0
- package/node_modules/fastify/types/schema.d.ts +61 -0
- package/node_modules/fastify/types/server-factory.d.ts +19 -0
- package/node_modules/fastify/types/type-provider.d.ts +130 -0
- package/node_modules/fastify/types/utils.d.ts +98 -0
- package/node_modules/fastify-plugin/.gitattributes +2 -0
- package/node_modules/fastify-plugin/.github/dependabot.yml +13 -0
- package/node_modules/fastify-plugin/.github/stale.yml +21 -0
- package/node_modules/fastify-plugin/.github/workflows/ci.yml +28 -0
- package/node_modules/fastify-plugin/LICENSE +23 -0
- package/node_modules/fastify-plugin/README.md +188 -0
- package/node_modules/fastify-plugin/eslint.config.js +6 -0
- package/node_modules/fastify-plugin/lib/getPluginName.js +25 -0
- package/node_modules/fastify-plugin/lib/toCamelCase.js +10 -0
- package/node_modules/fastify-plugin/package.json +70 -0
- package/node_modules/fastify-plugin/plugin.js +67 -0
- package/node_modules/fastify-plugin/test/bundlers.test.js +110 -0
- package/node_modules/fastify-plugin/test/checkVersion.test.js +67 -0
- package/node_modules/fastify-plugin/test/composite.test.js +14 -0
- package/node_modules/fastify-plugin/test/esm/esm.mjs +11 -0
- package/node_modules/fastify-plugin/test/esm/index.test.js +11 -0
- package/node_modules/fastify-plugin/test/extractPluginName.test.js +49 -0
- package/node_modules/fastify-plugin/test/mu1tip1e.composite.test.js +15 -0
- package/node_modules/fastify-plugin/test/test.js +396 -0
- package/node_modules/fastify-plugin/test/toCamelCase.test.js +24 -0
- package/node_modules/fastify-plugin/types/example-async.test-d.ts +19 -0
- package/node_modules/fastify-plugin/types/example-callback.test-d.ts +19 -0
- package/node_modules/fastify-plugin/types/plugin.d.ts +61 -0
- package/node_modules/fastify-plugin/types/plugin.test-d.ts +166 -0
- package/node_modules/fastq/LICENSE +13 -0
- package/node_modules/fastq/README.md +310 -0
- package/node_modules/fastq/SECURITY.md +15 -0
- package/node_modules/fastq/bench.js +66 -0
- package/node_modules/fastq/eslint.config.js +11 -0
- package/node_modules/fastq/example.js +14 -0
- package/node_modules/fastq/example.mjs +9 -0
- package/node_modules/fastq/index.d.ts +59 -0
- package/node_modules/fastq/package.json +49 -0
- package/node_modules/fastq/queue.js +346 -0
- package/node_modules/fastq/test/example.ts +83 -0
- package/node_modules/fastq/test/promise.js +325 -0
- package/node_modules/fastq/test/test.js +733 -0
- package/node_modules/fastq/test/tsconfig.json +11 -0
- package/node_modules/find-my-way/.github/dependabot.yml +34 -0
- package/node_modules/find-my-way/.github/workflows/node.js.yml +68 -0
- package/node_modules/find-my-way/LICENSE +21 -0
- package/node_modules/find-my-way/README.md +885 -0
- package/node_modules/find-my-way/benchmark/bench-thread.js +35 -0
- package/node_modules/find-my-way/benchmark/bench.js +156 -0
- package/node_modules/find-my-way/benchmark/compare-branches.js +113 -0
- package/node_modules/find-my-way/benchmark/uri-decoding.js +55 -0
- package/node_modules/find-my-way/example.js +29 -0
- package/node_modules/find-my-way/index.d.ts +247 -0
- package/node_modules/find-my-way/index.js +872 -0
- package/node_modules/find-my-way/lib/constrainer.js +172 -0
- package/node_modules/find-my-way/lib/handler-storage.js +175 -0
- package/node_modules/find-my-way/lib/http-methods.js +13 -0
- package/node_modules/find-my-way/lib/node.js +228 -0
- package/node_modules/find-my-way/lib/null-object.js +8 -0
- package/node_modules/find-my-way/lib/pretty-print.js +168 -0
- package/node_modules/find-my-way/lib/strategies/accept-host.js +36 -0
- package/node_modules/find-my-way/lib/strategies/accept-version.js +64 -0
- package/node_modules/find-my-way/lib/strategies/http-method.js +15 -0
- package/node_modules/find-my-way/lib/url-sanitizer.js +105 -0
- package/node_modules/find-my-way/package.json +57 -0
- package/node_modules/find-my-way/test/case-insensitive.test.js +230 -0
- package/node_modules/find-my-way/test/constraint.custom-versioning.test.js +130 -0
- package/node_modules/find-my-way/test/constraint.custom.async.test.js +111 -0
- package/node_modules/find-my-way/test/constraint.custom.test.js +273 -0
- package/node_modules/find-my-way/test/constraint.default-versioning.test.js +289 -0
- package/node_modules/find-my-way/test/constraint.host.test.js +104 -0
- package/node_modules/find-my-way/test/constraints.test.js +108 -0
- package/node_modules/find-my-way/test/custom-querystring-parser.test.js +46 -0
- package/node_modules/find-my-way/test/errors.test.js +484 -0
- package/node_modules/find-my-way/test/fastify-issue-3129.test.js +34 -0
- package/node_modules/find-my-way/test/fastify-issue-3957.test.js +23 -0
- package/node_modules/find-my-way/test/find-route.test.js +275 -0
- package/node_modules/find-my-way/test/find.test.js +16 -0
- package/node_modules/find-my-way/test/for-in-loop.test.js +22 -0
- package/node_modules/find-my-way/test/full-url.test.js +30 -0
- package/node_modules/find-my-way/test/has-route.test.js +218 -0
- package/node_modules/find-my-way/test/host-storage.test.js +27 -0
- package/node_modules/find-my-way/test/http2/constraint.host.test.js +44 -0
- package/node_modules/find-my-way/test/issue-101.test.js +31 -0
- package/node_modules/find-my-way/test/issue-104.test.js +206 -0
- package/node_modules/find-my-way/test/issue-110.test.js +31 -0
- package/node_modules/find-my-way/test/issue-132.test.js +80 -0
- package/node_modules/find-my-way/test/issue-145.test.js +24 -0
- package/node_modules/find-my-way/test/issue-149.test.js +21 -0
- package/node_modules/find-my-way/test/issue-151.test.js +54 -0
- package/node_modules/find-my-way/test/issue-154.test.js +21 -0
- package/node_modules/find-my-way/test/issue-161.test.js +88 -0
- package/node_modules/find-my-way/test/issue-17.test.js +397 -0
- package/node_modules/find-my-way/test/issue-175.test.js +80 -0
- package/node_modules/find-my-way/test/issue-182.test.js +18 -0
- package/node_modules/find-my-way/test/issue-190.test.js +44 -0
- package/node_modules/find-my-way/test/issue-20.test.js +79 -0
- package/node_modules/find-my-way/test/issue-206.test.js +121 -0
- package/node_modules/find-my-way/test/issue-221.test.js +50 -0
- package/node_modules/find-my-way/test/issue-234.test.js +94 -0
- package/node_modules/find-my-way/test/issue-238.test.js +119 -0
- package/node_modules/find-my-way/test/issue-240.test.js +30 -0
- package/node_modules/find-my-way/test/issue-241.test.js +32 -0
- package/node_modules/find-my-way/test/issue-247.test.js +51 -0
- package/node_modules/find-my-way/test/issue-254.test.js +31 -0
- package/node_modules/find-my-way/test/issue-28.test.js +618 -0
- package/node_modules/find-my-way/test/issue-280.test.js +14 -0
- package/node_modules/find-my-way/test/issue-285.test.js +37 -0
- package/node_modules/find-my-way/test/issue-330.test.js +231 -0
- package/node_modules/find-my-way/test/issue-44.test.js +149 -0
- package/node_modules/find-my-way/test/issue-46.test.js +75 -0
- package/node_modules/find-my-way/test/issue-49.test.js +108 -0
- package/node_modules/find-my-way/test/issue-59.test.js +131 -0
- package/node_modules/find-my-way/test/issue-62.test.js +28 -0
- package/node_modules/find-my-way/test/issue-63.test.js +23 -0
- package/node_modules/find-my-way/test/issue-67.test.js +50 -0
- package/node_modules/find-my-way/test/issue-93.test.js +19 -0
- package/node_modules/find-my-way/test/lookup-async.test.js +29 -0
- package/node_modules/find-my-way/test/lookup.test.js +58 -0
- package/node_modules/find-my-way/test/matching-order.test.js +17 -0
- package/node_modules/find-my-way/test/max-param-length.test.js +44 -0
- package/node_modules/find-my-way/test/methods.test.js +830 -0
- package/node_modules/find-my-way/test/null-object.test.js +36 -0
- package/node_modules/find-my-way/test/on-bad-url.test.js +72 -0
- package/node_modules/find-my-way/test/optional-params.test.js +216 -0
- package/node_modules/find-my-way/test/params-collisions.test.js +126 -0
- package/node_modules/find-my-way/test/path-params-match.test.js +53 -0
- package/node_modules/find-my-way/test/path-utils.test.js +68 -0
- package/node_modules/find-my-way/test/pretty-print-tree.test.js +596 -0
- package/node_modules/find-my-way/test/pretty-print.test.js +680 -0
- package/node_modules/find-my-way/test/querystring.test.js +54 -0
- package/node_modules/find-my-way/test/regex.test.js +269 -0
- package/node_modules/find-my-way/test/repro-issue-414.test.js +57 -0
- package/node_modules/find-my-way/test/routes-registered.test.js +45 -0
- package/node_modules/find-my-way/test/server.test.js +368 -0
- package/node_modules/find-my-way/test/shorthands.test.js +44 -0
- package/node_modules/find-my-way/test/store.test.js +49 -0
- package/node_modules/find-my-way/test/types/router.test-d.ts +188 -0
- package/node_modules/find-my-way/test/url-sanitizer.test.js +43 -0
- package/node_modules/glob/LICENSE.md +63 -0
- package/node_modules/glob/README.md +1203 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts +396 -0
- package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/glob.js +248 -0
- package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
- package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
- package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/ignore.js +119 -0
- package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
- package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
- package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/index.js +68 -0
- package/node_modules/glob/dist/commonjs/index.js.map +1 -0
- 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/package.json +3 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts +79 -0
- package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/pattern.js +223 -0
- package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
- package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/processor.js +301 -0
- package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
- package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/commonjs/walker.js +387 -0
- package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
- package/node_modules/glob/dist/esm/glob.d.ts +396 -0
- package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/glob.js +244 -0
- package/node_modules/glob/dist/esm/glob.js.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
- package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/has-magic.js +23 -0
- package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
- package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
- package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/ignore.js +115 -0
- package/node_modules/glob/dist/esm/ignore.js.map +1 -0
- package/node_modules/glob/dist/esm/index.d.ts +97 -0
- package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/index.js +55 -0
- package/node_modules/glob/dist/esm/index.js.map +1 -0
- 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/package.json +3 -0
- package/node_modules/glob/dist/esm/pattern.d.ts +79 -0
- package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/pattern.js +219 -0
- package/node_modules/glob/dist/esm/pattern.js.map +1 -0
- package/node_modules/glob/dist/esm/processor.d.ts +59 -0
- package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/processor.js +294 -0
- package/node_modules/glob/dist/esm/processor.js.map +1 -0
- package/node_modules/glob/dist/esm/walker.d.ts +97 -0
- package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
- package/node_modules/glob/dist/esm/walker.js +381 -0
- package/node_modules/glob/dist/esm/walker.js.map +1 -0
- package/node_modules/glob/package.json +98 -0
- package/node_modules/http-errors/HISTORY.md +186 -0
- package/node_modules/http-errors/LICENSE +23 -0
- package/node_modules/http-errors/README.md +169 -0
- package/node_modules/http-errors/index.js +290 -0
- package/node_modules/http-errors/package.json +54 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/ipaddr.js/LICENSE +19 -0
- package/node_modules/ipaddr.js/README.md +229 -0
- package/node_modules/ipaddr.js/ipaddr.min.js +1 -0
- package/node_modules/ipaddr.js/lib/ipaddr.js +1082 -0
- package/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +72 -0
- package/node_modules/ipaddr.js/package.json +36 -0
- package/node_modules/jishushell-panel/LICENSE +6 -0
- package/node_modules/jishushell-panel/README.md +47 -0
- package/node_modules/jishushell-panel/output/dist/server.d.ts +13 -0
- package/node_modules/jishushell-panel/output/dist/server.js +466 -0
- package/node_modules/jishushell-panel/output/dist/server.js.map +1 -0
- 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 +22 -0
- package/node_modules/jishushell-panel/package.json +33 -0
- package/node_modules/json-schema-ref-resolver/.gitattributes +2 -0
- package/node_modules/json-schema-ref-resolver/.github/dependabot.yml +13 -0
- package/node_modules/json-schema-ref-resolver/.github/workflows/ci.yml +25 -0
- package/node_modules/json-schema-ref-resolver/LICENSE +21 -0
- package/node_modules/json-schema-ref-resolver/README.md +406 -0
- package/node_modules/json-schema-ref-resolver/eslint.config.js +6 -0
- package/node_modules/json-schema-ref-resolver/index.js +284 -0
- package/node_modules/json-schema-ref-resolver/package.json +76 -0
- package/node_modules/json-schema-ref-resolver/test/anchor.test.js +56 -0
- package/node_modules/json-schema-ref-resolver/test/collisions.test.js +199 -0
- package/node_modules/json-schema-ref-resolver/test/deref-schema.test.js +287 -0
- package/node_modules/json-schema-ref-resolver/test/get-deref-schema.test.js +363 -0
- package/node_modules/json-schema-ref-resolver/test/get-schema-dependencies.test.js +158 -0
- package/node_modules/json-schema-ref-resolver/test/get-schema-refs.test.js +87 -0
- package/node_modules/json-schema-ref-resolver/test/get-schema.test.js +222 -0
- package/node_modules/json-schema-ref-resolver/test/has-schema.test.js +28 -0
- package/node_modules/json-schema-ref-resolver/types/index.d.ts +67 -0
- package/node_modules/json-schema-ref-resolver/types/index.test-d.ts +23 -0
- package/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
- package/node_modules/json-schema-traverse/.github/FUNDING.yml +2 -0
- package/node_modules/json-schema-traverse/.github/workflows/build.yml +28 -0
- package/node_modules/json-schema-traverse/.github/workflows/publish.yml +27 -0
- package/node_modules/json-schema-traverse/LICENSE +21 -0
- package/node_modules/json-schema-traverse/README.md +95 -0
- package/node_modules/json-schema-traverse/index.d.ts +40 -0
- package/node_modules/json-schema-traverse/index.js +93 -0
- package/node_modules/json-schema-traverse/package.json +43 -0
- package/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
- package/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
- package/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
- package/node_modules/light-my-request/.gitattributes +2 -0
- package/node_modules/light-my-request/.github/dependabot.yml +13 -0
- package/node_modules/light-my-request/.github/stale.yml +21 -0
- package/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
- package/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
- package/node_modules/light-my-request/LICENSE +32 -0
- package/node_modules/light-my-request/README.md +261 -0
- package/node_modules/light-my-request/benchmark/benchmark.js +164 -0
- package/node_modules/light-my-request/build/build-validation.js +100 -0
- package/node_modules/light-my-request/eslint.config.js +9 -0
- package/node_modules/light-my-request/index.js +194 -0
- package/node_modules/light-my-request/lib/config-validator.js +919 -0
- package/node_modules/light-my-request/lib/form-data.js +79 -0
- package/node_modules/light-my-request/lib/parse-url.js +47 -0
- package/node_modules/light-my-request/lib/request.js +290 -0
- package/node_modules/light-my-request/lib/response.js +240 -0
- package/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
- package/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
- package/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
- package/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
- package/node_modules/light-my-request/node_modules/process-warning/LICENSE +21 -0
- package/node_modules/light-my-request/node_modules/process-warning/README.md +118 -0
- package/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
- package/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
- package/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
- package/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
- package/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
- package/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
- package/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
- package/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
- package/node_modules/light-my-request/package.json +85 -0
- package/node_modules/light-my-request/test/async-await.test.js +55 -0
- package/node_modules/light-my-request/test/index.test.js +2316 -0
- package/node_modules/light-my-request/test/request.test.js +16 -0
- package/node_modules/light-my-request/test/response.test.js +19 -0
- package/node_modules/light-my-request/test/stream.test.js +359 -0
- package/node_modules/light-my-request/types/index.d.ts +128 -0
- package/node_modules/light-my-request/types/index.test-d.ts +149 -0
- package/node_modules/mime/CHANGELOG.md +312 -0
- package/node_modules/mime/LICENSE +21 -0
- package/node_modules/mime/Mime.js +97 -0
- package/node_modules/mime/README.md +178 -0
- package/node_modules/mime/cli.js +46 -0
- package/node_modules/mime/index.js +4 -0
- package/node_modules/mime/lite.js +4 -0
- package/node_modules/mime/package.json +52 -0
- package/node_modules/mime/types/other.js +1 -0
- package/node_modules/mime/types/standard.js +1 -0
- package/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/minimatch/README.md +528 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
- package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
- package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
- package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
- package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
- package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/ast.js +841 -0
- package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
- package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/index.d.ts +174 -0
- package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/index.js +1114 -0
- package/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/minimatch/package.json +73 -0
- package/node_modules/minipass/LICENSE.md +55 -0
- package/node_modules/minipass/README.md +825 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
- package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/commonjs/index.js +1038 -0
- package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
- package/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/node_modules/minipass/dist/esm/index.d.ts +545 -0
- package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minipass/dist/esm/index.js +1020 -0
- package/node_modules/minipass/dist/esm/index.js.map +1 -0
- package/node_modules/minipass/dist/esm/package.json +3 -0
- package/node_modules/minipass/package.json +77 -0
- package/node_modules/on-exit-leak-free/.github/dependabot.yml +12 -0
- package/node_modules/on-exit-leak-free/.github/workflows/ci.yml +46 -0
- package/node_modules/on-exit-leak-free/LICENSE +21 -0
- package/node_modules/on-exit-leak-free/README.md +54 -0
- package/node_modules/on-exit-leak-free/index.js +108 -0
- package/node_modules/on-exit-leak-free/package.json +37 -0
- package/node_modules/on-exit-leak-free/test/base.test.js +30 -0
- package/node_modules/on-exit-leak-free/test/event-emitter-leak.test.js +23 -0
- package/node_modules/on-exit-leak-free/test/fixtures/beforeExit.js +33 -0
- package/node_modules/on-exit-leak-free/test/fixtures/close.js +21 -0
- package/node_modules/on-exit-leak-free/test/fixtures/gc-not-close.js +24 -0
- package/node_modules/on-exit-leak-free/test/fixtures/unregister.js +24 -0
- package/node_modules/path-scurry/LICENSE.md +55 -0
- package/node_modules/path-scurry/README.md +636 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
- package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
- package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
- package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/dist/esm/index.js +1983 -0
- package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
- package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel-browser.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.d.ts +5 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.d.ts +1400 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts +12 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.cjs.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts +1400 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel-node.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.d.ts +5 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.d.ts +1400 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.d.ts +12 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.d.ts +12 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel-browser.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.d.ts +1400 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.d.ts +12 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.mjs.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts +1400 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel-node.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.d.ts +1400 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js.map +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.d.ts +12 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.d.ts +12 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.d.ts.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
- package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js.map +1 -0
- package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
- package/node_modules/path-scurry/package.json +72 -0
- package/node_modules/pino/.nojekyll +0 -0
- package/node_modules/pino/.prettierignore +1 -0
- package/node_modules/pino/CNAME +1 -0
- package/node_modules/pino/CONTRIBUTING.md +30 -0
- package/node_modules/pino/LICENSE +21 -0
- package/node_modules/pino/README.md +177 -0
- package/node_modules/pino/SECURITY.md +87 -0
- package/node_modules/pino/benchmarks/basic.bench.js +95 -0
- package/node_modules/pino/benchmarks/child-child.bench.js +52 -0
- package/node_modules/pino/benchmarks/child-creation.bench.js +73 -0
- package/node_modules/pino/benchmarks/child.bench.js +62 -0
- package/node_modules/pino/benchmarks/deep-object.bench.js +88 -0
- package/node_modules/pino/benchmarks/formatters.bench.js +50 -0
- package/node_modules/pino/benchmarks/internal/custom-levels.js +67 -0
- package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +76 -0
- package/node_modules/pino/benchmarks/internal/just-pino.bench.js +182 -0
- package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +75 -0
- package/node_modules/pino/benchmarks/internal/redact.bench.js +86 -0
- package/node_modules/pino/benchmarks/long-string.bench.js +81 -0
- package/node_modules/pino/benchmarks/multi-arg.bench.js +193 -0
- package/node_modules/pino/benchmarks/multistream.js +98 -0
- package/node_modules/pino/benchmarks/object.bench.js +82 -0
- package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +36 -0
- package/node_modules/pino/benchmarks/utils/runbench.js +138 -0
- package/node_modules/pino/benchmarks/utils/wrap-log-level.js +55 -0
- package/node_modules/pino/bin.js +6 -0
- package/node_modules/pino/browser.js +547 -0
- package/node_modules/pino/build/sync-version.js +25 -0
- package/node_modules/pino/docs/api.md +1593 -0
- package/node_modules/pino/docs/asynchronous.md +40 -0
- package/node_modules/pino/docs/benchmarks.md +55 -0
- package/node_modules/pino/docs/browser.md +278 -0
- package/node_modules/pino/docs/bundling.md +40 -0
- package/node_modules/pino/docs/child-loggers.md +95 -0
- package/node_modules/pino/docs/diagnostics.md +16 -0
- package/node_modules/pino/docs/ecosystem.md +86 -0
- package/node_modules/pino/docs/help.md +345 -0
- package/node_modules/pino/docs/lts.md +64 -0
- package/node_modules/pino/docs/pretty.md +35 -0
- package/node_modules/pino/docs/redaction.md +135 -0
- package/node_modules/pino/docs/transports.md +1376 -0
- package/node_modules/pino/docs/web.md +309 -0
- package/node_modules/pino/eslint.config.js +28 -0
- package/node_modules/pino/examples/basic.js +43 -0
- package/node_modules/pino/examples/transport.js +68 -0
- package/node_modules/pino/favicon.ico +0 -0
- package/node_modules/pino/file.js +12 -0
- package/node_modules/pino/inc-version.sh +42 -0
- package/node_modules/pino/index.html +55 -0
- package/node_modules/pino/lib/caller.js +30 -0
- package/node_modules/pino/lib/constants.js +28 -0
- package/node_modules/pino/lib/deprecations.js +8 -0
- package/node_modules/pino/lib/levels.js +241 -0
- package/node_modules/pino/lib/meta.js +3 -0
- package/node_modules/pino/lib/multistream.js +203 -0
- package/node_modules/pino/lib/proto.js +256 -0
- package/node_modules/pino/lib/redaction.js +114 -0
- package/node_modules/pino/lib/symbols.js +74 -0
- package/node_modules/pino/lib/time.js +39 -0
- package/node_modules/pino/lib/tools.js +427 -0
- package/node_modules/pino/lib/transport-stream.js +56 -0
- package/node_modules/pino/lib/transport.js +289 -0
- package/node_modules/pino/lib/worker.js +194 -0
- package/node_modules/pino/package.json +120 -0
- package/node_modules/pino/pino.d.ts +908 -0
- package/node_modules/pino/pino.js +234 -0
- package/node_modules/pino/test/basic.test.js +886 -0
- package/node_modules/pino/test/broken-pipe.test.js +59 -0
- package/node_modules/pino/test/browser-child.test.js +132 -0
- package/node_modules/pino/test/browser-disabled.test.js +87 -0
- package/node_modules/pino/test/browser-early-console-freeze.test.js +12 -0
- package/node_modules/pino/test/browser-is-level-enabled.test.js +101 -0
- package/node_modules/pino/test/browser-levels.test.js +241 -0
- package/node_modules/pino/test/browser-serializers.test.js +352 -0
- package/node_modules/pino/test/browser-timestamp.test.js +88 -0
- package/node_modules/pino/test/browser-transmit.test.js +417 -0
- package/node_modules/pino/test/browser.test.js +698 -0
- package/node_modules/pino/test/complex-objects.test.js +36 -0
- package/node_modules/pino/test/crlf.test.js +34 -0
- package/node_modules/pino/test/custom-levels.test.js +267 -0
- package/node_modules/pino/test/diagnostics.test.js +107 -0
- package/node_modules/pino/test/error-key.test.js +37 -0
- package/node_modules/pino/test/error.test.js +403 -0
- package/node_modules/pino/test/escaping.test.js +93 -0
- package/node_modules/pino/test/esm/esm.mjs +14 -0
- package/node_modules/pino/test/esm/index.test.js +21 -0
- package/node_modules/pino/test/esm/named-exports.mjs +29 -0
- package/node_modules/pino/test/exit.test.js +79 -0
- package/node_modules/pino/test/fixtures/broken-pipe/basic.js +9 -0
- package/node_modules/pino/test/fixtures/broken-pipe/destination.js +10 -0
- package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/node_modules/pino/test/fixtures/console-transport.js +13 -0
- package/node_modules/pino/test/fixtures/crashing-transport.js +13 -0
- package/node_modules/pino/test/fixtures/default-exit.js +8 -0
- package/node_modules/pino/test/fixtures/destination-exit.js +8 -0
- package/node_modules/pino/test/fixtures/eval/index.js +13 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +11 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +5 -0
- package/node_modules/pino/test/fixtures/noop-transport.js +10 -0
- package/node_modules/pino/test/fixtures/pretty/null-prototype.js +8 -0
- package/node_modules/pino/test/fixtures/stdout-hack-protection.js +11 -0
- package/node_modules/pino/test/fixtures/syncfalse-child.js +6 -0
- package/node_modules/pino/test/fixtures/syncfalse-exit.js +9 -0
- package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/node_modules/pino/test/fixtures/syncfalse.js +6 -0
- package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +2 -0
- package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/node_modules/pino/test/fixtures/to-file-transport.js +13 -0
- package/node_modules/pino/test/fixtures/to-file-transport.mjs +8 -0
- package/node_modules/pino/test/fixtures/transport/index.js +12 -0
- package/node_modules/pino/test/fixtures/transport/package.json +5 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately.js +11 -0
- package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +12 -0
- package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +26 -0
- package/node_modules/pino/test/fixtures/transport-main.js +9 -0
- package/node_modules/pino/test/fixtures/transport-many-lines.js +29 -0
- package/node_modules/pino/test/fixtures/transport-preload-main.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-preload.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-string-stdout.js +9 -0
- package/node_modules/pino/test/fixtures/transport-transform.js +21 -0
- package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +33 -0
- package/node_modules/pino/test/fixtures/transport-with-on-exit.js +12 -0
- package/node_modules/pino/test/fixtures/transport-worker-data.js +19 -0
- package/node_modules/pino/test/fixtures/transport-worker-name.js +24 -0
- package/node_modules/pino/test/fixtures/transport-worker.js +15 -0
- package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +3 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +15 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transpile.cjs +36 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transport-main.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-worker.ts +14 -0
- package/node_modules/pino/test/formatters.test.js +364 -0
- package/node_modules/pino/test/helper.d.ts +4 -0
- package/node_modules/pino/test/helper.js +155 -0
- package/node_modules/pino/test/hooks.test.js +114 -0
- package/node_modules/pino/test/http.test.js +214 -0
- package/node_modules/pino/test/internals/version.test.js +17 -0
- package/node_modules/pino/test/is-level-enabled.test.js +179 -0
- package/node_modules/pino/test/jest/basic.spec.js +10 -0
- package/node_modules/pino/test/levels.test.js +810 -0
- package/node_modules/pino/test/metadata.test.js +120 -0
- package/node_modules/pino/test/mixin-merge-strategy.test.js +57 -0
- package/node_modules/pino/test/mixin.test.js +241 -0
- package/node_modules/pino/test/multistream.test.js +729 -0
- package/node_modules/pino/test/redact.test.js +893 -0
- package/node_modules/pino/test/serializers.test.js +257 -0
- package/node_modules/pino/test/stdout-protection.test.js +41 -0
- package/node_modules/pino/test/syncfalse.test.js +186 -0
- package/node_modules/pino/test/timestamp-nano.test.js +37 -0
- package/node_modules/pino/test/timestamp.test.js +124 -0
- package/node_modules/pino/test/transport/big.test.js +42 -0
- package/node_modules/pino/test/transport/bundlers-support.test.js +99 -0
- package/node_modules/pino/test/transport/caller.test.js +24 -0
- package/node_modules/pino/test/transport/core.test.js +733 -0
- package/node_modules/pino/test/transport/core.transpiled.test.ts +114 -0
- package/node_modules/pino/test/transport/crash.test.js +36 -0
- package/node_modules/pino/test/transport/module-link.test.js +241 -0
- package/node_modules/pino/test/transport/native-type-stripping.test.mjs +151 -0
- package/node_modules/pino/test/transport/node-options.test.js +116 -0
- package/node_modules/pino/test/transport/pipeline.test.js +137 -0
- package/node_modules/pino/test/transport/preload.test.js +54 -0
- package/node_modules/pino/test/transport/repl.test.js +15 -0
- package/node_modules/pino/test/transport/sync-false.test.js +67 -0
- package/node_modules/pino/test/transport/sync-true.test.js +57 -0
- package/node_modules/pino/test/transport/targets.test.js +48 -0
- package/node_modules/pino/test/transport/uses-pino-config.test.js +166 -0
- package/node_modules/pino/test/transport-stream.test.js +40 -0
- package/node_modules/pino/test/types/pino-import.test-d.cts +30 -0
- package/node_modules/pino/test/types/pino-multistream.test-d.ts +28 -0
- package/node_modules/pino/test/types/pino-top-export.test-d.ts +34 -0
- package/node_modules/pino/test/types/pino-transport.test-d.ts +156 -0
- package/node_modules/pino/test/types/pino-type-only.test-d.ts +75 -0
- package/node_modules/pino/test/types/pino.test-d.ts +683 -0
- package/node_modules/pino/test/types/pino.ts +91 -0
- package/node_modules/pino/tsconfig.json +14 -0
- package/node_modules/pino-abstract-transport/.github/dependabot.yml +13 -0
- package/node_modules/pino-abstract-transport/.github/workflows/ci.yml +80 -0
- package/node_modules/pino-abstract-transport/.husky/pre-commit +4 -0
- package/node_modules/pino-abstract-transport/LICENSE +21 -0
- package/node_modules/pino-abstract-transport/README.md +171 -0
- package/node_modules/pino-abstract-transport/index.d.ts +122 -0
- package/node_modules/pino-abstract-transport/index.js +128 -0
- package/node_modules/pino-abstract-transport/package.json +41 -0
- package/node_modules/pino-abstract-transport/test/base.test.js +473 -0
- package/node_modules/pino-abstract-transport/test/fixtures/transport-async-iteration.js +22 -0
- package/node_modules/pino-abstract-transport/test/fixtures/transport-on-data.js +22 -0
- package/node_modules/pino-abstract-transport/test/fixtures/transport-transform.js +24 -0
- package/node_modules/pino-abstract-transport/test/fixtures/worker-pipeline.js +15 -0
- package/node_modules/pino-abstract-transport/test/match.js +24 -0
- package/node_modules/pino-abstract-transport/test/types/index.test-d.ts +31 -0
- package/node_modules/pino-abstract-transport/test/worker.test.js +372 -0
- package/node_modules/pino-std-serializers/.editorconfig +13 -0
- package/node_modules/pino-std-serializers/.github/dependabot.yml +13 -0
- package/node_modules/pino-std-serializers/.github/workflows/ci.yml +81 -0
- package/node_modules/pino-std-serializers/LICENSE +7 -0
- package/node_modules/pino-std-serializers/Readme.md +182 -0
- package/node_modules/pino-std-serializers/eslint.config.js +7 -0
- package/node_modules/pino-std-serializers/index.d.ts +145 -0
- package/node_modules/pino-std-serializers/index.js +36 -0
- package/node_modules/pino-std-serializers/lib/err-helpers.js +118 -0
- package/node_modules/pino-std-serializers/lib/err-proto.js +48 -0
- package/node_modules/pino-std-serializers/lib/err-with-cause.js +48 -0
- package/node_modules/pino-std-serializers/lib/err.js +45 -0
- package/node_modules/pino-std-serializers/lib/req.js +100 -0
- package/node_modules/pino-std-serializers/lib/res.js +47 -0
- package/node_modules/pino-std-serializers/package.json +42 -0
- package/node_modules/pino-std-serializers/test/err-with-cause.test.js +187 -0
- package/node_modules/pino-std-serializers/test/err.test.js +200 -0
- package/node_modules/pino-std-serializers/test/req.test.js +477 -0
- package/node_modules/pino-std-serializers/test/res.test.js +120 -0
- package/node_modules/pino-std-serializers/test/types/index.test-d.ts +71 -0
- package/node_modules/pino-std-serializers/tsconfig.json +13 -0
- package/node_modules/process-warning/.gitattributes +2 -0
- package/node_modules/process-warning/.github/dependabot.yml +13 -0
- package/node_modules/process-warning/.github/workflows/ci.yml +22 -0
- package/node_modules/process-warning/LICENSE +21 -0
- package/node_modules/process-warning/README.md +118 -0
- package/node_modules/process-warning/benchmarks/warn.js +25 -0
- package/node_modules/process-warning/eslint.config.js +6 -0
- package/node_modules/process-warning/examples/example.js +11 -0
- package/node_modules/process-warning/index.js +124 -0
- package/node_modules/process-warning/package.json +73 -0
- package/node_modules/process-warning/test/emit-interpolated-string.test.js +34 -0
- package/node_modules/process-warning/test/emit-once-only.test.js +33 -0
- package/node_modules/process-warning/test/emit-reset.test.js +40 -0
- package/node_modules/process-warning/test/emit-set.test.js +35 -0
- package/node_modules/process-warning/test/emit-unlimited.test.js +42 -0
- package/node_modules/process-warning/test/index.test.js +99 -0
- package/node_modules/process-warning/test/issue-88.test.js +38 -0
- package/node_modules/process-warning/test/jest.test.js +24 -0
- package/node_modules/process-warning/test/no-warnings.test.js +80 -0
- package/node_modules/process-warning/test/promise.js +10 -0
- package/node_modules/process-warning/types/index.d.ts +37 -0
- package/node_modules/process-warning/types/index.test-d.ts +36 -0
- package/node_modules/quick-format-unescaped/.github/workflows/ci.yml +21 -0
- package/node_modules/quick-format-unescaped/LICENSE +21 -0
- package/node_modules/quick-format-unescaped/benchmark.js +24 -0
- package/node_modules/quick-format-unescaped/index.js +109 -0
- package/node_modules/quick-format-unescaped/package.json +29 -0
- package/node_modules/quick-format-unescaped/readme.md +66 -0
- package/node_modules/quick-format-unescaped/test/index.js +136 -0
- package/node_modules/real-require/LICENSE.md +21 -0
- package/node_modules/real-require/README.md +51 -0
- package/node_modules/real-require/package.json +49 -0
- package/node_modules/real-require/src/index.js +14 -0
- package/node_modules/require-from-string/index.js +34 -0
- package/node_modules/require-from-string/license +21 -0
- package/node_modules/require-from-string/package.json +28 -0
- package/node_modules/require-from-string/readme.md +56 -0
- package/node_modules/ret/LICENSE +21 -0
- package/node_modules/ret/README.md +539 -0
- package/node_modules/ret/dist/index.d.ts +7 -0
- package/node_modules/ret/dist/index.js +26 -0
- package/node_modules/ret/dist/index.js.map +1 -0
- package/node_modules/ret/dist/reconstruct.d.ts +2 -0
- package/node_modules/ret/dist/reconstruct.js +77 -0
- package/node_modules/ret/dist/reconstruct.js.map +1 -0
- package/node_modules/ret/dist/sets-lookup.d.ts +5 -0
- package/node_modules/ret/dist/sets-lookup.js +51 -0
- package/node_modules/ret/dist/sets-lookup.js.map +1 -0
- package/node_modules/ret/dist/sets.d.ts +9 -0
- package/node_modules/ret/dist/sets.js +43 -0
- package/node_modules/ret/dist/sets.js.map +1 -0
- package/node_modules/ret/dist/tokenizer.d.ts +8 -0
- package/node_modules/ret/dist/tokenizer.js +361 -0
- package/node_modules/ret/dist/tokenizer.js.map +1 -0
- package/node_modules/ret/dist/types/index.d.ts +3 -0
- package/node_modules/ret/dist/types/index.js +16 -0
- package/node_modules/ret/dist/types/index.js.map +1 -0
- package/node_modules/ret/dist/types/set-lookup.d.ts +8 -0
- package/node_modules/ret/dist/types/set-lookup.js +3 -0
- package/node_modules/ret/dist/types/set-lookup.js.map +1 -0
- package/node_modules/ret/dist/types/tokens.d.ts +41 -0
- package/node_modules/ret/dist/types/tokens.js +3 -0
- package/node_modules/ret/dist/types/tokens.js.map +1 -0
- package/node_modules/ret/dist/types/types.d.ts +10 -0
- package/node_modules/ret/dist/types/types.js +15 -0
- package/node_modules/ret/dist/types/types.js.map +1 -0
- package/node_modules/ret/dist/util.d.ts +18 -0
- package/node_modules/ret/dist/util.js +82 -0
- package/node_modules/ret/dist/util.js.map +1 -0
- package/node_modules/ret/dist/write-set-tokens.d.ts +14 -0
- package/node_modules/ret/dist/write-set-tokens.js +108 -0
- package/node_modules/ret/dist/write-set-tokens.js.map +1 -0
- package/node_modules/ret/package.json +42 -0
- package/node_modules/reusify/.github/dependabot.yml +7 -0
- package/node_modules/reusify/.github/workflows/ci.yml +96 -0
- package/node_modules/reusify/LICENSE +22 -0
- package/node_modules/reusify/README.md +139 -0
- package/node_modules/reusify/SECURITY.md +15 -0
- package/node_modules/reusify/benchmarks/createNoCodeFunction.js +30 -0
- package/node_modules/reusify/benchmarks/fib.js +13 -0
- package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +38 -0
- package/node_modules/reusify/eslint.config.js +14 -0
- package/node_modules/reusify/package.json +50 -0
- package/node_modules/reusify/reusify.d.ts +14 -0
- package/node_modules/reusify/reusify.js +33 -0
- package/node_modules/reusify/test.js +66 -0
- package/node_modules/reusify/tsconfig.json +11 -0
- package/node_modules/rfdc/.github/workflows/ci.yml +21 -0
- package/node_modules/rfdc/LICENSE +15 -0
- package/node_modules/rfdc/default.js +3 -0
- package/node_modules/rfdc/index.d.ts +13 -0
- package/node_modules/rfdc/index.js +198 -0
- package/node_modules/rfdc/index.test-d.ts +13 -0
- package/node_modules/rfdc/package.json +73 -0
- package/node_modules/rfdc/readme.md +181 -0
- package/node_modules/rfdc/test/index.js +306 -0
- package/node_modules/safe-regex2/.gitattributes +2 -0
- package/node_modules/safe-regex2/.github/dependabot.yml +13 -0
- package/node_modules/safe-regex2/.github/workflows/ci.yml +33 -0
- package/node_modules/safe-regex2/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/safe-regex2/LICENSE +21 -0
- package/node_modules/safe-regex2/README.md +68 -0
- package/node_modules/safe-regex2/bin/safe-regex2.js +58 -0
- package/node_modules/safe-regex2/eslint.config.js +6 -0
- package/node_modules/safe-regex2/example/safe.js +5 -0
- package/node_modules/safe-regex2/index.js +76 -0
- package/node_modules/safe-regex2/package.json +78 -0
- package/node_modules/safe-regex2/test/regex.test.js +58 -0
- package/node_modules/safe-regex2/types/index.d.ts +9 -0
- package/node_modules/safe-regex2/types/index.test-d.ts +12 -0
- package/node_modules/safe-stable-stringify/LICENSE +21 -0
- package/node_modules/safe-stable-stringify/esm/package.json +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.d.ts +4 -0
- package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
- package/node_modules/safe-stable-stringify/index.d.ts +22 -0
- package/node_modules/safe-stable-stringify/index.js +625 -0
- package/node_modules/safe-stable-stringify/package.json +65 -0
- package/node_modules/safe-stable-stringify/readme.md +179 -0
- package/node_modules/secure-json-parse/.airtap.yml +7 -0
- package/node_modules/secure-json-parse/.gitattributes +2 -0
- package/node_modules/secure-json-parse/.github/dependabot.yml +13 -0
- package/node_modules/secure-json-parse/.github/stale.yml +21 -0
- package/node_modules/secure-json-parse/.github/workflows/ci.yml +149 -0
- package/node_modules/secure-json-parse/LICENSE +19 -0
- package/node_modules/secure-json-parse/README.md +132 -0
- package/node_modules/secure-json-parse/benchmarks/ignore.js +35 -0
- package/node_modules/secure-json-parse/benchmarks/no__proto__.js +40 -0
- package/node_modules/secure-json-parse/benchmarks/package.json +15 -0
- package/node_modules/secure-json-parse/benchmarks/remove.js +39 -0
- package/node_modules/secure-json-parse/benchmarks/throw.js +49 -0
- package/node_modules/secure-json-parse/benchmarks/valid.js +49 -0
- package/node_modules/secure-json-parse/eslint.config.js +6 -0
- package/node_modules/secure-json-parse/index.js +161 -0
- package/node_modules/secure-json-parse/package.json +74 -0
- package/node_modules/secure-json-parse/test/index.test.js +649 -0
- package/node_modules/secure-json-parse/types/index.d.ts +60 -0
- package/node_modules/secure-json-parse/types/index.test-d.ts +43 -0
- package/node_modules/semver/LICENSE +15 -0
- package/node_modules/semver/README.md +680 -0
- package/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/semver/classes/index.js +7 -0
- package/node_modules/semver/classes/range.js +573 -0
- package/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/semver/functions/major.js +5 -0
- package/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/semver/index.js +93 -0
- package/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/semver/internal/re.js +223 -0
- package/node_modules/semver/package.json +78 -0
- package/node_modules/semver/preload.js +4 -0
- package/node_modules/semver/range.bnf +17 -0
- package/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/set-cookie-parser/LICENSE +21 -0
- package/node_modules/set-cookie-parser/README.md +202 -0
- package/node_modules/set-cookie-parser/lib/set-cookie.js +242 -0
- package/node_modules/set-cookie-parser/package.json +45 -0
- package/node_modules/setprototypeof/LICENSE +13 -0
- package/node_modules/setprototypeof/README.md +31 -0
- package/node_modules/setprototypeof/index.d.ts +2 -0
- package/node_modules/setprototypeof/index.js +17 -0
- package/node_modules/setprototypeof/package.json +38 -0
- package/node_modules/setprototypeof/test/index.js +24 -0
- package/node_modules/sonic-boom/.eslintignore +2 -0
- package/node_modules/sonic-boom/.taprc +3 -0
- package/node_modules/sonic-boom/LICENSE +21 -0
- package/node_modules/sonic-boom/README.md +153 -0
- package/node_modules/sonic-boom/bench.js +98 -0
- package/node_modules/sonic-boom/check.js +18 -0
- package/node_modules/sonic-boom/example.js +8 -0
- package/node_modules/sonic-boom/fixtures/firehose.js +22 -0
- package/node_modules/sonic-boom/index.js +733 -0
- package/node_modules/sonic-boom/package.json +52 -0
- package/node_modules/sonic-boom/test/destroy.test.js +49 -0
- package/node_modules/sonic-boom/test/end.test.js +98 -0
- package/node_modules/sonic-boom/test/flush-sync.test.js +140 -0
- package/node_modules/sonic-boom/test/flush.test.js +419 -0
- package/node_modules/sonic-boom/test/fsync.test.js +63 -0
- package/node_modules/sonic-boom/test/helper.js +42 -0
- package/node_modules/sonic-boom/test/minlength.test.js +35 -0
- package/node_modules/sonic-boom/test/mode.test.js +116 -0
- package/node_modules/sonic-boom/test/periodicflush.test.js +61 -0
- package/node_modules/sonic-boom/test/reopen.test.js +239 -0
- package/node_modules/sonic-boom/test/retry.test.js +414 -0
- package/node_modules/sonic-boom/test/sync.test.js +261 -0
- package/node_modules/sonic-boom/test/write.test.js +515 -0
- package/node_modules/sonic-boom/types/index.d.ts +63 -0
- package/node_modules/sonic-boom/types/tests/test.ts +4 -0
- package/node_modules/split2/LICENSE +13 -0
- package/node_modules/split2/README.md +85 -0
- package/node_modules/split2/bench.js +27 -0
- package/node_modules/split2/index.js +141 -0
- package/node_modules/split2/package.json +39 -0
- package/node_modules/split2/test.js +409 -0
- package/node_modules/statuses/HISTORY.md +87 -0
- package/node_modules/statuses/LICENSE +23 -0
- package/node_modules/statuses/README.md +139 -0
- package/node_modules/statuses/codes.json +65 -0
- package/node_modules/statuses/index.js +146 -0
- package/node_modules/statuses/package.json +49 -0
- package/node_modules/thread-stream/.claude/settings.local.json +15 -0
- package/node_modules/thread-stream/.github/dependabot.yml +13 -0
- package/node_modules/thread-stream/.github/workflows/ci.yml +74 -0
- package/node_modules/thread-stream/LICENSE +21 -0
- package/node_modules/thread-stream/README.md +138 -0
- package/node_modules/thread-stream/bench.js +85 -0
- package/node_modules/thread-stream/eslint.config.js +10 -0
- package/node_modules/thread-stream/index.d.ts +99 -0
- package/node_modules/thread-stream/index.js +645 -0
- package/node_modules/thread-stream/lib/indexes.js +11 -0
- package/node_modules/thread-stream/lib/wait.js +77 -0
- package/node_modules/thread-stream/lib/worker.js +298 -0
- package/node_modules/thread-stream/node_modules/real-require/LICENSE.md +21 -0
- package/node_modules/thread-stream/node_modules/real-require/README.md +51 -0
- package/node_modules/thread-stream/node_modules/real-require/package.json +38 -0
- package/node_modules/thread-stream/node_modules/real-require/src/index.js +14 -0
- package/node_modules/thread-stream/package.json +50 -0
- package/node_modules/thread-stream/test/base.test.js +259 -0
- package/node_modules/thread-stream/test/bench.test.js +38 -0
- package/node_modules/thread-stream/test/bundlers.test.js +59 -0
- package/node_modules/thread-stream/test/close-on-gc.js +37 -0
- package/node_modules/thread-stream/test/commonjs-fallback.test.js +75 -0
- package/node_modules/thread-stream/test/context.test.js +21 -0
- package/node_modules/thread-stream/test/create-and-exit.js +16 -0
- package/node_modules/thread-stream/test/custom-worker.js +9 -0
- package/node_modules/thread-stream/test/dir with spaces/test-package.zip +0 -0
- package/node_modules/thread-stream/test/emit-event.js +22 -0
- package/node_modules/thread-stream/test/end.test.js +56 -0
- package/node_modules/thread-stream/test/error.js +14 -0
- package/node_modules/thread-stream/test/esm.test.mjs +46 -0
- package/node_modules/thread-stream/test/event.test.js +24 -0
- package/node_modules/thread-stream/test/exit.js +14 -0
- package/node_modules/thread-stream/test/flush-worker.js +68 -0
- package/node_modules/thread-stream/test/flush.test.js +112 -0
- package/node_modules/thread-stream/test/get-context.js +22 -0
- package/node_modules/thread-stream/test/helper.d.ts +1 -0
- package/node_modules/thread-stream/test/helper.js +26 -0
- package/node_modules/thread-stream/test/indexes.test.js +11 -0
- package/node_modules/thread-stream/test/message-without-code.js +19 -0
- package/node_modules/thread-stream/test/multibyte-chars.test.mjs +75 -0
- package/node_modules/thread-stream/test/multibyte-overrun.test.mjs +33 -0
- package/node_modules/thread-stream/test/on-message.js +18 -0
- package/node_modules/thread-stream/test/pkg/index.js +37 -0
- package/node_modules/thread-stream/test/pkg/pkg.config.json +14 -0
- package/node_modules/thread-stream/test/pkg/pkg.test.js +45 -0
- package/node_modules/thread-stream/test/port.js +16 -0
- package/node_modules/thread-stream/test/post-message.test.js +23 -0
- package/node_modules/thread-stream/test/report-thread-name.js +16 -0
- package/node_modules/thread-stream/test/string-limit-2.test.js +35 -0
- package/node_modules/thread-stream/test/string-limit.test.js +37 -0
- package/node_modules/thread-stream/test/syntax-error.mjs +2 -0
- package/node_modules/thread-stream/test/thread-management.test.js +150 -0
- package/node_modules/thread-stream/test/to-file-on-destroy.js +23 -0
- package/node_modules/thread-stream/test/to-file-on-final.js +24 -0
- package/node_modules/thread-stream/test/to-file.js +12 -0
- package/node_modules/thread-stream/test/to-file.mjs +8 -0
- package/node_modules/thread-stream/test/to-next.js +9 -0
- package/node_modules/thread-stream/test/transpiled.test.js +29 -0
- package/node_modules/thread-stream/test/ts/to-file.ts +10 -0
- package/node_modules/thread-stream/test/ts/transpile.sh +19 -0
- package/node_modules/thread-stream/test/ts-commonjs-default-export.zip +0 -0
- package/node_modules/thread-stream/test/ts-native.test.mjs +35 -0
- package/node_modules/thread-stream/test/ts-node-fallback.test.js +35 -0
- package/node_modules/thread-stream/test/uncaughtException.js +21 -0
- package/node_modules/thread-stream/test/unhandledRejection.js +21 -0
- package/node_modules/thread-stream/test/watch-mode.test.js +30 -0
- package/node_modules/thread-stream/test/worker-name.test.js +43 -0
- package/node_modules/thread-stream/test/yarnrc.yml +7 -0
- package/node_modules/thread-stream/tsconfig.json +8 -0
- package/node_modules/toad-cache/LICENSE +21 -0
- package/node_modules/toad-cache/README.md +265 -0
- package/node_modules/toad-cache/dist/toad-cache.cjs +878 -0
- package/node_modules/toad-cache/dist/toad-cache.mjs +852 -0
- package/node_modules/toad-cache/package.json +84 -0
- package/node_modules/toad-cache/toad-cache.d.cts +138 -0
- package/node_modules/toad-cache/toad-cache.d.ts +128 -0
- package/node_modules/toidentifier/HISTORY.md +9 -0
- package/node_modules/toidentifier/LICENSE +21 -0
- package/node_modules/toidentifier/README.md +61 -0
- package/node_modules/toidentifier/index.js +32 -0
- package/node_modules/toidentifier/package.json +38 -0
- package/package.json +43 -20
- package/scripts/build-local.sh +10 -11
- package/scripts/check-app-path-boundaries.mjs +121 -0
- package/scripts/check-app-spec.mjs +127 -25
- package/scripts/check-colima-launchd.mjs +26 -22
- package/scripts/check-integration-isolation.ts +541 -0
- package/scripts/check-new-file-tests.mjs +16 -47
- package/scripts/check-open-core-boundaries.mjs +334 -0
- package/scripts/check-test-layering.sh +86 -0
- 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 +147 -0
- package/scripts/local-web-upgrade-test.example.env +54 -0
- package/scripts/local-web-upgrade-test.sh +894 -0
- package/scripts/pack-gui-and-send-pi.sh +41 -0
- package/scripts/pack-with-gui.mjs +391 -0
- package/scripts/perf/instances.js +1 -1
- package/scripts/prune-open-core-dist.mjs +91 -0
- package/scripts/run.sh +24 -25
- package/scripts/setup-pi.sh +2 -2
- package/scripts/smoke/hermes-bootstrap.sh +7 -7
- package/scripts/smoke-backend.mjs +33 -1
- package/templates/hermes-entrypoint.sh +19 -29
- package/apps/openwebui-container.yaml +0 -97
- package/apps/playwright-container.yaml +0 -126
- package/dist/cli/panel.d.ts +0 -27
- package/dist/cli/panel.js +0 -805
- package/dist/cli/panel.js.map +0 -1
- 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 -15
- package/dist/routes/agent-apps.js +0 -78
- package/dist/routes/agent-apps.js.map +0 -1
- package/dist/routes/internal.d.ts +0 -2
- package/dist/routes/internal.js +0 -59
- package/dist/routes/internal.js.map +0 -1
- package/dist/routes/runtime.d.ts +0 -15
- package/dist/routes/runtime.js +0 -69
- 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 -223
- 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 -172
- package/dist/services/app/app-compiler.js.map +0 -1
- package/dist/services/app/app-manager.d.ts +0 -174
- package/dist/services/app/app-manager.js +0 -2741
- 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 -285
- 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 -292
- 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 -207
- 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 -1210
- package/dist/services/app/openclaw-manager.js.map +0 -1
- package/dist/services/app/paths.d.ts +0 -47
- package/dist/services/app/paths.js +0 -68
- 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 -112
- 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 -72
- package/dist/services/app/types.js +0 -16
- package/dist/services/app/types.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-manager.d.ts +0 -264
- package/dist/services/backup-manager.js +0 -2264
- 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 -123
- 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 -106
- package/dist/services/capability-registry.js +0 -313
- package/dist/services/capability-registry.js.map +0 -1
- package/dist/services/connection-apply.d.ts +0 -91
- package/dist/services/connection-apply.js +0 -475
- 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 -351
- package/dist/services/connection-transactor.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 -1075
- 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-manager.d.ts +0 -191
- package/dist/services/instance-manager.js +0 -1296
- package/dist/services/instance-manager.js.map +0 -1
- package/dist/services/macos-launchd.d.ts +0 -89
- package/dist/services/macos-launchd.js +0 -273
- package/dist/services/macos-launchd.js.map +0 -1
- package/dist/services/nomad-manager.d.ts +0 -290
- package/dist/services/nomad-manager.js +0 -3953
- 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/panel-manager.d.ts +0 -50
- package/dist/services/panel-manager.js +0 -472
- package/dist/services/panel-manager.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 -146
- 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 -1631
- 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-routes.d.ts +0 -23
- package/dist/services/runtime/adapters/openclaw-routes.js +0 -1014
- package/dist/services/runtime/adapters/openclaw-routes.js.map +0 -1
- package/dist/services/runtime/adapters/openclaw.d.ts +0 -393
- package/dist/services/runtime/adapters/openclaw.js +0 -3853
- 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.d.ts +0 -54
- package/dist/services/runtime/mcp-shims/drive-shim.js +0 -489
- package/dist/services/runtime/mcp-shims/drive-shim.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/setup-manager.d.ts +0 -136
- package/dist/services/setup-manager.js +0 -2149
- 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/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 -323
- 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/public/assets/ApiKeyField-CvyAOcJS.js +0 -1
- package/public/assets/Dashboard-AuJESBlJ.js +0 -1
- package/public/assets/HermesChatPanel-CByPREwb.js +0 -1
- package/public/assets/HermesConfigForm-DRda8FKX.js +0 -4
- package/public/assets/InitPassword-ka4wNpM5.js +0 -1
- package/public/assets/InstanceDetail-Cg1nS8HX.js +0 -92
- package/public/assets/Login-aPajuQzf.js +0 -1
- package/public/assets/NewInstance-Dd1ebNIx.js +0 -1
- package/public/assets/ProviderRecommendations-DFmADQ7V.js +0 -1
- package/public/assets/Settings-BYQnbLYL.js +0 -1
- package/public/assets/Setup-D05lwDOV.js +0 -1
- package/public/assets/WeixinLoginPanel-D89kdhP4.js +0 -9
- package/public/assets/index-HSXCsceK.css +0 -1
- package/public/assets/index-bnBu0nlQ.js +0 -19
- package/public/assets/registry-C_qeFTkZ.js +0 -2
- package/public/assets/usePolling-Bn93fe7M.js +0 -1
- package/public/assets/vendor-i18n-flxcMVeP.js +0 -9
- package/public/assets/vendor-react-ZC5T_huj.js +0 -59
- package/public/index.html +0 -20
- package/scripts/build-image.sh +0 -55
- package/scripts/check-adapter-isolation.ts +0 -293
- package/scripts/check-i18n.mjs +0 -154
- /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/{plugin-installer.d.ts → setup/plugin-installer.d.ts} +0 -0
- /package/dist/services/{system-monitor.d.ts → system/system-monitor.d.ts} +0 -0
- /package/{public → node_modules/jishushell-panel/output/public}/assets/logo-black-theme-DywLAtFy.png +0 -0
- /package/{public → node_modules/jishushell-panel/output/public}/assets/logo-white-theme-DXffFAWw.png +0 -0
- /package/{public → node_modules/jishushell-panel/output/public}/favicon.png +0 -0
- /package/{public → node_modules/jishushell-panel/output/public}/logos/hermes.png +0 -0
- /package/{public → node_modules/jishushell-panel/output/public}/logos/ollama.png +0 -0
- /package/{public → node_modules/jishushell-panel/output/public}/logos/openclaw.svg +0 -0
|
@@ -1,3853 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenClawAdapter — the framework face of OpenClaw business logic.
|
|
3
|
-
*
|
|
4
|
-
* Per §32.2 / §32.8 of docs/multi-agent-runtime-generalization-plan.md, the
|
|
5
|
-
* goal of this file is simple: **all OpenClaw-specific knowledge leaves the
|
|
6
|
-
* framework (instance-manager / nomad-manager / routes) and lives here**.
|
|
7
|
-
*
|
|
8
|
-
* Why not a huge rewrite in a single pass?
|
|
9
|
-
* A full physical migration of ~6500 lines of OpenClaw code out of
|
|
10
|
-
* `instance-manager.ts` / `nomad-manager.ts` / `setup-manager.ts` is a
|
|
11
|
-
* multi-PR undertaking. This file lands the **structural** decoupling
|
|
12
|
-
* (contract + dispatch) today, so:
|
|
13
|
-
*
|
|
14
|
-
* 1. Every framework call site now goes through `getAdapter(agentType).X()`
|
|
15
|
-
* with zero string-literal branching on "openclaw" / "hermes".
|
|
16
|
-
* 2. OpenClaw-specific imperative logic that was already contained (Nomad
|
|
17
|
-
* task build, on-disk patches, npm update seed, pairing CLI mapping)
|
|
18
|
-
* is physically moved into this file.
|
|
19
|
-
* 3. Larger pieces that are still entangled inside instance-manager.ts
|
|
20
|
-
* (`saveConfig` with channel-plugin auto-install, `createInstance`
|
|
21
|
-
* with `openclaw.json` seeding) are exposed through adapter hooks
|
|
22
|
-
* that framework code calls, and the physical code move from
|
|
23
|
-
* instance-manager.ts into a sibling `openclaw-*.ts` file is a
|
|
24
|
-
* straightforward follow-up PR — the `check-adapter-isolation.ts`
|
|
25
|
-
* script (§32.2.1) will block any new code from sneaking back into
|
|
26
|
-
* the framework layer.
|
|
27
|
-
*
|
|
28
|
-
* The user contract for adding a THIRD agent is therefore already satisfied
|
|
29
|
-
* even before the follow-up physical migration:
|
|
30
|
-
*
|
|
31
|
-
* 1. Create `src/services/runtime/adapters/foo.ts` mirroring this file.
|
|
32
|
-
* 2. Add `import "./adapters/foo.js"` to `src/services/runtime/index.ts`.
|
|
33
|
-
* 3. Add one line to `frontend/src/runtimes/registry.ts`.
|
|
34
|
-
* 4. Done. No `instance-manager.ts` / `nomad-manager.ts` / routes edits.
|
|
35
|
-
*/
|
|
36
|
-
import { execFile, execFileSync } from "child_process";
|
|
37
|
-
import { accessSync, chmodSync, chownSync, copyFileSync, cpSync, constants, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync, } from "fs";
|
|
38
|
-
import { createHash, randomBytes } from "crypto";
|
|
39
|
-
import { homedir, userInfo } from "os";
|
|
40
|
-
import { delimiter, dirname, join, resolve as pathResolve } from "path";
|
|
41
|
-
import { getNomadDriver, getOpenclawDockerImage, JISHUSHELL_HOME, getPanelConfig, } from "../../../config.js";
|
|
42
|
-
import { LEGACY_PROVIDER_API_ALIASES } from "../../../constants.js";
|
|
43
|
-
import { ensureDirContainer, ensureDirHost, writeConfigFile } from "../../../utils/fs.js";
|
|
44
|
-
import { safeWriteJson } from "../../../utils/safe-json.js";
|
|
45
|
-
import { compileTaskRuntime } from "../../app/app-compiler.js";
|
|
46
|
-
import { allocateGatewayPort, chownToServiceUser, extractGatewayPort, getInstance, getRuntimeEnv, getRuntimeEnvFiles, inferProviderApiKeyEnvName, listInstances, normalizePath, notifyConfigChange, releasePendingPort, resolveServiceUser, updateEnvFile, } from "../../instance-manager.js";
|
|
47
|
-
import { getInstanceDir as framework_instanceDir, instanceMetaPath } from "../../../config.js";
|
|
48
|
-
import { createTask, emitTask, spawnWithTask, getDirSizeMB, npmProgressParser, dockerBuildProgressParser, resolveDockerInvocation, } from "../../setup-manager.js";
|
|
49
|
-
import { DEFAULT_OPENCLAW_DOCKER_IMAGE, setOpenclawDockerImage, OPENCLAW_MODULES, OPENCLAW_PKG_DIR, } from "../../../config.js";
|
|
50
|
-
import { fileURLToPath } from "node:url";
|
|
51
|
-
import { bootstrapInstanceProxy, decryptApiKey, getInstanceConfig as getProxyInstanceConfig } from "../../llm-proxy/index.js";
|
|
52
|
-
import { registerAdapter } from "../registry.js";
|
|
53
|
-
import { registerOpenclawRoutes } from "./openclaw-routes.js";
|
|
54
|
-
// ── Constants physically migrated from nomad-manager.ts ───────────────
|
|
55
|
-
//
|
|
56
|
-
// These used to live as module-scope constants in nomad-manager.ts and were
|
|
57
|
-
// read by `buildTaskDocker` / `buildRuntime` helpers. They describe how
|
|
58
|
-
// OpenClaw expects to be launched — container image paths, default command,
|
|
59
|
-
// memory ceilings — and therefore belong to the OpenClaw adapter, not the
|
|
60
|
-
// Nomad scheduler.
|
|
61
|
-
const DEFAULT_COMMAND = "/usr/bin/openclaw";
|
|
62
|
-
const DEFAULT_ARGS = ["gateway", "run", "--port", "18789", "--allow-unconfigured"];
|
|
63
|
-
const DEFAULT_USER = userInfo().username;
|
|
64
|
-
const DEFAULT_CWD = homedir();
|
|
65
|
-
const DEFAULT_ENV = {
|
|
66
|
-
HOME: homedir(),
|
|
67
|
-
TMPDIR: "/tmp",
|
|
68
|
-
PATH: `${homedir()}/.local/bin:${homedir()}/.npm-global/bin:${homedir()}/bin:${homedir()}/.volta/bin:` +
|
|
69
|
-
`${homedir()}/.asdf/shims:${homedir()}/.bun/bin:${homedir()}/.nvm/current/bin:${homedir()}/.fnm/current/bin:` +
|
|
70
|
-
`${homedir()}/.local/share/pnpm:/usr/local/bin:/usr/bin:/bin`,
|
|
71
|
-
};
|
|
72
|
-
const DEFAULT_RESOURCES = { CPU: 500, MemoryMB: 512 };
|
|
73
|
-
const DEFAULT_PIDS_LIMIT = 512;
|
|
74
|
-
// Hard upper bounds applied before submitting any Nomad job. Prevents a
|
|
75
|
-
// misconfigured or malicious instance config from exhausting scheduler
|
|
76
|
-
// resources on the host (no Nomad Enterprise Resource Quotas in OSS).
|
|
77
|
-
const MAX_CPU_MHZ = 4000;
|
|
78
|
-
const MAX_MEMORY_MB = 4096;
|
|
79
|
-
const MAX_MEMORY_MAX_MB = 4096;
|
|
80
|
-
// Path inside the openclaw-runtime Docker image where the baked-in openclaw
|
|
81
|
-
// npm package lives. Referenced by the entrypoint shim as the fallback and
|
|
82
|
-
// used by the control-UI "Update now" path through a pre-seeded symlink in
|
|
83
|
-
// $HOME/.npm-global (see ensureOpenclawUpdateSeed below).
|
|
84
|
-
const CONTAINER_IMAGE_PKG_ROOT = "/app/node_modules/openclaw";
|
|
85
|
-
const VALID_USER_RE = /^[a-z0-9._-]{1,32}$/;
|
|
86
|
-
const DOCKER_IMAGE_RE = /^[a-zA-Z0-9][a-zA-Z0-9\-_.:/@]*$/;
|
|
87
|
-
const MAX_DOCKER_IMAGE_NAME_LEN = 256;
|
|
88
|
-
export const OPENCLAW_DEFAULT_GATEWAY_PORT = 18789;
|
|
89
|
-
// ── Capability profile (moved from runtime/instance.ts) ──────────────
|
|
90
|
-
//
|
|
91
|
-
// Describes what the framework should expose for OpenClaw instances. The
|
|
92
|
-
// frontend uses this to decide which tabs render and how the Chat tab looks.
|
|
93
|
-
const DEFAULT_CAPABILITIES = {
|
|
94
|
-
gateway: {
|
|
95
|
-
http: true,
|
|
96
|
-
websocket: true,
|
|
97
|
-
chatPanel: "iframe",
|
|
98
|
-
},
|
|
99
|
-
pairing: {
|
|
100
|
-
list: true,
|
|
101
|
-
approve: true,
|
|
102
|
-
revoke: false,
|
|
103
|
-
clearPending: false,
|
|
104
|
-
},
|
|
105
|
-
configEditor: "json",
|
|
106
|
-
configSchema: false,
|
|
107
|
-
customProvider: true,
|
|
108
|
-
pluginInstall: true,
|
|
109
|
-
skills: true,
|
|
110
|
-
mcp: true,
|
|
111
|
-
memory: true,
|
|
112
|
-
backupRestore: true,
|
|
113
|
-
usageStats: true,
|
|
114
|
-
restartlessReload: false,
|
|
115
|
-
messagingPlatforms: ["feishu", "openclaw-weixin"],
|
|
116
|
-
};
|
|
117
|
-
import { FILES_ROOT } from "../../../config.js";
|
|
118
|
-
import { defaultMountsForNewInstance, ensureMountTargets, } from "../../files-mounts.js";
|
|
119
|
-
/**
|
|
120
|
-
* Tolerate both `fileMounts` and `file_mounts` in instance.json — some
|
|
121
|
-
* earlier migrations may have written snake_case.
|
|
122
|
-
*/
|
|
123
|
-
function readFileMounts(runtime) {
|
|
124
|
-
const raw = runtime.fileMounts ?? runtime.file_mounts;
|
|
125
|
-
return Array.isArray(raw) ? raw : [];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Build the volume list for the docker driver:
|
|
129
|
-
* 1. The existing openclaw-home self-mount (HOME == container HOME)
|
|
130
|
-
* 2. The root FILES_ROOT bind when any mount has empty path
|
|
131
|
-
* ({"path":"","alias":"","mode":"rw"} — the default for new
|
|
132
|
-
* instances). Without this, in-container plugins (Feishu / WeChat
|
|
133
|
-
* send_file) try `fs.open("/home/.../files/...")` and hit ENOENT
|
|
134
|
-
* because the host path isn't bind-mounted. Verified on pi2
|
|
135
|
-
* 2026-05-11: claw1's drive_resolve_local_path returned a valid
|
|
136
|
-
* abs_path; feishu_im_user_message then ENOENT'd on it.
|
|
137
|
-
* 3. One additional bind per non-root FileMount, host==container so
|
|
138
|
-
* the workspace/{alias} symlink (placed by rebuildWorkspace)
|
|
139
|
-
* resolves identically inside the container.
|
|
140
|
-
*
|
|
141
|
-
* Mode "ro" is enforced by the docker bind option; raw_exec / process
|
|
142
|
-
* modes don't go through this path (the agent runs natively on the host
|
|
143
|
-
* and reads files directly).
|
|
144
|
-
*/
|
|
145
|
-
function buildVolumes(openclawHome, runtime) {
|
|
146
|
-
const list = [`${openclawHome}:${openclawHome}:rw`];
|
|
147
|
-
let rootBound = false;
|
|
148
|
-
for (const m of readFileMounts(runtime)) {
|
|
149
|
-
if (!m)
|
|
150
|
-
continue;
|
|
151
|
-
const mode = m.mode === "ro" ? "ro" : "rw";
|
|
152
|
-
if (!m.path) {
|
|
153
|
-
if (rootBound)
|
|
154
|
-
continue;
|
|
155
|
-
list.push(`${FILES_ROOT}:${FILES_ROOT}:${mode}`);
|
|
156
|
-
rootBound = true;
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
if (rootBound)
|
|
160
|
-
continue; // root already covers every subtree
|
|
161
|
-
const abs = join(FILES_ROOT, m.path);
|
|
162
|
-
list.push(`${abs}:${abs}:${mode}`);
|
|
163
|
-
}
|
|
164
|
-
return list;
|
|
165
|
-
}
|
|
166
|
-
// ── Path helpers (physically migrated from instance-manager.ts) ───────
|
|
167
|
-
const INSTANCE_OPENCLAW_HOME_DIRNAME = "openclaw-home";
|
|
168
|
-
const INSTANCE_MODEL_ENV_FILENAME = "model.env";
|
|
169
|
-
const OPENCLAW_STATE_DIRNAME = ".openclaw";
|
|
170
|
-
const OPENCLAW_CONFIG_FILENAME = "openclaw.json";
|
|
171
|
-
function defaultOpenclawHome(instanceId) {
|
|
172
|
-
return join(framework_instanceDir(instanceId), INSTANCE_OPENCLAW_HOME_DIRNAME);
|
|
173
|
-
}
|
|
174
|
-
function defaultOpenclawModelEnvFile(instanceId) {
|
|
175
|
-
return join(framework_instanceDir(instanceId), INSTANCE_MODEL_ENV_FILENAME);
|
|
176
|
-
}
|
|
177
|
-
function isPrecreatedManagedAppDir(dir) {
|
|
178
|
-
return existsSync(join(dir, "app-spec.yaml")) && existsSync(join(dir, "manifest.json"));
|
|
179
|
-
}
|
|
180
|
-
function openclawConfigPath(instanceId, home) {
|
|
181
|
-
const h = home ?? defaultOpenclawHome(instanceId);
|
|
182
|
-
return join(h, OPENCLAW_STATE_DIRNAME, OPENCLAW_CONFIG_FILENAME);
|
|
183
|
-
}
|
|
184
|
-
function legacyOpenclawConfigPath(instanceId, home) {
|
|
185
|
-
const h = home ?? defaultOpenclawHome(instanceId);
|
|
186
|
-
return join(h, OPENCLAW_CONFIG_FILENAME);
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Resolve the most relevant openclaw.json path for a SOURCE instance used
|
|
190
|
-
* by the clone_from branch. Prefers the .openclaw/ state dir, falls back
|
|
191
|
-
* to the legacy flat path so clones of old instances still work.
|
|
192
|
-
*/
|
|
193
|
-
function resolveExistingConfigPath(instanceId) {
|
|
194
|
-
const runtimePath = openclawConfigPath(instanceId);
|
|
195
|
-
if (existsSync(runtimePath))
|
|
196
|
-
return runtimePath;
|
|
197
|
-
const legacy = legacyOpenclawConfigPath(instanceId);
|
|
198
|
-
if (existsSync(legacy))
|
|
199
|
-
return legacy;
|
|
200
|
-
return runtimePath;
|
|
201
|
-
}
|
|
202
|
-
// ── Runtime + config defaults (physically migrated) ───────────────────
|
|
203
|
-
function resolveOpenclawBin() {
|
|
204
|
-
const candidates = [
|
|
205
|
-
join(JISHUSHELL_HOME, "packages", "openclaw", "bin", "openclaw"),
|
|
206
|
-
"/usr/local/bin/openclaw",
|
|
207
|
-
"/usr/bin/openclaw",
|
|
208
|
-
];
|
|
209
|
-
for (const p of candidates) {
|
|
210
|
-
if (existsSync(p)) {
|
|
211
|
-
try {
|
|
212
|
-
chmodSync(p, 0o755);
|
|
213
|
-
}
|
|
214
|
-
catch {
|
|
215
|
-
/* best effort — may be a symlink */
|
|
216
|
-
}
|
|
217
|
-
try {
|
|
218
|
-
const real = realpathSync(p);
|
|
219
|
-
if (real !== p)
|
|
220
|
-
chmodSync(real, 0o755);
|
|
221
|
-
}
|
|
222
|
-
catch {
|
|
223
|
-
/* best effort */
|
|
224
|
-
}
|
|
225
|
-
return p;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
// Fallback: scan $PATH for user-installed openclaw (nvm, homebrew, etc.)
|
|
229
|
-
// Uses in-process lookup instead of spawning `which` for security and performance.
|
|
230
|
-
const fromPath = findExecutableOnPath("openclaw");
|
|
231
|
-
if (fromPath)
|
|
232
|
-
return fromPath;
|
|
233
|
-
return candidates[0]; // will fail with clear error at spawn
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Search $PATH for an executable by name. Returns the first match or null.
|
|
237
|
-
* Does not chmod the result — PATH-discovered binaries are not managed by JishuShell.
|
|
238
|
-
*/
|
|
239
|
-
function findExecutableOnPath(name) {
|
|
240
|
-
const pathEnv = process.env.PATH || "";
|
|
241
|
-
for (const dir of pathEnv.split(delimiter)) {
|
|
242
|
-
if (!dir)
|
|
243
|
-
continue;
|
|
244
|
-
const candidate = join(dir, name);
|
|
245
|
-
try {
|
|
246
|
-
accessSync(candidate, constants.X_OK);
|
|
247
|
-
return candidate;
|
|
248
|
-
}
|
|
249
|
-
catch {
|
|
250
|
-
/* not found or not executable in this dir */
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
function buildDefaultRuntime(instanceId, port, openclawHome) {
|
|
256
|
-
const home = openclawHome || defaultOpenclawHome(instanceId);
|
|
257
|
-
return {
|
|
258
|
-
command: resolveOpenclawBin(),
|
|
259
|
-
args: ["gateway", "run", "--port", String(port), "--allow-unconfigured"],
|
|
260
|
-
cwd: home,
|
|
261
|
-
user: resolveServiceUser()?.username ?? userInfo().username,
|
|
262
|
-
env_files: [defaultOpenclawModelEnvFile(instanceId)],
|
|
263
|
-
env: {
|
|
264
|
-
OPENCLAW_GATEWAY_PORT: String(port),
|
|
265
|
-
NODE_OPTIONS: "--max-old-space-size=2048",
|
|
266
|
-
// Let mcporter find its config regardless of the agent's CWD. The
|
|
267
|
-
// gateway's CWD is openclaw-home (no config/), and `cd workspace`
|
|
268
|
-
// means the user-files symlink (also no config/). Without this env,
|
|
269
|
-
// every `mcporter call drive.*` fails with "Unknown MCP server 'drive'"
|
|
270
|
-
// and the agent reports a generic "network error" to the user.
|
|
271
|
-
MCPORTER_CONFIG: `${home}/.openclaw/workspace/config/mcporter.json`,
|
|
272
|
-
},
|
|
273
|
-
resources: { CPU: 1000, MemoryMB: 2048 },
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function starterConfig() {
|
|
277
|
-
const dp = getPanelConfig().default_provider;
|
|
278
|
-
let providerName = "minimax";
|
|
279
|
-
let providerConfig = {
|
|
280
|
-
baseUrl: "https://api.minimaxi.com/v1",
|
|
281
|
-
api: "openai-completions",
|
|
282
|
-
models: [{ id: "MiniMax-M2.7", name: "MiniMax M2.7", contextWindow: 204800 }],
|
|
283
|
-
};
|
|
284
|
-
let defaultModel = "minimax/MiniMax-M2.7";
|
|
285
|
-
if (dp?.providerId) {
|
|
286
|
-
providerName = dp.providerId;
|
|
287
|
-
providerConfig = {
|
|
288
|
-
baseUrl: dp.baseUrl,
|
|
289
|
-
api: dp.api,
|
|
290
|
-
...(dp.authHeader ? { authHeader: true } : {}),
|
|
291
|
-
models: dp.models || [],
|
|
292
|
-
};
|
|
293
|
-
const modelId = dp.selectedModelId || dp.models?.[0]?.id || "";
|
|
294
|
-
defaultModel = `${providerName}/${modelId}`;
|
|
295
|
-
}
|
|
296
|
-
const config = {
|
|
297
|
-
models: { providers: { [providerName]: providerConfig } },
|
|
298
|
-
agents: { defaults: { model: defaultModel, models: { [defaultModel]: {} } } },
|
|
299
|
-
channels: {},
|
|
300
|
-
gateway: {
|
|
301
|
-
mode: "local",
|
|
302
|
-
auth: { mode: "token", token: randomBytes(24).toString("hex") },
|
|
303
|
-
controlUi: { dangerouslyDisableDeviceAuth: true },
|
|
304
|
-
},
|
|
305
|
-
plugins: { entries: { feishu: { enabled: false } } },
|
|
306
|
-
};
|
|
307
|
-
if (dp?.providerId) {
|
|
308
|
-
config["x-jishushell"] = {
|
|
309
|
-
proxy: {
|
|
310
|
-
upstream: {
|
|
311
|
-
providerId: dp.providerId,
|
|
312
|
-
baseUrl: dp.baseUrl,
|
|
313
|
-
api: dp.api,
|
|
314
|
-
authHeader: dp.authHeader || false,
|
|
315
|
-
models: dp.models || [],
|
|
316
|
-
selectedModelId: dp.selectedModelId || dp.models?.[0]?.id || "",
|
|
317
|
-
hasApiKey: !!dp.apiKey,
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
return config;
|
|
323
|
-
}
|
|
324
|
-
// ── Nomad-patching helpers (migrated from nomad-manager.ts) ───────────
|
|
325
|
-
/**
|
|
326
|
-
* In docker bridge mode, 127.0.0.1 inside the container resolves to the
|
|
327
|
-
* container's own loopback, not the host. Rewrite the jsproxy provider
|
|
328
|
-
* baseUrl in openclaw.json to use host.docker.internal instead.
|
|
329
|
-
*/
|
|
330
|
-
function patchJsproxyBaseUrl(configPath) {
|
|
331
|
-
try {
|
|
332
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
333
|
-
const patched = raw.replace(/http:\/\/127\.0\.0\.1:(\d+)\/proxy/g, `http://host.docker.internal:$1/proxy`);
|
|
334
|
-
if (patched !== raw) {
|
|
335
|
-
writeConfigFile(configPath, patched);
|
|
336
|
-
console.log(`[openclaw] Patched jsproxy baseUrl in ${configPath} (127.0.0.1 → host.docker.internal)`);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
catch (e) {
|
|
340
|
-
console.warn(`[openclaw] Failed to patch jsproxy baseUrl in ${configPath}: ${e.message}`);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
/** Known private/internal hostnames used by JishuShell's local proxy. */
|
|
344
|
-
const PRIVATE_NETWORK_HOSTS = ["host.docker.internal", "127.0.0.1", "localhost", "0.0.0.0"];
|
|
345
|
-
export function isPrivateNetworkBaseUrl(baseUrl) {
|
|
346
|
-
try {
|
|
347
|
-
const url = new URL(baseUrl);
|
|
348
|
-
if (PRIVATE_NETWORK_HOSTS.includes(url.hostname))
|
|
349
|
-
return true;
|
|
350
|
-
if (url.hostname.startsWith("10."))
|
|
351
|
-
return true;
|
|
352
|
-
if (url.hostname.startsWith("192.168."))
|
|
353
|
-
return true;
|
|
354
|
-
// RFC 1918: 172.16.0.0/12 → 172.16.x.x through 172.31.x.x
|
|
355
|
-
const m = url.hostname.match(/^172\.(\d+)\./);
|
|
356
|
-
if (m) {
|
|
357
|
-
const second = parseInt(m[1], 10);
|
|
358
|
-
if (second >= 16 && second <= 31)
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
return false;
|
|
362
|
-
}
|
|
363
|
-
catch {
|
|
364
|
-
return false;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Ensure `request.allowPrivateNetwork: true` is set on providers whose baseUrl
|
|
369
|
-
* targets a private/internal host (e.g. host.docker.internal). Without this,
|
|
370
|
-
* OpenClaw's SSRF guard blocks requests to the JishuShell local proxy.
|
|
371
|
-
*/
|
|
372
|
-
export function patchPrivateNetworkAllowFlag(configPath) {
|
|
373
|
-
try {
|
|
374
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
375
|
-
const config = JSON.parse(raw);
|
|
376
|
-
const providers = config?.models?.providers;
|
|
377
|
-
if (!providers || typeof providers !== "object")
|
|
378
|
-
return;
|
|
379
|
-
let changed = false;
|
|
380
|
-
for (const [, provider] of Object.entries(providers)) {
|
|
381
|
-
if (typeof provider !== "object" || provider === null)
|
|
382
|
-
continue;
|
|
383
|
-
const p = provider;
|
|
384
|
-
if (typeof p.baseUrl !== "string")
|
|
385
|
-
continue;
|
|
386
|
-
if (!isPrivateNetworkBaseUrl(p.baseUrl))
|
|
387
|
-
continue;
|
|
388
|
-
if (p.request?.allowPrivateNetwork === true)
|
|
389
|
-
continue;
|
|
390
|
-
p.request = { ...(p.request || {}), allowPrivateNetwork: true };
|
|
391
|
-
changed = true;
|
|
392
|
-
}
|
|
393
|
-
if (changed) {
|
|
394
|
-
writeConfigFile(configPath, JSON.stringify(config, null, 2));
|
|
395
|
-
console.log(`[openclaw] Patched request.allowPrivateNetwork in ${configPath} for private-network providers`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
catch (e) {
|
|
399
|
-
console.warn(`[openclaw] Failed to patch allowPrivateNetwork in ${configPath}: ${e.message}`);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Docker bridge port publishing cannot reach a process that only binds the
|
|
404
|
-
* container loopback. Normalize default/loopback gateway binds to `lan` so
|
|
405
|
-
* Nomad's published host port can reach the gateway.
|
|
406
|
-
*/
|
|
407
|
-
// Mirrors hermes.ts:nomadHasExternalHostNetwork. When the host nomad.hcl
|
|
408
|
-
// declares `host_network "external" { ... }`, the legacy openclaw job
|
|
409
|
-
// attaches it to its ReservedPorts so docker publishes the gateway to
|
|
410
|
-
// the LAN address instead of 127.0.0.1. Without this, OpenWebUI in a
|
|
411
|
-
// sibling container can't reach openclaw at all.
|
|
412
|
-
function nomadHasExternalHostNetwork() {
|
|
413
|
-
const path = join(JISHUSHELL_HOME, "nomad", "nomad.hcl");
|
|
414
|
-
try {
|
|
415
|
-
return /host_network\s+"external"\s*\{/.test(readFileSync(path, "utf-8"));
|
|
416
|
-
}
|
|
417
|
-
catch {
|
|
418
|
-
return false;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function patchDockerBridgeGatewayBind(configPath) {
|
|
422
|
-
try {
|
|
423
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
424
|
-
const parsed = JSON.parse(raw);
|
|
425
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
426
|
-
return;
|
|
427
|
-
const gatewayRaw = parsed.gateway;
|
|
428
|
-
const gateway = gatewayRaw && typeof gatewayRaw === "object" && !Array.isArray(gatewayRaw)
|
|
429
|
-
? gatewayRaw
|
|
430
|
-
: (parsed.gateway = {});
|
|
431
|
-
const bind = typeof gateway.bind === "string" ? gateway.bind.trim() : "";
|
|
432
|
-
if (bind && bind !== "loopback")
|
|
433
|
-
return;
|
|
434
|
-
gateway.bind = "lan";
|
|
435
|
-
const next = JSON.stringify(parsed, null, 2);
|
|
436
|
-
const output = raw.endsWith("\n") ? `${next}\n` : next;
|
|
437
|
-
if (output === raw)
|
|
438
|
-
return;
|
|
439
|
-
writeConfigFile(configPath, output);
|
|
440
|
-
console.log(`[openclaw] Normalized gateway.bind to "lan" in ${configPath} for Docker bridge networking`);
|
|
441
|
-
}
|
|
442
|
-
catch (e) {
|
|
443
|
-
console.warn(`[openclaw] Failed to patch gateway.bind in ${configPath}: ${e.message}`);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Ensure the `llm-agent` capability advertised by openclaw-*.yaml works for
|
|
448
|
-
* every instance, including ones created before this code shipped: enable
|
|
449
|
-
* OpenClaw's OpenAI-compatible endpoints in `openclaw.json` on every start.
|
|
450
|
-
*
|
|
451
|
-
* Runs idempotently next to `patchDockerBridgeGatewayBind`. The OpenAI
|
|
452
|
-
* routes (`/v1/chat/completions`, `/v1/responses`, `/v1/models`,
|
|
453
|
-
* `/v1/embeddings`) live in openclaw's bundled server.impl and are gated
|
|
454
|
-
* behind `gateway.http.endpoints.{chatCompletions,responses}.enabled` —
|
|
455
|
-
* default false, so a fresh OpenClaw install would 404 those paths even
|
|
456
|
-
* though OpenWebUI binds it through the connections page.
|
|
457
|
-
*/
|
|
458
|
-
export function patchOpenAIEndpointsEnabled(configPath) {
|
|
459
|
-
try {
|
|
460
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
461
|
-
const parsed = JSON.parse(raw);
|
|
462
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
463
|
-
return;
|
|
464
|
-
const root = parsed;
|
|
465
|
-
const gateway = root.gateway && typeof root.gateway === "object" && !Array.isArray(root.gateway)
|
|
466
|
-
? root.gateway
|
|
467
|
-
: (root.gateway = {});
|
|
468
|
-
const http = gateway.http && typeof gateway.http === "object" && !Array.isArray(gateway.http)
|
|
469
|
-
? gateway.http
|
|
470
|
-
: (gateway.http = {});
|
|
471
|
-
const endpoints = http.endpoints && typeof http.endpoints === "object" && !Array.isArray(http.endpoints)
|
|
472
|
-
? http.endpoints
|
|
473
|
-
: (http.endpoints = {});
|
|
474
|
-
let changed = false;
|
|
475
|
-
for (const key of ["chatCompletions", "responses"]) {
|
|
476
|
-
const ep = endpoints[key] && typeof endpoints[key] === "object" && !Array.isArray(endpoints[key])
|
|
477
|
-
? endpoints[key]
|
|
478
|
-
: (endpoints[key] = {});
|
|
479
|
-
if (ep.enabled !== true) {
|
|
480
|
-
ep.enabled = true;
|
|
481
|
-
changed = true;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
if (!changed)
|
|
485
|
-
return;
|
|
486
|
-
const next = JSON.stringify(parsed, null, 2);
|
|
487
|
-
const output = raw.endsWith("\n") ? `${next}\n` : next;
|
|
488
|
-
writeConfigFile(configPath, output);
|
|
489
|
-
console.log(`[openclaw] Enabled gateway.http.endpoints.{chatCompletions,responses} in ${configPath} for llm-agent capability`);
|
|
490
|
-
}
|
|
491
|
-
catch (e) {
|
|
492
|
-
console.warn(`[openclaw] Failed to patch OpenAI endpoints in ${configPath}: ${e.message}`);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Deep-merge a SearXNG connection into an OpenClaw config file at `configPath`.
|
|
497
|
-
*
|
|
498
|
-
* Writes both halves of the wiring required for the `web_search` tool to use
|
|
499
|
-
* the registry-resolved SearXNG instance:
|
|
500
|
-
*
|
|
501
|
-
* plugins.entries.searxng.enabled = true
|
|
502
|
-
* plugins.entries.searxng.config.webSearch.baseUrl = baseUrl
|
|
503
|
-
* tools.web.search.provider = "searxng"
|
|
504
|
-
*
|
|
505
|
-
* The provider selector is required because OpenClaw's built-in default is
|
|
506
|
-
* `"brave"`; without it the tool fails with `missing_brave_api_key` even when
|
|
507
|
-
* the searxng plugin is otherwise correctly configured (verified on Pi
|
|
508
|
-
* 2026-04-29: claw11 had the plugin block right but the selector unset).
|
|
509
|
-
*
|
|
510
|
-
* Why a partial deep-merge instead of `saveNativeConfig`: the latter is
|
|
511
|
-
* destructive — it replaces top-level keys wholesale and only preserves a
|
|
512
|
-
* hardcoded subset (`plugins.installs`, `plugins.entries` per-key, partial
|
|
513
|
-
* `channels` merge). A partial patch through it would wipe `models.providers`
|
|
514
|
-
* / `agents.defaults` / etc., bricking the instance with `No API key found
|
|
515
|
-
* for provider "openai"` on the next chat. So we read, merge, write back.
|
|
516
|
-
*
|
|
517
|
-
* No-op when the config file is absent (instance not yet started).
|
|
518
|
-
*/
|
|
519
|
-
export function applySearxngConnectionToConfig(configPath, baseUrl) {
|
|
520
|
-
if (!existsSync(configPath))
|
|
521
|
-
return;
|
|
522
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
523
|
-
existing.plugins = existing.plugins ?? {};
|
|
524
|
-
existing.plugins.entries = existing.plugins.entries ?? {};
|
|
525
|
-
const prior = existing.plugins.entries.searxng ?? {};
|
|
526
|
-
existing.plugins.entries.searxng = {
|
|
527
|
-
...prior,
|
|
528
|
-
enabled: true,
|
|
529
|
-
config: {
|
|
530
|
-
...(prior.config ?? {}),
|
|
531
|
-
webSearch: {
|
|
532
|
-
...((prior.config ?? {}).webSearch ?? {}),
|
|
533
|
-
baseUrl,
|
|
534
|
-
},
|
|
535
|
-
},
|
|
536
|
-
};
|
|
537
|
-
existing.tools = existing.tools ?? {};
|
|
538
|
-
existing.tools.web = existing.tools.web ?? {};
|
|
539
|
-
existing.tools.web.search = existing.tools.web.search ?? {};
|
|
540
|
-
existing.tools.web.search.provider = "searxng";
|
|
541
|
-
safeWriteJson(configPath, existing);
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Counterpart to `applySearxngConnectionToConfig` — invoked when the user
|
|
545
|
-
* unbinds the SEARCH slot in the Connections tab. Without this, unbinding
|
|
546
|
-
* left the plugin entry enabled with a baseUrl pointing at the now-gone
|
|
547
|
-
* searxng provider, and `tools.web.search.provider="searxng"` kept routing
|
|
548
|
-
* the agent's `web_search` tool through that dead URL on every chat.
|
|
549
|
-
*
|
|
550
|
-
* Conservative cleanup so a future re-bind (or user-customized plugin
|
|
551
|
-
* settings) survives:
|
|
552
|
-
* - flip the searxng plugin to enabled:false (don't delete the entry —
|
|
553
|
-
* user may have hand-tuned it and we want re-bind to re-enable cheaply)
|
|
554
|
-
* - drop the stale `webSearch.baseUrl` so nothing reads it as still-live
|
|
555
|
-
* - clear `tools.web.search.provider` so the runtime falls back to its
|
|
556
|
-
* built-in default (which today errors out with `missing_brave_api_key`
|
|
557
|
-
* — the right outcome: search was unbound, web_search shouldn't work)
|
|
558
|
-
*
|
|
559
|
-
* No-op when the config file is absent.
|
|
560
|
-
*/
|
|
561
|
-
export function clearSearxngConnectionFromConfig(configPath) {
|
|
562
|
-
if (!existsSync(configPath))
|
|
563
|
-
return;
|
|
564
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
565
|
-
const sx = existing?.plugins?.entries?.searxng;
|
|
566
|
-
if (sx && typeof sx === "object") {
|
|
567
|
-
sx.enabled = false;
|
|
568
|
-
if (sx.config?.webSearch && typeof sx.config.webSearch === "object") {
|
|
569
|
-
delete sx.config.webSearch.baseUrl;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
if (existing?.tools?.web?.search && typeof existing.tools.web.search === "object") {
|
|
573
|
-
delete existing.tools.web.search.provider;
|
|
574
|
-
}
|
|
575
|
-
safeWriteJson(configPath, existing);
|
|
576
|
-
}
|
|
577
|
-
/** Profile name used in `browser.profiles` for jishushell-managed Browserless bindings. */
|
|
578
|
-
const BROWSERLESS_PROFILE = "browserless";
|
|
579
|
-
/**
|
|
580
|
-
* Default `color` for the jishushell-managed browserless profile. OpenClaw's
|
|
581
|
-
* profile schema treats `color` as required (the field shows up as the
|
|
582
|
-
* profile chip tint in the UI); omitting it triggers
|
|
583
|
-
* "browser.profiles.browserless.color: Invalid input: expected string,
|
|
584
|
-
* received undefined"
|
|
585
|
-
* on every config reload, which crashloops the gateway. Verified against
|
|
586
|
-
* the runtime image `ghcr.io/x-aijishu/openclaw-runtime:2026.4.15` on Pi 2
|
|
587
|
-
* (2026-05-07). The tone is Browserless brand green; users can override it
|
|
588
|
-
* once and we preserve their override on re-bind via the `prior` spread.
|
|
589
|
-
*/
|
|
590
|
-
const BROWSERLESS_DEFAULT_COLOR = "#00AA66";
|
|
591
|
-
/**
|
|
592
|
-
* Deep-merge a Browserless CDP connection into an OpenClaw config file at
|
|
593
|
-
* `configPath`. Mirrors `applySearxngConnectionToConfig` for the browser slot.
|
|
594
|
-
*
|
|
595
|
-
* Writes:
|
|
596
|
-
* browser.profiles.browserless.cdpUrl = cdpUrl // ws:// or wss://
|
|
597
|
-
* browser.profiles.browserless.attachOnly = true // since v2026.3.2
|
|
598
|
-
* browser.profiles.browserless.color = "#00AA66" // required by schema
|
|
599
|
-
* browser.defaultProfile = "browserless" // only if unset
|
|
600
|
-
* browser.enabled = true // only if unset
|
|
601
|
-
* gateway.nodes.browser.mode = "off" // only if unset
|
|
602
|
-
*
|
|
603
|
-
* Why per-profile `attachOnly` and not global `browser.attachOnly`: global
|
|
604
|
-
* attachOnly forces every profile to skip launch — that breaks the user's
|
|
605
|
-
* other manually-configured profiles. Per-profile attachOnly was added in
|
|
606
|
-
* OpenClaw v2026.3.2; older versions silently ignore the extra field and
|
|
607
|
-
* fall back to attach-via-cdpUrl semantics (which `cdpUrl` triggers on its
|
|
608
|
-
* own from v2.0.0-beta5), so the schema is forward-compatible all the way
|
|
609
|
-
* back to the first remote-CDP release.
|
|
610
|
-
*
|
|
611
|
-
* Why `gateway.nodes.browser.mode = "off"`: in OpenClaw 2026.5.6 the
|
|
612
|
-
* gateway only registers the `browser.request` WS method when this config
|
|
613
|
-
* block exists. Without it, `openclaw browser …` CLI and the gateway
|
|
614
|
-
* canvas tool both fail with `unknown method: browser.request` or
|
|
615
|
-
* `node required`. Setting `mode: "off"` forces gateway-local CDP
|
|
616
|
-
* dispatch (use `cdpUrl` directly, never look for paired nodes), which
|
|
617
|
-
* matches jishushell's intent: Browserless is a service-style provider,
|
|
618
|
-
* not a node-style provider. Verified end-to-end on Pi 2 (2026-05-07):
|
|
619
|
-
* Browserless `/sessions` shows `numbConnected: 1` and `openclaw browser
|
|
620
|
-
* navigate <allowed-host>` succeeds + screenshots render correctly.
|
|
621
|
-
*
|
|
622
|
-
* `defaultProfile`, `enabled`, and `gateway.nodes.browser.mode` are all
|
|
623
|
-
* set only when absent so user-customized values survive a re-bind. The
|
|
624
|
-
* `enabled` flag is never flipped off — Browserless binding shouldn't
|
|
625
|
-
* override a user who explicitly disabled the browser tool tree.
|
|
626
|
-
*
|
|
627
|
-
* SSRF policy is intentionally NOT touched here: `browser.ssrfPolicy`
|
|
628
|
-
* (`dangerouslyAllowPrivateNetwork`, `allowedHostnames`) is a user-level
|
|
629
|
-
* security decision (default deny-all is correct for an LLM-driven
|
|
630
|
-
* browser); jishushell would be over-reaching to silently widen it on
|
|
631
|
-
* binding. Users who want the agent to reach a specific host configure
|
|
632
|
-
* the allowlist themselves.
|
|
633
|
-
*
|
|
634
|
-
* No-op when the config file is absent (instance not yet started).
|
|
635
|
-
*/
|
|
636
|
-
export function applyBrowserlessConnectionToConfig(configPath, cdpUrl) {
|
|
637
|
-
if (!existsSync(configPath))
|
|
638
|
-
return;
|
|
639
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
640
|
-
const browser = (existing.browser ??= {});
|
|
641
|
-
if (browser.enabled === undefined)
|
|
642
|
-
browser.enabled = true;
|
|
643
|
-
if (!browser.defaultProfile)
|
|
644
|
-
browser.defaultProfile = BROWSERLESS_PROFILE;
|
|
645
|
-
const profiles = (browser.profiles ??= {});
|
|
646
|
-
const prior = profiles[BROWSERLESS_PROFILE] ?? {};
|
|
647
|
-
profiles[BROWSERLESS_PROFILE] = {
|
|
648
|
-
...prior,
|
|
649
|
-
cdpUrl,
|
|
650
|
-
attachOnly: true,
|
|
651
|
-
color: typeof prior.color === "string" && prior.color ? prior.color : BROWSERLESS_DEFAULT_COLOR,
|
|
652
|
-
};
|
|
653
|
-
const gateway = (existing.gateway ??= {});
|
|
654
|
-
const nodes = (gateway.nodes ??= {});
|
|
655
|
-
const browserPolicy = (nodes.browser ??= {});
|
|
656
|
-
if (browserPolicy.mode === undefined)
|
|
657
|
-
browserPolicy.mode = "off";
|
|
658
|
-
safeWriteJson(configPath, existing);
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* Counterpart to `applyBrowserlessConnectionToConfig` — invoked when the user
|
|
662
|
-
* unbinds the BROWSER slot in the Connections tab. Removes the
|
|
663
|
-
* jishushell-managed `browserless` profile and clears `defaultProfile` only
|
|
664
|
-
* if it still points at that profile (so user-set defaults pointing at their
|
|
665
|
-
* own profiles survive). Other profiles and `browser.enabled` are left alone.
|
|
666
|
-
*
|
|
667
|
-
* No-op when the config file is absent.
|
|
668
|
-
*/
|
|
669
|
-
export function clearBrowserlessConnectionFromConfig(configPath) {
|
|
670
|
-
if (!existsSync(configPath))
|
|
671
|
-
return;
|
|
672
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
673
|
-
const browser = existing?.browser;
|
|
674
|
-
if (!browser || typeof browser !== "object")
|
|
675
|
-
return;
|
|
676
|
-
if (browser.profiles && typeof browser.profiles === "object") {
|
|
677
|
-
delete browser.profiles[BROWSERLESS_PROFILE];
|
|
678
|
-
}
|
|
679
|
-
if (browser.defaultProfile === BROWSERLESS_PROFILE) {
|
|
680
|
-
delete browser.defaultProfile;
|
|
681
|
-
}
|
|
682
|
-
safeWriteJson(configPath, existing);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Bump when a panel-side change invalidates the agent's prior reasoning
|
|
686
|
-
* within an existing chat session — e.g., a mount fix that turns prior
|
|
687
|
-
* "I can't read this file" tool failures into stale conclusions. The
|
|
688
|
-
* first onBeforeStart after the bump rotates the instance's session
|
|
689
|
-
* jsonl files (`<file>.jsonl` → `<file>.jsonl.reset.<ts>`), so the next
|
|
690
|
-
* user message lands on a clean context window. Old transcripts are
|
|
691
|
-
* preserved as .reset.* siblings — never deleted, just archived.
|
|
692
|
-
*
|
|
693
|
-
* Concrete history:
|
|
694
|
-
* 2026.5.11.1 — buildVolumes root-mount fix: empty-path FileMount
|
|
695
|
-
* finally binds FILES_ROOT into docker containers. Prior
|
|
696
|
-
* sessions had agent conclude "drive only has metadata,
|
|
697
|
-
* no file content" after ENOENT — that reasoning is
|
|
698
|
-
* poisoned post-fix.
|
|
699
|
-
* 2026.5.11.2 — WeChat target-format rule in TOOLS.md: agent was
|
|
700
|
-
* extrapolating Feishu's `user:` prefix onto WeChat
|
|
701
|
-
* chat_ids that don't carry it, causing WeChat's
|
|
702
|
-
* getuploadurl to return ret:-1. Prior sessions need
|
|
703
|
-
* rotation so the agent re-reads the corrected target
|
|
704
|
-
* rule and stops adding the prefix.
|
|
705
|
-
*
|
|
706
|
-
* Format: YYYY.M.D.N (date + same-day bump counter). Compare as strings;
|
|
707
|
-
* any difference means rotate. Stored per-instance at
|
|
708
|
-
* `<instanceDir>/runtime-contract.txt`
|
|
709
|
-
*/
|
|
710
|
-
const RUNTIME_CONTRACT_VERSION = "2026.5.11.2";
|
|
711
|
-
const JISHUSHELL_DRIVE_HINT_BEGIN = "<!-- jishushell-drive: BEGIN auto-generated -->";
|
|
712
|
-
const JISHUSHELL_DRIVE_HINT_END = "<!-- jishushell-drive: END -->";
|
|
713
|
-
const JISHUSHELL_KB_HINT_BEGIN = "<!-- jishushell-kb: BEGIN auto-generated -->";
|
|
714
|
-
const JISHUSHELL_KB_HINT_END = "<!-- jishushell-kb: END -->";
|
|
715
|
-
/**
|
|
716
|
-
* Rotate session jsonl files when the runtime contract version has bumped
|
|
717
|
-
* since this instance last started. Matches OpenClaw's own .reset.<ts>
|
|
718
|
-
* naming convention so its existing UI/cleanup paths still apply.
|
|
719
|
-
*
|
|
720
|
-
* Why this exists: when a panel upgrade fixes a runtime bug (e.g. the
|
|
721
|
-
* 2026-05-11 mount-bind fix), the agent's prior turn-by-turn reasoning
|
|
722
|
-
* inside an existing session is anchored to the broken behaviour. Even
|
|
723
|
-
* after the fix is deployed and the alloc restarted, the LLM keeps
|
|
724
|
-
* citing past tool failures and refusing to retry. Rotating the session
|
|
725
|
-
* jsonl(s) gives the next user message a clean context where the agent
|
|
726
|
-
* sees fresh TOOLS.md + fresh tool outputs.
|
|
727
|
-
*
|
|
728
|
-
* Side effect: the user loses chat scrollback in IM/web. Acceptable
|
|
729
|
-
* because (a) the rotated file is preserved on disk, (b) panel upgrades
|
|
730
|
-
* are infrequent, (c) the alternative — agent stuck in old reasoning —
|
|
731
|
-
* is worse UX.
|
|
732
|
-
*/
|
|
733
|
-
function rotateSessionsIfContractChanged(instanceId, openclawHome) {
|
|
734
|
-
try {
|
|
735
|
-
const markerPath = join(framework_instanceDir(instanceId), "runtime-contract.txt");
|
|
736
|
-
let previous = "";
|
|
737
|
-
try {
|
|
738
|
-
previous = readFileSync(markerPath, "utf-8").trim();
|
|
739
|
-
}
|
|
740
|
-
catch (e) {
|
|
741
|
-
if (e?.code !== "ENOENT")
|
|
742
|
-
throw e;
|
|
743
|
-
}
|
|
744
|
-
if (previous === RUNTIME_CONTRACT_VERSION)
|
|
745
|
-
return;
|
|
746
|
-
const sessionsDir = join(openclawHome, ".openclaw", "agents", "main", "sessions");
|
|
747
|
-
if (existsSync(sessionsDir)) {
|
|
748
|
-
const ts = new Date()
|
|
749
|
-
.toISOString()
|
|
750
|
-
.replace(/:/g, "-")
|
|
751
|
-
.replace(/\.\d+Z$/, ".000Z");
|
|
752
|
-
const entries = readdirSync(sessionsDir);
|
|
753
|
-
let rotated = 0;
|
|
754
|
-
for (const name of entries) {
|
|
755
|
-
if (!name.endsWith(".jsonl"))
|
|
756
|
-
continue; // skip already-rotated
|
|
757
|
-
const from = join(sessionsDir, name);
|
|
758
|
-
const to = `${from}.reset.${ts}`;
|
|
759
|
-
try {
|
|
760
|
-
renameSync(from, to);
|
|
761
|
-
rotated++;
|
|
762
|
-
}
|
|
763
|
-
catch (e) {
|
|
764
|
-
console.warn(`[openclaw] session rotate failed for ${from}: ${e?.message ?? e}`);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
if (rotated > 0) {
|
|
768
|
-
console.log(`[openclaw] runtime contract ${previous || "(none)"} → ${RUNTIME_CONTRACT_VERSION}: rotated ${rotated} session(s) under ${sessionsDir}`);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
writeConfigFile(markerPath, RUNTIME_CONTRACT_VERSION + "\n");
|
|
772
|
-
}
|
|
773
|
-
catch (e) {
|
|
774
|
-
console.warn(`[openclaw] rotateSessionsIfContractChanged failed: ${e?.message ?? e}`);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Inject a guarded section into the agent's TOOLS.md telling the LLM that
|
|
779
|
-
* user files live on the local filesystem (host==container bind mount),
|
|
780
|
-
* not on some remote "drive server", and showing the concrete
|
|
781
|
-
* resolve-then-send chain for IM channels (Feishu / WeChat).
|
|
782
|
-
*
|
|
783
|
-
* Why this exists: the LLM defaults to interpreting `drive` as a remote
|
|
784
|
-
* service, then refuses to send NAS files via IM with "I can't access the
|
|
785
|
-
* cloud drive" — even when `drive_list` literally just enumerated them.
|
|
786
|
-
* Verified on pi2 2026-05-11: claw1 saw `文档/宇树G1-D...xlsx` via
|
|
787
|
-
* drive_list, then told the user to "open Feishu cloud space and forward
|
|
788
|
-
* it back" because nothing in TOOLS.md tied drive paths to filesystem
|
|
789
|
-
* paths. This patcher closes that gap by spelling it out.
|
|
790
|
-
*
|
|
791
|
-
* Idempotent: section is bracketed by HTML markers; content between them
|
|
792
|
-
* is rewritten on every call. User edits OUTSIDE the markers are kept.
|
|
793
|
-
*
|
|
794
|
-
* filesRoot is baked in so the example abs path matches the actual install
|
|
795
|
-
* — third-party users on `/home/alice/.jishushell/files/` see their own
|
|
796
|
-
* root, not pi's.
|
|
797
|
-
*/
|
|
798
|
-
export function patchToolsMdDriveHint(workspaceDir, filesRoot) {
|
|
799
|
-
try {
|
|
800
|
-
const toolsPath = join(workspaceDir, "TOOLS.md");
|
|
801
|
-
let original = "";
|
|
802
|
-
try {
|
|
803
|
-
original = readFileSync(toolsPath, "utf-8");
|
|
804
|
-
}
|
|
805
|
-
catch (e) {
|
|
806
|
-
if (e?.code !== "ENOENT")
|
|
807
|
-
throw e;
|
|
808
|
-
}
|
|
809
|
-
const section = [
|
|
810
|
-
JISHUSHELL_DRIVE_HINT_BEGIN,
|
|
811
|
-
"",
|
|
812
|
-
"### 📁 用户的 NAS / 文件库",
|
|
813
|
-
"",
|
|
814
|
-
"⚠️ **用户文件操作硬路由 — 必读**",
|
|
815
|
-
"",
|
|
816
|
-
"**单一规则(语言无关)**:用户用任何语言(中文 / English / 日本語 / ...)说「**我的 / 我的 / my / mine / our / the user's / 私の**」+ 任何文件/目录/资料/笔记/文档/代码/data/notes/docs/files → **CRUD 全部走 `drive.*` 工具,禁止用 shell 在 cwd 上操作**。判定按**语义**不按**字面**,本表只是举例。",
|
|
817
|
-
"",
|
|
818
|
-
"动作 ↔ 工具映射表(用户文件场景,中英混排示例):",
|
|
819
|
-
"",
|
|
820
|
-
"| 用户意图(多语言示例) | ✅ 必须用 | ❌ 禁止 |",
|
|
821
|
-
"|---|---|---|",
|
|
822
|
-
"| list / show / 「列一下 / 我有什么 / 看看我的 / what files do I have / show me my docs / list my files」 | `drive_list` | `ls`, `find`, `pwd` |",
|
|
823
|
-
"| read / open / 「打开 / 看看 / 念一下 / 内容是啥 / open my X / read the content of / what's in」 | `drive_read_preview` / `drive_read_full` | `cat`, `head`, `tail` |",
|
|
824
|
-
"| search / find / 「搜 / 找一下 / 哪里提到 / search my docs for / find X in my files / where did I write about」 | `drive_search` | `grep`, `rg` |",
|
|
825
|
-
"| write / save / create / 「写 / 存 / 记一下 / 新建 / save this as / write a note / create a file」 | `drive_write_text` / `drive_write_binary` | `echo >`, `cat <<EOF`, `tee` |",
|
|
826
|
-
"| delete / remove / 「删 / 扔掉 / delete X / remove the file」 | `drive_delete` | `rm` |",
|
|
827
|
-
"| rename / move / 「改名 / 挪到 / 移到 / rename X to Y / move X to」 | `drive_move` | `mv` |",
|
|
828
|
-
"| mkdir / 「建文件夹 / create a folder / make a directory」 | `drive_mkdir` | `mkdir` |",
|
|
829
|
-
"| quota / space / 「配额 / 空间 / how much space / quota / disk usage」 | `drive_quota` | `df`, `du` |",
|
|
830
|
-
"| send / share / 「发给我 / 把 X 发出去 / send me X / share the file with me」 | `drive_resolve_local_path` → IM `send_file` | (拒绝 / refuse) |",
|
|
831
|
-
"",
|
|
832
|
-
"**触发词不完全列表(再次强调:语义优先)**:",
|
|
833
|
-
"- 中文:我的、我那份、我之前的、我刚刚的、用户的、咱们的、文件、文档、资料、笔记、报告、合同、PDF、Excel、附件",
|
|
834
|
-
"- English: my, mine, our, the user's, files, file, doc(s), document(s), note(s), paper(s), report(s), spreadsheet(s), pdf(s), attachment(s)",
|
|
835
|
-
"- 其它语言:私の (ja) / mes (fr) / mein (de) / 我的 (variants) — 含义相同时同等处理",
|
|
836
|
-
"",
|
|
837
|
-
"**为什么硬规定**:cwd 是你自己的运行骨架(`AGENTS.md`、`TOOLS.md`、`memory/`、`state/`、`config/`),跟用户**毫无关系**。",
|
|
838
|
-
"- 用户问「我有什么文件 / what files do I have」你 `ls` cwd → 列出 `AGENTS.md`、`memory/` → 用户懵 + 觉得 jishushell 装错了",
|
|
839
|
-
"- 用户说「帮我写笔记 notes.md / save a note for me」你 `echo > notes.md` 落 cwd → 文件落到 agent 工作目录,用户在 filebrowser 看不到 → 数据等于丢了",
|
|
840
|
-
"- 用户说「打开我那份产品规格 / open my spec」你 `cat spec.md` → cwd 里没有该文件 → 找不到 → 用户被冤枉「文件根本不存在」",
|
|
841
|
-
"",
|
|
842
|
-
"**判定方法(消息归属判定,跨语言)**:主语/所有格指向「用户/我们」(我 / 我的 / my / our / the user / 私の + 文件相关名词)→ 走 drive。指向「你/agent」(你的 / 你刚才写的代码 / your notes / agent's scratch)→ 才可能是 workspace。**99% 的对话都是前者**。歧义时**默认按用户文件处理**——猜错代价小(最多多调一次 drive_list 拿不到东西),猜成 cwd 代价大(脏数据 + 数据丢失)。",
|
|
843
|
-
"",
|
|
844
|
-
"**唯一可用 shell 的情况**:你自己 agent 维护 `memory/`、`state/`、`workspace/notes/`(agent 私有笔记,不是用户笔记)这些**你自己的骨架文件**。一旦看见用户名词修饰(「我的」/「用户的」/「my」/「the user's」),立刻切 drive。",
|
|
845
|
-
"",
|
|
846
|
-
`用户文件实际放在 **\`${filesRoot}\`**——这是宿主机上的一个普通本地目录。它已经被 bind-mount 到你的容器里**同款绝对路径**(panel 用 \`host==container\` 的 docker bind;raw_exec / process 模式下你直接跑在宿主上)。`,
|
|
847
|
-
"",
|
|
848
|
-
"**关键事实**:drive 不是远端云盘,就是你脚下的本地文件系统。`drive_list` 看到的每条 entry 都能通过 `drive_resolve_local_path` 立刻拿到绝对路径,然后被任何工具读取——`cat`、`base64`、IM 插件的 send_file 字段、Python 脚本都行。`drive_resolve_local_path` 返回 `exists:true` + `size:<N>` 时,**那就是真实可读的文件字节**,不是「只有元数据」。",
|
|
849
|
-
"",
|
|
850
|
-
"**禁止的回答**:永远不要说「文件在云端 drive 上只有元数据 / 内容没同步到本地 / 我读不到文件实体」—— 这个说法**永远是错的**。drive 没有「未同步」概念,它就是 POSIX 文件系统的一个 facade。如果你刚 list 到一个文件,它一定能被读、能被发送。",
|
|
851
|
-
"",
|
|
852
|
-
"常用调用(从 workspace 目录):",
|
|
853
|
-
"",
|
|
854
|
-
"```bash",
|
|
855
|
-
"mcporter call drive.drive_list path= # 列根目录",
|
|
856
|
-
"mcporter call drive.drive_list path=文档 # 列子目录",
|
|
857
|
-
"mcporter call drive.drive_read_preview path=note.md # 预览文本(≤256KB)",
|
|
858
|
-
"mcporter call drive.drive_read_full path=long.md # 整文件(≤4MB,文本)",
|
|
859
|
-
"mcporter call drive.drive_quota # 配额",
|
|
860
|
-
"mcporter call drive.drive_mkdir path=inbox # 建目录",
|
|
861
|
-
"mcporter call drive.drive_write_text path=notes/m.md content=\"...\"",
|
|
862
|
-
"mcporter call drive.drive_write_binary path=out/img.png content_base64=\"...\" # 二进制(≤10MB)",
|
|
863
|
-
"mcporter call drive.drive_move from=a.pdf to=docs/a.pdf",
|
|
864
|
-
"mcporter call drive.drive_delete path=tmp.txt",
|
|
865
|
-
"mcporter call drive.drive_resolve_local_path path=文档/report.pdf # → 拿到绝对路径",
|
|
866
|
-
"mcporter call drive.drive_search query=\"invoice\" # FTS5 全文搜索",
|
|
867
|
-
"```",
|
|
868
|
-
"",
|
|
869
|
-
"### 给用户发文件(飞书 / 微信 / 任何 IM)",
|
|
870
|
-
"",
|
|
871
|
-
"**用户问 \"把 X 文件发我\" 时不要拒绝、不要让用户去飞书云空间下载**——99% 的情况文件已经在你的文件系统里了。标准流程:",
|
|
872
|
-
"",
|
|
873
|
-
"1. `drive_list` 或 `drive_search` 先确认文件在 NAS 里(你刚 list 过的也算)。",
|
|
874
|
-
"2. `drive_resolve_local_path path=文档/x.xlsx` 拿到 `abs_path`,确认 `exists:true`。",
|
|
875
|
-
"3. 把 `abs_path` 传给**当前会话所在 IM 通道**的发送工具。**`target` 字段一律原样照搬当前消息 `Conversation info` 里的 `chat_id`——一个字符都不要加、不要改、不要补前缀**。各通道 chat_id 形态本来就不一样,照搬就对。",
|
|
876
|
-
" - **飞书 DM**:metadata 给 `\"chat_id\":\"user:ou_xxx\"`(自带 `user:` 前缀,**这是飞书的格式不是通用约定**)→ `target=\"user:ou_xxx\"`。工具用 `message` (channel=feishu, msg_type=file, path=<abs_path>) 或 `openclaw-lark` 的 `feishu_im_user_message`。",
|
|
877
|
-
" - **微信 DM**:metadata 给 `\"chat_id\":\"o9cq...@im.wechat\"`(**裸 ID,没有 `user:` 前缀**)→ `target=\"o9cq...@im.wechat\"`。工具用 `message` (channel=openclaw-weixin, msg_type=file, path=<abs_path>)。**千万别照搬飞书的 `user:` 加上去**——会让微信服务端的 `getuploadurl` 返 `ret:-1`,文件传不出去。",
|
|
878
|
-
" - 通用规则:当前 inbound 消息的 `from` 就是回复 target。打开你刚收到的那条 user message 里 `Conversation info` 的 JSON,把 `chat_id` 整段复制就行。",
|
|
879
|
-
"4. 失败先查 `exists` 字段、文件大小、IM 通道大小上限(飞书典型 30MB、微信 20MB),再决定降级方案。",
|
|
880
|
-
"",
|
|
881
|
-
"**ENOENT / \"no such file or directory\" 处理**:IM 插件返回 ENOENT 但 `drive_resolve_local_path` 刚刚 `exists:true`,**99% 是 panel 刚升级 / mount 刚刷新,但你这个 alloc 用的是旧 spec**。无脑重试一次。还是 ENOENT 才提示用户去 panel 重启实例(stop+start,不是 restart)——但**永远不要**回答 \"文件只是元数据所以读不到\",那是错的。",
|
|
882
|
-
"",
|
|
883
|
-
"要发**新生成**的文件(PDF、图片、报表):先 `drive_write_binary path=agent-data/<instance>/outbox/x.pdf content_base64=...` 落盘,再 resolve → 发送。",
|
|
884
|
-
"",
|
|
885
|
-
"### 用户给你发文件",
|
|
886
|
-
"",
|
|
887
|
-
"目前飞书/微信通道不会自动把附件落盘到 NAS。当用户说\"文件给你了\"但你 `drive_list inbox` 看不到:",
|
|
888
|
-
"- 优先让用户走 panel 的 Filebrowser(`/apps/filebrowser/`)或 WebDAV 把文件上传到 `inbox/`,再告诉你路径。",
|
|
889
|
-
"- 飞书附件流:如果飞书 app 已配 `im:resource` 权限,可以用 `feishu_im_user_fetch_resource` 取 file_key、落到 `inbox/feishu/<date>/`。",
|
|
890
|
-
"",
|
|
891
|
-
"权限:在 panel \"关联 agent\" UI 里给实例授 ro/rw。403 时让用户去 panel 加。",
|
|
892
|
-
"",
|
|
893
|
-
JISHUSHELL_DRIVE_HINT_END,
|
|
894
|
-
"",
|
|
895
|
-
].join("\n");
|
|
896
|
-
let next;
|
|
897
|
-
const beginIdx = original.indexOf(JISHUSHELL_DRIVE_HINT_BEGIN);
|
|
898
|
-
const endIdx = original.indexOf(JISHUSHELL_DRIVE_HINT_END);
|
|
899
|
-
if (beginIdx >= 0 && endIdx > beginIdx) {
|
|
900
|
-
const tail = endIdx + JISHUSHELL_DRIVE_HINT_END.length;
|
|
901
|
-
const after = original
|
|
902
|
-
.slice(tail)
|
|
903
|
-
.replace(/^\n+/, "\n");
|
|
904
|
-
next = original.slice(0, beginIdx) + section + after;
|
|
905
|
-
}
|
|
906
|
-
else {
|
|
907
|
-
const sep = original && !original.endsWith("\n") ? "\n\n" : "\n";
|
|
908
|
-
next = (original ? original + sep : "") + section;
|
|
909
|
-
}
|
|
910
|
-
if (next === original)
|
|
911
|
-
return;
|
|
912
|
-
writeConfigFile(toolsPath, next);
|
|
913
|
-
console.log(`[openclaw] Patched drive hint into ${toolsPath}`);
|
|
914
|
-
}
|
|
915
|
-
catch (e) {
|
|
916
|
-
console.warn(`[openclaw] Failed to patch TOOLS.md drive hint: ${e.message}`);
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* Inject a guarded section into TOOLS.md describing the kb_search MCP
|
|
921
|
-
* tool — only when an AnythingLLM-backed knowledge base is wired into
|
|
922
|
-
* this instance. Mirrors patchToolsMdDriveHint's marker model so an
|
|
923
|
-
* uninstall / unbind can cleanly strip the section.
|
|
924
|
-
*
|
|
925
|
-
* `mode === "install"` writes the kb hint between the markers
|
|
926
|
-
* (overwriting any previous content there). `mode === "remove"`
|
|
927
|
-
* deletes the entire bracketed section, leaving the user's
|
|
928
|
-
* surrounding content intact.
|
|
929
|
-
*/
|
|
930
|
-
export function patchToolsMdKbHint(workspaceDir, mode) {
|
|
931
|
-
try {
|
|
932
|
-
const toolsPath = join(workspaceDir, "TOOLS.md");
|
|
933
|
-
let original = "";
|
|
934
|
-
try {
|
|
935
|
-
original = readFileSync(toolsPath, "utf-8");
|
|
936
|
-
}
|
|
937
|
-
catch (e) {
|
|
938
|
-
if (e?.code !== "ENOENT")
|
|
939
|
-
throw e;
|
|
940
|
-
if (mode === "remove")
|
|
941
|
-
return; // nothing to strip
|
|
942
|
-
}
|
|
943
|
-
// Strip every existing kb section first — tolerant of legacy variants
|
|
944
|
-
// (e.g. early manual injections that used "END auto-generated -->"
|
|
945
|
-
// instead of the current "END -->" marker). Without this, repeated
|
|
946
|
-
// re-patches would accumulate sections in TOOLS.md.
|
|
947
|
-
const STRIP_RE = /\n*<!-- jishushell-kb: BEGIN[^>]*-->[\s\S]*?<!-- jishushell-kb: END[^>]*-->\n*/g;
|
|
948
|
-
const stripped = original.replace(STRIP_RE, "\n");
|
|
949
|
-
let next;
|
|
950
|
-
if (mode === "remove") {
|
|
951
|
-
if (stripped === original)
|
|
952
|
-
return;
|
|
953
|
-
next = stripped;
|
|
954
|
-
}
|
|
955
|
-
else {
|
|
956
|
-
const section = [
|
|
957
|
-
JISHUSHELL_KB_HINT_BEGIN,
|
|
958
|
-
"",
|
|
959
|
-
"### 📚 知识库(AnythingLLM)",
|
|
960
|
-
"",
|
|
961
|
-
"用户长期投递的文档(手册、PDF、内部笔记、过往会议纪要等)由 **AnythingLLM** 维护索引(本地 LanceDB 向量库 + 内置 Xenova ONNX embedder),通过 `kb.kb_search` 一次调用拿「答案 + 引用来源」。",
|
|
962
|
-
"",
|
|
963
|
-
"**两个工具**:",
|
|
964
|
-
"",
|
|
965
|
-
"- `mcporter call kb.kb_search query=\"<用户原话>\"` — 在已索引文档里检索,返回答案 + 最多 5 条引用源",
|
|
966
|
-
"- `mcporter call kb.kb_ingest path=\"<绝对路径>\"` — 把 drive 里的文件加入知识库并 embed(用户说「加进知识库 / index this / 学习这份」时调)",
|
|
967
|
-
"",
|
|
968
|
-
"**ingest 标准链**(drive 里的文件 → 知识库):",
|
|
969
|
-
"1. `mcporter call drive.drive_resolve_local_path path=inbox/contract.pdf` → 拿 `abs_path`",
|
|
970
|
-
"2. `mcporter call kb.kb_ingest path=<abs_path>` → AnythingLLM 自动 embed",
|
|
971
|
-
"3. 几秒后用户问相关问题,`kb_search` 命中",
|
|
972
|
-
"",
|
|
973
|
-
"**search 什么时候调**:用户问的东西像在已上传文档里能找到——「那个 X 的手册里怎么说」、「我们之前关于 Y 的讨论」、「产品规格」、「合同条款」、「what does the doc say about X」等。",
|
|
974
|
-
"",
|
|
975
|
-
"**什么时候不要调**:寒暄、纯代码生成、数学计算、实时信息(天气/股票/新闻)、**操作 NAS 文件**(那是 `drive.*`,不是 kb)、纯创作类。",
|
|
976
|
-
"",
|
|
977
|
-
"**与 drive 的分工**:",
|
|
978
|
-
"- `drive.*` = 文件系统 facade(列目录、读字节、发文件)—— 要的是**文件本体**用 drive",
|
|
979
|
-
"- `kb.kb_search` / `kb.kb_ingest` = 语义检索 + RAG 入库 —— 要的是**答案/知识**用 kb",
|
|
980
|
-
"",
|
|
981
|
-
"两者数据**不共享**:drive 看到 `manual.pdf` ≠ kb 一定能搜到它。要让 kb 能搜到 → 先 `kb_ingest`。",
|
|
982
|
-
"",
|
|
983
|
-
"**搜不到时的标准回复**:`kb_search` 回答里说「无相关文档」或 sources 为空 → 先确认 drive 里有没有相关文件,如果有,主动建议「要我把它加入知识库吗」(用户同意就 `drive_resolve_local_path` + `kb_ingest`);drive 也没有,告诉用户「我在你的知识库里没找到相关内容」,然后**不要继续幻想答案**。",
|
|
984
|
-
"",
|
|
985
|
-
JISHUSHELL_KB_HINT_END,
|
|
986
|
-
"",
|
|
987
|
-
].join("\n");
|
|
988
|
-
const sep = stripped && !stripped.endsWith("\n") ? "\n\n" : "\n";
|
|
989
|
-
next = (stripped ? stripped + sep : "") + section;
|
|
990
|
-
}
|
|
991
|
-
if (next === original)
|
|
992
|
-
return;
|
|
993
|
-
writeConfigFile(toolsPath, next);
|
|
994
|
-
console.log(`[openclaw] ${mode === "remove" ? "Removed" : "Patched"} kb hint in ${toolsPath}`);
|
|
995
|
-
}
|
|
996
|
-
catch (e) {
|
|
997
|
-
console.warn(`[openclaw] Failed to ${mode} TOOLS.md kb hint: ${e.message}`);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Pre-seed the per-instance npm global prefix with a symlink to the image's
|
|
1002
|
-
* baked openclaw package so OpenClaw's in-gateway "Update now" handler can
|
|
1003
|
-
* detect the install as an npm global install. Idempotent; docker driver only.
|
|
1004
|
-
*/
|
|
1005
|
-
function ensureOpenclawUpdateSeed(openclawHome, instanceId) {
|
|
1006
|
-
if (getNomadDriver() !== "docker")
|
|
1007
|
-
return;
|
|
1008
|
-
if (!openclawHome)
|
|
1009
|
-
return;
|
|
1010
|
-
const linkDir = join(openclawHome, ".npm-global", "lib", "node_modules");
|
|
1011
|
-
const linkPath = join(linkDir, "openclaw");
|
|
1012
|
-
try {
|
|
1013
|
-
lstatSync(linkPath);
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
catch (err) {
|
|
1017
|
-
if (err?.code !== "ENOENT") {
|
|
1018
|
-
console.warn(`[openclaw] update-seed: lstat failed for ${linkPath}: ${err?.message ?? err}`);
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
try {
|
|
1023
|
-
mkdirSync(linkDir, { recursive: true });
|
|
1024
|
-
symlinkSync(CONTAINER_IMAGE_PKG_ROOT, linkPath);
|
|
1025
|
-
console.log(`[openclaw] update-seed ${instanceId}: seeded ${linkPath} -> ${CONTAINER_IMAGE_PKG_ROOT}`);
|
|
1026
|
-
}
|
|
1027
|
-
catch (err) {
|
|
1028
|
-
console.warn(`[openclaw] update-seed ${instanceId}: failed to create seed: ${err?.message ?? err}`);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
// ── Session fence patch (OpenClaw >= 5.19 regression) ─────────────────
|
|
1032
|
-
/**
|
|
1033
|
-
* The minimum OpenClaw version where the session fence bug exists.
|
|
1034
|
-
* The bug was introduced in v2026.5.19 — `eventMayReachTranscriptWriters()`
|
|
1035
|
-
* doesn't recognize `"message"` / `"custom_message"` event types, causing
|
|
1036
|
-
* session writes to bypass `withSessionWriteLock`, which in turn leaves
|
|
1037
|
-
* the file fingerprint stale and triggers `EmbeddedAttemptSessionTakeoverError`
|
|
1038
|
-
* on the next prompt.
|
|
1039
|
-
*
|
|
1040
|
-
* Additionally, on virtiofs mounts (macOS → Colima VM → Docker), file
|
|
1041
|
-
* metadata (mtime/ctime) can drift between `releaseForPrompt()` and
|
|
1042
|
-
* `assertSessionFileFence()` even without actual writes, due to the
|
|
1043
|
-
* multi-layer filesystem stack timing. Patching `assertSessionFileFence`
|
|
1044
|
-
* to a no-op fully disables the flawed fence check.
|
|
1045
|
-
*/
|
|
1046
|
-
const SESSION_FENCE_BUG_MIN_VERSION = [2026, 5, 19];
|
|
1047
|
-
/**
|
|
1048
|
-
* Maximum version (exclusive) to apply the patch. Once OpenClaw ships a fix
|
|
1049
|
-
* upstream, set a concrete version here to stop patching newer releases.
|
|
1050
|
-
* For now, no upper bound — patch all versions >= MIN.
|
|
1051
|
-
*/
|
|
1052
|
-
/**
|
|
1053
|
-
* Safety limit: if the extracted function body exceeds this many characters,
|
|
1054
|
-
* skip the patch to avoid corrupting the bundle (e.g. brace-depth counter
|
|
1055
|
-
* fooled by string literals containing braces in a future refactored version).
|
|
1056
|
-
*/
|
|
1057
|
-
const MAX_PATCH_TARGET_BODY_LENGTH = 5000;
|
|
1058
|
-
/**
|
|
1059
|
-
* Patch targets: each entry defines a function to replace.
|
|
1060
|
-
* - `eventMayReachTranscriptWriters`: broad return prevents events from
|
|
1061
|
-
* bypassing the write lock (necessary but not sufficient on virtiofs).
|
|
1062
|
-
* - `assertSessionFileFence`: no-op disables the fingerprint comparison
|
|
1063
|
-
* that false-triggers due to virtiofs stat drift.
|
|
1064
|
-
*/
|
|
1065
|
-
const SESSION_FENCE_PATCH_TARGETS = [
|
|
1066
|
-
{
|
|
1067
|
-
fnName: "function assertSessionFileFence()",
|
|
1068
|
-
litNeedle: "sameSessionFileFingerprint",
|
|
1069
|
-
replacement: "function assertSessionFileFence() { return; }",
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
fnName: "function eventMayReachTranscriptWriters",
|
|
1073
|
-
litNeedle: '"message_update"',
|
|
1074
|
-
replacement: 'function eventMayReachTranscriptWriters(session, event) { return typeof event?.type === "string"; }',
|
|
1075
|
-
},
|
|
1076
|
-
];
|
|
1077
|
-
/**
|
|
1078
|
-
* Patch the session fence bug in OpenClaw >= 5.19 by replacing the
|
|
1079
|
-
* `eventMayReachTranscriptWriters` function in the minified bundle.
|
|
1080
|
-
*
|
|
1081
|
-
* Idempotent: uses a marker file containing the SHA-256 of the patched
|
|
1082
|
-
* file. Skips if already patched or if the pattern is not found (future
|
|
1083
|
-
* fixed version or different bundle layout).
|
|
1084
|
-
*
|
|
1085
|
-
* Docker-only: the bug manifests through the virtiofs mount timing
|
|
1086
|
-
* discrepancy between container and host — raw_exec/process modes are
|
|
1087
|
-
* unaffected in practice.
|
|
1088
|
-
*/
|
|
1089
|
-
export function patchSessionFenceBug(openclawHome, instanceId) {
|
|
1090
|
-
if (getNomadDriver() !== "docker")
|
|
1091
|
-
return;
|
|
1092
|
-
// 1. Read installed version from npm-global package.json
|
|
1093
|
-
const pkgPath = join(openclawHome, ".npm-global", "lib", "node_modules", "openclaw", "package.json");
|
|
1094
|
-
let versionStr;
|
|
1095
|
-
try {
|
|
1096
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
1097
|
-
versionStr = pkg.version || "";
|
|
1098
|
-
}
|
|
1099
|
-
catch {
|
|
1100
|
-
return; // no npm-global install or unreadable — skip
|
|
1101
|
-
}
|
|
1102
|
-
// 2. Parse version and check minimum threshold
|
|
1103
|
-
const parts = versionStr.split(".").map(Number);
|
|
1104
|
-
if (parts.length < 3 || parts.some(Number.isNaN))
|
|
1105
|
-
return;
|
|
1106
|
-
const [major, minor, patch] = parts;
|
|
1107
|
-
const [minMajor, minMinor, minPatch] = SESSION_FENCE_BUG_MIN_VERSION;
|
|
1108
|
-
if (major < minMajor ||
|
|
1109
|
-
(major === minMajor && minor < minMinor) ||
|
|
1110
|
-
(major === minMajor && minor === minMinor && patch < minPatch)) {
|
|
1111
|
-
return; // version predates the bug
|
|
1112
|
-
}
|
|
1113
|
-
// 3. Find the selection-*.js bundle that contains the target function.
|
|
1114
|
-
// There may be multiple selection-*.js files in dist/; only one holds
|
|
1115
|
-
// the session management code.
|
|
1116
|
-
const distDir = join(openclawHome, ".npm-global", "lib", "node_modules", "openclaw", "dist");
|
|
1117
|
-
let bundleFiles;
|
|
1118
|
-
try {
|
|
1119
|
-
const entries = readdirSync(distDir);
|
|
1120
|
-
bundleFiles = entries.filter((f) => f.startsWith("selection-") && f.endsWith(".js"));
|
|
1121
|
-
}
|
|
1122
|
-
catch {
|
|
1123
|
-
return; // dist dir missing or unreadable
|
|
1124
|
-
}
|
|
1125
|
-
if (bundleFiles.length === 0)
|
|
1126
|
-
return;
|
|
1127
|
-
// Scan each candidate for any of the patch target signatures
|
|
1128
|
-
let bundlePath;
|
|
1129
|
-
let bundleContent;
|
|
1130
|
-
for (const file of bundleFiles) {
|
|
1131
|
-
const candidatePath = join(distDir, file);
|
|
1132
|
-
let content;
|
|
1133
|
-
try {
|
|
1134
|
-
content = readFileSync(candidatePath, "utf-8");
|
|
1135
|
-
}
|
|
1136
|
-
catch {
|
|
1137
|
-
continue;
|
|
1138
|
-
}
|
|
1139
|
-
// Match if any target's fnName or litNeedle is present
|
|
1140
|
-
const hasTarget = SESSION_FENCE_PATCH_TARGETS.some((t) => content.includes(t.fnName) || content.includes(t.litNeedle));
|
|
1141
|
-
if (hasTarget) {
|
|
1142
|
-
bundlePath = candidatePath;
|
|
1143
|
-
bundleContent = content;
|
|
1144
|
-
break;
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
if (!bundlePath || !bundleContent)
|
|
1148
|
-
return;
|
|
1149
|
-
// 4. Check marker file for idempotency
|
|
1150
|
-
const markerPath = join(distDir, `.session-fence-patched`);
|
|
1151
|
-
const currentHash = createHash("sha256").update(bundleContent).digest("hex");
|
|
1152
|
-
try {
|
|
1153
|
-
const marker = readFileSync(markerPath, "utf-8").trim();
|
|
1154
|
-
if (marker === currentHash)
|
|
1155
|
-
return; // already patched, hash matches
|
|
1156
|
-
}
|
|
1157
|
-
catch {
|
|
1158
|
-
// marker missing — proceed
|
|
1159
|
-
}
|
|
1160
|
-
// 5. Apply each patch target using brace-depth counting to extract and
|
|
1161
|
-
// replace function bodies. Process targets in order; earlier patches
|
|
1162
|
-
// shift offsets so we re-search after each replacement.
|
|
1163
|
-
let patched = bundleContent;
|
|
1164
|
-
let patchCount = 0;
|
|
1165
|
-
for (const target of SESSION_FENCE_PATCH_TARGETS) {
|
|
1166
|
-
let fnStart = patched.indexOf(target.fnName);
|
|
1167
|
-
// Fallback for eventMayReachTranscriptWriters: locate by unique literal
|
|
1168
|
-
// combination ("message_update" near "message_end" and "agent_end")
|
|
1169
|
-
if (fnStart === -1 && target.litNeedle === '"message_update"') {
|
|
1170
|
-
let scanPos = 0;
|
|
1171
|
-
while (scanPos < patched.length) {
|
|
1172
|
-
const litIdx = patched.indexOf(target.litNeedle, scanPos);
|
|
1173
|
-
if (litIdx === -1)
|
|
1174
|
-
break;
|
|
1175
|
-
const window = patched.slice(litIdx, litIdx + 200);
|
|
1176
|
-
if (window.includes('"message_end"') && window.includes('"agent_end"')) {
|
|
1177
|
-
const searchStart = Math.max(0, litIdx - 300);
|
|
1178
|
-
const prefix = patched.slice(searchStart, litIdx);
|
|
1179
|
-
const fnKeywordIdx = prefix.lastIndexOf("function ");
|
|
1180
|
-
if (fnKeywordIdx !== -1) {
|
|
1181
|
-
fnStart = searchStart + fnKeywordIdx;
|
|
1182
|
-
break;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
scanPos = litIdx + 1;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
if (fnStart === -1)
|
|
1189
|
-
continue; // target not found (already patched or fixed version)
|
|
1190
|
-
// Check if already patched (replacement is short and contains `return;`)
|
|
1191
|
-
const peekEnd = Math.min(fnStart + target.replacement.length + 10, patched.length);
|
|
1192
|
-
const peek = patched.slice(fnStart, peekEnd);
|
|
1193
|
-
if (peek.startsWith(target.replacement))
|
|
1194
|
-
continue;
|
|
1195
|
-
// Extract function body with brace-depth counting
|
|
1196
|
-
const braceStart = patched.indexOf("{", fnStart);
|
|
1197
|
-
if (braceStart === -1)
|
|
1198
|
-
continue;
|
|
1199
|
-
let depth = 0;
|
|
1200
|
-
let fnEnd = -1;
|
|
1201
|
-
for (let i = braceStart; i < patched.length; i++) {
|
|
1202
|
-
if (patched[i] === "{")
|
|
1203
|
-
depth++;
|
|
1204
|
-
else if (patched[i] === "}") {
|
|
1205
|
-
depth--;
|
|
1206
|
-
if (depth === 0) {
|
|
1207
|
-
fnEnd = i + 1;
|
|
1208
|
-
break;
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
if (fnEnd === -1)
|
|
1213
|
-
continue;
|
|
1214
|
-
// Safety: if extracted body is suspiciously large, skip to avoid corrupting
|
|
1215
|
-
// the bundle (brace counter may have been fooled by string contents).
|
|
1216
|
-
if (fnEnd - fnStart > MAX_PATCH_TARGET_BODY_LENGTH) {
|
|
1217
|
-
console.warn(`[openclaw] session-fence-patch ${instanceId}: skipping ${target.fnName} — body too large (${fnEnd - fnStart} chars)`);
|
|
1218
|
-
continue;
|
|
1219
|
-
}
|
|
1220
|
-
patched = patched.slice(0, fnStart) + target.replacement + patched.slice(fnEnd);
|
|
1221
|
-
patchCount++;
|
|
1222
|
-
}
|
|
1223
|
-
if (patchCount === 0) {
|
|
1224
|
-
// No targets needed patching — write marker for current state
|
|
1225
|
-
try {
|
|
1226
|
-
writeFileSync(markerPath, currentHash + "\n", "utf-8");
|
|
1227
|
-
}
|
|
1228
|
-
catch {
|
|
1229
|
-
/* best effort */
|
|
1230
|
-
}
|
|
1231
|
-
return;
|
|
1232
|
-
}
|
|
1233
|
-
// 7. Atomic write: temp file → rename
|
|
1234
|
-
const tmpPath = bundlePath + `.tmp.${randomBytes(4).toString("hex")}`;
|
|
1235
|
-
try {
|
|
1236
|
-
writeFileSync(tmpPath, patched, "utf-8");
|
|
1237
|
-
renameSync(tmpPath, bundlePath);
|
|
1238
|
-
}
|
|
1239
|
-
catch (err) {
|
|
1240
|
-
// Clean up temp file on failure
|
|
1241
|
-
try {
|
|
1242
|
-
unlinkSync(tmpPath);
|
|
1243
|
-
}
|
|
1244
|
-
catch {
|
|
1245
|
-
/* ignore */
|
|
1246
|
-
}
|
|
1247
|
-
console.warn(`[openclaw] session-fence-patch ${instanceId}: atomic write failed: ${err?.message ?? err}`);
|
|
1248
|
-
return;
|
|
1249
|
-
}
|
|
1250
|
-
// 8. Write marker with hash of the PATCHED file
|
|
1251
|
-
const patchedHash = createHash("sha256").update(patched).digest("hex");
|
|
1252
|
-
try {
|
|
1253
|
-
writeFileSync(markerPath, patchedHash + "\n", "utf-8");
|
|
1254
|
-
}
|
|
1255
|
-
catch {
|
|
1256
|
-
// Non-fatal — patch was applied, marker just helps idempotency
|
|
1257
|
-
}
|
|
1258
|
-
console.log(`[openclaw] session-fence-patch ${instanceId}: patched ${bundlePath.split("/").pop()} (v${versionStr})`);
|
|
1259
|
-
}
|
|
1260
|
-
// ── Container-side patch script ───────────────────────────────────────────
|
|
1261
|
-
/**
|
|
1262
|
-
* Self-contained Node.js script that patches the session fence bug from
|
|
1263
|
-
* INSIDE the container. Written to `$OPENCLAW_HOME/.jishushell/session-fence-patch.mjs`
|
|
1264
|
-
* by onBeforeStart and executed by the custom entrypoint wrapper before
|
|
1265
|
-
* the OpenClaw gateway starts.
|
|
1266
|
-
*
|
|
1267
|
-
* This covers the case where an in-container `npm install openclaw@latest`
|
|
1268
|
-
* upgrades to a buggy version (>= 5.19) after the container was created
|
|
1269
|
-
* with a clean image (5.7). The host-side `patchSessionFenceBug` cannot
|
|
1270
|
-
* patch at onBeforeStart time because the npm-global directory may not yet
|
|
1271
|
-
* contain the upgraded bundle (it's a dangling symlink to a container-only path).
|
|
1272
|
-
*/
|
|
1273
|
-
const CONTAINER_PATCH_SCRIPT = `#!/usr/bin/env node
|
|
1274
|
-
// Session fence patch — auto-generated by JishuShell.
|
|
1275
|
-
// Patches assertSessionFileFence + eventMayReachTranscriptWriters
|
|
1276
|
-
// in OpenClaw >= 2026.5.19 to work around virtiofs stat drift.
|
|
1277
|
-
import { readFileSync, writeFileSync, readdirSync, renameSync, existsSync } from "fs";
|
|
1278
|
-
import { join } from "path";
|
|
1279
|
-
import { createHash } from "crypto";
|
|
1280
|
-
|
|
1281
|
-
const home = process.env.HOME || process.env.OPENCLAW_HOME || "/home/openclaw";
|
|
1282
|
-
const distDir = join(home, ".npm-global", "lib", "node_modules", "openclaw", "dist");
|
|
1283
|
-
const pkgPath = join(home, ".npm-global", "lib", "node_modules", "openclaw", "package.json");
|
|
1284
|
-
|
|
1285
|
-
try {
|
|
1286
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
1287
|
-
const parts = (pkg.version || "").split(".").map(Number);
|
|
1288
|
-
if (parts.length < 3 || parts[0] < 2026 || (parts[0] === 2026 && parts[1] < 5) ||
|
|
1289
|
-
(parts[0] === 2026 && parts[1] === 5 && parts[2] < 19)) process.exit(0);
|
|
1290
|
-
// No upper version cap for now — patch all versions >= 5.19
|
|
1291
|
-
} catch { process.exit(0); }
|
|
1292
|
-
|
|
1293
|
-
const markerPath = join(distDir, ".session-fence-patched");
|
|
1294
|
-
let files;
|
|
1295
|
-
try { files = readdirSync(distDir).filter(f => f.startsWith("selection-") && f.endsWith(".js")); }
|
|
1296
|
-
catch { process.exit(0); }
|
|
1297
|
-
|
|
1298
|
-
const targets = [
|
|
1299
|
-
{ fn: "function assertSessionFileFence()", repl: "function assertSessionFileFence() { return; }" },
|
|
1300
|
-
{ fn: "function eventMayReachTranscriptWriters", repl: 'function eventMayReachTranscriptWriters(session, event) { return typeof event?.type === "string"; }' },
|
|
1301
|
-
];
|
|
1302
|
-
|
|
1303
|
-
for (const file of files) {
|
|
1304
|
-
const p = join(distDir, file);
|
|
1305
|
-
let src;
|
|
1306
|
-
try { src = readFileSync(p, "utf-8"); } catch { continue; }
|
|
1307
|
-
if (!targets.some(t => src.includes(t.fn) || src.includes("sameSessionFileFingerprint"))) continue;
|
|
1308
|
-
|
|
1309
|
-
const hash = createHash("sha256").update(src).digest("hex");
|
|
1310
|
-
try { if (readFileSync(markerPath, "utf-8").trim() === hash) process.exit(0); } catch {}
|
|
1311
|
-
|
|
1312
|
-
let modified = src;
|
|
1313
|
-
let count = 0;
|
|
1314
|
-
for (const t of targets) {
|
|
1315
|
-
const idx = modified.indexOf(t.fn);
|
|
1316
|
-
if (idx === -1) continue;
|
|
1317
|
-
if (modified.slice(idx, idx + t.repl.length + 5).startsWith(t.repl)) continue;
|
|
1318
|
-
const braceStart = modified.indexOf("{", idx);
|
|
1319
|
-
if (braceStart === -1) continue;
|
|
1320
|
-
let d = 0, end = -1;
|
|
1321
|
-
for (let i = braceStart; i < modified.length; i++) {
|
|
1322
|
-
if (modified[i] === "{") d++;
|
|
1323
|
-
else if (modified[i] === "}") { d--; if (d === 0) { end = i + 1; break; } }
|
|
1324
|
-
}
|
|
1325
|
-
if (end === -1) continue;
|
|
1326
|
-
if (end - idx > 5000) continue; // safety: skip if body suspiciously large
|
|
1327
|
-
modified = modified.slice(0, idx) + t.repl + modified.slice(end);
|
|
1328
|
-
count++;
|
|
1329
|
-
}
|
|
1330
|
-
if (count === 0) {
|
|
1331
|
-
try { writeFileSync(markerPath, hash + "\\n"); } catch {}
|
|
1332
|
-
process.exit(0);
|
|
1333
|
-
}
|
|
1334
|
-
const tmp = p + ".tmp." + Math.random().toString(36).slice(2, 8);
|
|
1335
|
-
writeFileSync(tmp, modified);
|
|
1336
|
-
renameSync(tmp, p);
|
|
1337
|
-
const newHash = createHash("sha256").update(modified).digest("hex");
|
|
1338
|
-
try { writeFileSync(markerPath, newHash + "\\n"); } catch {}
|
|
1339
|
-
console.log("[session-fence-patch] patched " + file);
|
|
1340
|
-
break;
|
|
1341
|
-
}
|
|
1342
|
-
`;
|
|
1343
|
-
/**
|
|
1344
|
-
* The custom entrypoint wrapper that executes the patch script before
|
|
1345
|
-
* deferring to the image's original entrypoint.
|
|
1346
|
-
*/
|
|
1347
|
-
const CONTAINER_ENTRYPOINT_WRAPPER = `#!/bin/sh
|
|
1348
|
-
# JishuShell session-fence-patch entrypoint wrapper
|
|
1349
|
-
PATCH="$HOME/.jishushell/session-fence-patch.mjs"
|
|
1350
|
-
if [ -f "$PATCH" ]; then
|
|
1351
|
-
node "$PATCH" 2>/dev/null || true
|
|
1352
|
-
fi
|
|
1353
|
-
exec /usr/local/bin/openclaw-entry.sh "$@"
|
|
1354
|
-
`;
|
|
1355
|
-
/**
|
|
1356
|
-
* Write the container-side patch script and entrypoint wrapper to the
|
|
1357
|
-
* openclaw-home directory so they are available inside the container
|
|
1358
|
-
* via the bind mount.
|
|
1359
|
-
*
|
|
1360
|
-
* Called from onBeforeStart. Idempotent — only writes if content changed.
|
|
1361
|
-
*/
|
|
1362
|
-
export function writeContainerPatchScript(openclawHome) {
|
|
1363
|
-
const scriptDir = join(openclawHome, ".jishushell");
|
|
1364
|
-
try {
|
|
1365
|
-
mkdirSync(scriptDir, { recursive: true });
|
|
1366
|
-
}
|
|
1367
|
-
catch {
|
|
1368
|
-
return;
|
|
1369
|
-
}
|
|
1370
|
-
const scriptPath = join(scriptDir, "session-fence-patch.mjs");
|
|
1371
|
-
const wrapperPath = join(scriptDir, "entrypoint.sh");
|
|
1372
|
-
// Write patch script (idempotent)
|
|
1373
|
-
try {
|
|
1374
|
-
const existing = readFileSync(scriptPath, "utf-8");
|
|
1375
|
-
if (existing === CONTAINER_PATCH_SCRIPT) {
|
|
1376
|
-
// Also check wrapper
|
|
1377
|
-
const existingWrapper = readFileSync(wrapperPath, "utf-8");
|
|
1378
|
-
if (existingWrapper === CONTAINER_ENTRYPOINT_WRAPPER)
|
|
1379
|
-
return;
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
catch {
|
|
1383
|
-
// file missing — write it
|
|
1384
|
-
}
|
|
1385
|
-
try {
|
|
1386
|
-
writeFileSync(scriptPath, CONTAINER_PATCH_SCRIPT, { mode: 0o755 });
|
|
1387
|
-
writeFileSync(wrapperPath, CONTAINER_ENTRYPOINT_WRAPPER, { mode: 0o755 });
|
|
1388
|
-
}
|
|
1389
|
-
catch {
|
|
1390
|
-
/* best effort */
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
function resolveUidGid(username) {
|
|
1394
|
-
try {
|
|
1395
|
-
if (!VALID_USER_RE.test(username)) {
|
|
1396
|
-
console.warn(`[openclaw] Invalid username for UID lookup: ${username}`);
|
|
1397
|
-
return `${process.getuid()}:${process.getgid()}`;
|
|
1398
|
-
}
|
|
1399
|
-
const passwd = readFileSync("/etc/passwd", "utf-8");
|
|
1400
|
-
const line = passwd.split("\n").find((l) => l.startsWith(username + ":"));
|
|
1401
|
-
if (line) {
|
|
1402
|
-
const parts = line.split(":");
|
|
1403
|
-
const uid = parseInt(parts[2], 10);
|
|
1404
|
-
const gid = parseInt(parts[3], 10);
|
|
1405
|
-
if (!isNaN(uid) && !isNaN(gid))
|
|
1406
|
-
return `${uid}:${gid}`;
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
catch {
|
|
1410
|
-
/* ignore */
|
|
1411
|
-
}
|
|
1412
|
-
return `${process.getuid()}:${process.getgid()}`;
|
|
1413
|
-
}
|
|
1414
|
-
function normalizeDockerResources(instanceId, resources) {
|
|
1415
|
-
const requestedMemoryMB = Number(resources.MemoryMB ?? DEFAULT_RESOURCES.MemoryMB);
|
|
1416
|
-
let effectiveMemoryMB = requestedMemoryMB;
|
|
1417
|
-
let effectiveMemoryMaxMB = Math.min(Number(resources.MemoryMaxMB ?? requestedMemoryMB), MAX_MEMORY_MAX_MB);
|
|
1418
|
-
if (effectiveMemoryMaxMB < effectiveMemoryMB) {
|
|
1419
|
-
console.warn(`[openclaw] ${instanceId}: MemoryMaxMB (${effectiveMemoryMaxMB}) is below MemoryMB (${effectiveMemoryMB}); clamping.`);
|
|
1420
|
-
effectiveMemoryMaxMB = effectiveMemoryMB;
|
|
1421
|
-
}
|
|
1422
|
-
return {
|
|
1423
|
-
...resources,
|
|
1424
|
-
MemoryMB: effectiveMemoryMB,
|
|
1425
|
-
MemoryMaxMB: effectiveMemoryMaxMB,
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1428
|
-
// ── Nomad template safety (migrated from nomad-manager.ts) ────────────
|
|
1429
|
-
const NOMAD_TEMPLATE_UNSAFE_RE = /[{}"\\]/;
|
|
1430
|
-
function assertSafeTemplateId(id) {
|
|
1431
|
-
if (NOMAD_TEMPLATE_UNSAFE_RE.test(id)) {
|
|
1432
|
-
throw new Error(`Job ID "${id}" contains characters unsafe for Nomad Template interpolation`);
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
// ── Lazy-imported framework helpers (avoid circular deps) ─────────────
|
|
1436
|
-
//
|
|
1437
|
-
// The adapter reaches back into instance-manager.ts for helpers that still
|
|
1438
|
-
// live there. Using lazy `await import()` keeps the static import graph
|
|
1439
|
-
// acyclic, so runtime/index.ts → adapters/openclaw.ts loads cleanly before
|
|
1440
|
-
// instance-manager.ts needs it.
|
|
1441
|
-
async function lazyIm() {
|
|
1442
|
-
return await import("../../instance-manager.js");
|
|
1443
|
-
}
|
|
1444
|
-
// ── Docker image build helpers (physically migrated from setup-manager) ─
|
|
1445
|
-
//
|
|
1446
|
-
// All OpenClaw-specific docker image build knowledge lives here. setup-manager
|
|
1447
|
-
// only retains a thin dispatch wrapper so the public
|
|
1448
|
-
// `buildSlimOpenclawImage()` / `startBuildSlimOpenclawImage()` API remains
|
|
1449
|
-
// back-compatible for routes/setup.ts and the CLI installer.
|
|
1450
|
-
/** Base image used for the slim OpenClaw runtime image. */
|
|
1451
|
-
const DOCKER_BASE_IMAGE = "node:22-slim";
|
|
1452
|
-
/** Mirror list tried in order when docker.io is unreachable. */
|
|
1453
|
-
const DOCKER_BASE_MIRRORS = [
|
|
1454
|
-
"node:22-slim",
|
|
1455
|
-
"hub-mirror.c.163.com/library/node:22-slim",
|
|
1456
|
-
"mirrors.tencent.com/library/node:22-slim",
|
|
1457
|
-
"registry.cn-hangzhou.aliyuncs.com/library/node:22-slim",
|
|
1458
|
-
];
|
|
1459
|
-
/** Matches a semver-ish tag suffix, e.g. "...:2026.4.9" or "...:v1.2.3-beta". */
|
|
1460
|
-
const PINNED_IMAGE_TAG_RE = /:[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$/;
|
|
1461
|
-
/**
|
|
1462
|
-
* Pull DOCKER_BASE_IMAGE from mirrors if not already cached locally.
|
|
1463
|
-
*/
|
|
1464
|
-
async function _ensureDockerBaseImage(invocation, task) {
|
|
1465
|
-
try {
|
|
1466
|
-
execFileSync(invocation.cmd, [...invocation.argsPrefix, "image", "inspect", DOCKER_BASE_IMAGE], {
|
|
1467
|
-
timeout: 5000,
|
|
1468
|
-
stdio: "ignore",
|
|
1469
|
-
});
|
|
1470
|
-
emitTask(task, { type: "log", message: `基础镜像已缓存: ${DOCKER_BASE_IMAGE}` });
|
|
1471
|
-
return DOCKER_BASE_IMAGE;
|
|
1472
|
-
}
|
|
1473
|
-
catch {
|
|
1474
|
-
/* not cached, fall through */
|
|
1475
|
-
}
|
|
1476
|
-
for (const mirror of DOCKER_BASE_MIRRORS) {
|
|
1477
|
-
emitTask(task, { type: "log", message: `拉取基础镜像: ${mirror} ...` });
|
|
1478
|
-
const result = await spawnWithTask(task, invocation.cmd, [...invocation.argsPrefix, "pull", mirror], { timeout: 300000 });
|
|
1479
|
-
if (result.ok) {
|
|
1480
|
-
if (mirror !== DOCKER_BASE_IMAGE) {
|
|
1481
|
-
try {
|
|
1482
|
-
execFileSync(invocation.cmd, [...invocation.argsPrefix, "tag", mirror, DOCKER_BASE_IMAGE], { timeout: 10000 });
|
|
1483
|
-
}
|
|
1484
|
-
catch {
|
|
1485
|
-
/* tag failure is non-fatal */
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
emitTask(task, { type: "log", message: `基础镜像就绪: ${DOCKER_BASE_IMAGE}` });
|
|
1489
|
-
return DOCKER_BASE_IMAGE;
|
|
1490
|
-
}
|
|
1491
|
-
emitTask(task, { type: "log", message: ` → ${mirror} 不可达,尝试下一个镜像源...` });
|
|
1492
|
-
}
|
|
1493
|
-
throw new Error(`无法获取基础镜像 ${DOCKER_BASE_IMAGE}。请检查网络或手动执行: docker pull ${DOCKER_BASE_MIRRORS[1]}`);
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* Query the npm registry for the current OpenClaw version. Used to bust the
|
|
1497
|
-
* Docker layer cache for `RUN npm install openclaw@${ver}` during local build.
|
|
1498
|
-
*/
|
|
1499
|
-
function resolveOpenclawNpmVersion() {
|
|
1500
|
-
try {
|
|
1501
|
-
const out = execFileSync("npm", ["view", "openclaw", "version"], {
|
|
1502
|
-
timeout: 15000,
|
|
1503
|
-
encoding: "utf-8",
|
|
1504
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
1505
|
-
}).trim();
|
|
1506
|
-
if (/^\d+\.\d+\.\d+/.test(out))
|
|
1507
|
-
return out;
|
|
1508
|
-
}
|
|
1509
|
-
catch {
|
|
1510
|
-
/* npm not reachable */
|
|
1511
|
-
}
|
|
1512
|
-
return "latest";
|
|
1513
|
-
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Read the OpenClaw version bundled at /app/ inside a Docker image.
|
|
1516
|
-
*/
|
|
1517
|
-
function readBundledOpenclawVersion(invocation, image) {
|
|
1518
|
-
try {
|
|
1519
|
-
const out = execFileSync(invocation.cmd, [
|
|
1520
|
-
...invocation.argsPrefix,
|
|
1521
|
-
"run",
|
|
1522
|
-
"--rm",
|
|
1523
|
-
"--entrypoint",
|
|
1524
|
-
"node",
|
|
1525
|
-
image,
|
|
1526
|
-
"-p",
|
|
1527
|
-
"require('/app/node_modules/openclaw/package.json').version",
|
|
1528
|
-
], { timeout: 20000, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
1529
|
-
if (/^\d+\.\d+\.\d+/.test(out))
|
|
1530
|
-
return out;
|
|
1531
|
-
}
|
|
1532
|
-
catch {
|
|
1533
|
-
/* docker unavailable, image missing, or path not present */
|
|
1534
|
-
}
|
|
1535
|
-
return "";
|
|
1536
|
-
}
|
|
1537
|
-
/**
|
|
1538
|
-
* Add a pinned version alias for an image, then drop the mutable :latest /
|
|
1539
|
-
* :slim tag. See original setup-manager commentary for details.
|
|
1540
|
-
*/
|
|
1541
|
-
function capturePinnedImageTag(invocation, targetTag, explicitVersion) {
|
|
1542
|
-
if (PINNED_IMAGE_TAG_RE.test(targetTag))
|
|
1543
|
-
return targetTag;
|
|
1544
|
-
let version = explicitVersion && /^\d+\.\d+\.\d+/.test(explicitVersion) ? explicitVersion : "";
|
|
1545
|
-
if (!version) {
|
|
1546
|
-
version = readBundledOpenclawVersion(invocation, targetTag);
|
|
1547
|
-
}
|
|
1548
|
-
if (!version || !/^\d+\.\d+\.\d+/.test(version))
|
|
1549
|
-
return targetTag;
|
|
1550
|
-
const colonIdx = targetTag.lastIndexOf(":");
|
|
1551
|
-
const slashIdx = targetTag.lastIndexOf("/");
|
|
1552
|
-
const hasTag = colonIdx > slashIdx;
|
|
1553
|
-
const repo = hasTag ? targetTag.slice(0, colonIdx) : targetTag;
|
|
1554
|
-
const pinnedTag = `${repo}:${version}`;
|
|
1555
|
-
if (pinnedTag === targetTag)
|
|
1556
|
-
return targetTag;
|
|
1557
|
-
try {
|
|
1558
|
-
execFileSync(invocation.cmd, [...invocation.argsPrefix, "tag", targetTag, pinnedTag], { timeout: 10000, stdio: "ignore" });
|
|
1559
|
-
}
|
|
1560
|
-
catch {
|
|
1561
|
-
return targetTag;
|
|
1562
|
-
}
|
|
1563
|
-
if (/:(latest|slim)$/.test(targetTag)) {
|
|
1564
|
-
try {
|
|
1565
|
-
execFileSync(invocation.cmd, [...invocation.argsPrefix, "rmi", targetTag], { timeout: 10000, stdio: "ignore" });
|
|
1566
|
-
}
|
|
1567
|
-
catch {
|
|
1568
|
-
/* best-effort cleanup */
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
return pinnedTag;
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* Try docker pull, fall back to local `Dockerfile.openclaw-slim` build. This
|
|
1575
|
-
* is the primary image-prep path used by every setup flow. Called from the
|
|
1576
|
-
* adapter's `buildRuntimeImage()` method.
|
|
1577
|
-
*/
|
|
1578
|
-
async function pullOrBuildOpenclawImageWithTask(task, tag) {
|
|
1579
|
-
const targetTag = tag || DEFAULT_OPENCLAW_DOCKER_IMAGE;
|
|
1580
|
-
try {
|
|
1581
|
-
const invocation = resolveDockerInvocation();
|
|
1582
|
-
// Always attempt pull — when the image is already local and in sync
|
|
1583
|
-
// with upstream, docker returns within seconds after a digest check.
|
|
1584
|
-
// The "skip if image present" early exit was making "reinstall" feel
|
|
1585
|
-
// like a no-op; explicit re-pull matches user intent better. On pull
|
|
1586
|
-
// failure we still fall back to local build below.
|
|
1587
|
-
emitTask(task, { type: "progress", message: `正在拉取镜像: ${targetTag} ...`, progress: 10 });
|
|
1588
|
-
const pullResult = await spawnWithTask(task, invocation.cmd, [...invocation.argsPrefix, "pull", targetTag], { timeout: 600000 });
|
|
1589
|
-
if (pullResult.ok) {
|
|
1590
|
-
const pinned = capturePinnedImageTag(invocation, targetTag);
|
|
1591
|
-
setOpenclawDockerImage(pinned);
|
|
1592
|
-
emitTask(task, { type: "done", message: `镜像拉取成功: ${pinned}`, progress: 100 });
|
|
1593
|
-
task.status = "done";
|
|
1594
|
-
return { ok: true, message: `Docker image ${pinned} pulled`, taskId: task.id };
|
|
1595
|
-
}
|
|
1596
|
-
console.log(`[openclaw] docker pull failed for ${targetTag}, falling back to local build...`);
|
|
1597
|
-
emitTask(task, {
|
|
1598
|
-
type: "progress",
|
|
1599
|
-
message: `拉取失败,正在本地构建镜像: ${targetTag} ...`,
|
|
1600
|
-
progress: 20,
|
|
1601
|
-
});
|
|
1602
|
-
const projectRoot = join(dirname(fileURLToPath(import.meta.url)), "../../../..");
|
|
1603
|
-
const dockerfilePath = join(projectRoot, "Dockerfile.openclaw-slim");
|
|
1604
|
-
if (!existsSync(dockerfilePath)) {
|
|
1605
|
-
emitTask(task, {
|
|
1606
|
-
type: "error",
|
|
1607
|
-
message: "Dockerfile.openclaw-slim not found, cannot fallback to local build",
|
|
1608
|
-
});
|
|
1609
|
-
task.status = "error";
|
|
1610
|
-
return {
|
|
1611
|
-
ok: false,
|
|
1612
|
-
message: "Docker pull failed and Dockerfile.openclaw-slim not found",
|
|
1613
|
-
taskId: task.id,
|
|
1614
|
-
};
|
|
1615
|
-
}
|
|
1616
|
-
const openclawVersion = resolveOpenclawNpmVersion();
|
|
1617
|
-
console.log(`[openclaw] building image with OPENCLAW_VERSION=${openclawVersion}`);
|
|
1618
|
-
const buildResult = await spawnWithTask(task, invocation.cmd, [
|
|
1619
|
-
...invocation.argsPrefix,
|
|
1620
|
-
"build",
|
|
1621
|
-
"--network=host",
|
|
1622
|
-
"--build-arg",
|
|
1623
|
-
`OPENCLAW_VERSION=${openclawVersion}`,
|
|
1624
|
-
"-f",
|
|
1625
|
-
dockerfilePath,
|
|
1626
|
-
"-t",
|
|
1627
|
-
targetTag,
|
|
1628
|
-
projectRoot,
|
|
1629
|
-
], { timeout: 1800000, progressParser: dockerBuildProgressParser });
|
|
1630
|
-
if (!buildResult.ok) {
|
|
1631
|
-
try {
|
|
1632
|
-
execFileSync(invocation.cmd, [...invocation.argsPrefix, "image", "prune", "-f"], { timeout: 15000, stdio: "ignore" });
|
|
1633
|
-
}
|
|
1634
|
-
catch {
|
|
1635
|
-
/* best-effort */
|
|
1636
|
-
}
|
|
1637
|
-
emitTask(task, { type: "error", message: "Docker 镜像构建失败" });
|
|
1638
|
-
task.status = "error";
|
|
1639
|
-
return {
|
|
1640
|
-
ok: false,
|
|
1641
|
-
message: "Docker image build failed",
|
|
1642
|
-
error: buildResult.output,
|
|
1643
|
-
taskId: task.id,
|
|
1644
|
-
};
|
|
1645
|
-
}
|
|
1646
|
-
const pinned = capturePinnedImageTag(invocation, targetTag, openclawVersion);
|
|
1647
|
-
setOpenclawDockerImage(pinned);
|
|
1648
|
-
emitTask(task, {
|
|
1649
|
-
type: "done",
|
|
1650
|
-
message: `OpenClaw 镜像就绪 (本地构建): ${pinned}`,
|
|
1651
|
-
progress: 100,
|
|
1652
|
-
});
|
|
1653
|
-
task.status = "done";
|
|
1654
|
-
return { ok: true, message: `Docker image ${pinned} built locally`, taskId: task.id };
|
|
1655
|
-
}
|
|
1656
|
-
catch (e) {
|
|
1657
|
-
emitTask(task, { type: "error", message: `镜像获取失败: ${e.message}` });
|
|
1658
|
-
task.status = "error";
|
|
1659
|
-
return {
|
|
1660
|
-
ok: false,
|
|
1661
|
-
message: "Docker image pull/build failed",
|
|
1662
|
-
error: e.message,
|
|
1663
|
-
taskId: task.id,
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
// ── OpenClawAdapter class ─────────────────────────────────────────────
|
|
1668
|
-
class OpenClawAdapter {
|
|
1669
|
-
agentType = "openclaw";
|
|
1670
|
-
displayName = "OpenClaw";
|
|
1671
|
-
defaultCapabilities = DEFAULT_CAPABILITIES;
|
|
1672
|
-
defaultGatewayPort = OPENCLAW_DEFAULT_GATEWAY_PORT;
|
|
1673
|
-
manifest = {
|
|
1674
|
-
agentType: "openclaw",
|
|
1675
|
-
displayName: "OpenClaw",
|
|
1676
|
-
description: "默认 runtime,支持克隆、飞书 / 企业微信插件",
|
|
1677
|
-
defaultCapabilities: DEFAULT_CAPABILITIES,
|
|
1678
|
-
requiresNomadDocker: false,
|
|
1679
|
-
diskSpaceMB: 2048,
|
|
1680
|
-
};
|
|
1681
|
-
hooks = {
|
|
1682
|
-
/**
|
|
1683
|
-
* Full OpenClaw pre-start prelude — used to live inline in
|
|
1684
|
-
* `nomad-manager.startInstance()` as an `if (!hermes) { ... }` branch
|
|
1685
|
-
* (~80 lines). Framework code now calls this hook uniformly for every
|
|
1686
|
-
* kind; Hermes provides a no-op and OpenClaw owns the full sequence:
|
|
1687
|
-
*
|
|
1688
|
-
* 1. Stop any legacy process-manager subprocess
|
|
1689
|
-
* 2. Ensure `openclaw.json` exists + fix state-dir permissions
|
|
1690
|
-
* 3. Docker-bridge: patch gateway.bind + jsproxy baseUrl
|
|
1691
|
-
* 4. Seed `$HOME/.npm-global` for in-gateway "Update now"
|
|
1692
|
-
* 5. Validate + image-inspect the Docker image; background-pull on miss
|
|
1693
|
-
* 6. Write JSPROXY_API_KEY into Nomad Variables
|
|
1694
|
-
*
|
|
1695
|
-
* Throws on fatal errors. Framework catches and returns the structured
|
|
1696
|
-
* result; a `taskId` property on the thrown error signals an async
|
|
1697
|
-
* image pull in progress.
|
|
1698
|
-
*/
|
|
1699
|
-
onBeforeStart: async ({ instanceId }) => {
|
|
1700
|
-
// 1. Stop any legacy subprocess
|
|
1701
|
-
try {
|
|
1702
|
-
const { getLegacyStatus, stopInstance: stopLegacyInstance } = await import("../../process-manager.js");
|
|
1703
|
-
const legacyStatus = await getLegacyStatus(instanceId);
|
|
1704
|
-
if (legacyStatus.status === "running") {
|
|
1705
|
-
console.log(`[openclaw] Stopping legacy process for ${instanceId} (pid=${legacyStatus.pid}) before Nomad start`);
|
|
1706
|
-
await stopLegacyInstance(instanceId);
|
|
1707
|
-
await new Promise((r) => setTimeout(r, 2000));
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
catch {
|
|
1711
|
-
/* process-manager may be absent; harmless */
|
|
1712
|
-
}
|
|
1713
|
-
// 2. Config path existence check + permissions — use local resolvers
|
|
1714
|
-
// instead of lazy importing back into instance-manager.
|
|
1715
|
-
let configPath;
|
|
1716
|
-
try {
|
|
1717
|
-
configPath = openclawAdapter.resolveConfigPath(instanceId);
|
|
1718
|
-
}
|
|
1719
|
-
catch {
|
|
1720
|
-
return; // bail gracefully for non-OpenClaw instances
|
|
1721
|
-
}
|
|
1722
|
-
if (!existsSync(configPath)) {
|
|
1723
|
-
throw new Error("Config file not found");
|
|
1724
|
-
}
|
|
1725
|
-
if (getNomadDriver() === "docker") {
|
|
1726
|
-
const stateDir = dirname(configPath);
|
|
1727
|
-
ensureDirContainer(stateDir);
|
|
1728
|
-
try {
|
|
1729
|
-
for (const entry of readdirSync(stateDir, { withFileTypes: true })) {
|
|
1730
|
-
if (entry.isDirectory()) {
|
|
1731
|
-
const sub = join(stateDir, entry.name);
|
|
1732
|
-
ensureDirContainer(sub);
|
|
1733
|
-
try {
|
|
1734
|
-
for (const child of readdirSync(sub, { withFileTypes: true })) {
|
|
1735
|
-
if (child.isDirectory())
|
|
1736
|
-
ensureDirContainer(join(sub, child.name));
|
|
1737
|
-
}
|
|
1738
|
-
}
|
|
1739
|
-
catch {
|
|
1740
|
-
/* ignore */
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
catch {
|
|
1746
|
-
/* ignore */
|
|
1747
|
-
}
|
|
1748
|
-
if (existsSync(configPath))
|
|
1749
|
-
chmodSync(configPath, 0o644);
|
|
1750
|
-
// 3. Docker bridge patches
|
|
1751
|
-
patchDockerBridgeGatewayBind(configPath);
|
|
1752
|
-
patchJsproxyBaseUrl(configPath);
|
|
1753
|
-
patchPrivateNetworkAllowFlag(configPath);
|
|
1754
|
-
}
|
|
1755
|
-
// Driver-agnostic: enable the OpenAI-compatible endpoints on every
|
|
1756
|
-
// start so the `llm-agent` capability advertised by openclaw-*.yaml
|
|
1757
|
-
// works for both fresh installs and instances created before this
|
|
1758
|
-
// patcher shipped. Idempotent — bails out fast if already enabled.
|
|
1759
|
-
patchOpenAIEndpointsEnabled(configPath);
|
|
1760
|
-
// 4. npm update-seed — use local resolver
|
|
1761
|
-
try {
|
|
1762
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1763
|
-
if (home)
|
|
1764
|
-
ensureOpenclawUpdateSeed(home, instanceId);
|
|
1765
|
-
}
|
|
1766
|
-
catch {
|
|
1767
|
-
/* best effort */
|
|
1768
|
-
}
|
|
1769
|
-
// 4a. Patch session fence bug in OpenClaw >= 5.19
|
|
1770
|
-
try {
|
|
1771
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1772
|
-
if (home) {
|
|
1773
|
-
patchSessionFenceBug(home, instanceId);
|
|
1774
|
-
// Also write the container-side patch script so that even if
|
|
1775
|
-
// the host-side patch couldn't apply (e.g. symlink to container
|
|
1776
|
-
// path), the container will self-patch on startup.
|
|
1777
|
-
if (getNomadDriver() === "docker") {
|
|
1778
|
-
writeContainerPatchScript(home);
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
catch {
|
|
1783
|
-
/* best effort — patch failure must not prevent start */
|
|
1784
|
-
}
|
|
1785
|
-
// 4b. Build the workspace symlink layout from this instance's
|
|
1786
|
-
// fileMounts (M1 W2). For docker mode, the corresponding
|
|
1787
|
-
// volume bindings are added in buildNomadTask below; for
|
|
1788
|
-
// raw_exec / process modes, the symlinks are sufficient
|
|
1789
|
-
// (no container layer between agent and host fs).
|
|
1790
|
-
try {
|
|
1791
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1792
|
-
const im = await lazyIm();
|
|
1793
|
-
const runtime = im.getInstanceRuntime(instanceId);
|
|
1794
|
-
const mounts = readFileMounts(runtime);
|
|
1795
|
-
if (home) {
|
|
1796
|
-
const { rebuildWorkspace } = await import("../../workspace-builder.js");
|
|
1797
|
-
rebuildWorkspace({
|
|
1798
|
-
openclawHome: home,
|
|
1799
|
-
filesRoot: FILES_ROOT,
|
|
1800
|
-
mounts,
|
|
1801
|
-
instanceId,
|
|
1802
|
-
});
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
catch (e) {
|
|
1806
|
-
// Surface migration-required clearly; otherwise fall back to a
|
|
1807
|
-
// warning so a misconfigured mount cannot prevent instance start.
|
|
1808
|
-
if (e?.reason === "needs-migration") {
|
|
1809
|
-
throw new Error(`instance ${instanceId} workspace contains pre-W2 user data; run legacy migration first (${e.message})`);
|
|
1810
|
-
}
|
|
1811
|
-
console.warn(`[openclaw] workspace rebuild skipped: ${e?.message ?? e}`);
|
|
1812
|
-
}
|
|
1813
|
-
// 4b-bis. Patch TOOLS.md with the drive-shim hint so the agent
|
|
1814
|
-
// understands user files are local (host==container bind) and
|
|
1815
|
-
// knows the resolve→send chain for IM channels. Without this,
|
|
1816
|
-
// the LLM defaults to "drive = remote cloud service" and
|
|
1817
|
-
// refuses to send NAS files via Feishu/WeChat. Runs after the
|
|
1818
|
-
// workspace rebuild because that step creates the workspace
|
|
1819
|
-
// tree if missing.
|
|
1820
|
-
try {
|
|
1821
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1822
|
-
if (home) {
|
|
1823
|
-
patchToolsMdDriveHint(join(home, ".openclaw", "workspace"), FILES_ROOT);
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
catch (e) {
|
|
1827
|
-
console.warn(`[openclaw] TOOLS.md drive hint skipped: ${e?.message ?? e}`);
|
|
1828
|
-
}
|
|
1829
|
-
// 4b-ter. Rotate stale session jsonl(s) when the runtime contract
|
|
1830
|
-
// bumps. This is the auto-recovery path for panel upgrades
|
|
1831
|
-
// that fix runtime bugs the agent has already "concluded
|
|
1832
|
-
// around" inside an existing session — without rotation the
|
|
1833
|
-
// LLM keeps citing past failures and refusing to retry even
|
|
1834
|
-
// after the underlying bug is fixed. Idempotent: after the
|
|
1835
|
-
// first onBeforeStart post-upgrade writes the new marker,
|
|
1836
|
-
// subsequent starts are no-ops.
|
|
1837
|
-
try {
|
|
1838
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1839
|
-
if (home)
|
|
1840
|
-
rotateSessionsIfContractChanged(instanceId, home);
|
|
1841
|
-
}
|
|
1842
|
-
catch (e) {
|
|
1843
|
-
console.warn(`[openclaw] session rotation skipped: ${e?.message ?? e}`);
|
|
1844
|
-
}
|
|
1845
|
-
// 4c. Install the drive MCP shim so the agent can call panel
|
|
1846
|
-
// file/organize APIs from chat (M1 W1.6). Idempotent — we
|
|
1847
|
-
// overwrite the shim file every start to pick up fixes, and
|
|
1848
|
-
// mergeMcporterServers marks the entry with __source so user-
|
|
1849
|
-
// managed mcporter entries are preserved untouched.
|
|
1850
|
-
try {
|
|
1851
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1852
|
-
if (home) {
|
|
1853
|
-
const { substituteDriveShimPlaceholders } = await import("../mcp-shims/drive-shim.js");
|
|
1854
|
-
const { mergeMcporterServers } = await import("./openclaw-mcporter.js");
|
|
1855
|
-
const { getInternalMcpToken } = await import("../../../config.js");
|
|
1856
|
-
// Pick the panel URL based on how THIS instance will actually run.
|
|
1857
|
-
// For a containerized instance (raw_exec/docker via Nomad with a
|
|
1858
|
-
// docker image), `host.docker.internal:8090` resolves through the
|
|
1859
|
-
// bridge gateway. For a host-process / binary spec under Nomad
|
|
1860
|
-
// raw_exec, the task gets its own network namespace where
|
|
1861
|
-
// 127.0.0.1 only reaches the task itself — must use the host's
|
|
1862
|
-
// LAN IPv4 so the shim's fetch crosses back into the host netns.
|
|
1863
|
-
// Detected via the instance's resolved runtime: container tasks
|
|
1864
|
-
// carry `runtime.image`, binary tasks carry only `runtime.command`.
|
|
1865
|
-
let drivePanelUrl = "http://host.docker.internal:8090";
|
|
1866
|
-
try {
|
|
1867
|
-
const im2 = await lazyIm();
|
|
1868
|
-
const rt = im2.getInstanceRuntime(instanceId);
|
|
1869
|
-
if (!rt?.image) {
|
|
1870
|
-
const { getPanelLanHost, getPanelPort } = await import("../../../config.js");
|
|
1871
|
-
drivePanelUrl = `http://${getPanelLanHost()}:${getPanelPort()}`;
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
catch {
|
|
1875
|
-
// Best effort — fall through to host.docker.internal default
|
|
1876
|
-
}
|
|
1877
|
-
const shimDir = join(home, "__mcp_shims__", "drive");
|
|
1878
|
-
ensureDirContainer(shimDir);
|
|
1879
|
-
const shimPath = join(shimDir, "drive-shim.mjs");
|
|
1880
|
-
// Bake panelUrl/token/instanceId into the shim source so it works
|
|
1881
|
-
// even when OpenClaw scrubs env on MCP subprocess spawn (verified
|
|
1882
|
-
// 2026-05-11 on pi2: env scrub made the shim default to the
|
|
1883
|
-
// unreachable host.docker.internal and surface as "fetch failed").
|
|
1884
|
-
const internalToken = getInternalMcpToken();
|
|
1885
|
-
const shimSource = substituteDriveShimPlaceholders({
|
|
1886
|
-
panelUrl: drivePanelUrl,
|
|
1887
|
-
token: internalToken,
|
|
1888
|
-
instanceId,
|
|
1889
|
-
});
|
|
1890
|
-
writeFileSync(shimPath, shimSource, { mode: 0o755 });
|
|
1891
|
-
mergeMcporterServers(instanceId, {
|
|
1892
|
-
drive: {
|
|
1893
|
-
command: "node",
|
|
1894
|
-
args: [shimPath],
|
|
1895
|
-
env: {
|
|
1896
|
-
// Env still set as a belt-and-suspenders. With baked-in
|
|
1897
|
-
// values in the shim source itself, these become a fallback
|
|
1898
|
-
// for dev/manual testing — production never depends on them.
|
|
1899
|
-
JISHUSHELL_INTERNAL_TOKEN: internalToken,
|
|
1900
|
-
JISHUSHELL_INSTANCE_ID: instanceId,
|
|
1901
|
-
JISHUSHELL_PANEL_URL: drivePanelUrl,
|
|
1902
|
-
},
|
|
1903
|
-
__source: {
|
|
1904
|
-
kind: "connection",
|
|
1905
|
-
slot: "drive",
|
|
1906
|
-
consumerInstanceId: instanceId,
|
|
1907
|
-
},
|
|
1908
|
-
},
|
|
1909
|
-
});
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
catch (e) {
|
|
1913
|
-
console.warn(`[openclaw] drive shim install skipped: ${e?.message ?? e}`);
|
|
1914
|
-
}
|
|
1915
|
-
// 4c-quater. Auto-wire AnythingLLM kb shim. The Connections-tab
|
|
1916
|
-
// knowledge slot (declared as `requires: knowledge` on the
|
|
1917
|
-
// OpenClaw spec, persisted under `instance.connections.KNOWLEDGE_BASE_URL`)
|
|
1918
|
-
// is honored here, so unbinding in the UI actually takes effect.
|
|
1919
|
-
// Three states (matching connection-resolver.ts):
|
|
1920
|
-
//
|
|
1921
|
-
// - `null` → user explicitly disconnected → DO NOT
|
|
1922
|
-
// inject (and strip any prior shim).
|
|
1923
|
-
// - explicit binding → inject only if it points at the
|
|
1924
|
-
// anythingllm-container provider; any
|
|
1925
|
-
// other choice means user wants a
|
|
1926
|
-
// different kb provider that we don't
|
|
1927
|
-
// yet ship a shim for.
|
|
1928
|
-
// - undefined → no opinion → fall back to the
|
|
1929
|
-
// historical "auto-on when AnythingLLM
|
|
1930
|
-
// credentials.json exists" UX.
|
|
1931
|
-
//
|
|
1932
|
-
// Secrets handling (defense-in-depth):
|
|
1933
|
-
// - shim source (mode 0o644) carries baseUrl + workspace only;
|
|
1934
|
-
// the API key lives in a sibling `secret.json` (0o600).
|
|
1935
|
-
// - mcporter.json (0o644) env carries only non-secret hints
|
|
1936
|
-
// for hand-running. Production shim reads the secret file.
|
|
1937
|
-
try {
|
|
1938
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
1939
|
-
if (home) {
|
|
1940
|
-
const instMeta = getInstance(instanceId);
|
|
1941
|
-
const kbBinding = instMeta?.connections?.KNOWLEDGE_BASE_URL;
|
|
1942
|
-
let bindingAllowsInject = true;
|
|
1943
|
-
if (kbBinding === null) {
|
|
1944
|
-
bindingAllowsInject = false;
|
|
1945
|
-
}
|
|
1946
|
-
else if (kbBinding && typeof kbBinding === "object") {
|
|
1947
|
-
if (kbBinding.kind === "single") {
|
|
1948
|
-
bindingAllowsInject = kbBinding.providerId === "anythingllm-container";
|
|
1949
|
-
}
|
|
1950
|
-
else if (kbBinding.kind === "many") {
|
|
1951
|
-
const providers = Array.isArray(kbBinding.providers) ? kbBinding.providers : [];
|
|
1952
|
-
bindingAllowsInject = providers.some((p) => p?.providerId === "anythingllm-container");
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
const credPath = join(JISHUSHELL_HOME, "apps", "anythingllm-container", "credentials.json");
|
|
1956
|
-
let kbCreds = null;
|
|
1957
|
-
if (bindingAllowsInject && existsSync(credPath)) {
|
|
1958
|
-
try {
|
|
1959
|
-
kbCreds = JSON.parse(readFileSync(credPath, "utf-8"));
|
|
1960
|
-
}
|
|
1961
|
-
catch (e) {
|
|
1962
|
-
console.warn(`[openclaw] kb: invalid credentials.json: ${e?.message ?? e}`);
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
const wsDir = join(home, ".openclaw", "workspace");
|
|
1966
|
-
const shimDir = join(home, "__mcp_shims__", "anythingllm");
|
|
1967
|
-
const shimPath = join(shimDir, "anythingllm-shim.js");
|
|
1968
|
-
const secretPath = join(shimDir, "secret.json");
|
|
1969
|
-
const { mergeMcporterServers, removeMcporterServers } = await import("./openclaw-mcporter.js");
|
|
1970
|
-
if (kbCreds?.apiKey && kbCreds?.baseUrl) {
|
|
1971
|
-
const { substituteAnythingllmShimPlaceholders } = await import("../mcp-shims/anythingllm-shim.js");
|
|
1972
|
-
ensureDirContainer(shimDir);
|
|
1973
|
-
const shimSource = substituteAnythingllmShimPlaceholders({
|
|
1974
|
-
baseUrl: kbCreds.baseUrl,
|
|
1975
|
-
workspace: kbCreds.workspace || "default",
|
|
1976
|
-
});
|
|
1977
|
-
writeFileSync(shimPath, shimSource, { mode: 0o644 });
|
|
1978
|
-
// chmod after write to dodge umask; secret.json must be 0o600.
|
|
1979
|
-
writeFileSync(secretPath, JSON.stringify({ apiKey: kbCreds.apiKey }), { mode: 0o600 });
|
|
1980
|
-
try {
|
|
1981
|
-
chmodSync(secretPath, 0o600);
|
|
1982
|
-
}
|
|
1983
|
-
catch { /* best effort */ }
|
|
1984
|
-
mergeMcporterServers(instanceId, {
|
|
1985
|
-
kb: {
|
|
1986
|
-
command: "node",
|
|
1987
|
-
args: [shimPath],
|
|
1988
|
-
env: {
|
|
1989
|
-
// Belt-and-suspenders fallback for hand-running. Baked
|
|
1990
|
-
// values in the shim source are the production source
|
|
1991
|
-
// of truth for baseUrl + workspace; the API key is
|
|
1992
|
-
// intentionally NOT placed here — it lives in
|
|
1993
|
-
// `secret.json` (0o600) next to the shim so this 0o644
|
|
1994
|
-
// file stays free of secrets.
|
|
1995
|
-
ANYTHINGLLM_BASE_URL: kbCreds.baseUrl,
|
|
1996
|
-
ANYTHINGLLM_WORKSPACE: kbCreds.workspace || "default",
|
|
1997
|
-
},
|
|
1998
|
-
__source: {
|
|
1999
|
-
kind: "connection",
|
|
2000
|
-
slot: "knowledge",
|
|
2001
|
-
consumerInstanceId: instanceId,
|
|
2002
|
-
},
|
|
2003
|
-
},
|
|
2004
|
-
});
|
|
2005
|
-
patchToolsMdKbHint(wsDir, "install");
|
|
2006
|
-
}
|
|
2007
|
-
else {
|
|
2008
|
-
// Clean removal path (covers "AnythingLLM uninstalled / not
|
|
2009
|
-
// yet ready" AND "user explicitly unbound knowledge in
|
|
2010
|
-
// Connections tab" AND "user bound a different kb provider").
|
|
2011
|
-
removeMcporterServers(instanceId, {
|
|
2012
|
-
source: { kind: "connection", slot: "knowledge", consumerInstanceId: instanceId },
|
|
2013
|
-
});
|
|
2014
|
-
patchToolsMdKbHint(wsDir, "remove");
|
|
2015
|
-
try {
|
|
2016
|
-
if (existsSync(shimPath)) {
|
|
2017
|
-
writeFileSync(shimPath, "// removed: AnythingLLM not installed or knowledge unbound\n", { mode: 0o644 });
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
catch { /* best effort */ }
|
|
2021
|
-
try {
|
|
2022
|
-
if (existsSync(secretPath))
|
|
2023
|
-
unlinkSync(secretPath);
|
|
2024
|
-
}
|
|
2025
|
-
catch { /* best effort */ }
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
2029
|
-
catch (e) {
|
|
2030
|
-
console.warn(`[openclaw] kb shim wiring skipped: ${e?.message ?? e}`);
|
|
2031
|
-
}
|
|
2032
|
-
// 4c-bis. Self-heal MCPORTER_CONFIG env on existing instances. Without
|
|
2033
|
-
// this, mcporter can't find its config when invoked from the
|
|
2034
|
-
// gateway's CWD (openclaw-home/) or from the workspace symlink
|
|
2035
|
-
// (which points at user files, also no config/), so every drive
|
|
2036
|
-
// tool call fails with "Unknown MCP server 'drive'" and the agent
|
|
2037
|
-
// degrades into reporting a generic "network error". New instances
|
|
2038
|
-
// get this env via the binary/container runtime template; this
|
|
2039
|
-
// block back-fills it for instances created before that template
|
|
2040
|
-
// update so users don't have to recreate them.
|
|
2041
|
-
try {
|
|
2042
|
-
const im2 = await lazyIm();
|
|
2043
|
-
const rt = im2.getInstanceRuntime(instanceId);
|
|
2044
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
2045
|
-
if (home && rt && (!rt.env || !rt.env.MCPORTER_CONFIG)) {
|
|
2046
|
-
const desired = `${home}/.openclaw/workspace/config/mcporter.json`;
|
|
2047
|
-
const nextEnv = { ...(rt.env || {}), MCPORTER_CONFIG: desired };
|
|
2048
|
-
im2.updateInstanceMeta(instanceId, { runtime: { ...rt, env: nextEnv } });
|
|
2049
|
-
console.log(`[openclaw] self-healed MCPORTER_CONFIG env for ${instanceId}`);
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
catch (e) {
|
|
2053
|
-
console.warn(`[openclaw] MCPORTER_CONFIG self-heal failed: ${e?.message ?? e}`);
|
|
2054
|
-
}
|
|
2055
|
-
// 4d. Self-heal mcporter bin: chmod cli.js + replace the npm-installed
|
|
2056
|
-
// symlink at .npm-global/bin/mcporter with a wrapper that pins
|
|
2057
|
-
// `--config <abs path>`. The wrapper is required because:
|
|
2058
|
-
// (a) npm install on Pi/ARM64 sometimes leaves cli.js as 0644
|
|
2059
|
-
// instead of 0755 (despite a valid shebang). Without +x,
|
|
2060
|
-
// spawning the bin returns "Permission denied".
|
|
2061
|
-
// (b) The OpenClaw bash tool scrubs env when spawning agent tool
|
|
2062
|
-
// subprocesses, so MCPORTER_CONFIG env doesn't reach mcporter,
|
|
2063
|
-
// and mcporter falls back to CWD-relative `config/mcporter.json`.
|
|
2064
|
-
// The agent's CWD is openclaw-home/ (no config/) or the
|
|
2065
|
-
// workspace symlink (also no config/) → "Unknown MCP server
|
|
2066
|
-
// 'drive'" → user sees "drive not configured" / "network
|
|
2067
|
-
// error" in chat.
|
|
2068
|
-
// The wrapper hardcodes both the cli.js path and the config path,
|
|
2069
|
-
// so it works regardless of CWD or env state.
|
|
2070
|
-
// Marker in wrapper body (`# jishushell mcporter wrapper`) lets us
|
|
2071
|
-
// detect when it's already installed and skip the rewrite.
|
|
2072
|
-
try {
|
|
2073
|
-
const home = openclawAdapter.resolveAgentHome(instanceId);
|
|
2074
|
-
if (home) {
|
|
2075
|
-
const mcporterCli = join(home, ".npm-global", "lib", "node_modules", "mcporter", "dist", "cli.js");
|
|
2076
|
-
const mcporterBin = join(home, ".npm-global", "bin", "mcporter");
|
|
2077
|
-
const mcporterConfig = join(home, ".openclaw", "workspace", "config", "mcporter.json");
|
|
2078
|
-
if (existsSync(mcporterCli)) {
|
|
2079
|
-
const st = statSync(mcporterCli);
|
|
2080
|
-
if (!(st.mode & 0o111)) {
|
|
2081
|
-
chmodSync(mcporterCli, 0o755);
|
|
2082
|
-
console.log(`[openclaw] +x ${mcporterCli} (mcporter cli.js self-heal)`);
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
// Wrapper install: only proceed when cli.js exists; otherwise
|
|
2086
|
-
// mcporter isn't installed and there's nothing to wrap.
|
|
2087
|
-
if (existsSync(mcporterCli)) {
|
|
2088
|
-
const wrapperMarker = "# jishushell mcporter wrapper";
|
|
2089
|
-
let needsInstall = true;
|
|
2090
|
-
try {
|
|
2091
|
-
if (existsSync(mcporterBin)) {
|
|
2092
|
-
const lst = lstatSync(mcporterBin);
|
|
2093
|
-
if (lst.isFile() && !lst.isSymbolicLink()) {
|
|
2094
|
-
const first200 = readFileSync(mcporterBin, "utf8").slice(0, 200);
|
|
2095
|
-
if (first200.includes(wrapperMarker))
|
|
2096
|
-
needsInstall = false;
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
catch { /* fall through to install */ }
|
|
2101
|
-
if (needsInstall) {
|
|
2102
|
-
const wrapperSrc = `#!/bin/bash\n` +
|
|
2103
|
-
`${wrapperMarker} — pins --config so OpenClaw bash-tool env\n` +
|
|
2104
|
-
`# scrubbing or unexpected CWD cannot detach mcporter from the\n` +
|
|
2105
|
-
`# drive MCP server. Auto-installed by adapter onBeforeStart\n` +
|
|
2106
|
-
`# (src/services/runtime/adapters/openclaw.ts).\n` +
|
|
2107
|
-
`exec node ${JSON.stringify(mcporterCli)} --config ${JSON.stringify(mcporterConfig)} "$@"\n`;
|
|
2108
|
-
// Remove first to handle symlink → regular file transition cleanly.
|
|
2109
|
-
try {
|
|
2110
|
-
unlinkSync(mcporterBin);
|
|
2111
|
-
}
|
|
2112
|
-
catch { /* may not exist */ }
|
|
2113
|
-
writeFileSync(mcporterBin, wrapperSrc, { mode: 0o755 });
|
|
2114
|
-
console.log(`[openclaw] installed mcporter wrapper at ${mcporterBin}`);
|
|
2115
|
-
}
|
|
2116
|
-
// UNCONDITIONAL chmod regardless of whether we just wrote or
|
|
2117
|
-
// detected an existing wrapper. writeFileSync's mode option is
|
|
2118
|
-
// ignored when the file already exists, and a prior run that
|
|
2119
|
-
// hit an umask issue may have left it 0644. Always force 0755
|
|
2120
|
-
// so the agent can exec the wrapper.
|
|
2121
|
-
try {
|
|
2122
|
-
if (existsSync(mcporterBin)) {
|
|
2123
|
-
const wst = statSync(mcporterBin);
|
|
2124
|
-
if (!(wst.mode & 0o111)) {
|
|
2125
|
-
chmodSync(mcporterBin, 0o755);
|
|
2126
|
-
console.log(`[openclaw] +x ${mcporterBin} (wrapper chmod self-heal)`);
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
catch { /* best effort */ }
|
|
2131
|
-
}
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
catch (e) {
|
|
2135
|
-
console.warn(`[openclaw] mcporter self-heal failed: ${e?.message ?? e}`);
|
|
2136
|
-
}
|
|
2137
|
-
// 5. Docker image validation + background pull fallback
|
|
2138
|
-
if (getNomadDriver() === "docker") {
|
|
2139
|
-
const image = getOpenclawDockerImage();
|
|
2140
|
-
if (!DOCKER_IMAGE_RE.test(image) || image.length > MAX_DOCKER_IMAGE_NAME_LEN) {
|
|
2141
|
-
throw new Error(`Invalid Docker image name: "${image}"`);
|
|
2142
|
-
}
|
|
2143
|
-
try {
|
|
2144
|
-
execFileSync("docker", ["image", "inspect", image], {
|
|
2145
|
-
timeout: 10000,
|
|
2146
|
-
stdio: "ignore",
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
catch {
|
|
2150
|
-
console.log(`[openclaw] Docker image ${image} not found, starting background pull`);
|
|
2151
|
-
try {
|
|
2152
|
-
const result = openclawAdapter.startBuildRuntimeImage({ tag: image });
|
|
2153
|
-
const err = new Error(`Docker image ${image} not found. Pull started in background.`);
|
|
2154
|
-
err.building = true;
|
|
2155
|
-
err.taskId = result.taskId;
|
|
2156
|
-
throw err;
|
|
2157
|
-
}
|
|
2158
|
-
catch (e) {
|
|
2159
|
-
if (e?.building)
|
|
2160
|
-
throw e;
|
|
2161
|
-
throw new Error(`Docker image ${image} not available: ${e?.message ?? e}`);
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
// 6. Write instance secrets to Nomad Variables
|
|
2166
|
-
try {
|
|
2167
|
-
const nomad = await import("../../nomad-manager.js");
|
|
2168
|
-
if (typeof nomad.writeInstanceVariables === "function") {
|
|
2169
|
-
await nomad.writeInstanceVariables(instanceId);
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
catch (e) {
|
|
2173
|
-
throw new Error(`Failed to store instance secrets in Nomad Variables: ${e?.message ?? e}`);
|
|
2174
|
-
}
|
|
2175
|
-
},
|
|
2176
|
-
/**
|
|
2177
|
-
* OpenClaw auto-installs IM channel plugins (feishu, weixin, etc.) when
|
|
2178
|
-
* they're enabled in `openclaw.json`. That logic currently lives in
|
|
2179
|
-
* `instance-manager.saveConfig()`; wiring it through this hook is a
|
|
2180
|
-
* no-op during MVP because saveConfig still runs inline. The hook
|
|
2181
|
-
* exists so the physical-migration follow-up PR can move the code into
|
|
2182
|
-
* this file without touching framework code.
|
|
2183
|
-
*/
|
|
2184
|
-
onConfigSaved: async (_args) => {
|
|
2185
|
-
/* reserved — channel plugin install hook, filled by follow-up PR */
|
|
2186
|
-
},
|
|
2187
|
-
/**
|
|
2188
|
-
* Surface an orphan-directory warning when the legacy `openclaw_home`
|
|
2189
|
-
* field points outside the instance dir. The framework's deleteInstance
|
|
2190
|
-
* only rm's the instance dir itself, so custom-home layouts leave a
|
|
2191
|
-
* tree that the operator must clean up manually.
|
|
2192
|
-
*/
|
|
2193
|
-
onDelete: async ({ instanceId, meta }) => {
|
|
2194
|
-
const home = typeof meta?.openclaw_home === "string" ? meta.openclaw_home : null;
|
|
2195
|
-
if (!home)
|
|
2196
|
-
return;
|
|
2197
|
-
const instDir = framework_instanceDir(instanceId);
|
|
2198
|
-
if (home.startsWith(instDir))
|
|
2199
|
-
return; // inside the instance dir — rm already caught it
|
|
2200
|
-
if (!existsSync(home))
|
|
2201
|
-
return;
|
|
2202
|
-
return {
|
|
2203
|
-
warnings: [
|
|
2204
|
-
`Custom openclaw_home '${home}' was preserved. Delete manually if no longer needed.`,
|
|
2205
|
-
],
|
|
2206
|
-
};
|
|
2207
|
-
},
|
|
2208
|
-
/**
|
|
2209
|
-
* Rewrite `openclaw.json` x-jishushell.proxy.upstream when the panel
|
|
2210
|
-
* default provider changes. Delegates to instance-manager's existing
|
|
2211
|
-
* helper so the transition stays stepwise.
|
|
2212
|
-
*/
|
|
2213
|
-
onUpstreamProviderChange: async ({ instanceId, upstream }) => {
|
|
2214
|
-
try {
|
|
2215
|
-
const im = await lazyIm();
|
|
2216
|
-
if (typeof im.pushUpstreamToInstance === "function") {
|
|
2217
|
-
await im.pushUpstreamToInstance(instanceId, upstream);
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
catch (e) {
|
|
2221
|
-
console.warn(`[openclaw] onUpstreamProviderChange failed for ${instanceId}: ${e.message}`);
|
|
2222
|
-
}
|
|
2223
|
-
},
|
|
2224
|
-
};
|
|
2225
|
-
/**
|
|
2226
|
-
* Full OpenClaw instance bootstrap, physically migrated from the legacy
|
|
2227
|
-
* `instance-manager.createInstance()` (~270 lines). Framework code now
|
|
2228
|
-
* calls this uniformly via `getAdapter(agentType).createInstance(args)` —
|
|
2229
|
-
* instance-manager no longer owns any OpenClaw business logic.
|
|
2230
|
-
*
|
|
2231
|
-
* Responsibilities:
|
|
2232
|
-
* 1. openclaw_home path validation (traversal + symlink safety)
|
|
2233
|
-
* 2. Gateway port allocation + runtime spec generation
|
|
2234
|
-
* 3. clone_from handling (extensions/workspace/memory/sessions copy)
|
|
2235
|
-
* 4. starter config seeding + default-provider API key injection
|
|
2236
|
-
* 5. AppSpec overlays (config_defaults / skills)
|
|
2237
|
-
* 6. Proxy bootstrap token generation via LLM proxy
|
|
2238
|
-
* 7. chown to service user when running as root
|
|
2239
|
-
*/
|
|
2240
|
-
async createInstance(args) {
|
|
2241
|
-
const { instanceId, name, description = "", cloneFrom, agentHome: openclawHomeArg, appSpec, cloneOptions, } = args;
|
|
2242
|
-
// Guard: prevent creating an OpenClaw instance when the runtime isn't
|
|
2243
|
-
// installed. Without this, the instance.json gets written but the first
|
|
2244
|
-
// `service/start` fails with an opaque `npm package not found` or
|
|
2245
|
-
// `docker image missing` error. The Setup wizard treats "any runtime
|
|
2246
|
-
// ready" as overall ready, so the Hermes-only case reaches here.
|
|
2247
|
-
// getInstallStatus() is best-effort: if config exports are unavailable
|
|
2248
|
-
// (e.g. partially mocked in test environments) the check is skipped so
|
|
2249
|
-
// tests that do not mock the install state continue to work unchanged.
|
|
2250
|
-
// The e2e-real suite spawns a real CLI on hosts that intentionally do
|
|
2251
|
-
// not have OpenClaw installed; NODE_ENV=test (set by the e2e helper)
|
|
2252
|
-
// is the explicit opt-out so the gate doesn't break instance-lifecycle
|
|
2253
|
-
// tests.
|
|
2254
|
-
try {
|
|
2255
|
-
const hasAppManagedRuntime = Boolean(appSpec?.tasks?.some((task) => (task.role ?? "service") === "service" && (task.command || task.image)));
|
|
2256
|
-
if (!hasAppManagedRuntime && process.env.NODE_ENV !== "test") {
|
|
2257
|
-
const installStatus = this.getInstallStatus();
|
|
2258
|
-
if (!installStatus.installed) {
|
|
2259
|
-
throw new Error("OpenClaw runtime is not installed. Install it from the Apps page " +
|
|
2260
|
-
"or run `jishushell install openclaw`, then retry.");
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
catch (err) {
|
|
2265
|
-
// Re-throw only our own install-gate error; absorb config-unavailable
|
|
2266
|
-
// errors that arise in partially mocked test environments.
|
|
2267
|
-
if (err?.message?.startsWith("OpenClaw runtime is not installed"))
|
|
2268
|
-
throw err;
|
|
2269
|
-
}
|
|
2270
|
-
const d = framework_instanceDir(instanceId);
|
|
2271
|
-
const metaPath = instanceMetaPath(instanceId);
|
|
2272
|
-
if (existsSync(metaPath))
|
|
2273
|
-
throw new Error(`Instance '${instanceId}' already exists`);
|
|
2274
|
-
if (existsSync(d) && !isPrecreatedManagedAppDir(d)) {
|
|
2275
|
-
throw new Error(`Instance '${instanceId}' already exists`);
|
|
2276
|
-
}
|
|
2277
|
-
const home = openclawHomeArg
|
|
2278
|
-
? normalizePath(openclawHomeArg)
|
|
2279
|
-
: defaultOpenclawHome(instanceId);
|
|
2280
|
-
// Restrict openclaw_home to be under JISHUSHELL_HOME or /home to prevent
|
|
2281
|
-
// path traversal. Use realpathSync after mkdir to resolve symlinks.
|
|
2282
|
-
if (openclawHomeArg) {
|
|
2283
|
-
const resolved = pathResolve(home);
|
|
2284
|
-
if (!resolved.startsWith(JISHUSHELL_HOME) && !resolved.startsWith("/home/")) {
|
|
2285
|
-
throw new Error(`openclaw_home must be under ${JISHUSHELL_HOME} or /home/`);
|
|
2286
|
-
}
|
|
2287
|
-
const parentDir = dirname(resolved);
|
|
2288
|
-
if (existsSync(parentDir)) {
|
|
2289
|
-
const realParent = realpathSync(parentDir);
|
|
2290
|
-
if (!realParent.startsWith(JISHUSHELL_HOME) && !realParent.startsWith("/home/")) {
|
|
2291
|
-
throw new Error(`openclaw_home parent resolves outside allowed paths (symlink detected)`);
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
const shared = listInstances().filter((inst) => normalizePath(inst.openclaw_home || defaultOpenclawHome(inst.id)) ===
|
|
2295
|
-
normalizePath(home));
|
|
2296
|
-
if (shared.length) {
|
|
2297
|
-
throw new Error(`OpenClaw home '${home}' is already used by instance(s): ${shared
|
|
2298
|
-
.map((i) => i.id)
|
|
2299
|
-
.join(", ")}`);
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
// Orphaned openclaw_home (e.g. instance.json deleted but data remains).
|
|
2303
|
-
if (existsSync(home)) {
|
|
2304
|
-
try {
|
|
2305
|
-
const entries = readdirSync(home);
|
|
2306
|
-
if (entries.length > 0) {
|
|
2307
|
-
throw new Error(`OpenClaw home directory '${home}' already exists and is not empty. ` +
|
|
2308
|
-
`Remove it manually or choose a different path.`);
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
catch (e) {
|
|
2312
|
-
if (e.message.includes("not empty"))
|
|
2313
|
-
throw e;
|
|
2314
|
-
}
|
|
2315
|
-
}
|
|
2316
|
-
ensureDirContainer(d);
|
|
2317
|
-
try {
|
|
2318
|
-
const parentGid = statSync(dirname(d)).gid;
|
|
2319
|
-
chownSync(d, -1, parentGid);
|
|
2320
|
-
}
|
|
2321
|
-
catch {
|
|
2322
|
-
/* non-root without CAP_CHOWN */
|
|
2323
|
-
}
|
|
2324
|
-
ensureDirContainer(home);
|
|
2325
|
-
ensureDirContainer(join(home, OPENCLAW_STATE_DIRNAME));
|
|
2326
|
-
const portAlloc = await allocateGatewayPort(instanceId, OPENCLAW_DEFAULT_GATEWAY_PORT);
|
|
2327
|
-
const baseRuntime = buildDefaultRuntime(instanceId, portAlloc.port, home);
|
|
2328
|
-
let runtime = baseRuntime;
|
|
2329
|
-
if (appSpec) {
|
|
2330
|
-
const serviceTask = appSpec.tasks.find((t) => t.role === "service");
|
|
2331
|
-
if (serviceTask) {
|
|
2332
|
-
const compiled = compileTaskRuntime(serviceTask, instanceId);
|
|
2333
|
-
runtime = { ...baseRuntime, ...compiled };
|
|
2334
|
-
}
|
|
2335
|
-
}
|
|
2336
|
-
// W2: every new instance gets a default rw mount on its own
|
|
2337
|
-
// agent-data/{id} subtree (alias _out). Cloned instances inherit
|
|
2338
|
-
// their source's mounts but have agent-data path rewritten to the
|
|
2339
|
-
// new instance id; we keep this simple here and just plant the
|
|
2340
|
-
// default — clone-from semantics for additional mounts can be
|
|
2341
|
-
// tightened in PR-7+ when migration arrives.
|
|
2342
|
-
if (!runtime.fileMounts && !runtime.file_mounts) {
|
|
2343
|
-
runtime.fileMounts = defaultMountsForNewInstance(instanceId);
|
|
2344
|
-
}
|
|
2345
|
-
try {
|
|
2346
|
-
ensureMountTargets(FILES_ROOT, readFileMounts(runtime));
|
|
2347
|
-
}
|
|
2348
|
-
catch (e) {
|
|
2349
|
-
console.warn(`[openclaw] could not pre-create mount targets for ${instanceId}: ${e?.message ?? e}`);
|
|
2350
|
-
}
|
|
2351
|
-
const allocatedPort = extractGatewayPort(runtime);
|
|
2352
|
-
try {
|
|
2353
|
-
const meta = {
|
|
2354
|
-
id: instanceId,
|
|
2355
|
-
name,
|
|
2356
|
-
description,
|
|
2357
|
-
agentType: "openclaw",
|
|
2358
|
-
openclaw_home: home,
|
|
2359
|
-
runtime,
|
|
2360
|
-
created_at: new Date().toISOString(),
|
|
2361
|
-
// Prefer appSpec.app_id (installed unique id set by routes/apps.ts:88-96)
|
|
2362
|
-
// over appSpec.id (which materializeInstalledSpec preserves as the base id).
|
|
2363
|
-
// Multi-instance / copied apps need the installed id so uninstall /
|
|
2364
|
-
// capability rebuild / skills metadata find the right installed entry.
|
|
2365
|
-
...(appSpec ? { app_id: appSpec.app_id ?? appSpec.id } : {}),
|
|
2366
|
-
};
|
|
2367
|
-
safeWriteJson(instanceMetaPath(instanceId), meta);
|
|
2368
|
-
const envFiles = (runtime.env_files || []).map((p) => normalizePath(p));
|
|
2369
|
-
for (const ef of envFiles) {
|
|
2370
|
-
if (!existsSync(ef))
|
|
2371
|
-
writeConfigFile(ef, "");
|
|
2372
|
-
}
|
|
2373
|
-
// After writing env files, ensure the runtime user can read them
|
|
2374
|
-
try {
|
|
2375
|
-
const runtimeUser = runtime.user;
|
|
2376
|
-
if (runtimeUser && runtimeUser !== userInfo().username) {
|
|
2377
|
-
for (const ef of envFiles) {
|
|
2378
|
-
execFileSync("chown", [runtimeUser, ef], { timeout: 5000 });
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
catch {
|
|
2383
|
-
/* ignore - same user or no permission to chown */
|
|
2384
|
-
}
|
|
2385
|
-
const configPath = openclawConfigPath(instanceId, home);
|
|
2386
|
-
ensureDirContainer(dirname(configPath));
|
|
2387
|
-
if (cloneFrom && !existsSync(configPath)) {
|
|
2388
|
-
const srcConfig = resolveExistingConfigPath(cloneFrom);
|
|
2389
|
-
if (existsSync(srcConfig)) {
|
|
2390
|
-
try {
|
|
2391
|
-
const cloned = JSON.parse(readFileSync(srcConfig, "utf-8"));
|
|
2392
|
-
// Remove proxy provider (will be regenerated with new token)
|
|
2393
|
-
const providers = cloned?.models?.providers;
|
|
2394
|
-
if (providers) {
|
|
2395
|
-
for (const [pid, prov] of Object.entries(providers)) {
|
|
2396
|
-
if (typeof prov?.baseUrl === "string" &&
|
|
2397
|
-
prov.baseUrl.includes("/proxy/")) {
|
|
2398
|
-
delete providers[pid];
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
// Remove proxy model reference from agent defaults
|
|
2403
|
-
const defaultModel = cloned?.agents?.defaults?.model;
|
|
2404
|
-
if (typeof defaultModel === "string" &&
|
|
2405
|
-
(defaultModel.startsWith("jsproxy/") || defaultModel.startsWith("js-"))) {
|
|
2406
|
-
delete cloned.agents.defaults.model;
|
|
2407
|
-
}
|
|
2408
|
-
// Strip IM channel configs + matching plugin entries
|
|
2409
|
-
stripImBindings(cloned);
|
|
2410
|
-
// Copy extensions, workspace, (optionally) memory + sessions
|
|
2411
|
-
const subdirs = ["extensions", "workspace"];
|
|
2412
|
-
if (cloneOptions?.include_memory !== false) {
|
|
2413
|
-
const memDir = join(dirname(srcConfig), "memory");
|
|
2414
|
-
if (existsSync(memDir))
|
|
2415
|
-
subdirs.push("memory");
|
|
2416
|
-
}
|
|
2417
|
-
if (cloneOptions?.include_sessions) {
|
|
2418
|
-
const sessDir = join(dirname(srcConfig), "agents");
|
|
2419
|
-
if (existsSync(sessDir))
|
|
2420
|
-
subdirs.push("agents");
|
|
2421
|
-
}
|
|
2422
|
-
for (const subdir of subdirs) {
|
|
2423
|
-
const srcDir = join(dirname(srcConfig), subdir);
|
|
2424
|
-
const dstDir = join(dirname(configPath), subdir);
|
|
2425
|
-
if (existsSync(srcDir) && !existsSync(dstDir)) {
|
|
2426
|
-
try {
|
|
2427
|
-
cpSync(srcDir, dstDir, { recursive: true });
|
|
2428
|
-
}
|
|
2429
|
-
catch {
|
|
2430
|
-
/* best effort */
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
writeConfigFile(configPath, JSON.stringify(cloned, null, 2));
|
|
2435
|
-
// Copy x-jishushell upstream metadata from source instance.json
|
|
2436
|
-
const srcMetaPath = join(framework_instanceDir(cloneFrom), "instance.json");
|
|
2437
|
-
if (existsSync(srcMetaPath)) {
|
|
2438
|
-
try {
|
|
2439
|
-
const srcMeta = JSON.parse(readFileSync(srcMetaPath, "utf-8"));
|
|
2440
|
-
const srcXj = srcMeta?.["x-jishushell"];
|
|
2441
|
-
if (srcXj?.proxy?.upstream) {
|
|
2442
|
-
const dstXj = { proxy: { upstream: srcXj.proxy.upstream } };
|
|
2443
|
-
delete dstXj.proxy.upstream.apiKey;
|
|
2444
|
-
const metaPath = instanceMetaPath(instanceId);
|
|
2445
|
-
if (existsSync(metaPath)) {
|
|
2446
|
-
const dstMeta = JSON.parse(readFileSync(metaPath, "utf-8"));
|
|
2447
|
-
dstMeta["x-jishushell"] = dstXj;
|
|
2448
|
-
writeConfigFile(metaPath, JSON.stringify(dstMeta, null, 2));
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
catch {
|
|
2453
|
-
/* ignore metadata copy errors */
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
catch {
|
|
2458
|
-
copyFileSync(srcConfig, configPath);
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
if (!existsSync(configPath)) {
|
|
2463
|
-
writeConfigFile(configPath, JSON.stringify(starterConfig(), null, 2));
|
|
2464
|
-
// Inject default provider API key from setup into both env files
|
|
2465
|
-
const dp = getPanelConfig().default_provider;
|
|
2466
|
-
if (dp?.apiKey && dp?.providerId && envFiles.length) {
|
|
2467
|
-
const envKey = inferProviderApiKeyEnvName(dp.providerId);
|
|
2468
|
-
updateEnvFile(envFiles[0], { [envKey]: dp.apiKey });
|
|
2469
|
-
const providerEnv = join(dirname(envFiles[0]), "provider.env");
|
|
2470
|
-
updateEnvFile(providerEnv, { UPSTREAM_API_KEY: dp.apiKey });
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
// Merge AppSpec runtime overlays into openclaw.json (shallow, app wins).
|
|
2474
|
-
// Prefers the plan §17 shape `runtime.defaults`; falls back to the
|
|
2475
|
-
// legacy `openclaw.config_defaults` namespace for pre-§17 specs.
|
|
2476
|
-
const runtimeOverlay = appSpec?.runtime ??
|
|
2477
|
-
appSpec?.openclaw;
|
|
2478
|
-
const overlayDefaults = runtimeOverlay?.defaults
|
|
2479
|
-
?? runtimeOverlay?.config_defaults;
|
|
2480
|
-
if (overlayDefaults && existsSync(configPath)) {
|
|
2481
|
-
try {
|
|
2482
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
2483
|
-
const defaults = overlayDefaults;
|
|
2484
|
-
for (const [key, value] of Object.entries(defaults)) {
|
|
2485
|
-
if (typeof value === "object" &&
|
|
2486
|
-
value !== null &&
|
|
2487
|
-
!Array.isArray(value) &&
|
|
2488
|
-
typeof existing[key] === "object" &&
|
|
2489
|
-
existing[key] !== null) {
|
|
2490
|
-
existing[key] = { ...existing[key], ...value };
|
|
2491
|
-
}
|
|
2492
|
-
else {
|
|
2493
|
-
existing[key] = value;
|
|
2494
|
-
}
|
|
2495
|
-
}
|
|
2496
|
-
writeConfigFile(configPath, JSON.stringify(existing, null, 2));
|
|
2497
|
-
}
|
|
2498
|
-
catch {
|
|
2499
|
-
/* ignore merge errors */
|
|
2500
|
-
}
|
|
2501
|
-
}
|
|
2502
|
-
// Record App-level skills for later installation. Prefers the new
|
|
2503
|
-
// `runtime.skills` namespace; falls back to `openclaw.skills` for
|
|
2504
|
-
// pre-§17 specs.
|
|
2505
|
-
const overlaySkills = Array.isArray(runtimeOverlay?.skills)
|
|
2506
|
-
? runtimeOverlay.skills
|
|
2507
|
-
: null;
|
|
2508
|
-
if (overlaySkills) {
|
|
2509
|
-
try {
|
|
2510
|
-
const skillsDir = join(dirname(configPath), "skills");
|
|
2511
|
-
ensureDirContainer(skillsDir);
|
|
2512
|
-
const skillMeta = join(skillsDir, ".app-skills.json");
|
|
2513
|
-
safeWriteJson(skillMeta, {
|
|
2514
|
-
app_id: appSpec.app_id ?? appSpec.id,
|
|
2515
|
-
skills: overlaySkills,
|
|
2516
|
-
});
|
|
2517
|
-
}
|
|
2518
|
-
catch {
|
|
2519
|
-
/* ignore */
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
// Copy cloned provider.env BEFORE proxy bootstrap
|
|
2523
|
-
if (cloneFrom && envFiles.length) {
|
|
2524
|
-
const srcEnvFiles = getRuntimeEnvFiles(cloneFrom);
|
|
2525
|
-
const srcEnvFile = srcEnvFiles[0];
|
|
2526
|
-
const dstEnvFile = envFiles[0];
|
|
2527
|
-
if (srcEnvFile) {
|
|
2528
|
-
const srcProvider = join(dirname(srcEnvFile), "provider.env");
|
|
2529
|
-
const dstProvider = join(dirname(dstEnvFile), "provider.env");
|
|
2530
|
-
if (existsSync(srcProvider) && !existsSync(dstProvider)) {
|
|
2531
|
-
copyFileSync(srcProvider, dstProvider);
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
// Bootstrap proxy: generate proxy token and write model.env
|
|
2536
|
-
try {
|
|
2537
|
-
await bootstrapInstanceProxy(instanceId);
|
|
2538
|
-
}
|
|
2539
|
-
catch (e) {
|
|
2540
|
-
console.warn(`[openclaw] Proxy bootstrap for ${instanceId} deferred: ${e.message}`);
|
|
2541
|
-
}
|
|
2542
|
-
// If running as root, hand ownership of all created files to service user
|
|
2543
|
-
const svcUser = resolveServiceUser();
|
|
2544
|
-
if (svcUser) {
|
|
2545
|
-
try {
|
|
2546
|
-
execFileSync("chown", ["-R", `${svcUser.uid}:${svcUser.gid}`, d], {
|
|
2547
|
-
timeout: 10_000,
|
|
2548
|
-
});
|
|
2549
|
-
if (!home.startsWith(d + "/") && existsSync(home)) {
|
|
2550
|
-
execFileSync("chown", ["-R", `${svcUser.uid}:${svcUser.gid}`, home], {
|
|
2551
|
-
timeout: 10_000,
|
|
2552
|
-
});
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
catch (e) {
|
|
2556
|
-
console.warn(`[openclaw] chown for ${instanceId} failed:`, e.message);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
if (portAlloc.skipped.length > 0) {
|
|
2560
|
-
meta.port_allocation = {
|
|
2561
|
-
assigned: portAlloc.port,
|
|
2562
|
-
requested: OPENCLAW_DEFAULT_GATEWAY_PORT,
|
|
2563
|
-
reason: "default_busy",
|
|
2564
|
-
skipped: portAlloc.skipped,
|
|
2565
|
-
};
|
|
2566
|
-
}
|
|
2567
|
-
return meta;
|
|
2568
|
-
}
|
|
2569
|
-
finally {
|
|
2570
|
-
if (allocatedPort)
|
|
2571
|
-
releasePendingPort(allocatedPort);
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
async createInitialLayout(ctx) {
|
|
2575
|
-
// Framework never calls this on OpenClaw directly — `createInstance()`
|
|
2576
|
-
// above does the full layout. Kept to satisfy the interface for path
|
|
2577
|
-
// preview / UI callers.
|
|
2578
|
-
const instDir = framework_instanceDir(ctx.instanceId);
|
|
2579
|
-
const agentHome = defaultOpenclawHome(ctx.instanceId);
|
|
2580
|
-
return {
|
|
2581
|
-
instanceDir: instDir,
|
|
2582
|
-
agentHome,
|
|
2583
|
-
primaryConfig: join(agentHome, OPENCLAW_STATE_DIRNAME, OPENCLAW_CONFIG_FILENAME),
|
|
2584
|
-
};
|
|
2585
|
-
}
|
|
2586
|
-
async buildRuntime(instanceId) {
|
|
2587
|
-
// OpenClaw persists its runtime in legacy snake_case shape
|
|
2588
|
-
// ({env_files, resources, ...}). Translate at read time into the
|
|
2589
|
-
// engine-neutral RuntimeSpec contract.
|
|
2590
|
-
const im = await lazyIm();
|
|
2591
|
-
const raw = im.getInstanceRuntime(instanceId);
|
|
2592
|
-
const home = im.getOpenclawHome(instanceId);
|
|
2593
|
-
return {
|
|
2594
|
-
image: raw?.image ?? getOpenclawDockerImage(),
|
|
2595
|
-
command: String(raw?.command || DEFAULT_COMMAND),
|
|
2596
|
-
args: Array.isArray(raw?.args) ? raw.args.map(String) : [...DEFAULT_ARGS],
|
|
2597
|
-
cwd: String(raw?.cwd || home || DEFAULT_CWD),
|
|
2598
|
-
user: String(raw?.user || DEFAULT_USER),
|
|
2599
|
-
env: { ...DEFAULT_ENV, ...(raw?.env || {}) },
|
|
2600
|
-
envFiles: Array.isArray(raw?.env_files)
|
|
2601
|
-
? raw.env_files
|
|
2602
|
-
: Array.isArray(raw?.envFiles)
|
|
2603
|
-
? raw.envFiles
|
|
2604
|
-
: [],
|
|
2605
|
-
resources: {
|
|
2606
|
-
CPU: Number(raw?.resources?.CPU ?? DEFAULT_RESOURCES.CPU),
|
|
2607
|
-
MemoryMB: Number(raw?.resources?.MemoryMB ?? DEFAULT_RESOURCES.MemoryMB),
|
|
2608
|
-
MemoryMaxMB: raw?.resources?.MemoryMaxMB != null ? Number(raw.resources.MemoryMaxMB) : undefined,
|
|
2609
|
-
},
|
|
2610
|
-
ports: [
|
|
2611
|
-
{
|
|
2612
|
-
name: "gateway",
|
|
2613
|
-
containerPort: im.getGatewayPort(instanceId),
|
|
2614
|
-
hostPort: im.getGatewayPort(instanceId),
|
|
2615
|
-
visibility: "external",
|
|
2616
|
-
},
|
|
2617
|
-
],
|
|
2618
|
-
volumes: [{ hostPath: home, containerPath: home, mode: "rw" }],
|
|
2619
|
-
health: null,
|
|
2620
|
-
};
|
|
2621
|
-
}
|
|
2622
|
-
async buildNomadTask(instanceId) {
|
|
2623
|
-
// Physically moved from nomad-manager.buildTaskDocker. The adapter owns
|
|
2624
|
-
// OpenClaw's Nomad task layout end-to-end so `nomad-manager.buildJob()`
|
|
2625
|
-
// becomes a pure dispatcher.
|
|
2626
|
-
const im = await lazyIm();
|
|
2627
|
-
const rawRuntime = im.getInstanceRuntime(instanceId);
|
|
2628
|
-
const openclawHome = im.getOpenclawHome(instanceId);
|
|
2629
|
-
if (rawRuntime.user && !VALID_USER_RE.test(rawRuntime.user)) {
|
|
2630
|
-
throw new Error(`Invalid runtime user: ${rawRuntime.user}`);
|
|
2631
|
-
}
|
|
2632
|
-
const image = rawRuntime.image || getOpenclawDockerImage();
|
|
2633
|
-
const _command = String(rawRuntime.command || DEFAULT_COMMAND);
|
|
2634
|
-
const args = Array.isArray(rawRuntime.args)
|
|
2635
|
-
? rawRuntime.args.map(String)
|
|
2636
|
-
: [...DEFAULT_ARGS];
|
|
2637
|
-
const env = { ...DEFAULT_ENV };
|
|
2638
|
-
Object.assign(env, im.getRuntimeEnv(instanceId));
|
|
2639
|
-
decryptRuntimeProviderEnv(env);
|
|
2640
|
-
injectProviderHostEnv(env, instanceId);
|
|
2641
|
-
delete env.JSPROXY_API_KEY; // supplied via Nomad Template from Variables
|
|
2642
|
-
env.OPENCLAW_HOME = openclawHome;
|
|
2643
|
-
env.OPENCLAW_INSTANCE_ID = instanceId;
|
|
2644
|
-
// Resource clamping
|
|
2645
|
-
const rawResources = { ...DEFAULT_RESOURCES };
|
|
2646
|
-
for (const [k, v] of Object.entries(rawRuntime.resources || {})) {
|
|
2647
|
-
if (v != null)
|
|
2648
|
-
rawResources[k] = Number(v);
|
|
2649
|
-
}
|
|
2650
|
-
rawResources.CPU = Math.max(1, Math.min(rawResources.CPU, MAX_CPU_MHZ));
|
|
2651
|
-
rawResources.MemoryMB = Math.max(1, Math.min(rawResources.MemoryMB, MAX_MEMORY_MB));
|
|
2652
|
-
// Container env — OpenClaw-specific HOME / NODE_PATH / PATH / npm cfg
|
|
2653
|
-
const containerEnv = { ...env };
|
|
2654
|
-
containerEnv.HOME = openclawHome;
|
|
2655
|
-
if (!containerEnv.OPENCLAW_STATE_DIR) {
|
|
2656
|
-
containerEnv.OPENCLAW_STATE_DIR = `${openclawHome}/.openclaw`;
|
|
2657
|
-
}
|
|
2658
|
-
containerEnv.npm_config_prefix = `${openclawHome}/.npm-global`;
|
|
2659
|
-
containerEnv.PIP_USER = "1";
|
|
2660
|
-
containerEnv.PYTHONUSERBASE = `${openclawHome}/.local`;
|
|
2661
|
-
containerEnv.NODE_ENV = "production";
|
|
2662
|
-
containerEnv.NODE_PATH = [
|
|
2663
|
-
`${openclawHome}/.npm-global/lib/node_modules`,
|
|
2664
|
-
"/app/node_modules",
|
|
2665
|
-
].join(":");
|
|
2666
|
-
containerEnv.PATH = [
|
|
2667
|
-
`${openclawHome}/.npm-global/bin`,
|
|
2668
|
-
`${openclawHome}/.local/bin`,
|
|
2669
|
-
`${openclawHome}/go/bin`,
|
|
2670
|
-
`${openclawHome}/.cargo/bin`,
|
|
2671
|
-
"/usr/local/sbin",
|
|
2672
|
-
"/usr/local/bin",
|
|
2673
|
-
"/usr/sbin",
|
|
2674
|
-
"/usr/bin",
|
|
2675
|
-
"/sbin",
|
|
2676
|
-
"/bin",
|
|
2677
|
-
].join(":");
|
|
2678
|
-
const gatewayPort = im.getGatewayPort(instanceId);
|
|
2679
|
-
const safeJobId = `${this.nomadJobPrefix}${instanceId}`;
|
|
2680
|
-
assertSafeTemplateId(safeJobId);
|
|
2681
|
-
const normalizedResources = normalizeDockerResources(instanceId, rawResources);
|
|
2682
|
-
// Same rationale as hermes.ts:nomadHasExternalHostNetwork — without
|
|
2683
|
-
// HostNetwork, Nomad's docker driver publishes the gateway port to
|
|
2684
|
-
// 127.0.0.1, breaking cross-container consumers (e.g. OpenWebUI
|
|
2685
|
-
// binding openclaw via the llm-agent capability). Bring the legacy
|
|
2686
|
-
// openclaw job in line with the unified app-spec path.
|
|
2687
|
-
const hostNetwork = nomadHasExternalHostNetwork() ? "external" : undefined;
|
|
2688
|
-
return {
|
|
2689
|
-
Name: "gateway",
|
|
2690
|
-
Driver: "docker",
|
|
2691
|
-
User: resolveUidGid(String(rawRuntime.user || DEFAULT_USER)),
|
|
2692
|
-
Config: {
|
|
2693
|
-
image,
|
|
2694
|
-
force_pull: false,
|
|
2695
|
-
// Match nomad-manager.ts:buildAppTask — default 5-minute pull
|
|
2696
|
-
// timeout is too short for Pi-class networks pulling a 1+ GiB
|
|
2697
|
-
// openclaw runtime image; bump to 15 minutes.
|
|
2698
|
-
image_pull_timeout: "15m",
|
|
2699
|
-
// Use the JishuShell entrypoint wrapper that applies the session
|
|
2700
|
-
// fence patch before deferring to the image's original entrypoint.
|
|
2701
|
-
// The wrapper script is written to $HOME/.jishushell/entrypoint.sh
|
|
2702
|
-
// by onBeforeStart (writeContainerPatchScript).
|
|
2703
|
-
entrypoint: [`${openclawHome}/.jishushell/entrypoint.sh`],
|
|
2704
|
-
args,
|
|
2705
|
-
work_dir: openclawHome,
|
|
2706
|
-
volumes: buildVolumes(openclawHome, im.getInstanceRuntime(instanceId)),
|
|
2707
|
-
// Tell the docker driver to publish the labeled "gateway" port so
|
|
2708
|
-
// it routes via the host_network IP rather than the 127.0.0.1
|
|
2709
|
-
// default.
|
|
2710
|
-
ports: ["gateway"],
|
|
2711
|
-
extra_hosts: ["host.docker.internal:host-gateway"],
|
|
2712
|
-
cap_drop: ["ALL"],
|
|
2713
|
-
security_opt: ["no-new-privileges"],
|
|
2714
|
-
pids_limit: DEFAULT_PIDS_LIMIT,
|
|
2715
|
-
readonly_rootfs: true,
|
|
2716
|
-
mounts: [
|
|
2717
|
-
{ type: "tmpfs", target: "/tmp", tmpfs_options: { size: 536870912 } },
|
|
2718
|
-
{ type: "tmpfs", target: "/var/tmp", tmpfs_options: { size: 67108864 } },
|
|
2719
|
-
{ type: "tmpfs", target: "/run", tmpfs_options: { size: 52428800 } },
|
|
2720
|
-
],
|
|
2721
|
-
},
|
|
2722
|
-
Env: containerEnv,
|
|
2723
|
-
Resources: {
|
|
2724
|
-
...normalizedResources,
|
|
2725
|
-
Networks: [
|
|
2726
|
-
{
|
|
2727
|
-
ReservedPorts: [
|
|
2728
|
-
{
|
|
2729
|
-
Label: "gateway",
|
|
2730
|
-
Value: gatewayPort,
|
|
2731
|
-
To: gatewayPort,
|
|
2732
|
-
...(hostNetwork ? { HostNetwork: hostNetwork } : {}),
|
|
2733
|
-
},
|
|
2734
|
-
],
|
|
2735
|
-
},
|
|
2736
|
-
],
|
|
2737
|
-
},
|
|
2738
|
-
LogConfig: { MaxFiles: 3, MaxFileSizeMB: 10 },
|
|
2739
|
-
Templates: [
|
|
2740
|
-
{
|
|
2741
|
-
DestPath: "secrets/instance.env",
|
|
2742
|
-
Envvars: true,
|
|
2743
|
-
EmbeddedTmpl: [
|
|
2744
|
-
`{{ if nomadVarExists "nomad/jobs/${safeJobId}/openclaw/gateway" }}`,
|
|
2745
|
-
`JSPROXY_API_KEY={{ with nomadVar "nomad/jobs/${safeJobId}/openclaw/gateway" }}{{ .JSPROXY_API_KEY }}{{ end }}`,
|
|
2746
|
-
`{{ end }}`,
|
|
2747
|
-
].join("\n"),
|
|
2748
|
-
ChangeMode: "restart",
|
|
2749
|
-
},
|
|
2750
|
-
],
|
|
2751
|
-
};
|
|
2752
|
-
}
|
|
2753
|
-
async getRuntimeVersion(_instanceId) {
|
|
2754
|
-
// Parse the image reference (digest > tag) for the baseline image.
|
|
2755
|
-
const image = getOpenclawDockerImage() || "";
|
|
2756
|
-
let ref;
|
|
2757
|
-
let digest;
|
|
2758
|
-
if (image) {
|
|
2759
|
-
if (image.includes("@")) {
|
|
2760
|
-
digest = image.split("@", 2)[1];
|
|
2761
|
-
}
|
|
2762
|
-
else {
|
|
2763
|
-
const lastColon = image.lastIndexOf(":");
|
|
2764
|
-
const lastSlash = image.lastIndexOf("/");
|
|
2765
|
-
if (lastColon > lastSlash)
|
|
2766
|
-
ref = image.slice(lastColon + 1);
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
return { agentType: "openclaw", ref, digest, mode: "baseline" };
|
|
2770
|
-
}
|
|
2771
|
-
async getConfigMeta(instanceId) {
|
|
2772
|
-
return {
|
|
2773
|
-
agentType: "openclaw",
|
|
2774
|
-
format: "json",
|
|
2775
|
-
schemaId: "openclaw/v1",
|
|
2776
|
-
capabilities: DEFAULT_CAPABILITIES,
|
|
2777
|
-
secretFields: ["content.x-jishushell.proxy.upstream.apiKey"],
|
|
2778
|
-
runtimeVersion: await this.getRuntimeVersion(instanceId),
|
|
2779
|
-
};
|
|
2780
|
-
}
|
|
2781
|
-
async readConfig(instanceId) {
|
|
2782
|
-
const im = await lazyIm();
|
|
2783
|
-
const content = im.getStoredConfig
|
|
2784
|
-
? im.getStoredConfig(instanceId)
|
|
2785
|
-
: null;
|
|
2786
|
-
return {
|
|
2787
|
-
format: "json",
|
|
2788
|
-
content: (content && typeof content === "object") ? content : {},
|
|
2789
|
-
};
|
|
2790
|
-
}
|
|
2791
|
-
async writeConfig(instanceId, doc) {
|
|
2792
|
-
if (doc.format !== "json") {
|
|
2793
|
-
throw new Error(`OpenClaw config requires format="json", got "${doc.format}"`);
|
|
2794
|
-
}
|
|
2795
|
-
// Route through llmProxy.saveInstanceConfig so x-jishushell.proxy
|
|
2796
|
-
// metadata is stripped, the upstream apiKey is AES-encrypted to
|
|
2797
|
-
// provider.env, and models.providers is rewritten to the local
|
|
2798
|
-
// proxy — same contract HermesAdapter.writeConfig uses. That
|
|
2799
|
-
// function internally calls instanceManager.saveConfig, which
|
|
2800
|
-
// dispatches back to this adapter's saveNativeConfig() for the
|
|
2801
|
-
// raw disk write (distinct method, no recursion).
|
|
2802
|
-
const { saveInstanceConfig } = await import("../../llm-proxy/index.js");
|
|
2803
|
-
await saveInstanceConfig(instanceId, doc.content);
|
|
2804
|
-
return this.readConfig(instanceId);
|
|
2805
|
-
}
|
|
2806
|
-
async buildPairingListCommand(_instanceId) {
|
|
2807
|
-
return ["openclaw", "pairing", "list"];
|
|
2808
|
-
}
|
|
2809
|
-
async buildPairingApproveCommand(_instanceId, input) {
|
|
2810
|
-
return ["openclaw", "pairing", "approve", input.channel, input.code];
|
|
2811
|
-
}
|
|
2812
|
-
/**
|
|
2813
|
-
* Framework delete hook — returns warnings for the caller to surface to
|
|
2814
|
-
* the user. OpenClaw supports a custom `openclaw_home` pointing outside
|
|
2815
|
-
* the instance directory; those directories are preserved on delete.
|
|
2816
|
-
*/
|
|
2817
|
-
async onDelete(args) {
|
|
2818
|
-
const warnings = [];
|
|
2819
|
-
const home = args.meta?.openclaw_home;
|
|
2820
|
-
if (home) {
|
|
2821
|
-
warnings.push(`Custom openclaw_home "${home}" was NOT removed; delete it manually if unused.`);
|
|
2822
|
-
}
|
|
2823
|
-
return warnings;
|
|
2824
|
-
}
|
|
2825
|
-
// ── Native config I/O (physically migrated from instance-manager) ───
|
|
2826
|
-
channelPluginMap = CHANNEL_PLUGIN_MAP;
|
|
2827
|
-
/**
|
|
2828
|
-
* Get the stored raw OpenClaw config (from `.openclaw/openclaw.json`
|
|
2829
|
-
* or the legacy `openclaw.json`), merged with the x-jishushell
|
|
2830
|
-
* metadata pulled from `instance.json`. Returns null when the instance
|
|
2831
|
-
* has no persisted config yet.
|
|
2832
|
-
*/
|
|
2833
|
-
getNativeConfig(instanceId) {
|
|
2834
|
-
const config = loadEffectiveConfig(instanceId);
|
|
2835
|
-
if (!config)
|
|
2836
|
-
return null;
|
|
2837
|
-
// Always merge the latest upstream proxy config from instance.json
|
|
2838
|
-
const meta = getInstance(instanceId);
|
|
2839
|
-
if (meta?.["x-jishushell"]) {
|
|
2840
|
-
config["x-jishushell"] = meta["x-jishushell"];
|
|
2841
|
-
}
|
|
2842
|
-
// Inject upstream provider apiKey from env file so callers see it
|
|
2843
|
-
return injectProviderApiKeys(instanceId, config);
|
|
2844
|
-
}
|
|
2845
|
-
/**
|
|
2846
|
-
* Get the stored raw config WITHOUT provider key injection. Used by
|
|
2847
|
-
* callers that round-trip the config back to disk (e.g. credential
|
|
2848
|
-
* writers) — injecting the provider key would re-persist it to the
|
|
2849
|
-
* config file, which is exactly what `saveConfig` takes pains to avoid.
|
|
2850
|
-
*/
|
|
2851
|
-
getStoredNativeConfig(instanceId) {
|
|
2852
|
-
const config = loadEffectiveConfig(instanceId);
|
|
2853
|
-
if (!config)
|
|
2854
|
-
return null;
|
|
2855
|
-
const meta = getInstance(instanceId);
|
|
2856
|
-
if (meta?.["x-jishushell"]) {
|
|
2857
|
-
config["x-jishushell"] = meta["x-jishushell"];
|
|
2858
|
-
}
|
|
2859
|
-
return config;
|
|
2860
|
-
}
|
|
2861
|
-
isChannelPluginInstalled(instanceId, channelId) {
|
|
2862
|
-
return isChannelPluginInstalled(instanceId, channelId);
|
|
2863
|
-
}
|
|
2864
|
-
async installChannelPlugin(instanceId, channelId) {
|
|
2865
|
-
return installChannelPlugin(instanceId, channelId);
|
|
2866
|
-
}
|
|
2867
|
-
saveNativeConfig(instanceId, config) {
|
|
2868
|
-
return saveNativeConfigImpl(instanceId, config);
|
|
2869
|
-
}
|
|
2870
|
-
/**
|
|
2871
|
-
* Connection-apply hook (§7 of app-interconnect-design): translate
|
|
2872
|
-
* resolved `inject_as` env vars into OpenClaw-native plugin config and
|
|
2873
|
-
* persist them into `openclaw.json`. Without this, the runtime env
|
|
2874
|
-
* injected by `nomad-manager.injectConnectionsRuntimeEnv` (PR 8) sits
|
|
2875
|
-
* in the container unused — the OpenClaw agent reads tool config from
|
|
2876
|
-
* `openclaw.json`, not from environment variables.
|
|
2877
|
-
*
|
|
2878
|
-
* Currently wired:
|
|
2879
|
-
* SEARCH_API_BASE_URL → plugins.entries.searxng.config.webSearch.baseUrl
|
|
2880
|
-
* SEARCH_API_BASE_URL → tools.web.search.provider = "searxng"
|
|
2881
|
-
*
|
|
2882
|
-
* The provider selector at `tools.web.search.provider` is required: without
|
|
2883
|
-
* it the `web_search` tool defaults to Brave and fails with
|
|
2884
|
-
* `missing_brave_api_key` even when the searxng plugin is fully configured.
|
|
2885
|
-
*
|
|
2886
|
-
* Browser / LLM / MCP wiring lands in PR 9b — they need their own
|
|
2887
|
-
* config-shape mapping (browser → tools.browser, llm → models.providers,
|
|
2888
|
-
* mcp already wired via openclaw-mcporter).
|
|
2889
|
-
*
|
|
2890
|
-
* The write goes through `saveNativeConfig` which deep-merges with the
|
|
2891
|
-
* existing on-disk config, so user-managed plugin entries (e.g.
|
|
2892
|
-
* openclaw-lark) are preserved. Plugin auto-enable then promotes the
|
|
2893
|
-
* searxng entry into `plugins.allow` automatically on next start
|
|
2894
|
-
* because we set `enabled:true` and provide config (the openclaw
|
|
2895
|
-
* runtime treats the presence of `config.webSearch.baseUrl` as a
|
|
2896
|
-
* "configured" signal — see `plugin-auto-enable` in the openclaw
|
|
2897
|
-
* dist bundle).
|
|
2898
|
-
*/
|
|
2899
|
-
async applyConnectionEnv(instanceId, env) {
|
|
2900
|
-
const configPath = openclawConfigPath(instanceId);
|
|
2901
|
-
const searchUrl = env.SEARCH_API_BASE_URL;
|
|
2902
|
-
if (typeof searchUrl === "string") {
|
|
2903
|
-
if (searchUrl === "") {
|
|
2904
|
-
// Empty value — connection-transactor's UNPERSIST_HOOKS uses this as
|
|
2905
|
-
// the "unbind" signal. Clear the searxng plugin config so the next
|
|
2906
|
-
// start doesn't keep routing web_search through a now-disconnected
|
|
2907
|
-
// provider.
|
|
2908
|
-
try {
|
|
2909
|
-
clearSearxngConnectionFromConfig(configPath);
|
|
2910
|
-
}
|
|
2911
|
-
catch (e) {
|
|
2912
|
-
console.warn(`[openclaw] applyConnectionEnv search unbind failed for ${instanceId}: ${e.message}`);
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
else {
|
|
2916
|
-
// SEARCH_API_BASE_URL points at "<base>/search" (the SearXNG search
|
|
2917
|
-
// endpoint). The plugin's webSearch.baseUrl wants the bare origin —
|
|
2918
|
-
// strip the trailing "/search" path segment if present.
|
|
2919
|
-
// baseUrl stays at the registry-resolved host:port snapshot from
|
|
2920
|
-
// when the user PUT /connections; the framework re-runs this hook
|
|
2921
|
-
// on every instance start (PR 9 phaseRefreshConnections), so host
|
|
2922
|
-
// IP changes propagate automatically on next agent restart.
|
|
2923
|
-
let baseUrl = searchUrl;
|
|
2924
|
-
try {
|
|
2925
|
-
const u = new URL(searchUrl);
|
|
2926
|
-
if (u.pathname === "/search" || u.pathname === "/search/") {
|
|
2927
|
-
u.pathname = "";
|
|
2928
|
-
baseUrl = u.toString().replace(/\/$/, "");
|
|
2929
|
-
}
|
|
2930
|
-
try {
|
|
2931
|
-
applySearxngConnectionToConfig(configPath, baseUrl);
|
|
2932
|
-
}
|
|
2933
|
-
catch (e) {
|
|
2934
|
-
console.warn(`[openclaw] applyConnectionEnv search merge failed for ${instanceId}: ${e.message}`);
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
catch {
|
|
2938
|
-
// not a URL — skip silently; the openclaw plugin would break
|
|
2939
|
-
// with a non-URL baseUrl, and start should still proceed.
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
const cdpUrl = env.BROWSER_CDP_URL;
|
|
2944
|
-
if (typeof cdpUrl === "string") {
|
|
2945
|
-
if (cdpUrl === "") {
|
|
2946
|
-
try {
|
|
2947
|
-
clearBrowserlessConnectionFromConfig(configPath);
|
|
2948
|
-
}
|
|
2949
|
-
catch (e) {
|
|
2950
|
-
console.warn(`[openclaw] applyConnectionEnv browser unbind failed for ${instanceId}: ${e.message}`);
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
else if (/^wss?:\/\//.test(cdpUrl)) {
|
|
2954
|
-
try {
|
|
2955
|
-
applyBrowserlessConnectionToConfig(configPath, cdpUrl);
|
|
2956
|
-
}
|
|
2957
|
-
catch (e) {
|
|
2958
|
-
console.warn(`[openclaw] applyConnectionEnv browser merge failed for ${instanceId}: ${e.message}`);
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
// Non-ws scheme: skip silently. The connection-apply browser hook
|
|
2962
|
-
// already builds ws:// from the capability protocol; an http:// here
|
|
2963
|
-
// would mean a misconfigured provider — better to no-op than to
|
|
2964
|
-
// write a URL OpenClaw can't dial.
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
// ── Path resolvers (physically migrated) ───────────────────────────
|
|
2968
|
-
resolveBin() {
|
|
2969
|
-
return resolveOpenclawBin();
|
|
2970
|
-
}
|
|
2971
|
-
resolveAgentHome(instanceId) {
|
|
2972
|
-
const meta = getInstance(instanceId);
|
|
2973
|
-
return meta?.openclaw_home || defaultOpenclawHome(instanceId);
|
|
2974
|
-
}
|
|
2975
|
-
/** Env vars OpenClaw's CLI needs when backup-manager runs it as a subprocess. */
|
|
2976
|
-
buildCliEnv(instanceId) {
|
|
2977
|
-
return { OPENCLAW_HOME: this.resolveAgentHome(instanceId) };
|
|
2978
|
-
}
|
|
2979
|
-
/**
|
|
2980
|
-
* Legacy gateway-port fallback for instances created before the
|
|
2981
|
-
* RuntimeSpec.ports[] migration. OpenClaw persists its port in both
|
|
2982
|
-
* `runtime.env.OPENCLAW_GATEWAY_PORT` and `runtime.args ["--port", N]`.
|
|
2983
|
-
*/
|
|
2984
|
-
readLegacyGatewayPort(runtime) {
|
|
2985
|
-
if (!runtime)
|
|
2986
|
-
return null;
|
|
2987
|
-
const envPort = runtime.env?.OPENCLAW_GATEWAY_PORT;
|
|
2988
|
-
if (envPort) {
|
|
2989
|
-
const p = parseInt(envPort, 10);
|
|
2990
|
-
if (!isNaN(p))
|
|
2991
|
-
return p;
|
|
2992
|
-
}
|
|
2993
|
-
const args = runtime.args || [];
|
|
2994
|
-
for (let i = 0; i < args.length; i++) {
|
|
2995
|
-
const arg = String(args[i]);
|
|
2996
|
-
if (arg === "--port" && i + 1 < args.length) {
|
|
2997
|
-
const p = parseInt(args[i + 1], 10);
|
|
2998
|
-
return isNaN(p) ? null : p;
|
|
2999
|
-
}
|
|
3000
|
-
if (arg.startsWith("--port=")) {
|
|
3001
|
-
const p = parseInt(arg.split("=")[1], 10);
|
|
3002
|
-
return isNaN(p) ? null : p;
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
return null;
|
|
3006
|
-
}
|
|
3007
|
-
/**
|
|
3008
|
-
* Rewrite a persisted OpenClaw runtime spec to use a new host port.
|
|
3009
|
-
* Updates `args[--port]` + `env.OPENCLAW_GATEWAY_PORT` atomically so
|
|
3010
|
-
* both places stay in sync.
|
|
3011
|
-
*/
|
|
3012
|
-
reallocateRuntimePort(runtime, newPort) {
|
|
3013
|
-
const args = Array.isArray(runtime.args) ? [...runtime.args] : [];
|
|
3014
|
-
for (let i = 0; i < args.length; i++) {
|
|
3015
|
-
if (args[i] === "--port" && i + 1 < args.length) {
|
|
3016
|
-
args[i + 1] = String(newPort);
|
|
3017
|
-
}
|
|
3018
|
-
else if (typeof args[i] === "string" && args[i].startsWith("--port=")) {
|
|
3019
|
-
args[i] = `--port=${newPort}`;
|
|
3020
|
-
}
|
|
3021
|
-
}
|
|
3022
|
-
runtime.args = args;
|
|
3023
|
-
const env = (runtime.env ?? {});
|
|
3024
|
-
env.OPENCLAW_GATEWAY_PORT = String(newPort);
|
|
3025
|
-
runtime.env = env;
|
|
3026
|
-
}
|
|
3027
|
-
nomadJobPrefix = "openclaw-";
|
|
3028
|
-
// OpenClaw is the default/core runtime — runFullSetup must fail hard if
|
|
3029
|
-
// its image install fails, because the panel is unusable without it.
|
|
3030
|
-
// Third-party adapters should leave `required` unset (= optional).
|
|
3031
|
-
required = true;
|
|
3032
|
-
// Must match the path referenced by this adapter's buildNomadTask Templates
|
|
3033
|
-
// (see `nomadVar "nomad/jobs/<jid>/openclaw/gateway"` in the template body).
|
|
3034
|
-
nomadVariablePath = "openclaw/gateway";
|
|
3035
|
-
resolveConfigPath(instanceId) {
|
|
3036
|
-
return openclawConfigPath(instanceId, this.resolveAgentHome(instanceId));
|
|
3037
|
-
}
|
|
3038
|
-
resolveLegacyConfigPath(instanceId) {
|
|
3039
|
-
return legacyOpenclawConfigPath(instanceId, this.resolveAgentHome(instanceId));
|
|
3040
|
-
}
|
|
3041
|
-
/**
|
|
3042
|
-
* Return other OpenClaw instance IDs that share this one's
|
|
3043
|
-
* `openclaw_home` path. Used by the start-time conflict check.
|
|
3044
|
-
*/
|
|
3045
|
-
findInstancesSharingHome(instanceId) {
|
|
3046
|
-
const target = normalizePath(this.resolveAgentHome(instanceId));
|
|
3047
|
-
return listInstances()
|
|
3048
|
-
.filter((inst) => inst.id !== instanceId)
|
|
3049
|
-
.filter((inst) => {
|
|
3050
|
-
const meta = inst;
|
|
3051
|
-
const otherHome = meta.openclaw_home || defaultOpenclawHome(inst.id);
|
|
3052
|
-
return normalizePath(otherHome) === target;
|
|
3053
|
-
})
|
|
3054
|
-
.map((inst) => inst.id);
|
|
3055
|
-
}
|
|
3056
|
-
// ── Feishu / WeChat credential writers (physically migrated) ───────
|
|
3057
|
-
saveFeishuCredentials(instanceId, creds) {
|
|
3058
|
-
if (!FEISHU_APP_ID_RE.test(creds.appId)) {
|
|
3059
|
-
throw new Error(`Invalid Feishu appId format: expected cli_<alnum> (got "${creds.appId}")`);
|
|
3060
|
-
}
|
|
3061
|
-
if (!creds.appSecret || typeof creds.appSecret !== "string" || creds.appSecret.length < 4) {
|
|
3062
|
-
throw new Error("Invalid Feishu appSecret: must be a non-empty string");
|
|
3063
|
-
}
|
|
3064
|
-
const configPath = this.resolveConfigPath(instanceId);
|
|
3065
|
-
let config = {};
|
|
3066
|
-
try {
|
|
3067
|
-
if (existsSync(configPath)) {
|
|
3068
|
-
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
3069
|
-
}
|
|
3070
|
-
}
|
|
3071
|
-
catch {
|
|
3072
|
-
/* best effort */
|
|
3073
|
-
}
|
|
3074
|
-
config.plugins ??= {};
|
|
3075
|
-
config.plugins.entries ??= {};
|
|
3076
|
-
config.plugins.entries.feishu = { enabled: false };
|
|
3077
|
-
config.plugins.entries["openclaw-lark"] = { enabled: true };
|
|
3078
|
-
config.channels ??= {};
|
|
3079
|
-
config.channels.feishu = {
|
|
3080
|
-
...config.channels.feishu,
|
|
3081
|
-
enabled: true,
|
|
3082
|
-
appId: creds.appId,
|
|
3083
|
-
appSecret: creds.appSecret,
|
|
3084
|
-
domain: creds.domain,
|
|
3085
|
-
dmPolicy: "open",
|
|
3086
|
-
allowFrom: ["*"],
|
|
3087
|
-
};
|
|
3088
|
-
safeWriteJson(configPath, config);
|
|
3089
|
-
chownToServiceUser(configPath);
|
|
3090
|
-
console.log(`[openclaw] Feishu credentials saved for ${instanceId}, domain=${creds.domain}`);
|
|
3091
|
-
}
|
|
3092
|
-
saveWeixinCredentials(instanceId, creds) {
|
|
3093
|
-
if (!creds.accountId || !SAFE_ACCOUNT_ID_RE.test(creds.accountId) || creds.accountId.includes("..")) {
|
|
3094
|
-
throw new Error(`Invalid accountId: must be 1-128 chars of [a-zA-Z0-9@._-] without '..'`);
|
|
3095
|
-
}
|
|
3096
|
-
const home = this.resolveAgentHome(instanceId);
|
|
3097
|
-
const stateDir = join(home, OPENCLAW_STATE_DIRNAME, "openclaw-weixin");
|
|
3098
|
-
const accountsDir = join(stateDir, "accounts");
|
|
3099
|
-
ensureDirContainer(accountsDir);
|
|
3100
|
-
const credObj = {
|
|
3101
|
-
token: creds.token,
|
|
3102
|
-
baseUrl: creds.baseUrl,
|
|
3103
|
-
userId: creds.userId,
|
|
3104
|
-
savedAt: new Date().toISOString(),
|
|
3105
|
-
};
|
|
3106
|
-
safeWriteJson(join(accountsDir, `${creds.accountId}.json`), credObj);
|
|
3107
|
-
safeWriteJson(join(accountsDir, "default.json"), credObj);
|
|
3108
|
-
chownToServiceUser(join(accountsDir, `${creds.accountId}.json`), join(accountsDir, "default.json"));
|
|
3109
|
-
// Update accounts.json index
|
|
3110
|
-
const indexPath = join(stateDir, "accounts.json");
|
|
3111
|
-
let index = [];
|
|
3112
|
-
try {
|
|
3113
|
-
const raw = readFileSync(indexPath, "utf-8");
|
|
3114
|
-
index = JSON.parse(raw);
|
|
3115
|
-
}
|
|
3116
|
-
catch {
|
|
3117
|
-
/* start fresh */
|
|
3118
|
-
}
|
|
3119
|
-
if (!Array.isArray(index))
|
|
3120
|
-
index = [];
|
|
3121
|
-
if (!index.includes(creds.accountId))
|
|
3122
|
-
index.push(creds.accountId);
|
|
3123
|
-
safeWriteJson(indexPath, index);
|
|
3124
|
-
const configPath = this.resolveConfigPath(instanceId);
|
|
3125
|
-
let config = {};
|
|
3126
|
-
try {
|
|
3127
|
-
if (existsSync(configPath))
|
|
3128
|
-
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
3129
|
-
}
|
|
3130
|
-
catch {
|
|
3131
|
-
/* best effort */
|
|
3132
|
-
}
|
|
3133
|
-
config.plugins ??= {};
|
|
3134
|
-
config.plugins.entries ??= {};
|
|
3135
|
-
config.plugins.entries["openclaw-weixin"] ??= {};
|
|
3136
|
-
config.plugins.entries["openclaw-weixin"].enabled = true;
|
|
3137
|
-
config.channels ??= {};
|
|
3138
|
-
config.channels["openclaw-weixin"] ??= {};
|
|
3139
|
-
config.channels["openclaw-weixin"].enabled = true;
|
|
3140
|
-
const normalizedId = creds.accountId.replace(/[@.]/g, "-");
|
|
3141
|
-
const accounts = config.channels["openclaw-weixin"].accounts ??= {};
|
|
3142
|
-
accounts[creds.accountId] = { enabled: true };
|
|
3143
|
-
if (normalizedId !== creds.accountId)
|
|
3144
|
-
accounts[normalizedId] = { enabled: true };
|
|
3145
|
-
accounts["default"] = { enabled: true };
|
|
3146
|
-
if (!config.channels["openclaw-weixin"].defaultAccount) {
|
|
3147
|
-
config.channels["openclaw-weixin"].defaultAccount = "default";
|
|
3148
|
-
}
|
|
3149
|
-
safeWriteJson(configPath, config);
|
|
3150
|
-
chownToServiceUser(configPath);
|
|
3151
|
-
console.log(`[openclaw] WeChat credentials saved for ${instanceId}, account=${creds.accountId}`);
|
|
3152
|
-
}
|
|
3153
|
-
getWeixinAccounts(instanceId) {
|
|
3154
|
-
const home = this.resolveAgentHome(instanceId);
|
|
3155
|
-
const stateDir = join(home, OPENCLAW_STATE_DIRNAME, "openclaw-weixin");
|
|
3156
|
-
const accountsDir = join(stateDir, "accounts");
|
|
3157
|
-
if (!existsSync(accountsDir))
|
|
3158
|
-
return [];
|
|
3159
|
-
let indexedIds = [];
|
|
3160
|
-
try {
|
|
3161
|
-
indexedIds = JSON.parse(readFileSync(join(stateDir, "accounts.json"), "utf-8"));
|
|
3162
|
-
}
|
|
3163
|
-
catch {
|
|
3164
|
-
/* fallback to scanning */
|
|
3165
|
-
}
|
|
3166
|
-
const results = [];
|
|
3167
|
-
for (const f of readdirSync(accountsDir)) {
|
|
3168
|
-
if (!f.endsWith(".json"))
|
|
3169
|
-
continue;
|
|
3170
|
-
const id = f.replace(/\.json$/, "");
|
|
3171
|
-
if (indexedIds.length > 0 && !indexedIds.includes(id))
|
|
3172
|
-
continue;
|
|
3173
|
-
if (id === "default")
|
|
3174
|
-
continue;
|
|
3175
|
-
try {
|
|
3176
|
-
const data = JSON.parse(readFileSync(join(accountsDir, f), "utf-8"));
|
|
3177
|
-
results.push({
|
|
3178
|
-
accountId: id,
|
|
3179
|
-
userId: data.userId,
|
|
3180
|
-
savedAt: data.savedAt,
|
|
3181
|
-
});
|
|
3182
|
-
}
|
|
3183
|
-
catch {
|
|
3184
|
-
/* skip */
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
return results;
|
|
3188
|
-
}
|
|
3189
|
-
// ── §32.2.4 runtime install (physically migrated from setup-manager) ──
|
|
3190
|
-
//
|
|
3191
|
-
// Installs the OpenClaw npm package via `npm install -g --prefix` so that
|
|
3192
|
-
// postinstall scripts run naturally. Emits SSE progress through the task
|
|
3193
|
-
// machinery exported by setup-manager.
|
|
3194
|
-
async installRuntime(opts) {
|
|
3195
|
-
const version = opts?.version ?? "latest";
|
|
3196
|
-
try {
|
|
3197
|
-
const openclawPkgDir = join(OPENCLAW_MODULES, "openclaw");
|
|
3198
|
-
if (existsSync(openclawPkgDir)) {
|
|
3199
|
-
const ver = readInstalledOpenclawVersion() || "unknown";
|
|
3200
|
-
return { ok: true, message: `OpenClaw already installed: ${ver}` };
|
|
3201
|
-
}
|
|
3202
|
-
const task = createTask("openclaw");
|
|
3203
|
-
ensureDirHost(OPENCLAW_PKG_DIR);
|
|
3204
|
-
emitTask(task, { type: "progress", message: "开始安装 OpenClaw...", progress: 0 });
|
|
3205
|
-
const sizeTracker = setInterval(() => {
|
|
3206
|
-
const sizeMB = getDirSizeMB(OPENCLAW_PKG_DIR);
|
|
3207
|
-
const pct = Math.min(95, Math.round((sizeMB / OPENCLAW_EXPECTED_SIZE_MB) * 95));
|
|
3208
|
-
if (pct > 0) {
|
|
3209
|
-
emitTask(task, {
|
|
3210
|
-
type: "progress",
|
|
3211
|
-
message: `下载安装中... ${sizeMB}MB / ~${OPENCLAW_EXPECTED_SIZE_MB}MB`,
|
|
3212
|
-
progress: pct,
|
|
3213
|
-
});
|
|
3214
|
-
}
|
|
3215
|
-
}, 3000);
|
|
3216
|
-
const result = await spawnWithTask(task, "npm", ["install", "-g", "--prefix", OPENCLAW_PKG_DIR, `openclaw@${version}`], { timeout: 600000, progressParser: npmProgressParser });
|
|
3217
|
-
clearInterval(sizeTracker);
|
|
3218
|
-
if (!result.ok) {
|
|
3219
|
-
emitTask(task, { type: "error", message: "OpenClaw 安装失败" });
|
|
3220
|
-
task.status = "error";
|
|
3221
|
-
return {
|
|
3222
|
-
ok: false,
|
|
3223
|
-
message: "OpenClaw installation failed",
|
|
3224
|
-
error: result.output,
|
|
3225
|
-
taskId: task.id,
|
|
3226
|
-
};
|
|
3227
|
-
}
|
|
3228
|
-
const ver = readInstalledOpenclawVersion() || "installed";
|
|
3229
|
-
emitTask(task, { type: "done", message: `OpenClaw 安装完成: ${ver}`, progress: 100 });
|
|
3230
|
-
task.status = "done";
|
|
3231
|
-
return { ok: true, message: `OpenClaw installed: ${ver}`, taskId: task.id };
|
|
3232
|
-
}
|
|
3233
|
-
catch (e) {
|
|
3234
|
-
return { ok: false, message: "OpenClaw installation failed", error: e.message };
|
|
3235
|
-
}
|
|
3236
|
-
}
|
|
3237
|
-
/**
|
|
3238
|
-
* Build / pull the OpenClaw Docker image. Blocking — useful for CLI
|
|
3239
|
-
* installer and `runFullSetup()`. Non-blocking variant below is used by
|
|
3240
|
-
* the REST API and the adapter's own `onBeforeStart` self-heal path.
|
|
3241
|
-
*/
|
|
3242
|
-
async buildRuntimeImage(opts) {
|
|
3243
|
-
const task = createTask("openclaw-docker-pull");
|
|
3244
|
-
return pullOrBuildOpenclawImageWithTask(task, opts?.tag);
|
|
3245
|
-
}
|
|
3246
|
-
/**
|
|
3247
|
-
* Non-blocking variant of `buildRuntimeImage` — returns a task id
|
|
3248
|
-
* immediately so the caller can poll SSE progress.
|
|
3249
|
-
*/
|
|
3250
|
-
startBuildRuntimeImage(opts) {
|
|
3251
|
-
const task = createTask("openclaw-docker-pull");
|
|
3252
|
-
void pullOrBuildOpenclawImageWithTask(task, opts?.tag).catch((err) => {
|
|
3253
|
-
emitTask(task, {
|
|
3254
|
-
type: "error",
|
|
3255
|
-
message: `镜像获取失败: ${err?.message || err}`,
|
|
3256
|
-
});
|
|
3257
|
-
task.status = "error";
|
|
3258
|
-
});
|
|
3259
|
-
return { ok: true, message: "Docker image pull started", taskId: task.id };
|
|
3260
|
-
}
|
|
3261
|
-
/**
|
|
3262
|
-
* §32.2.5 — register OpenClaw-specific HTTP endpoints. Called from
|
|
3263
|
-
* `routes/instances.ts` at server startup via the generic adapter
|
|
3264
|
-
* dispatch loop.
|
|
3265
|
-
*/
|
|
3266
|
-
registerRoutes(app) {
|
|
3267
|
-
registerOpenclawRoutes(app);
|
|
3268
|
-
}
|
|
3269
|
-
/**
|
|
3270
|
-
* Return OpenClaw's readiness for spawning instances. Docker image
|
|
3271
|
-
* presence is the gating factor in the default docker-mode deployment;
|
|
3272
|
-
* the legacy `npm install` path is still reported as `installed` but is
|
|
3273
|
-
* not required for the docker-driver stack.
|
|
3274
|
-
*/
|
|
3275
|
-
getInstallStatus() {
|
|
3276
|
-
// OPENCLAW_MODULES may be undefined when config is partially mocked in tests.
|
|
3277
|
-
const pkgInstalled = OPENCLAW_MODULES ? existsSync(join(OPENCLAW_MODULES, "openclaw")) : false;
|
|
3278
|
-
const version = pkgInstalled ? readInstalledOpenclawVersion() : undefined;
|
|
3279
|
-
const imageTag = getOpenclawDockerImage?.() ?? "";
|
|
3280
|
-
let imageReady = false;
|
|
3281
|
-
try {
|
|
3282
|
-
const invocation = resolveDockerInvocation();
|
|
3283
|
-
if (invocation?.cmd) {
|
|
3284
|
-
execFileSync(invocation.cmd, [...invocation.argsPrefix, "image", "inspect", imageTag], {
|
|
3285
|
-
timeout: 5000,
|
|
3286
|
-
stdio: "ignore",
|
|
3287
|
-
});
|
|
3288
|
-
imageReady = true;
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
catch { /* image absent */ }
|
|
3292
|
-
return {
|
|
3293
|
-
installed: imageReady || pkgInstalled,
|
|
3294
|
-
imageReady,
|
|
3295
|
-
version: version || undefined,
|
|
3296
|
-
};
|
|
3297
|
-
}
|
|
3298
|
-
}
|
|
3299
|
-
// ── Install-time helpers (used by installRuntime) ─────────────────────
|
|
3300
|
-
const OPENCLAW_EXPECTED_SIZE_MB = 700;
|
|
3301
|
-
function readInstalledOpenclawVersion() {
|
|
3302
|
-
try {
|
|
3303
|
-
const pkg = join(OPENCLAW_MODULES, "openclaw", "package.json");
|
|
3304
|
-
if (existsSync(pkg))
|
|
3305
|
-
return JSON.parse(readFileSync(pkg, "utf-8")).version || "";
|
|
3306
|
-
}
|
|
3307
|
-
catch {
|
|
3308
|
-
/* best effort */
|
|
3309
|
-
}
|
|
3310
|
-
return "";
|
|
3311
|
-
}
|
|
3312
|
-
// Feishu app IDs issued by the open platform follow `cli_<hex/alnum>`.
|
|
3313
|
-
const FEISHU_APP_ID_RE = /^cli_[a-zA-Z0-9]{8,64}$/;
|
|
3314
|
-
const SAFE_ACCOUNT_ID_RE = /^[a-zA-Z0-9@._-]{1,128}$/;
|
|
3315
|
-
// ── Channel plugin constants (physically migrated) ───────────────────
|
|
3316
|
-
const CHANNEL_EXT_DIR_ALIAS = {
|
|
3317
|
-
feishu: "openclaw-lark",
|
|
3318
|
-
lark: "openclaw-lark",
|
|
3319
|
-
};
|
|
3320
|
-
const CHANNEL_PLUGIN_MAP = {
|
|
3321
|
-
feishu: "@larksuite/openclaw-lark",
|
|
3322
|
-
lark: "@larksuite/openclaw-lark",
|
|
3323
|
-
telegram: "@openclaw/telegram",
|
|
3324
|
-
discord: "@openclaw/discord",
|
|
3325
|
-
slack: "@openclaw/slack",
|
|
3326
|
-
whatsapp: "@openclaw/whatsapp",
|
|
3327
|
-
signal: "@openclaw/signal",
|
|
3328
|
-
line: "@openclaw/line",
|
|
3329
|
-
msteams: "@openclaw/msteams",
|
|
3330
|
-
"openclaw-weixin": "@tencent-weixin/openclaw-weixin",
|
|
3331
|
-
};
|
|
3332
|
-
const IM_PLUGIN_ENTRY_IDS = new Set([
|
|
3333
|
-
...Object.keys(CHANNEL_PLUGIN_MAP),
|
|
3334
|
-
...Object.values(CHANNEL_EXT_DIR_ALIAS),
|
|
3335
|
-
]);
|
|
3336
|
-
// ── Config I/O helpers (physically migrated) ─────────────────────────
|
|
3337
|
-
function hasConfiguredValue(value) {
|
|
3338
|
-
if (typeof value !== "string")
|
|
3339
|
-
return !!value;
|
|
3340
|
-
return value.trim().length > 0;
|
|
3341
|
-
}
|
|
3342
|
-
function loadJsonSafe(path) {
|
|
3343
|
-
try {
|
|
3344
|
-
return JSON.parse(readFileSync(path, "utf-8"));
|
|
3345
|
-
}
|
|
3346
|
-
catch (e) {
|
|
3347
|
-
console.warn(`[openclaw] Failed to parse ${path}: ${e.message}`);
|
|
3348
|
-
return null;
|
|
3349
|
-
}
|
|
3350
|
-
}
|
|
3351
|
-
function deepMergeConfig(base, overlay) {
|
|
3352
|
-
if (typeof base !== "object" || base === null ||
|
|
3353
|
-
typeof overlay !== "object" || overlay === null ||
|
|
3354
|
-
Array.isArray(base) || Array.isArray(overlay)) {
|
|
3355
|
-
return structuredClone(overlay);
|
|
3356
|
-
}
|
|
3357
|
-
const merged = structuredClone(base);
|
|
3358
|
-
for (const key of Object.keys(overlay)) {
|
|
3359
|
-
merged[key] = key in merged ? deepMergeConfig(merged[key], overlay[key]) : structuredClone(overlay[key]);
|
|
3360
|
-
}
|
|
3361
|
-
return merged;
|
|
3362
|
-
}
|
|
3363
|
-
function loadEffectiveConfig(instanceId) {
|
|
3364
|
-
const runtimePath = openclawConfigPath(instanceId);
|
|
3365
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
3366
|
-
const rExists = existsSync(runtimePath);
|
|
3367
|
-
const lExists = existsSync(legacyPath);
|
|
3368
|
-
if (rExists && lExists) {
|
|
3369
|
-
const legacy = loadJsonSafe(legacyPath);
|
|
3370
|
-
const runtime = loadJsonSafe(runtimePath);
|
|
3371
|
-
if (legacy && runtime)
|
|
3372
|
-
return deepMergeConfig(legacy, runtime);
|
|
3373
|
-
return runtime || legacy || null;
|
|
3374
|
-
}
|
|
3375
|
-
if (rExists)
|
|
3376
|
-
return loadJsonSafe(runtimePath);
|
|
3377
|
-
if (lExists)
|
|
3378
|
-
return loadJsonSafe(legacyPath);
|
|
3379
|
-
return null;
|
|
3380
|
-
}
|
|
3381
|
-
function injectProviderApiKeys(instanceId, config) {
|
|
3382
|
-
const merged = structuredClone(config);
|
|
3383
|
-
const runtimeEnv = getRuntimeEnv(instanceId);
|
|
3384
|
-
const providers = merged.models?.providers || {};
|
|
3385
|
-
for (const [providerId, provider] of Object.entries(providers)) {
|
|
3386
|
-
if (typeof provider !== "object" || provider === null)
|
|
3387
|
-
continue;
|
|
3388
|
-
const p = provider;
|
|
3389
|
-
const api = p.api;
|
|
3390
|
-
if (typeof api === "string" && api in LEGACY_PROVIDER_API_ALIASES) {
|
|
3391
|
-
p.api = LEGACY_PROVIDER_API_ALIASES[api];
|
|
3392
|
-
}
|
|
3393
|
-
const apiKey = runtimeEnv[inferProviderApiKeyEnvName(providerId)];
|
|
3394
|
-
if (apiKey)
|
|
3395
|
-
p.apiKey = apiKey;
|
|
3396
|
-
}
|
|
3397
|
-
return merged;
|
|
3398
|
-
}
|
|
3399
|
-
function applyFeishuDebugAccessDefaults(channel) {
|
|
3400
|
-
if (channel.enabled === false)
|
|
3401
|
-
return;
|
|
3402
|
-
if (!hasConfiguredValue(channel.appId))
|
|
3403
|
-
return;
|
|
3404
|
-
if (!hasConfiguredValue(channel.appSecret))
|
|
3405
|
-
return;
|
|
3406
|
-
let dmPolicy = channel.dmPolicy;
|
|
3407
|
-
if (typeof dmPolicy !== "string" || !dmPolicy.trim()) {
|
|
3408
|
-
channel.dmPolicy = "open";
|
|
3409
|
-
dmPolicy = "open";
|
|
3410
|
-
}
|
|
3411
|
-
if (dmPolicy !== "open")
|
|
3412
|
-
return;
|
|
3413
|
-
if (!("resolveSenderNames" in channel))
|
|
3414
|
-
channel.resolveSenderNames = false;
|
|
3415
|
-
let accounts = channel.accounts;
|
|
3416
|
-
if (typeof accounts !== "object" || accounts === null) {
|
|
3417
|
-
accounts = {};
|
|
3418
|
-
channel.accounts = accounts;
|
|
3419
|
-
}
|
|
3420
|
-
let defaultAccount = accounts.default;
|
|
3421
|
-
if (typeof defaultAccount !== "object" || defaultAccount === null) {
|
|
3422
|
-
defaultAccount = {};
|
|
3423
|
-
accounts.default = defaultAccount;
|
|
3424
|
-
}
|
|
3425
|
-
if (!("resolveSenderNames" in defaultAccount))
|
|
3426
|
-
defaultAccount.resolveSenderNames = false;
|
|
3427
|
-
const allowFrom = channel.allowFrom;
|
|
3428
|
-
if (Array.isArray(allowFrom)) {
|
|
3429
|
-
const normalized = allowFrom.map((e) => String(e).trim()).filter(Boolean);
|
|
3430
|
-
if (!normalized.includes("*"))
|
|
3431
|
-
normalized.push("*");
|
|
3432
|
-
channel.allowFrom = normalized;
|
|
3433
|
-
return;
|
|
3434
|
-
}
|
|
3435
|
-
channel.allowFrom = ["*"];
|
|
3436
|
-
}
|
|
3437
|
-
function prepareConfigForSave(instanceId, config) {
|
|
3438
|
-
const configToWrite = structuredClone(config);
|
|
3439
|
-
delete configToWrite["x-jishushell"];
|
|
3440
|
-
const envUpdates = {};
|
|
3441
|
-
const providers = configToWrite.models?.providers || {};
|
|
3442
|
-
const envFiles = getRuntimeEnvFiles(instanceId);
|
|
3443
|
-
const channels = configToWrite.channels || {};
|
|
3444
|
-
const plugins = configToWrite.plugins ??= {};
|
|
3445
|
-
const pluginEntries = plugins.entries ??= {};
|
|
3446
|
-
for (const [providerId, provider] of Object.entries(providers)) {
|
|
3447
|
-
if (typeof provider !== "object" || provider === null)
|
|
3448
|
-
continue;
|
|
3449
|
-
const p = provider;
|
|
3450
|
-
if (typeof p.api === "string" && p.api in LEGACY_PROVIDER_API_ALIASES) {
|
|
3451
|
-
p.api = LEGACY_PROVIDER_API_ALIASES[p.api];
|
|
3452
|
-
}
|
|
3453
|
-
// Ensure allowPrivateNetwork for providers targeting the local proxy
|
|
3454
|
-
if (typeof p.baseUrl === "string" && isPrivateNetworkBaseUrl(p.baseUrl)) {
|
|
3455
|
-
p.request = { ...(p.request || {}), allowPrivateNetwork: true };
|
|
3456
|
-
}
|
|
3457
|
-
if (!("apiKey" in p))
|
|
3458
|
-
continue;
|
|
3459
|
-
if (typeof p.baseUrl === "string" && p.baseUrl.includes("/proxy/"))
|
|
3460
|
-
continue;
|
|
3461
|
-
const apiKey = p.apiKey;
|
|
3462
|
-
delete p.apiKey;
|
|
3463
|
-
if (envFiles.length) {
|
|
3464
|
-
envUpdates[inferProviderApiKeyEnvName(providerId)] = decryptRuntimeProviderApiKey(apiKey);
|
|
3465
|
-
}
|
|
3466
|
-
else {
|
|
3467
|
-
p.apiKey = apiKey;
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
for (const [channelId, channel] of Object.entries(channels)) {
|
|
3471
|
-
if (typeof channel !== "object" || channel === null)
|
|
3472
|
-
continue;
|
|
3473
|
-
const ch = channel;
|
|
3474
|
-
if (channelId === "feishu" || channelId === "lark")
|
|
3475
|
-
applyFeishuDebugAccessDefaults(ch);
|
|
3476
|
-
let pluginEntry = pluginEntries[channelId];
|
|
3477
|
-
if (pluginEntry == null) {
|
|
3478
|
-
pluginEntry = {};
|
|
3479
|
-
pluginEntries[channelId] = pluginEntry;
|
|
3480
|
-
}
|
|
3481
|
-
if (typeof pluginEntry === "object") {
|
|
3482
|
-
pluginEntry.enabled = ch.enabled !== false;
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
|
-
return [configToWrite, envUpdates];
|
|
3486
|
-
}
|
|
3487
|
-
function decryptRuntimeProviderApiKey(apiKey) {
|
|
3488
|
-
const value = String(apiKey || "");
|
|
3489
|
-
return value.startsWith("enc:") ? decryptApiKey(value) : value;
|
|
3490
|
-
}
|
|
3491
|
-
function decryptRuntimeProviderEnv(env) {
|
|
3492
|
-
for (const [key, value] of Object.entries(env)) {
|
|
3493
|
-
if (!key.endsWith("_API_KEY"))
|
|
3494
|
-
continue;
|
|
3495
|
-
if (!String(value || "").startsWith("enc:"))
|
|
3496
|
-
continue;
|
|
3497
|
-
env[key] = decryptApiKey(value);
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
/**
|
|
3501
|
-
* Auto-injects provider-specific host env vars that OpenClaw tools need
|
|
3502
|
-
* at runtime, if the user hasn't already set them explicitly.
|
|
3503
|
-
*
|
|
3504
|
-
* Currently handles:
|
|
3505
|
-
* - MINIMAX_API_HOST: Derived from MINIMAX_BASE_URL or upstream proxy config
|
|
3506
|
-
* to ensure the VLM tool calls the correct MiniMax API domain.
|
|
3507
|
-
*
|
|
3508
|
-
* Note: Only MiniMax needs this because its VLM tool reads MINIMAX_API_HOST
|
|
3509
|
-
* to determine the endpoint. DeepSeek does not have a dedicated VLM tool
|
|
3510
|
-
* in OpenClaw that requires a similar host env var.
|
|
3511
|
-
*/
|
|
3512
|
-
function injectProviderHostEnv(env, instanceId) {
|
|
3513
|
-
// MINIMAX_API_HOST — needed by OpenClaw's VLM tool to call the correct domain
|
|
3514
|
-
if (!env.MINIMAX_API_HOST) {
|
|
3515
|
-
const baseUrl = env.MINIMAX_BASE_URL || "";
|
|
3516
|
-
if (baseUrl) {
|
|
3517
|
-
try {
|
|
3518
|
-
const parsed = new URL(baseUrl);
|
|
3519
|
-
env.MINIMAX_API_HOST = `${parsed.protocol}//${parsed.host}`;
|
|
3520
|
-
}
|
|
3521
|
-
catch { /* invalid URL, skip */ }
|
|
3522
|
-
}
|
|
3523
|
-
else {
|
|
3524
|
-
// Infer from upstream proxy config if available
|
|
3525
|
-
const config = getProxyInstanceConfig(instanceId);
|
|
3526
|
-
const upstream = config?.["x-jishushell"]?.proxy?.upstream;
|
|
3527
|
-
if (upstream?.providerId === "minimax" && upstream.baseUrl) {
|
|
3528
|
-
try {
|
|
3529
|
-
const parsed = new URL(upstream.baseUrl);
|
|
3530
|
-
env.MINIMAX_API_HOST = `${parsed.protocol}//${parsed.host}`;
|
|
3531
|
-
}
|
|
3532
|
-
catch { /* invalid URL, skip */ }
|
|
3533
|
-
}
|
|
3534
|
-
}
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
/**
|
|
3538
|
-
* Dissociate a cloned/imported config from its source instance's IM bindings.
|
|
3539
|
-
* Physically migrated from `instance-manager.stripImBindings` so framework
|
|
3540
|
-
* code no longer references OpenClaw channel concepts.
|
|
3541
|
-
*
|
|
3542
|
-
* Exported so `OpenClawAdapter.createInstance`'s clone path + `backup-manager`
|
|
3543
|
-
* import paths can use it without depending on instance-manager.
|
|
3544
|
-
*/
|
|
3545
|
-
export function stripImBindings(config) {
|
|
3546
|
-
if (config?.channels)
|
|
3547
|
-
delete config.channels;
|
|
3548
|
-
const entries = config?.plugins?.entries;
|
|
3549
|
-
if (entries && typeof entries === "object") {
|
|
3550
|
-
for (const key of Object.keys(entries)) {
|
|
3551
|
-
if (IM_PLUGIN_ENTRY_IDS.has(key))
|
|
3552
|
-
delete entries[key];
|
|
3553
|
-
}
|
|
3554
|
-
}
|
|
3555
|
-
}
|
|
3556
|
-
function getChannelExtensionsDir(instanceId) {
|
|
3557
|
-
const home = getInstance(instanceId)?.openclaw_home ||
|
|
3558
|
-
defaultOpenclawHome(instanceId);
|
|
3559
|
-
return join(home, OPENCLAW_STATE_DIRNAME, "extensions");
|
|
3560
|
-
}
|
|
3561
|
-
function getStockExtensionsDir() {
|
|
3562
|
-
return join(JISHUSHELL_HOME, "packages", "openclaw", "lib", "node_modules", "openclaw", "extensions");
|
|
3563
|
-
}
|
|
3564
|
-
function isChannelPluginInstalled(instanceId, channelId) {
|
|
3565
|
-
const extDirName = CHANNEL_EXT_DIR_ALIAS[channelId] || channelId;
|
|
3566
|
-
const stockExtDir = getStockExtensionsDir();
|
|
3567
|
-
if (existsSync(join(getChannelExtensionsDir(instanceId), extDirName)))
|
|
3568
|
-
return true;
|
|
3569
|
-
if (existsSync(join(stockExtDir, extDirName)))
|
|
3570
|
-
return true;
|
|
3571
|
-
if (extDirName !== channelId && existsSync(join(stockExtDir, channelId)))
|
|
3572
|
-
return true;
|
|
3573
|
-
// OpenClaw's npm-backed plugin store lives at
|
|
3574
|
-
// `<home>/.openclaw/npm/node_modules/<pkg>`. The CLI refuses to reinstall
|
|
3575
|
-
// when that path is present ("plugin already exists ... delete it first"),
|
|
3576
|
-
// even if the per-instance extensions/<name> dir is missing (e.g. the
|
|
3577
|
-
// first install was interrupted, or the dir was manually cleaned). Treat
|
|
3578
|
-
// the npm path as authoritative so re-saves stay idempotent.
|
|
3579
|
-
const pkg = CHANNEL_PLUGIN_MAP[channelId];
|
|
3580
|
-
if (pkg) {
|
|
3581
|
-
const home = getInstance(instanceId)?.openclaw_home ||
|
|
3582
|
-
defaultOpenclawHome(instanceId);
|
|
3583
|
-
const npmPath = join(home, OPENCLAW_STATE_DIRNAME, "npm", "node_modules", ...pkg.split("/"));
|
|
3584
|
-
if (existsSync(npmPath))
|
|
3585
|
-
return true;
|
|
3586
|
-
}
|
|
3587
|
-
return false;
|
|
3588
|
-
}
|
|
3589
|
-
/**
|
|
3590
|
-
* Install a single channel plugin. Docker mode → `docker exec` inside the
|
|
3591
|
-
* running container. Host mode → spawn the host openclaw binary directly.
|
|
3592
|
-
* Physically migrated from `instance-manager.installChannelPlugin`.
|
|
3593
|
-
*/
|
|
3594
|
-
async function installChannelPlugin(instanceId, channelId) {
|
|
3595
|
-
const pkg = CHANNEL_PLUGIN_MAP[channelId];
|
|
3596
|
-
if (!pkg)
|
|
3597
|
-
throw new Error(`Unknown channel: ${channelId}`);
|
|
3598
|
-
if (isChannelPluginInstalled(instanceId, channelId))
|
|
3599
|
-
return;
|
|
3600
|
-
const home = getInstance(instanceId)?.openclaw_home ||
|
|
3601
|
-
defaultOpenclawHome(instanceId);
|
|
3602
|
-
const extensionsDir = getChannelExtensionsDir(instanceId);
|
|
3603
|
-
if (getNomadDriver() === "docker") {
|
|
3604
|
-
await installChannelPluginViaDocker(instanceId, channelId, pkg, extensionsDir);
|
|
3605
|
-
return;
|
|
3606
|
-
}
|
|
3607
|
-
const openclawBin = resolveOpenclawBin();
|
|
3608
|
-
const nodeBinDir = dirname(process.execPath);
|
|
3609
|
-
const childPath = [nodeBinDir, process.env.PATH].filter(Boolean).join(":");
|
|
3610
|
-
const proxyEnvKeys = [
|
|
3611
|
-
"http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY",
|
|
3612
|
-
"no_proxy", "NO_PROXY", "NODE_EXTRA_CA_CERTS", "NODE_TLS_REJECT_UNAUTHORIZED",
|
|
3613
|
-
];
|
|
3614
|
-
const proxyEnv = {};
|
|
3615
|
-
for (const key of proxyEnvKeys) {
|
|
3616
|
-
if (process.env[key])
|
|
3617
|
-
proxyEnv[key] = process.env[key];
|
|
3618
|
-
}
|
|
3619
|
-
const childEnv = {
|
|
3620
|
-
PATH: childPath,
|
|
3621
|
-
HOME: process.env.HOME,
|
|
3622
|
-
LANG: process.env.LANG,
|
|
3623
|
-
OPENCLAW_HOME: home,
|
|
3624
|
-
...proxyEnv,
|
|
3625
|
-
};
|
|
3626
|
-
const MAX_ATTEMPTS = 3;
|
|
3627
|
-
const RETRY_DELAY_MS = 5_000;
|
|
3628
|
-
const attemptInstall = () => new Promise((resolve, reject) => {
|
|
3629
|
-
execFile(openclawBin, ["plugins", "install", pkg], { cwd: home, env: childEnv, timeout: 300_000 }, (err, stdout, stderr) => {
|
|
3630
|
-
if (err && !isChannelPluginInstalled(instanceId, channelId)) {
|
|
3631
|
-
const msg = [stderr?.trim(), stdout?.trim(), err.message].filter(Boolean).join(" | ");
|
|
3632
|
-
console.error(`[plugins] ${pkg} exit code ${err.code ?? "?"}, stderr: ${stderr?.trim() || "(empty)"}, stdout: ${stdout?.trim() || "(empty)"}`);
|
|
3633
|
-
try {
|
|
3634
|
-
if (existsSync(extensionsDir)) {
|
|
3635
|
-
for (const entry of readdirSync(extensionsDir)) {
|
|
3636
|
-
if (entry.startsWith(".openclaw-install-stage-")) {
|
|
3637
|
-
rmSync(join(extensionsDir, entry), { recursive: true, force: true });
|
|
3638
|
-
console.log(`[plugins] Cleaned up stage dir: ${entry}`);
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
}
|
|
3642
|
-
}
|
|
3643
|
-
catch {
|
|
3644
|
-
/* ignore */
|
|
3645
|
-
}
|
|
3646
|
-
reject(new Error(msg));
|
|
3647
|
-
}
|
|
3648
|
-
else {
|
|
3649
|
-
if (err)
|
|
3650
|
-
console.log(`[plugins] ${pkg} installed (ignored non-zero exit)`);
|
|
3651
|
-
else
|
|
3652
|
-
console.log(`[plugins] ${pkg} installed`);
|
|
3653
|
-
resolve();
|
|
3654
|
-
}
|
|
3655
|
-
});
|
|
3656
|
-
});
|
|
3657
|
-
console.log(`[plugins] Installing ${pkg} for ${channelId} (host)...`);
|
|
3658
|
-
let lastErr;
|
|
3659
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
3660
|
-
try {
|
|
3661
|
-
await attemptInstall();
|
|
3662
|
-
const extDirName = CHANNEL_EXT_DIR_ALIAS[channelId] || channelId;
|
|
3663
|
-
const installedExtDir = join(extensionsDir, extDirName);
|
|
3664
|
-
if (existsSync(installedExtDir)) {
|
|
3665
|
-
ensureDirContainer(installedExtDir);
|
|
3666
|
-
try {
|
|
3667
|
-
for (const entry of readdirSync(installedExtDir, { withFileTypes: true })) {
|
|
3668
|
-
if (entry.isDirectory()) {
|
|
3669
|
-
ensureDirContainer(join(installedExtDir, entry.name));
|
|
3670
|
-
}
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3673
|
-
catch {
|
|
3674
|
-
/* best effort */
|
|
3675
|
-
}
|
|
3676
|
-
}
|
|
3677
|
-
ensureDirContainer(extensionsDir);
|
|
3678
|
-
return;
|
|
3679
|
-
}
|
|
3680
|
-
catch (err) {
|
|
3681
|
-
lastErr = err;
|
|
3682
|
-
const isFetchError = /fetch failed/i.test(err.message ?? "");
|
|
3683
|
-
if (isFetchError && attempt < MAX_ATTEMPTS) {
|
|
3684
|
-
console.warn(`[plugins] ${pkg} install attempt ${attempt}/${MAX_ATTEMPTS} failed, retrying in ${RETRY_DELAY_MS / 1000}s...`);
|
|
3685
|
-
await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
3686
|
-
continue;
|
|
3687
|
-
}
|
|
3688
|
-
console.error(`[plugins] Failed to install ${pkg}:`, err.message);
|
|
3689
|
-
break;
|
|
3690
|
-
}
|
|
3691
|
-
}
|
|
3692
|
-
throw lastErr;
|
|
3693
|
-
}
|
|
3694
|
-
async function installChannelPluginViaDocker(instanceId, channelId, pkg, extensionsDir) {
|
|
3695
|
-
const { exec } = await import("../../nomad-manager.js");
|
|
3696
|
-
const MAX_ATTEMPTS = 3;
|
|
3697
|
-
const RETRY_DELAY_MS = 5_000;
|
|
3698
|
-
console.log(`[plugins] Installing ${pkg} for ${channelId} via docker exec (instance: ${instanceId})...`);
|
|
3699
|
-
let lastErr;
|
|
3700
|
-
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
3701
|
-
try {
|
|
3702
|
-
const result = await exec(instanceId, ["openclaw", "plugins", "install", pkg], 300_000);
|
|
3703
|
-
if (result.exitCode !== 0 && !isChannelPluginInstalled(instanceId, channelId)) {
|
|
3704
|
-
const msg = [result.stderr?.trim(), result.stdout?.trim()].filter(Boolean).join(" | ");
|
|
3705
|
-
console.error(`[plugins] ${pkg} docker exec exit code ${result.exitCode}, output: ${msg}`);
|
|
3706
|
-
throw new Error(msg || `openclaw plugins install exited with code ${result.exitCode}`);
|
|
3707
|
-
}
|
|
3708
|
-
if (result.exitCode !== 0) {
|
|
3709
|
-
console.log(`[plugins] ${pkg} installed via docker (ignored non-zero exit)`);
|
|
3710
|
-
}
|
|
3711
|
-
else {
|
|
3712
|
-
console.log(`[plugins] ${pkg} installed via docker`);
|
|
3713
|
-
}
|
|
3714
|
-
const extDirName = CHANNEL_EXT_DIR_ALIAS[channelId] || channelId;
|
|
3715
|
-
const installedExtDir = join(extensionsDir, extDirName);
|
|
3716
|
-
if (existsSync(installedExtDir)) {
|
|
3717
|
-
ensureDirContainer(installedExtDir);
|
|
3718
|
-
try {
|
|
3719
|
-
for (const entry of readdirSync(installedExtDir, { withFileTypes: true })) {
|
|
3720
|
-
if (entry.isDirectory()) {
|
|
3721
|
-
ensureDirContainer(join(installedExtDir, entry.name));
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
catch {
|
|
3726
|
-
/* best effort */
|
|
3727
|
-
}
|
|
3728
|
-
}
|
|
3729
|
-
ensureDirContainer(extensionsDir);
|
|
3730
|
-
return;
|
|
3731
|
-
}
|
|
3732
|
-
catch (err) {
|
|
3733
|
-
lastErr = err;
|
|
3734
|
-
if (/not running/i.test(err.message ?? "")) {
|
|
3735
|
-
throw new Error("请先启动实例后再安装插件(Docker 模式下插件需在容器内安装)");
|
|
3736
|
-
}
|
|
3737
|
-
const isTransient = /fetch failed|ECONNREFUSED/i.test(err.message ?? "");
|
|
3738
|
-
if (isTransient && attempt < MAX_ATTEMPTS) {
|
|
3739
|
-
console.warn(`[plugins] ${pkg} docker install attempt ${attempt}/${MAX_ATTEMPTS} failed, retrying...`);
|
|
3740
|
-
await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
3741
|
-
continue;
|
|
3742
|
-
}
|
|
3743
|
-
console.error(`[plugins] Failed to install ${pkg} via docker:`, err.message);
|
|
3744
|
-
break;
|
|
3745
|
-
}
|
|
3746
|
-
}
|
|
3747
|
-
throw lastErr;
|
|
3748
|
-
}
|
|
3749
|
-
/**
|
|
3750
|
-
* Full saveConfig implementation. Writes `.openclaw/openclaw.json`,
|
|
3751
|
-
* mirrors into legacy `openclaw.json` path, updates env files with
|
|
3752
|
-
* provider API keys, preserves backend-managed fields, and fires
|
|
3753
|
-
* config-change listeners.
|
|
3754
|
-
*
|
|
3755
|
-
* Physically migrated from `instance-manager.saveConfig`.
|
|
3756
|
-
*/
|
|
3757
|
-
function saveNativeConfigImpl(instanceId, config) {
|
|
3758
|
-
const configPath = openclawConfigPath(instanceId);
|
|
3759
|
-
if (!existsSync(framework_instanceDir(instanceId)))
|
|
3760
|
-
return false;
|
|
3761
|
-
if (!existsSync(configPath)) {
|
|
3762
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
3763
|
-
ensureDirContainer(dirname(configPath));
|
|
3764
|
-
if (existsSync(legacyPath))
|
|
3765
|
-
copyFileSync(legacyPath, configPath);
|
|
3766
|
-
}
|
|
3767
|
-
// Save x-jishushell metadata to instance.json (not openclaw.json)
|
|
3768
|
-
if (config["x-jishushell"]) {
|
|
3769
|
-
const metaPath = instanceMetaPath(instanceId);
|
|
3770
|
-
if (existsSync(metaPath)) {
|
|
3771
|
-
const meta = JSON.parse(readFileSync(metaPath, "utf-8"));
|
|
3772
|
-
meta["x-jishushell"] = config["x-jishushell"];
|
|
3773
|
-
safeWriteJson(metaPath, meta);
|
|
3774
|
-
chownToServiceUser(metaPath);
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
const [configToWrite, envUpdates] = prepareConfigForSave(instanceId, config);
|
|
3778
|
-
// If openclaw-lark is enabled, resolve which feishu plugin to use
|
|
3779
|
-
if (configToWrite.plugins?.entries?.["openclaw-lark"]?.enabled) {
|
|
3780
|
-
const stockExtDir = getStockExtensionsDir();
|
|
3781
|
-
const stockFeishu = join(stockExtDir, "feishu");
|
|
3782
|
-
const stockOcl = join(stockExtDir, "openclaw-lark");
|
|
3783
|
-
const instanceOcl = join(getChannelExtensionsDir(instanceId), "openclaw-lark");
|
|
3784
|
-
if (existsSync(stockFeishu) && !existsSync(stockOcl) && !existsSync(instanceOcl)) {
|
|
3785
|
-
configToWrite.plugins.entries.feishu = { enabled: true };
|
|
3786
|
-
delete configToWrite.plugins.entries["openclaw-lark"];
|
|
3787
|
-
}
|
|
3788
|
-
else if (existsSync(stockFeishu)) {
|
|
3789
|
-
configToWrite.plugins ??= {};
|
|
3790
|
-
configToWrite.plugins.entries ??= {};
|
|
3791
|
-
configToWrite.plugins.entries.feishu = { enabled: false };
|
|
3792
|
-
}
|
|
3793
|
-
}
|
|
3794
|
-
// Preserve backend-managed fields
|
|
3795
|
-
if (existsSync(configPath)) {
|
|
3796
|
-
try {
|
|
3797
|
-
const existing = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
3798
|
-
if (existing.plugins?.installs) {
|
|
3799
|
-
configToWrite.plugins ??= {};
|
|
3800
|
-
configToWrite.plugins.installs = { ...existing.plugins.installs, ...configToWrite.plugins?.installs };
|
|
3801
|
-
}
|
|
3802
|
-
if (existing.plugins?.entries && configToWrite.plugins?.entries) {
|
|
3803
|
-
for (const [key, val] of Object.entries(configToWrite.plugins.entries)) {
|
|
3804
|
-
const old = existing.plugins.entries[key];
|
|
3805
|
-
if (val && typeof val === "object" && !Array.isArray(val) && old && typeof old === "object") {
|
|
3806
|
-
configToWrite.plugins.entries[key] = { ...old, ...val };
|
|
3807
|
-
}
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3810
|
-
if (existing.channels && configToWrite.channels) {
|
|
3811
|
-
for (const [key, val] of Object.entries(configToWrite.channels)) {
|
|
3812
|
-
const old = existing.channels[key];
|
|
3813
|
-
if (val && typeof val === "object" && !Array.isArray(val) && old && typeof old === "object") {
|
|
3814
|
-
configToWrite.channels[key] = { ...old, ...val };
|
|
3815
|
-
}
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
}
|
|
3819
|
-
catch {
|
|
3820
|
-
/* best effort */
|
|
3821
|
-
}
|
|
3822
|
-
}
|
|
3823
|
-
// Backup + atomic write
|
|
3824
|
-
if (existsSync(configPath)) {
|
|
3825
|
-
copyFileSync(configPath, configPath + ".bak");
|
|
3826
|
-
}
|
|
3827
|
-
const configJson = JSON.stringify(configToWrite, null, 2);
|
|
3828
|
-
ensureDirContainer(dirname(configPath));
|
|
3829
|
-
writeConfigFile(configPath + ".tmp", configJson);
|
|
3830
|
-
JSON.parse(readFileSync(configPath + ".tmp", "utf-8"));
|
|
3831
|
-
renameSync(configPath + ".tmp", configPath);
|
|
3832
|
-
chownToServiceUser(configPath);
|
|
3833
|
-
// Mirror into legacy path
|
|
3834
|
-
const legacyPath = legacyOpenclawConfigPath(instanceId);
|
|
3835
|
-
if (existsSync(legacyPath)) {
|
|
3836
|
-
copyFileSync(legacyPath, legacyPath + ".bak");
|
|
3837
|
-
}
|
|
3838
|
-
writeConfigFile(legacyPath + ".tmp", configJson);
|
|
3839
|
-
JSON.parse(readFileSync(legacyPath + ".tmp", "utf-8"));
|
|
3840
|
-
renameSync(legacyPath + ".tmp", legacyPath);
|
|
3841
|
-
chownToServiceUser(legacyPath);
|
|
3842
|
-
if (Object.keys(envUpdates).length) {
|
|
3843
|
-
const envFiles = getRuntimeEnvFiles(instanceId);
|
|
3844
|
-
if (envFiles.length)
|
|
3845
|
-
updateEnvFile(envFiles[0], envUpdates);
|
|
3846
|
-
}
|
|
3847
|
-
// Notify listeners (LLM proxy cache invalidation etc.)
|
|
3848
|
-
notifyConfigChange(instanceId);
|
|
3849
|
-
return true;
|
|
3850
|
-
}
|
|
3851
|
-
export const openclawAdapter = new OpenClawAdapter();
|
|
3852
|
-
registerAdapter(openclawAdapter);
|
|
3853
|
-
//# sourceMappingURL=openclaw.js.map
|