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
|
@@ -0,0 +1,3092 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nomad runtime driver — kind-agnostic scheduler layer.
|
|
3
|
+
*
|
|
4
|
+
* This file contains no direct knowledge of specific agent kinds. The runtime
|
|
5
|
+
* dispatch surface is now reduced to two compile-path primitives:
|
|
6
|
+
*
|
|
7
|
+
* const kind = resolvePrimaryIntegrationKind(getInstance(id));
|
|
8
|
+
* const integration = getIntegration(kind);
|
|
9
|
+
* const persistedRuntime = await integration.getPersistedRuntimeSpec(id);
|
|
10
|
+
* const contribution = await integration.buildRuntimeContribution?.(id);
|
|
11
|
+
*
|
|
12
|
+
* The persisted runtime spec + contribution are then handed to
|
|
13
|
+
* WorkloadCompiler, which is the single canonical task builder. The app
|
|
14
|
+
* lifecycle pipeline owns integration pre-start materialization before calling
|
|
15
|
+
* the prepared submit path; the legacy direct start wrapper still preserves the
|
|
16
|
+
* older runtime-local hook path until remaining callers are migrated.
|
|
17
|
+
*/
|
|
18
|
+
import { execFile as execFileCb, spawn } from "child_process";
|
|
19
|
+
import { existsSync, readFileSync } from "fs";
|
|
20
|
+
import { createServer as netCreateServer } from "net";
|
|
21
|
+
import { homedir } from "os";
|
|
22
|
+
import { basename, join } from "path";
|
|
23
|
+
import { StringDecoder } from "string_decoder";
|
|
24
|
+
import { promisify } from "util";
|
|
25
|
+
import * as config from "../../../config.js";
|
|
26
|
+
import { getPrimaryHostPort, getInstance, getInstanceRuntime, instanceMetaPath, getRuntimeEnv, isPortInUse, reallocatePrimaryHostPort, reallocateRuntimeHostPort, } from "../../instances/manager.js";
|
|
27
|
+
import { getIntegration } from "../../integrations/index.js";
|
|
28
|
+
import { resolveNomadJobId } from "../job-id.js";
|
|
29
|
+
import { isExecutionOwnerRequiredError, resolveExecutionOwner, } from "../../app-common/execution-owner.js";
|
|
30
|
+
import { readCanonicalSpecForInstance } from "../../app-common/instance-store.js";
|
|
31
|
+
import { DEFINITION_FILENAME, MANIFEST_FILENAME, RESOLVED_SPEC_FILENAME, resolveAppDir, } from "../../app-common/paths.js";
|
|
32
|
+
import { compileWorkload } from "../workload-compiler.js";
|
|
33
|
+
function getConfigValue(name) {
|
|
34
|
+
return name in config ? config[name] : undefined;
|
|
35
|
+
}
|
|
36
|
+
function resolveConfigPath(value, fallback) {
|
|
37
|
+
return typeof value === "string" && value.trim() ? value : fallback;
|
|
38
|
+
}
|
|
39
|
+
const JISHUSHELL_HOME = resolveConfigPath(getConfigValue("JISHUSHELL_HOME"), join(process.env.HOME ?? homedir(), ".jishushell"));
|
|
40
|
+
const getNomadAddrValue = getConfigValue("getNomadAddr");
|
|
41
|
+
const getNomadDriverValue = getConfigValue("getNomadDriver");
|
|
42
|
+
const getNomadTokenValue = getConfigValue("getNomadToken");
|
|
43
|
+
const getCoreConfigValue = getConfigValue("getCoreConfig");
|
|
44
|
+
const getNomadAddr = typeof getNomadAddrValue === "function"
|
|
45
|
+
? getNomadAddrValue
|
|
46
|
+
: () => "http://127.0.0.1:4646";
|
|
47
|
+
const getNomadDriver = typeof getNomadDriverValue === "function"
|
|
48
|
+
? getNomadDriverValue
|
|
49
|
+
: () => "docker";
|
|
50
|
+
const getNomadToken = typeof getNomadTokenValue === "function"
|
|
51
|
+
? getNomadTokenValue
|
|
52
|
+
: () => "";
|
|
53
|
+
const getCoreConfig = typeof getCoreConfigValue === "function"
|
|
54
|
+
? getCoreConfigValue
|
|
55
|
+
: () => ({});
|
|
56
|
+
// Docker image names must match this pattern to prevent command injection.
|
|
57
|
+
export const DOCKER_IMAGE_RE = /^[a-zA-Z0-9][a-zA-Z0-9\-_.:/@]*$/;
|
|
58
|
+
/**
|
|
59
|
+
* Linux username validation regex. Shared by integration Nomad task builders
|
|
60
|
+
* (OpenClaw / Hermes) and re-exported here as a neutral framework constant
|
|
61
|
+
* so security-regression tests can assert on it without depending on a
|
|
62
|
+
* specific integration file.
|
|
63
|
+
*
|
|
64
|
+
* Strict form: lowercase letters/digits/dot/dash/underscore only, 1..32 chars.
|
|
65
|
+
* Rejects uppercase, shell metacharacters, paths, and empty strings.
|
|
66
|
+
*/
|
|
67
|
+
export const VALID_USER_RE = /^[a-z0-9._-]{1,32}$/;
|
|
68
|
+
// Maximum allowed length for a Docker image reference.
|
|
69
|
+
export const MAX_DOCKER_IMAGE_NAME_LEN = 256;
|
|
70
|
+
/**
|
|
71
|
+
* Nomad job name prefix. Dispatched via `integration.nomadJobPrefix` so
|
|
72
|
+
* every runtime owns its own namespace (`hermes-<id>`, `openclaw-<id>`,
|
|
73
|
+
* …). New integration runtimes should declare their own prefix on the
|
|
74
|
+
* integration rather than re-using another kind's.
|
|
75
|
+
*/
|
|
76
|
+
function jobPrefixFor(instanceId) {
|
|
77
|
+
const kind = getInstanceIntegrationKind(instanceId);
|
|
78
|
+
const integration = getIntegration(kind);
|
|
79
|
+
return integration.nomadJobPrefix ?? "jishushell-";
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Per-instance Nomad Variable subpath. Returned without the leading
|
|
83
|
+
* `nomad/jobs/<jid>/` prefix. `undefined` means this integration does not
|
|
84
|
+
* use Nomad Variables — writeInstanceVariables/purgeInstanceVariables
|
|
85
|
+
* become no-ops.
|
|
86
|
+
*/
|
|
87
|
+
function integrationVariableSubpath(instanceId) {
|
|
88
|
+
const kind = getInstanceIntegrationKind(instanceId);
|
|
89
|
+
const integration = getIntegration(kind);
|
|
90
|
+
return integration.nomadVariablePath;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolve the Nomad task name for the given instance. Reads
|
|
94
|
+
* `integration.nomadTaskName` so framework code never hardcodes "gateway".
|
|
95
|
+
*/
|
|
96
|
+
function resolveTaskName(instanceId) {
|
|
97
|
+
const kind = getInstanceIntegrationKind(instanceId);
|
|
98
|
+
return getIntegration(kind).nomadTaskName ?? "gateway";
|
|
99
|
+
}
|
|
100
|
+
async function getInstanceInstallRecordForRuntime(instanceId) {
|
|
101
|
+
const { getInstanceInstallRecord } = await import("../../app-common/service.js");
|
|
102
|
+
return getInstanceInstallRecord(instanceId);
|
|
103
|
+
}
|
|
104
|
+
async function getIntegrationManagedInstanceRecord(instanceId) {
|
|
105
|
+
const installRecord = await getInstanceInstallRecordForRuntime(instanceId);
|
|
106
|
+
if (!installRecord)
|
|
107
|
+
return null;
|
|
108
|
+
const owner = tryResolveExecutionOwner(instanceId);
|
|
109
|
+
return owner?.type === "integration" ? installRecord : null;
|
|
110
|
+
}
|
|
111
|
+
function synthesizeCompileOnlyRuntimeAppSpec(input) {
|
|
112
|
+
const runtimeKind = typeof input.runtime.image === "string" && input.runtime.image.trim()
|
|
113
|
+
? "container"
|
|
114
|
+
: "process";
|
|
115
|
+
return {
|
|
116
|
+
id: input.instanceId,
|
|
117
|
+
name: input.instanceId,
|
|
118
|
+
tasks: [{
|
|
119
|
+
name: input.taskName,
|
|
120
|
+
role: "service",
|
|
121
|
+
runtime: runtimeKind,
|
|
122
|
+
}],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
async function compileIntegrationManagedJob(instanceId) {
|
|
126
|
+
const kind = getInstanceIntegrationKind(instanceId);
|
|
127
|
+
const integration = getIntegration(kind);
|
|
128
|
+
if (!integration.getPersistedRuntimeSpec) {
|
|
129
|
+
throw new Error(`Runtime integration "${kind}" must implement getPersistedRuntimeSpec() so WorkloadCompiler remains the only compile path`);
|
|
130
|
+
}
|
|
131
|
+
const persistedRuntime = await integration.getPersistedRuntimeSpec(instanceId);
|
|
132
|
+
const installRecord = await getIntegrationManagedInstanceRecord(instanceId);
|
|
133
|
+
const taskName = integration.nomadTaskName
|
|
134
|
+
?? (installRecord ? primaryTaskNameForSpec(installRecord.spec) : "gateway");
|
|
135
|
+
const inferredRuntimeKind = typeof persistedRuntime.image === "string"
|
|
136
|
+
&& String(persistedRuntime.image).trim()
|
|
137
|
+
? "container"
|
|
138
|
+
: "process";
|
|
139
|
+
const spec = installRecord?.spec
|
|
140
|
+
? {
|
|
141
|
+
...installRecord.spec,
|
|
142
|
+
tasks: installRecord.spec.tasks.map((task, index) => (task.name === taskName || index === 0
|
|
143
|
+
? {
|
|
144
|
+
...task,
|
|
145
|
+
runtime: task.runtime ?? inferredRuntimeKind,
|
|
146
|
+
}
|
|
147
|
+
: task)),
|
|
148
|
+
}
|
|
149
|
+
: synthesizeCompileOnlyRuntimeAppSpec({
|
|
150
|
+
instanceId,
|
|
151
|
+
taskName,
|
|
152
|
+
runtime: persistedRuntime,
|
|
153
|
+
});
|
|
154
|
+
const compiled = compileWorkload({
|
|
155
|
+
instanceId,
|
|
156
|
+
jobId: jobId(instanceId),
|
|
157
|
+
groupName: kind,
|
|
158
|
+
spec,
|
|
159
|
+
runtimeByTaskName: {
|
|
160
|
+
[taskName]: persistedRuntime,
|
|
161
|
+
},
|
|
162
|
+
contribution: integration.buildRuntimeContribution
|
|
163
|
+
? await integration.buildRuntimeContribution(instanceId)
|
|
164
|
+
: undefined,
|
|
165
|
+
});
|
|
166
|
+
const tasks = (compiled.nomadJob?.Job?.TaskGroups?.[0]?.Tasks ?? []);
|
|
167
|
+
const runtimeTask = tasks.find((task) => task?.Name === taskName) ?? tasks[0];
|
|
168
|
+
if (runtimeTask) {
|
|
169
|
+
await injectConnectionsRuntimeEnv(instanceId, runtimeTask);
|
|
170
|
+
}
|
|
171
|
+
return compiled.nomadJob;
|
|
172
|
+
}
|
|
173
|
+
function primaryTaskNameForSpec(spec, fallback = "gateway") {
|
|
174
|
+
return spec.tasks.find((task) => (task.role ?? "service") === "service")?.name
|
|
175
|
+
?? spec.tasks[0]?.name
|
|
176
|
+
?? fallback;
|
|
177
|
+
}
|
|
178
|
+
// Tracks the core server's listening port so bridge-mode containers can reach it via host.docker.internal.
|
|
179
|
+
let _corePort = 8091;
|
|
180
|
+
export function setCorePort(port) { _corePort = port; }
|
|
181
|
+
export const VALID_LOG_TYPES = new Set(["stdout", "stderr"]);
|
|
182
|
+
async function inspectDockerLogPath(command, args) {
|
|
183
|
+
try {
|
|
184
|
+
const { stdout } = await execFileAsync(command, args, { timeout: 5_000 });
|
|
185
|
+
const logPath = stdout.trim();
|
|
186
|
+
return logPath || null;
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
async function resolveDockerLogPath(containerName) {
|
|
193
|
+
const direct = await inspectDockerLogPath("docker", [
|
|
194
|
+
"inspect",
|
|
195
|
+
"--format",
|
|
196
|
+
"{{.LogPath}}",
|
|
197
|
+
containerName,
|
|
198
|
+
]);
|
|
199
|
+
if (direct)
|
|
200
|
+
return direct;
|
|
201
|
+
return inspectDockerLogPath("sudo", [
|
|
202
|
+
"-n",
|
|
203
|
+
"docker",
|
|
204
|
+
"inspect",
|
|
205
|
+
"--format",
|
|
206
|
+
"{{.LogPath}}",
|
|
207
|
+
containerName,
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
async function readDockerLogText(logPath, lines) {
|
|
211
|
+
try {
|
|
212
|
+
return readFileSync(logPath, "utf-8");
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
try {
|
|
216
|
+
const tailLines = String(Math.max(lines * 50, 2_000));
|
|
217
|
+
const { stdout } = await execFileAsync("sudo", ["-n", "tail", "-n", tailLines, logPath], {
|
|
218
|
+
timeout: 5_000,
|
|
219
|
+
});
|
|
220
|
+
return stdout;
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return "";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async function readDockerCliLogs(containerName, lines) {
|
|
228
|
+
const commands = [
|
|
229
|
+
{ command: "docker", args: ["logs", "--tail", String(lines), containerName] },
|
|
230
|
+
{ command: "sudo", args: ["-n", "docker", "logs", "--tail", String(lines), containerName] },
|
|
231
|
+
];
|
|
232
|
+
for (const candidate of commands) {
|
|
233
|
+
try {
|
|
234
|
+
const { stdout, stderr } = await execFileAsync(candidate.command, candidate.args, { timeout: 10_000 });
|
|
235
|
+
const combined = `${stdout}${stderr}`.trim();
|
|
236
|
+
if (combined)
|
|
237
|
+
return combined.split("\n").slice(-lines);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
async function readDockerStreamLogs(containerName, lines = 200, logType = "stderr") {
|
|
246
|
+
if (!VALID_LOG_TYPES.has(logType))
|
|
247
|
+
logType = "stderr";
|
|
248
|
+
const logPath = await resolveDockerLogPath(containerName);
|
|
249
|
+
if (!logPath)
|
|
250
|
+
return readDockerCliLogs(containerName, lines);
|
|
251
|
+
const rawText = await readDockerLogText(logPath, lines);
|
|
252
|
+
if (!rawText)
|
|
253
|
+
return readDockerCliLogs(containerName, lines);
|
|
254
|
+
const collected = [];
|
|
255
|
+
const entries = rawText.split("\n");
|
|
256
|
+
for (let index = entries.length - 1; index >= 0 && collected.length < lines; index--) {
|
|
257
|
+
const line = entries[index]?.trim();
|
|
258
|
+
if (!line)
|
|
259
|
+
continue;
|
|
260
|
+
try {
|
|
261
|
+
const parsed = JSON.parse(line);
|
|
262
|
+
if (parsed.stream !== logType)
|
|
263
|
+
continue;
|
|
264
|
+
const message = typeof parsed.log === "string"
|
|
265
|
+
? parsed.log.replace(/\n$/, "")
|
|
266
|
+
: "";
|
|
267
|
+
if (message)
|
|
268
|
+
collected.push(message);
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const streamLines = collected.reverse();
|
|
275
|
+
if (streamLines.length > 0)
|
|
276
|
+
return streamLines;
|
|
277
|
+
return readDockerCliLogs(containerName, lines);
|
|
278
|
+
}
|
|
279
|
+
function nomadAuthHeaders() {
|
|
280
|
+
const token = getNomadToken();
|
|
281
|
+
return token ? { "X-Nomad-Token": token } : {};
|
|
282
|
+
}
|
|
283
|
+
// Integration dispatch: scheduler-level defaults and resource ceilings. Runtime
|
|
284
|
+
// command / args / env / resources now live inside each integration's
|
|
285
|
+
// `buildNomadTask` — the Nomad driver never looks at them directly.
|
|
286
|
+
function jobId(instanceId) {
|
|
287
|
+
return resolveNomadJobId(instanceId, jobPrefixFor(instanceId));
|
|
288
|
+
}
|
|
289
|
+
/** Exported only for unit tests — not part of the public API. */
|
|
290
|
+
export function __jobIdForTests(instanceId) {
|
|
291
|
+
return jobId(instanceId);
|
|
292
|
+
}
|
|
293
|
+
// Nomad Template metacharacters that must not appear in values interpolated
|
|
294
|
+
// into EmbeddedTmpl. Defense-in-depth: instanceId is already validated by the
|
|
295
|
+
// route layer, but this guard makes the template-building code self-contained.
|
|
296
|
+
export const NOMAD_TEMPLATE_UNSAFE_RE = /[{}"\\]/;
|
|
297
|
+
function assertSafeTemplateId(id) {
|
|
298
|
+
if (NOMAD_TEMPLATE_UNSAFE_RE.test(id)) {
|
|
299
|
+
throw new Error(`Job ID "${id}" contains characters unsafe for Nomad Template interpolation`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
async function nomadGet(path) {
|
|
303
|
+
const resp = await fetch(`${getNomadAddr()}${path}`, {
|
|
304
|
+
headers: nomadAuthHeaders(),
|
|
305
|
+
signal: AbortSignal.timeout(10000),
|
|
306
|
+
});
|
|
307
|
+
if (!resp.ok && resp.status !== 404)
|
|
308
|
+
throw new Error(`Nomad ${path}: ${resp.status}`);
|
|
309
|
+
return resp;
|
|
310
|
+
}
|
|
311
|
+
async function nomadPost(path, body) {
|
|
312
|
+
return fetch(`${getNomadAddr()}${path}`, {
|
|
313
|
+
method: "POST",
|
|
314
|
+
headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
|
|
315
|
+
body: JSON.stringify(body),
|
|
316
|
+
signal: AbortSignal.timeout(10000),
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async function nomadDelete(path) {
|
|
320
|
+
return fetch(`${getNomadAddr()}${path}`, {
|
|
321
|
+
method: "DELETE",
|
|
322
|
+
headers: nomadAuthHeaders(),
|
|
323
|
+
signal: AbortSignal.timeout(10000),
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
async function nomadPut(path, body) {
|
|
327
|
+
return fetch(`${getNomadAddr()}${path}`, {
|
|
328
|
+
method: "PUT",
|
|
329
|
+
headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
|
|
330
|
+
body: JSON.stringify(body),
|
|
331
|
+
signal: AbortSignal.timeout(10000),
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
// ── Nomad Variables (secrets) ──
|
|
335
|
+
export async function writeInstanceVariables(instanceId) {
|
|
336
|
+
const jid = jobId(instanceId);
|
|
337
|
+
// (short-term mitigation): variable path follows Nomad's workload-identity
|
|
338
|
+
// convention. Each job's workload identity has implicit read/write access only
|
|
339
|
+
// to variables under its own nomad/jobs/<job-id>/ prefix, providing per-job
|
|
340
|
+
// secret isolation within the shared "default" namespace. Per-instance Nomad
|
|
341
|
+
// namespaces remain a planned future improvement.
|
|
342
|
+
const ns = "default";
|
|
343
|
+
const subpath = integrationVariableSubpath(instanceId);
|
|
344
|
+
if (!subpath)
|
|
345
|
+
return;
|
|
346
|
+
const varPath = `nomad/jobs/${jid}/${subpath}`;
|
|
347
|
+
const encodedPath = encodeURIComponent(varPath);
|
|
348
|
+
// Read proxy token from env file
|
|
349
|
+
const env = getRuntimeEnv(instanceId);
|
|
350
|
+
const proxyToken = env.JSPROXY_API_KEY || "";
|
|
351
|
+
// Nothing to store when proxy token is unconfigured.
|
|
352
|
+
if (!proxyToken)
|
|
353
|
+
return;
|
|
354
|
+
const items = { JSPROXY_API_KEY: proxyToken };
|
|
355
|
+
// retry with exponential back-off on CAS conflicts (409) so concurrent
|
|
356
|
+
// runtime submit calls do not silently discard the latest token. Throw after
|
|
357
|
+
// MAX_ATTEMPTS so the caller can surface the error instead of continuing with
|
|
358
|
+
// a missing proxy token.
|
|
359
|
+
const MAX_ATTEMPTS = 3;
|
|
360
|
+
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
361
|
+
// Re-read ModifyIndex on every attempt to always CAS against the latest version.
|
|
362
|
+
let cas = 0;
|
|
363
|
+
try {
|
|
364
|
+
const existing = await nomadGet(`/v1/var/${encodedPath}?namespace=${ns}`);
|
|
365
|
+
if (existing.ok) {
|
|
366
|
+
const data = await existing.json();
|
|
367
|
+
cas = data.ModifyIndex || 0;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
catch { /* variable may not exist yet — cas=0 creates a new one */ }
|
|
371
|
+
const resp = await nomadPut(`/v1/var/${encodedPath}?cas=${cas}&namespace=${ns}`, {
|
|
372
|
+
Namespace: ns,
|
|
373
|
+
Path: varPath,
|
|
374
|
+
Items: items,
|
|
375
|
+
});
|
|
376
|
+
if (resp.ok)
|
|
377
|
+
return;
|
|
378
|
+
const text = await resp.text();
|
|
379
|
+
// 409 Conflict = CAS mismatch; another writer won the race — retry.
|
|
380
|
+
if (resp.status === 409 && attempt < MAX_ATTEMPTS - 1) {
|
|
381
|
+
await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
throw new Error(`Failed to write Nomad Variables for ${instanceId}` +
|
|
385
|
+
` (attempt ${attempt + 1}/${MAX_ATTEMPTS}): HTTP ${resp.status} ${text}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
export async function purgeInstanceVariables(instanceId) {
|
|
389
|
+
const jid = jobId(instanceId);
|
|
390
|
+
const subpath = integrationVariableSubpath(instanceId);
|
|
391
|
+
if (!subpath)
|
|
392
|
+
return;
|
|
393
|
+
const varPath = `nomad/jobs/${jid}/${subpath}`;
|
|
394
|
+
const encodedPath = encodeURIComponent(varPath);
|
|
395
|
+
try {
|
|
396
|
+
// Match writeInstanceVariables symmetry: always pin the namespace on
|
|
397
|
+
// every Variables API call so the delete cannot drift into a different
|
|
398
|
+
// namespace if Nomad's default-namespace behaviour changes between
|
|
399
|
+
// minor versions. Without this, a schema tweak in a future 1.6.x point
|
|
400
|
+
// release could leave a stale secret behind after purge=true.
|
|
401
|
+
const resp = await nomadDelete(`/v1/var/${encodedPath}?namespace=default`);
|
|
402
|
+
if (!resp.ok && resp.status !== 404) {
|
|
403
|
+
console.warn(`[nomad] Failed to purge variables for ${instanceId}: HTTP ${resp.status}`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
catch (e) {
|
|
407
|
+
console.warn(`[nomad] Failed to purge variables for ${instanceId}: ${e.message}`);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Resolve the numeric uid:gid for a given username by reading /etc/passwd.
|
|
412
|
+
* Falls back to process.getuid!():process.getgid!() when the lookup fails.
|
|
413
|
+
* Still used here by the kind-agnostic `exec()` helper below (for docker
|
|
414
|
+
* exec user resolution); integrations carry their own copies for task build.
|
|
415
|
+
*/
|
|
416
|
+
function resolveUidGid(username) {
|
|
417
|
+
try {
|
|
418
|
+
const passwd = readFileSync("/etc/passwd", "utf-8");
|
|
419
|
+
const line = passwd.split("\n").find(l => l.startsWith(username + ":"));
|
|
420
|
+
if (line) {
|
|
421
|
+
const parts = line.split(":");
|
|
422
|
+
const uid = parseInt(parts[2], 10);
|
|
423
|
+
const gid = parseInt(parts[3], 10);
|
|
424
|
+
if (!isNaN(uid) && !isNaN(gid))
|
|
425
|
+
return `${uid}:${gid}`;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
catch { /* ignore */ }
|
|
429
|
+
return `${process.getuid()}:${process.getgid()}`;
|
|
430
|
+
}
|
|
431
|
+
// Integration dispatch:
|
|
432
|
+
// The previous ~380 lines of OpenClaw / Hermes task assembly
|
|
433
|
+
// (`buildRuntime`, `buildTaskDocker`, `buildHermesTaskDocker`, resource
|
|
434
|
+
// normalizer, kind detector) have been physically migrated into
|
|
435
|
+
// `src/services/integrations/{openclaw,hermes}/integration.ts:buildNomadTask()`.
|
|
436
|
+
// Framework code here is now a pure dispatcher: it asks the integration for
|
|
437
|
+
// a Nomad task definition and embeds it in the job spec below.
|
|
438
|
+
function getInstanceIntegrationKind(instanceId) {
|
|
439
|
+
const owner = tryResolveExecutionOwner(instanceId);
|
|
440
|
+
if (owner?.type === "integration") {
|
|
441
|
+
return owner.integrationKind;
|
|
442
|
+
}
|
|
443
|
+
throw new Error(missingExecutionOwnerMessage(instanceId));
|
|
444
|
+
}
|
|
445
|
+
function tryResolveExecutionOwner(instanceId) {
|
|
446
|
+
try {
|
|
447
|
+
return resolveExecutionOwner(instanceId);
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
if (isExecutionOwnerRequiredError(error))
|
|
451
|
+
return null;
|
|
452
|
+
throw error;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function missingExecutionOwnerMessage(instanceId) {
|
|
456
|
+
return `Instance '${instanceId}' is missing canonical execution owner; run migration or repair before using the runtime path.`;
|
|
457
|
+
}
|
|
458
|
+
async function buildJob(instanceId) {
|
|
459
|
+
const driver = getNomadDriver();
|
|
460
|
+
if (driver !== "docker") {
|
|
461
|
+
throw new Error(`Unsupported Nomad driver: ${driver}. Only "docker" is supported.`);
|
|
462
|
+
}
|
|
463
|
+
return compileIntegrationManagedJob(instanceId);
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Re-resolve `instance.connections` against the live capability registry
|
|
467
|
+
* and merge the resulting env into the freshly-built Nomad task. Idempotent
|
|
468
|
+
* — empty meta.connections short-circuits to a no-op.
|
|
469
|
+
*
|
|
470
|
+
* Resolving at start time (rather than reading the frozen
|
|
471
|
+
* `instance.json["connections-env"]` written by PUT /connections) means
|
|
472
|
+
* provider port / address changes in the registry propagate on next
|
|
473
|
+
* restart without requiring the user to re-bind. Failures here are
|
|
474
|
+
* logged but never block start: a missing required binding still surfaces
|
|
475
|
+
* via the Connections UI status badge.
|
|
476
|
+
*/
|
|
477
|
+
async function injectConnectionsRuntimeEnv(instanceId, task) {
|
|
478
|
+
try {
|
|
479
|
+
const meta = getInstance(instanceId);
|
|
480
|
+
const connections = meta?.connections;
|
|
481
|
+
if (!meta || !connections || Object.keys(connections).length === 0)
|
|
482
|
+
return;
|
|
483
|
+
const { readCanonicalSpecForInstance } = await import("../../app-common/instance-store.js");
|
|
484
|
+
const spec = readCanonicalSpecForInstance(instanceId);
|
|
485
|
+
if (!spec)
|
|
486
|
+
return;
|
|
487
|
+
const { resolveConnections } = await import("../../connections/resolver.js");
|
|
488
|
+
const { resolved } = resolveConnections(spec, { connections }, "preCreate");
|
|
489
|
+
if (resolved.length === 0)
|
|
490
|
+
return;
|
|
491
|
+
const { RUNTIME_HOOKS } = await import("../../connections/apply.js");
|
|
492
|
+
const merged = {};
|
|
493
|
+
for (const binding of resolved) {
|
|
494
|
+
const hook = RUNTIME_HOOKS[binding.category];
|
|
495
|
+
if (!hook)
|
|
496
|
+
continue;
|
|
497
|
+
Object.assign(merged, await hook(meta, binding));
|
|
498
|
+
}
|
|
499
|
+
if (Object.keys(merged).length === 0)
|
|
500
|
+
return;
|
|
501
|
+
task.Env = { ...(task.Env ?? {}), ...merged };
|
|
502
|
+
}
|
|
503
|
+
catch (e) {
|
|
504
|
+
console.warn(`[nomad] connections runtime env merge failed for ${instanceId}: ${e?.message ?? e}`);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
async function getRunningAlloc(instanceId) {
|
|
508
|
+
const allocs = await getAllocs(instanceId);
|
|
509
|
+
if (!allocs)
|
|
510
|
+
return null;
|
|
511
|
+
for (const status of ["running", "pending"]) {
|
|
512
|
+
for (const alloc of allocs) {
|
|
513
|
+
if (alloc.ClientStatus === status)
|
|
514
|
+
return alloc;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
}
|
|
519
|
+
async function getAllocs(instanceId) {
|
|
520
|
+
const jid = jobId(instanceId);
|
|
521
|
+
try {
|
|
522
|
+
const resp = await nomadGet(`/v1/job/${jid}/allocations`);
|
|
523
|
+
if (resp.status === 404)
|
|
524
|
+
return [];
|
|
525
|
+
const allocs = await resp.json();
|
|
526
|
+
return Array.isArray(allocs) ? allocs : [];
|
|
527
|
+
}
|
|
528
|
+
catch {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function latestAlloc(allocs) {
|
|
533
|
+
if (!allocs.length)
|
|
534
|
+
return null;
|
|
535
|
+
return [...allocs].sort((a, b) => ((b.ModifyIndex ?? b.CreateIndex ?? 0) - (a.ModifyIndex ?? a.CreateIndex ?? 0)))[0] ?? null;
|
|
536
|
+
}
|
|
537
|
+
// Returns true if the Nomad job exists and was NOT explicitly stopped by the user (Stop=false).
|
|
538
|
+
// Used on jishushell startup to auto-restart instances that were running before a reboot.
|
|
539
|
+
export async function shouldAutoStart(instanceId) {
|
|
540
|
+
const jid = jobId(instanceId);
|
|
541
|
+
try {
|
|
542
|
+
const resp = await nomadGet(`/v1/job/${jid}`);
|
|
543
|
+
// 404 = nomad has no record of this job. Two cases:
|
|
544
|
+
// (a) Raft was wiped — e.g. Nomad 1.11.3 → 1.6.5 auto-migration
|
|
545
|
+
// (install/jishu-install.sh:_migrate_nomad_to_target). The
|
|
546
|
+
// on-disk instance config is still present and MUST be
|
|
547
|
+
// resubmitted on the next jishushell startup, otherwise every
|
|
548
|
+
// OpenClaw instance silently disappears after the upgrade.
|
|
549
|
+
// (b) Brand-new instance created without a default LLM provider, never
|
|
550
|
+
// started via /api/instances/.../service/start. Resubmitting it
|
|
551
|
+
// here is a safe superset — the Nomad job is idempotent and the
|
|
552
|
+
// container starts whether or not a provider is configured; the
|
|
553
|
+
// user still needs to configure one to answer chat.
|
|
554
|
+
// Returning true on 404 covers (a); (b) is an accepted side effect and
|
|
555
|
+
// does not regress any user-facing behaviour.
|
|
556
|
+
if (resp.status === 404)
|
|
557
|
+
return true;
|
|
558
|
+
if (!resp.ok)
|
|
559
|
+
return false;
|
|
560
|
+
const job = await resp.json();
|
|
561
|
+
// Stop=true means user explicitly stopped it; Stop=false means it was running.
|
|
562
|
+
// Also skip dead jobs — all allocs failed, resubmitting would fail again.
|
|
563
|
+
return job.Stop === false && job.Status !== "dead";
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
export async function getStatus(instanceId) {
|
|
570
|
+
const jid = jobId(instanceId);
|
|
571
|
+
const stopped = { status: "stopped", pid: null, uptime: null, memory_mb: null, cpu_percent: null };
|
|
572
|
+
try {
|
|
573
|
+
const resp = await nomadGet(`/v1/job/${jid}`);
|
|
574
|
+
if (resp.status === 404)
|
|
575
|
+
return stopped;
|
|
576
|
+
const job = await resp.json();
|
|
577
|
+
if (job.Stop)
|
|
578
|
+
return stopped;
|
|
579
|
+
}
|
|
580
|
+
catch {
|
|
581
|
+
return { ...stopped, status: "unknown", error: "Nomad unreachable" };
|
|
582
|
+
}
|
|
583
|
+
const allocs = await getAllocs(instanceId);
|
|
584
|
+
if (allocs == null || allocs.length === 0)
|
|
585
|
+
return { ...stopped, status: "pending" };
|
|
586
|
+
const alloc = allocs.find((entry) => entry.ClientStatus === "running")
|
|
587
|
+
?? allocs.find((entry) => entry.ClientStatus === "pending")
|
|
588
|
+
?? latestAlloc(allocs);
|
|
589
|
+
if (!alloc)
|
|
590
|
+
return { ...stopped, status: "pending" };
|
|
591
|
+
const allocId = alloc.ID;
|
|
592
|
+
const result = {
|
|
593
|
+
status: alloc.ClientStatus || "unknown",
|
|
594
|
+
alloc_id: allocId,
|
|
595
|
+
pid: null,
|
|
596
|
+
uptime: null,
|
|
597
|
+
memory_mb: null,
|
|
598
|
+
cpu_percent: null,
|
|
599
|
+
restarts: 0,
|
|
600
|
+
};
|
|
601
|
+
const gwState = alloc.TaskStates?.[resolveTaskName(instanceId)] || {};
|
|
602
|
+
result.restarts = gwState.Restarts || 0;
|
|
603
|
+
const startedAt = gwState.StartedAt;
|
|
604
|
+
if (startedAt) {
|
|
605
|
+
try {
|
|
606
|
+
const start = new Date(startedAt);
|
|
607
|
+
result.uptime = Math.floor((Date.now() - start.getTime()) / 1000);
|
|
608
|
+
}
|
|
609
|
+
catch { /* ignore */ }
|
|
610
|
+
}
|
|
611
|
+
try {
|
|
612
|
+
const statsResp = await nomadGet(`/v1/client/allocation/${allocId}/stats`);
|
|
613
|
+
if (statsResp.ok) {
|
|
614
|
+
const stats = await statsResp.json();
|
|
615
|
+
// raw_exec: stats nested under Tasks.<taskName>; docker: top-level ResourceUsage
|
|
616
|
+
const tn = resolveTaskName(instanceId);
|
|
617
|
+
const taskStats = stats.Tasks?.[tn]?.ResourceUsage || stats.ResourceUsage || {};
|
|
618
|
+
const memStats = taskStats.MemoryStats || {};
|
|
619
|
+
const cpuStats = taskStats.CpuStats || {};
|
|
620
|
+
const memBytes = memStats.RSS || memStats.Usage || 0;
|
|
621
|
+
result.memory_mb = Math.round(memBytes / (1024 * 1024) * 10) / 10;
|
|
622
|
+
result.cpu_percent = Math.round((cpuStats.Percent || 0) * 10) / 10;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
catch { /* ignore */ }
|
|
626
|
+
// Fallback: Nomad cgroup stats are often zero on cgroup v2 (e.g. Raspberry
|
|
627
|
+
// Pi / CIX). Read from the shared, cached, single-flight `docker stats`
|
|
628
|
+
// snapshot instead of forking one `docker stats` per instance — see
|
|
629
|
+
// getDockerMemSnapshot for why per-instance forking was the cold-path cost.
|
|
630
|
+
if (!result.memory_mb && allocId && /^[a-f0-9-]+$/i.test(allocId)) {
|
|
631
|
+
const containerName = `${resolveTaskName(instanceId)}-${allocId}`;
|
|
632
|
+
const stat = (await getDockerMemSnapshot()).get(containerName);
|
|
633
|
+
if (stat) {
|
|
634
|
+
if (stat.memory_mb)
|
|
635
|
+
result.memory_mb = stat.memory_mb;
|
|
636
|
+
if (!result.cpu_percent && stat.cpu_percent)
|
|
637
|
+
result.cpu_percent = stat.cpu_percent;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
642
|
+
/** Phase 1: reject if the instance's Nomad job is already running. */
|
|
643
|
+
async function phaseRunningCheck(instanceId) {
|
|
644
|
+
const status = await getStatus(instanceId);
|
|
645
|
+
if (status.status === "running") {
|
|
646
|
+
return { ok: false, error: "Instance is already running", code: "INSTANCE_ALREADY_RUNNING" };
|
|
647
|
+
}
|
|
648
|
+
return { ok: true };
|
|
649
|
+
}
|
|
650
|
+
async function phaseResetTerminalJobBeforeStart(instanceId) {
|
|
651
|
+
const status = await getStatus(instanceId);
|
|
652
|
+
if (!["failed", "dead", "complete"].includes(String(status.status)))
|
|
653
|
+
return;
|
|
654
|
+
try {
|
|
655
|
+
const resp = await nomadDelete(`/v1/job/${jobId(instanceId)}?purge=false`);
|
|
656
|
+
if (!resp.ok && resp.status !== 404) {
|
|
657
|
+
console.warn(`[nomad] ${instanceId}: failed to stop terminal job before start (HTTP ${resp.status}): ${await resp.text()}`);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
catch (e) {
|
|
661
|
+
console.warn(`[nomad] ${instanceId}: failed to stop terminal job before start: ${e?.message ?? e}`);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Phase 2: home-conflict check — dispatched through the integration so
|
|
666
|
+
* framework code carries no kind-specific knowledge. Integrations that
|
|
667
|
+
* do not share an integration-home directory across instances (e.g. Hermes,
|
|
668
|
+
* each instance owns its own bind-mount) leave the hook unset and this
|
|
669
|
+
* phase is a no-op.
|
|
670
|
+
*/
|
|
671
|
+
async function phaseHomeConflict(_instanceId, sharedHomeIds) {
|
|
672
|
+
const homeConflicts = [];
|
|
673
|
+
for (const otherId of sharedHomeIds) {
|
|
674
|
+
const otherStatus = await getStatus(otherId);
|
|
675
|
+
if (otherStatus.status === "running")
|
|
676
|
+
homeConflicts.push(otherId);
|
|
677
|
+
}
|
|
678
|
+
if (homeConflicts.length) {
|
|
679
|
+
return {
|
|
680
|
+
ok: false,
|
|
681
|
+
error: `This instance shares its integration-home directory with running instance(s): ` +
|
|
682
|
+
`${homeConflicts.join(", ")}. Move it to its own instance directory before starting it.`,
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
return { ok: true };
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Phase 3: host port probe + self-heal. Returns the allocation record so
|
|
689
|
+
* the caller can surface it in the API response, or null if the desired
|
|
690
|
+
* port was already free.
|
|
691
|
+
*/
|
|
692
|
+
async function phasePortAlloc(instanceId) {
|
|
693
|
+
let desiredPort;
|
|
694
|
+
try {
|
|
695
|
+
desiredPort = getPrimaryHostPort(instanceId);
|
|
696
|
+
}
|
|
697
|
+
catch (e) {
|
|
698
|
+
return {
|
|
699
|
+
ok: false,
|
|
700
|
+
error: e?.message || `Instance '${instanceId}' has no canonical primary host port allocation`,
|
|
701
|
+
...(typeof e?.code === "string" ? { code: e.code } : {}),
|
|
702
|
+
...(typeof e?.statusCode === "number" ? { statusCode: e.statusCode } : {}),
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
if (!(await isPortInUse(desiredPort)))
|
|
706
|
+
return { ok: true, portAllocation: null };
|
|
707
|
+
try {
|
|
708
|
+
const re = await reallocatePrimaryHostPort(instanceId);
|
|
709
|
+
return { ok: true, portAllocation: { from: re.from, to: re.to, reason: "host_port_busy" } };
|
|
710
|
+
}
|
|
711
|
+
catch (e) {
|
|
712
|
+
return {
|
|
713
|
+
ok: false,
|
|
714
|
+
error: `Primary host port ${desiredPort} is held by another process and reallocation failed: ${e?.message ?? e}`,
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Phase 5: submit to Nomad with a single retry on port race. Between our
|
|
720
|
+
* earlier host probe and Docker's actual bind another process could have
|
|
721
|
+
* grabbed the port; on submit failure we re-probe, reallocate once if
|
|
722
|
+
* busy, and retry. Otherwise we surface the original submit error.
|
|
723
|
+
*/
|
|
724
|
+
async function phaseSubmit(instanceId, initialAllocation) {
|
|
725
|
+
let portAllocation = initialAllocation;
|
|
726
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
727
|
+
let jobDef;
|
|
728
|
+
try {
|
|
729
|
+
jobDef = await buildJob(instanceId);
|
|
730
|
+
}
|
|
731
|
+
catch (e) {
|
|
732
|
+
return {
|
|
733
|
+
ok: false,
|
|
734
|
+
error: e?.message || `Failed to build Nomad job for ${instanceId}`,
|
|
735
|
+
...(typeof e?.code === "string" ? { code: e.code } : {}),
|
|
736
|
+
...(typeof e?.statusCode === "number" ? { statusCode: e.statusCode } : {}),
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
let submitError = null;
|
|
740
|
+
let netErr = false;
|
|
741
|
+
try {
|
|
742
|
+
const resp = await nomadPost("/v1/jobs", jobDef);
|
|
743
|
+
if (resp.ok) {
|
|
744
|
+
const data = await resp.json();
|
|
745
|
+
return { ok: true, evalId: data.EvalID, portAllocation };
|
|
746
|
+
}
|
|
747
|
+
submitError = await resp.text();
|
|
748
|
+
}
|
|
749
|
+
catch (e) {
|
|
750
|
+
netErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
|
|
751
|
+
submitError = netErr ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad` : e.message;
|
|
752
|
+
}
|
|
753
|
+
let currentPrimaryHostPort = null;
|
|
754
|
+
try {
|
|
755
|
+
currentPrimaryHostPort = getPrimaryHostPort(instanceId);
|
|
756
|
+
}
|
|
757
|
+
catch (e) {
|
|
758
|
+
return {
|
|
759
|
+
ok: false,
|
|
760
|
+
error: e?.message || `Instance '${instanceId}' has no canonical primary host port allocation`,
|
|
761
|
+
...(typeof e?.code === "string" ? { code: e.code } : {}),
|
|
762
|
+
...(typeof e?.statusCode === "number" ? { statusCode: e.statusCode } : {}),
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
if (attempt === 0 && !netErr && currentPrimaryHostPort != null && (await isPortInUse(currentPrimaryHostPort))) {
|
|
766
|
+
try {
|
|
767
|
+
const re = await reallocatePrimaryHostPort(instanceId);
|
|
768
|
+
portAllocation = { from: re.from, to: re.to, reason: "docker_race" };
|
|
769
|
+
console.log(`[nomad] ${instanceId}: retrying after docker port race (${re.from} -> ${re.to})`);
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
catch { /* fall through to error return */ }
|
|
773
|
+
}
|
|
774
|
+
return { ok: false, error: submitError ?? "unknown error" };
|
|
775
|
+
}
|
|
776
|
+
return { ok: false, error: "start retry exhausted" };
|
|
777
|
+
}
|
|
778
|
+
async function submitPreparedIntegrationJob(instanceId) {
|
|
779
|
+
return startPreparedInstance(instanceId);
|
|
780
|
+
}
|
|
781
|
+
async function startPreparedInstance(instanceId) {
|
|
782
|
+
const owner = tryResolveExecutionOwner(instanceId);
|
|
783
|
+
if (owner && owner.type !== "integration") {
|
|
784
|
+
return { ok: false, error: `App '${instanceId}' 必须通过 lifecycle-service 启动` };
|
|
785
|
+
}
|
|
786
|
+
if (owner?.type !== "integration") {
|
|
787
|
+
return { ok: false, error: missingExecutionOwnerMessage(instanceId) };
|
|
788
|
+
}
|
|
789
|
+
const failed = (phase, rest) => {
|
|
790
|
+
console.log(`[nomad] ${instanceId}: prepared start failed at phase=${phase}: ${rest.error ?? ""}`);
|
|
791
|
+
return { ok: false, phase, ...rest };
|
|
792
|
+
};
|
|
793
|
+
const running = await phaseRunningCheck(instanceId);
|
|
794
|
+
if (!running.ok) {
|
|
795
|
+
const extra = { error: running.error };
|
|
796
|
+
if (running.code)
|
|
797
|
+
extra.code = running.code;
|
|
798
|
+
return failed("running_check", extra);
|
|
799
|
+
}
|
|
800
|
+
await phaseResetTerminalJobBeforeStart(instanceId);
|
|
801
|
+
const kind = getInstanceIntegrationKind(instanceId);
|
|
802
|
+
const integration = getIntegration(kind);
|
|
803
|
+
const home = await phaseHomeConflict(instanceId, integration.findInstancesSharingHome?.(instanceId) ?? []);
|
|
804
|
+
if (!home.ok)
|
|
805
|
+
return failed("home_conflict", { error: home.error });
|
|
806
|
+
const port = await phasePortAlloc(instanceId);
|
|
807
|
+
if (!port.ok) {
|
|
808
|
+
const extra = { error: port.error };
|
|
809
|
+
if (port.code)
|
|
810
|
+
extra.code = port.code;
|
|
811
|
+
if (typeof port.statusCode === "number")
|
|
812
|
+
extra.statusCode = port.statusCode;
|
|
813
|
+
return failed("port_alloc", extra);
|
|
814
|
+
}
|
|
815
|
+
const submit = await phaseSubmit(instanceId, port.portAllocation);
|
|
816
|
+
if (!submit.ok) {
|
|
817
|
+
const extra = { error: submit.error };
|
|
818
|
+
if (submit.code)
|
|
819
|
+
extra.code = submit.code;
|
|
820
|
+
if (typeof submit.statusCode === "number")
|
|
821
|
+
extra.statusCode = submit.statusCode;
|
|
822
|
+
return failed("submit", extra);
|
|
823
|
+
}
|
|
824
|
+
return {
|
|
825
|
+
ok: true,
|
|
826
|
+
eval_id: submit.evalId,
|
|
827
|
+
...(submit.portAllocation ? { port_allocation: submit.portAllocation } : {}),
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
async function stopPreparedIntegrationJob(instanceId, purge = false) {
|
|
831
|
+
const jid = jobId(instanceId);
|
|
832
|
+
try {
|
|
833
|
+
const resp = await nomadDelete(`/v1/job/${jid}?purge=${purge}`);
|
|
834
|
+
if (resp.ok) {
|
|
835
|
+
if (purge) {
|
|
836
|
+
try {
|
|
837
|
+
await purgeInstanceVariables(instanceId);
|
|
838
|
+
}
|
|
839
|
+
catch { /* ignore */ }
|
|
840
|
+
}
|
|
841
|
+
// No capability-sync on stop — lifecycle/status observation owns registry projection.
|
|
842
|
+
// Stop callers (`waitForObservedStatus("stopped")`) drive observer
|
|
843
|
+
// ticks until the registry reflects `status: "stopped"` and the
|
|
844
|
+
// reverse proxy stops routing to the dead allocation.
|
|
845
|
+
return { ok: true };
|
|
846
|
+
}
|
|
847
|
+
if (resp.status === 404) {
|
|
848
|
+
return { ok: false, error: "Instance is not running" };
|
|
849
|
+
}
|
|
850
|
+
return { ok: false, error: await resp.text() };
|
|
851
|
+
}
|
|
852
|
+
catch (e) {
|
|
853
|
+
const isNetErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
|
|
854
|
+
return { ok: false, error: isNetErr ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad` : e.message };
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
export async function getLogs(instanceId, lines = 200, logType = "stderr") {
|
|
858
|
+
// Defense-in-depth: only allow known log types to prevent path/query injection
|
|
859
|
+
if (!VALID_LOG_TYPES.has(logType))
|
|
860
|
+
logType = "stderr";
|
|
861
|
+
let alloc = await getRunningAlloc(instanceId);
|
|
862
|
+
if (!alloc) {
|
|
863
|
+
const jid = jobId(instanceId);
|
|
864
|
+
try {
|
|
865
|
+
const resp = await nomadGet(`/v1/job/${jid}/allocations`);
|
|
866
|
+
if (resp.ok) {
|
|
867
|
+
const allocs = await resp.json();
|
|
868
|
+
if (allocs.length) {
|
|
869
|
+
alloc = allocs.sort((a, b) => (b.CreateIndex || 0) - (a.CreateIndex || 0))[0];
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
catch { /* ignore */ }
|
|
874
|
+
}
|
|
875
|
+
if (!alloc)
|
|
876
|
+
return [];
|
|
877
|
+
const preferredTask = resolveTaskName(instanceId);
|
|
878
|
+
const resolvedTask = alloc.TaskStates?.[preferredTask]
|
|
879
|
+
? preferredTask
|
|
880
|
+
: alloc.TaskStates?.gateway
|
|
881
|
+
? "gateway"
|
|
882
|
+
: (Object.keys(alloc.TaskStates ?? {})[0] ?? preferredTask);
|
|
883
|
+
// Primary: Nomad log API
|
|
884
|
+
try {
|
|
885
|
+
const params = new URLSearchParams({
|
|
886
|
+
task: resolvedTask,
|
|
887
|
+
type: logType,
|
|
888
|
+
plain: "true",
|
|
889
|
+
origin: "end",
|
|
890
|
+
offset: String(Math.max(lines * 512, 100000)),
|
|
891
|
+
follow: "false",
|
|
892
|
+
});
|
|
893
|
+
const resp = await nomadGet(`/v1/client/fs/logs/${alloc.ID}?${params}`);
|
|
894
|
+
if (resp.ok) {
|
|
895
|
+
const text = await resp.text();
|
|
896
|
+
const trimmed = text.trim();
|
|
897
|
+
if (trimmed)
|
|
898
|
+
return trimmed.split("\n").slice(-lines);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
catch { /* ignore */ }
|
|
902
|
+
// Fallback: read Docker's json-file log directly so stdout/stderr can still
|
|
903
|
+
// be separated when Nomad log collection is disabled.
|
|
904
|
+
const dockerLogLines = await readDockerStreamLogs(`${resolvedTask}-${alloc.ID}`, lines, logType);
|
|
905
|
+
if (dockerLogLines.length > 0)
|
|
906
|
+
return dockerLogLines;
|
|
907
|
+
return [];
|
|
908
|
+
}
|
|
909
|
+
const execFileAsync = promisify(execFileCb);
|
|
910
|
+
const DOCKER_STATS_TTL_MS = 30_000;
|
|
911
|
+
/** Field separator for the batched `docker stats --format` line. Exported so
|
|
912
|
+
* tests can construct mock output without hardcoding the literal. */
|
|
913
|
+
export const DOCKER_STATS_FIELD_SEP = "__JS__";
|
|
914
|
+
let _dockerStatsEntry = null;
|
|
915
|
+
let _dockerStatsInFlight = null;
|
|
916
|
+
/** Test-only: reset the shared docker-stats snapshot so each test starts from
|
|
917
|
+
* a cold cache (the 30s TTL + single-flight would otherwise leak one test's
|
|
918
|
+
* mocked snapshot into the next). Not used by production code paths. */
|
|
919
|
+
export function __resetDockerStatsCacheForTests() {
|
|
920
|
+
_dockerStatsEntry = null;
|
|
921
|
+
_dockerStatsInFlight = null;
|
|
922
|
+
}
|
|
923
|
+
function parseDockerMemUsageMb(memUsage) {
|
|
924
|
+
// Format: "499.6MiB / 3GiB" — the used side is everything before "/".
|
|
925
|
+
const used = (memUsage.split("/")[0] ?? "").trim();
|
|
926
|
+
const match = used.match(/^([\d.]+)\s*(MiB|GiB|MB|GB|KiB|KB|B)?/i);
|
|
927
|
+
if (!match)
|
|
928
|
+
return 0;
|
|
929
|
+
let mb = parseFloat(match[1]);
|
|
930
|
+
if (!Number.isFinite(mb))
|
|
931
|
+
return 0;
|
|
932
|
+
const unit = (match[2] ?? "MiB").toLowerCase();
|
|
933
|
+
if (unit === "gib" || unit === "gb")
|
|
934
|
+
mb *= 1024;
|
|
935
|
+
else if (unit === "kib" || unit === "kb")
|
|
936
|
+
mb /= 1024;
|
|
937
|
+
else if (unit === "b")
|
|
938
|
+
mb /= 1024 * 1024;
|
|
939
|
+
return Math.round(mb * 10) / 10;
|
|
940
|
+
}
|
|
941
|
+
async function loadDockerStatsSnapshot() {
|
|
942
|
+
const snapshot = new Map();
|
|
943
|
+
try {
|
|
944
|
+
const fmt = `{{.Name}}${DOCKER_STATS_FIELD_SEP}{{.MemUsage}}${DOCKER_STATS_FIELD_SEP}{{.CPUPerc}}`;
|
|
945
|
+
const { stdout } = await execFileAsync("docker", ["stats", "--no-stream", "--format", fmt], { timeout: 8_000 });
|
|
946
|
+
for (const line of stdout.split("\n")) {
|
|
947
|
+
const trimmed = line.trim();
|
|
948
|
+
if (!trimmed)
|
|
949
|
+
continue;
|
|
950
|
+
const [name, memUsage, cpuPerc] = trimmed.split(DOCKER_STATS_FIELD_SEP);
|
|
951
|
+
if (!name)
|
|
952
|
+
continue;
|
|
953
|
+
snapshot.set(name, {
|
|
954
|
+
memory_mb: parseDockerMemUsageMb(memUsage ?? ""),
|
|
955
|
+
cpu_percent: Math.round((parseFloat(cpuPerc ?? "") || 0) * 10) / 10,
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
catch {
|
|
960
|
+
/* docker missing / timeout / daemon down → empty map, caller degrades */
|
|
961
|
+
}
|
|
962
|
+
return snapshot;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Returns a per-container stats map, refreshing at most once per
|
|
966
|
+
* DOCKER_STATS_TTL_MS. Concurrent callers (the `Promise.all` over every
|
|
967
|
+
* instance in `GET /api/instances`) share a single in-flight docker call.
|
|
968
|
+
*/
|
|
969
|
+
async function getDockerMemSnapshot() {
|
|
970
|
+
const now = Date.now();
|
|
971
|
+
if (_dockerStatsEntry && now - _dockerStatsEntry.ts < DOCKER_STATS_TTL_MS) {
|
|
972
|
+
return _dockerStatsEntry.data;
|
|
973
|
+
}
|
|
974
|
+
if (_dockerStatsInFlight)
|
|
975
|
+
return _dockerStatsInFlight;
|
|
976
|
+
_dockerStatsInFlight = loadDockerStatsSnapshot()
|
|
977
|
+
.then((data) => {
|
|
978
|
+
_dockerStatsEntry = { data, ts: Date.now() };
|
|
979
|
+
return data;
|
|
980
|
+
})
|
|
981
|
+
.finally(() => {
|
|
982
|
+
_dockerStatsInFlight = null;
|
|
983
|
+
});
|
|
984
|
+
return _dockerStatsInFlight;
|
|
985
|
+
}
|
|
986
|
+
export async function exec(instanceId, command, timeoutMs = 120_000, options = {}) {
|
|
987
|
+
const alloc = await getRunningAlloc(instanceId);
|
|
988
|
+
if (!alloc || alloc.ClientStatus !== "running") {
|
|
989
|
+
throw new Error("Instance is not running");
|
|
990
|
+
}
|
|
991
|
+
const allocId = alloc.ID;
|
|
992
|
+
if (!/^[a-f0-9-]+$/i.test(allocId))
|
|
993
|
+
throw new Error("invalid allocId");
|
|
994
|
+
const containerName = `gateway-${allocId}`;
|
|
995
|
+
// Use the same user as the container's main process unless the caller
|
|
996
|
+
// explicitly requested a docker-exec user.
|
|
997
|
+
const runtime = getInstanceRuntime(instanceId);
|
|
998
|
+
const userFlag = options.user ?? resolveUidGid(runtime.user);
|
|
999
|
+
try {
|
|
1000
|
+
const { stdout, stderr } = await execFileAsync("docker", ["exec", "--user", userFlag, containerName, ...command], { timeout: timeoutMs });
|
|
1001
|
+
return { stdout, stderr, exitCode: 0 };
|
|
1002
|
+
}
|
|
1003
|
+
catch (e) {
|
|
1004
|
+
return {
|
|
1005
|
+
stdout: e.stdout || "",
|
|
1006
|
+
stderr: e.stderr || e.message,
|
|
1007
|
+
exitCode: e.code ?? 1,
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Clamp container memory reservation/limit to the framework ceilings and
|
|
1013
|
+
* ensure `MemoryMaxMB >= MemoryMB`. Shared by every container-runtime app
|
|
1014
|
+
* manager (openclaw / custom / ollama / hermes) so they apply the same
|
|
1015
|
+
* guard-rails before handing a task spec to Nomad.
|
|
1016
|
+
*/
|
|
1017
|
+
export function normalizeDockerResources(instanceId, runtime) {
|
|
1018
|
+
const ceiling = config.getMaxAppMemoryMB();
|
|
1019
|
+
const requestedMemoryMB = Number(runtime.resources?.MemoryMB ?? 512);
|
|
1020
|
+
let effectiveMemoryMB = Math.min(requestedMemoryMB, ceiling);
|
|
1021
|
+
let effectiveMemoryMaxMB = Math.min(Number(runtime.resources?.MemoryMaxMB ?? requestedMemoryMB), ceiling);
|
|
1022
|
+
if (effectiveMemoryMaxMB < effectiveMemoryMB) {
|
|
1023
|
+
console.warn(`[nomad] ${instanceId}: MemoryMaxMB (${effectiveMemoryMaxMB}) is below MemoryMB (${effectiveMemoryMB}); clamping max to reservation.`);
|
|
1024
|
+
effectiveMemoryMaxMB = effectiveMemoryMB;
|
|
1025
|
+
}
|
|
1026
|
+
return {
|
|
1027
|
+
...(runtime.resources ?? {}),
|
|
1028
|
+
MemoryMB: effectiveMemoryMB,
|
|
1029
|
+
MemoryMaxMB: effectiveMemoryMaxMB,
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
// ── Compatibility re-exports for app-type managers ─────────────────────────
|
|
1033
|
+
// `jobId`/`resolveUidGid`/`nomadGet`/`nomadPut`/`assertSafeTemplateId` are
|
|
1034
|
+
// internal helpers defined elsewhere in this file; re-exporting them keeps
|
|
1035
|
+
// cli-branch imports working while preserving a single driver implementation.
|
|
1036
|
+
export { jobId, resolveUidGid, nomadGet, nomadPut, assertSafeTemplateId, };
|
|
1037
|
+
const instanceScheduler = {
|
|
1038
|
+
getStatus,
|
|
1039
|
+
submitIntegrationRuntimeJob: submitPreparedIntegrationJob,
|
|
1040
|
+
startPreparedInstance,
|
|
1041
|
+
stopIntegrationRuntimeJob: stopPreparedIntegrationJob,
|
|
1042
|
+
getLogs,
|
|
1043
|
+
exec,
|
|
1044
|
+
};
|
|
1045
|
+
var UnifiedNomadJobs;
|
|
1046
|
+
(function (UnifiedNomadJobs) {
|
|
1047
|
+
// ── Constants ─────────────────────────────────────────────────────────────
|
|
1048
|
+
// Docker image names must match this pattern to prevent command injection.
|
|
1049
|
+
UnifiedNomadJobs.DOCKER_IMAGE_RE = /^[a-zA-Z0-9][a-zA-Z0-9\-_.:/@]*$/;
|
|
1050
|
+
UnifiedNomadJobs.MAX_DOCKER_IMAGE_NAME_LEN = 256;
|
|
1051
|
+
UnifiedNomadJobs.VALID_LOG_TYPES = new Set(["stdout", "stderr"]);
|
|
1052
|
+
// Nomad Template metacharacters that must not appear in values interpolated
|
|
1053
|
+
// into EmbeddedTmpl strings.
|
|
1054
|
+
UnifiedNomadJobs.NOMAD_TEMPLATE_UNSAFE_RE = /[{}"\\]/;
|
|
1055
|
+
const DEFAULT_CPU_MHZ = 500;
|
|
1056
|
+
const DEFAULT_MEMORY_MB = 512;
|
|
1057
|
+
// Hard upper bounds: prevents misconfigured specs from exhausting scheduler resources.
|
|
1058
|
+
const MAX_CPU_MHZ = 4000; // 4 GHz
|
|
1059
|
+
// Memory ceilings read from core.json at runtime via config.getMaxAppMemoryMB().
|
|
1060
|
+
const DEFAULT_PIDS_LIMIT = 512;
|
|
1061
|
+
const NOMAD_CONFIG_PATH = join(JISHUSHELL_HOME, "nomad", "nomad.hcl");
|
|
1062
|
+
const _DEFAULT_CWD = homedir();
|
|
1063
|
+
function isAppJob(id) {
|
|
1064
|
+
const owner = tryResolveExecutionOwner(id);
|
|
1065
|
+
return owner?.type === "app-job";
|
|
1066
|
+
}
|
|
1067
|
+
UnifiedNomadJobs.isAppJob = isAppJob;
|
|
1068
|
+
function findInstalledRuntimeRoot(instanceId) {
|
|
1069
|
+
const dir = resolveAppDir(instanceId);
|
|
1070
|
+
const hasCanonicalSpec = existsSync(join(dir, RESOLVED_SPEC_FILENAME))
|
|
1071
|
+
|| existsSync(join(dir, DEFINITION_FILENAME));
|
|
1072
|
+
if (existsSync(join(dir, MANIFEST_FILENAME)) && hasCanonicalSpec) {
|
|
1073
|
+
return dir;
|
|
1074
|
+
}
|
|
1075
|
+
return null;
|
|
1076
|
+
}
|
|
1077
|
+
// ── Job ID ────────────────────────────────────────────────────────────────
|
|
1078
|
+
function jobId(instanceId) {
|
|
1079
|
+
return instanceId;
|
|
1080
|
+
}
|
|
1081
|
+
function assertSafeTemplateId(id) {
|
|
1082
|
+
if (UnifiedNomadJobs.NOMAD_TEMPLATE_UNSAFE_RE.test(id)) {
|
|
1083
|
+
throw new Error(`Job ID "${id}" contains characters unsafe for Nomad Template interpolation`);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
// ── Nomad HTTP helpers ────────────────────────────────────────────────────
|
|
1087
|
+
function nomadAuthHeaders() {
|
|
1088
|
+
const token = getNomadToken();
|
|
1089
|
+
return token ? { "X-Nomad-Token": token } : {};
|
|
1090
|
+
}
|
|
1091
|
+
async function nomadGet(path) {
|
|
1092
|
+
const resp = await fetch(`${getNomadAddr()}${path}`, {
|
|
1093
|
+
headers: nomadAuthHeaders(),
|
|
1094
|
+
signal: AbortSignal.timeout(10_000),
|
|
1095
|
+
});
|
|
1096
|
+
if (!resp.ok && resp.status !== 404) {
|
|
1097
|
+
throw new Error(`Nomad GET ${path}: HTTP ${resp.status}`);
|
|
1098
|
+
}
|
|
1099
|
+
return resp;
|
|
1100
|
+
}
|
|
1101
|
+
async function nomadPost(path, body) {
|
|
1102
|
+
return fetch(`${getNomadAddr()}${path}`, {
|
|
1103
|
+
method: "POST",
|
|
1104
|
+
headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
|
|
1105
|
+
body: JSON.stringify(body),
|
|
1106
|
+
signal: AbortSignal.timeout(10_000),
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
async function nomadPut(path, body) {
|
|
1110
|
+
return fetch(`${getNomadAddr()}${path}`, {
|
|
1111
|
+
method: "PUT",
|
|
1112
|
+
headers: { "Content-Type": "application/json", ...nomadAuthHeaders() },
|
|
1113
|
+
body: JSON.stringify(body),
|
|
1114
|
+
signal: AbortSignal.timeout(10_000),
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
async function nomadDelete(path) {
|
|
1118
|
+
return fetch(`${getNomadAddr()}${path}`, {
|
|
1119
|
+
method: "DELETE",
|
|
1120
|
+
headers: nomadAuthHeaders(),
|
|
1121
|
+
signal: AbortSignal.timeout(10_000),
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
async function listNomadNodes() {
|
|
1125
|
+
try {
|
|
1126
|
+
const resp = await nomadGet("/v1/nodes");
|
|
1127
|
+
if (!resp.ok)
|
|
1128
|
+
return [];
|
|
1129
|
+
const nodes = await resp.json();
|
|
1130
|
+
return Array.isArray(nodes) ? nodes : [];
|
|
1131
|
+
}
|
|
1132
|
+
catch {
|
|
1133
|
+
return [];
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
function isSchedulableNode(node) {
|
|
1137
|
+
return (node.Status ?? "ready") === "ready"
|
|
1138
|
+
&& (node.SchedulingEligibility ?? "eligible") === "eligible";
|
|
1139
|
+
}
|
|
1140
|
+
function rawExecDriverHealthy(node) {
|
|
1141
|
+
const driver = node.Drivers?.raw_exec;
|
|
1142
|
+
return driver?.Detected === true && driver?.Healthy === true;
|
|
1143
|
+
}
|
|
1144
|
+
function rawExecRestartHint() {
|
|
1145
|
+
if (process.platform === "linux")
|
|
1146
|
+
return "sudo systemctl restart nomad";
|
|
1147
|
+
if (process.platform === "darwin")
|
|
1148
|
+
return "重启 Nomad launchd agent";
|
|
1149
|
+
return "重启 Nomad 服务";
|
|
1150
|
+
}
|
|
1151
|
+
function nomadConfigEnablesRawExec() {
|
|
1152
|
+
try {
|
|
1153
|
+
const config = readFileSync(NOMAD_CONFIG_PATH, "utf-8");
|
|
1154
|
+
return /plugin\s+"raw_exec"\s*\{[\s\S]*?enabled\s*=\s*true\b/.test(config);
|
|
1155
|
+
}
|
|
1156
|
+
catch {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
async function validateRawExecDriverAvailability() {
|
|
1161
|
+
const nodes = (await listNomadNodes()).filter(isSchedulableNode);
|
|
1162
|
+
if (nodes.length === 0)
|
|
1163
|
+
return null;
|
|
1164
|
+
if (nodes.some(rawExecDriverHealthy))
|
|
1165
|
+
return null;
|
|
1166
|
+
const detail = nodes
|
|
1167
|
+
.map((node) => {
|
|
1168
|
+
const driver = node.Drivers?.raw_exec;
|
|
1169
|
+
const name = String(node.Name ?? node.ID ?? "unknown-node");
|
|
1170
|
+
const description = String(driver?.HealthDescription
|
|
1171
|
+
?? (driver?.Detected === false ? "disabled" : "unavailable"));
|
|
1172
|
+
return `${name}: ${description}`;
|
|
1173
|
+
})
|
|
1174
|
+
.join("; ");
|
|
1175
|
+
if (nomadConfigEnablesRawExec()) {
|
|
1176
|
+
return `Nomad client 当前未启用 raw_exec driver(${detail})。磁盘配置已启用 raw_exec,但运行中的 Nomad 仍在使用旧配置;请先执行 ${rawExecRestartHint()} 后重试。`;
|
|
1177
|
+
}
|
|
1178
|
+
return `Nomad client 当前未启用 raw_exec driver(${detail})。请先在 Nomad 配置中启用 plugin \"raw_exec\" { config { enabled = true } },然后重启 Nomad。`;
|
|
1179
|
+
}
|
|
1180
|
+
function allocTimestamp(alloc) {
|
|
1181
|
+
const raw = alloc.ModifyTime ?? alloc.CreateTime ?? alloc.CreateIndex ?? 0;
|
|
1182
|
+
return typeof raw === "number" ? raw : Number(raw) || 0;
|
|
1183
|
+
}
|
|
1184
|
+
// ── Resource unit parsers ─────────────────────────────────────────────────
|
|
1185
|
+
/**
|
|
1186
|
+
* Parse a CPU resource string to Nomad MHz integer.
|
|
1187
|
+
* "500m" → 500 (millicores treated as MHz for simplicity)
|
|
1188
|
+
* "1" → 1000 (1 core → 1000 MHz)
|
|
1189
|
+
* "1000" → 1000 (bare integer treated as MHz already)
|
|
1190
|
+
*
|
|
1191
|
+
* Nomad doesn't have a concept of "cores"; it schedules by MHz.
|
|
1192
|
+
* We treat 1 core = 1000 MHz as a reasonable proxy for a Pi-class host.
|
|
1193
|
+
*/
|
|
1194
|
+
function parseCpuMHz(cpu) {
|
|
1195
|
+
if (cpu == null)
|
|
1196
|
+
return DEFAULT_CPU_MHZ;
|
|
1197
|
+
const s = String(cpu).trim();
|
|
1198
|
+
if (s.endsWith("m")) {
|
|
1199
|
+
// millicores (K8s-style): "500m" → 500 MHz
|
|
1200
|
+
const val = parseFloat(s.slice(0, -1));
|
|
1201
|
+
return isNaN(val) ? DEFAULT_CPU_MHZ : Math.max(1, Math.min(Math.round(val), MAX_CPU_MHZ));
|
|
1202
|
+
}
|
|
1203
|
+
const val = parseFloat(s);
|
|
1204
|
+
if (isNaN(val))
|
|
1205
|
+
return DEFAULT_CPU_MHZ;
|
|
1206
|
+
// Bare integer ≤ 16 likely means "cores" (e.g. "1", "2"); convert to MHz.
|
|
1207
|
+
// Bare integer > 16 likely already MHz.
|
|
1208
|
+
const mhz = val <= 16 ? Math.round(val * 1000) : Math.round(val);
|
|
1209
|
+
return Math.max(1, Math.min(mhz, MAX_CPU_MHZ));
|
|
1210
|
+
}
|
|
1211
|
+
UnifiedNomadJobs.parseCpuMHz = parseCpuMHz;
|
|
1212
|
+
/**
|
|
1213
|
+
* Parse a memory resource string to Nomad MB integer.
|
|
1214
|
+
* "512Mi" or "512MiB" → 512 MB
|
|
1215
|
+
* "1Gi" or "1GiB" → 1024 MB
|
|
1216
|
+
* "512M" or "512MB" → 512 MB
|
|
1217
|
+
* "1G" or "1GB" → 1024 MB
|
|
1218
|
+
* "1024" → 1024 MB (bare integer = MB)
|
|
1219
|
+
*/
|
|
1220
|
+
function parseMemoryMB(memory) {
|
|
1221
|
+
if (memory == null)
|
|
1222
|
+
return DEFAULT_MEMORY_MB;
|
|
1223
|
+
const s = String(memory).trim();
|
|
1224
|
+
const match = s.match(/^([\d.]+)\s*(gi|gib|g|gb|mi|mib|m|mb|ki|kib|k|kb)?$/i);
|
|
1225
|
+
if (!match)
|
|
1226
|
+
return DEFAULT_MEMORY_MB;
|
|
1227
|
+
const val = parseFloat(match[1]);
|
|
1228
|
+
if (isNaN(val))
|
|
1229
|
+
return DEFAULT_MEMORY_MB;
|
|
1230
|
+
const unit = (match[2] || "").toLowerCase();
|
|
1231
|
+
let mb;
|
|
1232
|
+
if (unit === "gi" || unit === "gib" || unit === "g" || unit === "gb") {
|
|
1233
|
+
mb = Math.round(val * 1024);
|
|
1234
|
+
}
|
|
1235
|
+
else if (unit === "ki" || unit === "kib" || unit === "k" || unit === "kb") {
|
|
1236
|
+
mb = Math.round(val / 1024);
|
|
1237
|
+
}
|
|
1238
|
+
else {
|
|
1239
|
+
// "mi"/"mib"/"m"/"mb" or bare integer
|
|
1240
|
+
mb = Math.round(val);
|
|
1241
|
+
}
|
|
1242
|
+
return Math.max(1, Math.min(mb, config.getMaxAppMemoryMB()));
|
|
1243
|
+
}
|
|
1244
|
+
UnifiedNomadJobs.parseMemoryMB = parseMemoryMB;
|
|
1245
|
+
// ── Interval parser ───────────────────────────────────────────────────────
|
|
1246
|
+
function parseIntervalNs(s, defaultNs) {
|
|
1247
|
+
if (!s)
|
|
1248
|
+
return defaultNs;
|
|
1249
|
+
if (s.endsWith("ms"))
|
|
1250
|
+
return parseInt(s, 10) * 1_000_000;
|
|
1251
|
+
if (s.endsWith("s"))
|
|
1252
|
+
return parseInt(s, 10) * 1_000_000_000;
|
|
1253
|
+
if (s.endsWith("m"))
|
|
1254
|
+
return parseInt(s, 10) * 60_000_000_000;
|
|
1255
|
+
return parseInt(s, 10) * 1_000_000_000;
|
|
1256
|
+
}
|
|
1257
|
+
function nomadConfigDeclaresHostNetwork(name) {
|
|
1258
|
+
if (!existsSync(NOMAD_CONFIG_PATH))
|
|
1259
|
+
return false;
|
|
1260
|
+
try {
|
|
1261
|
+
const config = readFileSync(NOMAD_CONFIG_PATH, "utf-8");
|
|
1262
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1263
|
+
return new RegExp(`host_network\\s+"${escaped}"\\s*\\{`).test(config);
|
|
1264
|
+
}
|
|
1265
|
+
catch {
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function requiredHostNetworkForPort(port) {
|
|
1270
|
+
if ((port.visibility ?? "external") === "internal")
|
|
1271
|
+
return null;
|
|
1272
|
+
const requested = (port.host_network ?? "").trim();
|
|
1273
|
+
return requested || "external";
|
|
1274
|
+
}
|
|
1275
|
+
function hostNetworkForPort(port) {
|
|
1276
|
+
if ((port.visibility ?? "external") === "internal")
|
|
1277
|
+
return undefined;
|
|
1278
|
+
// Honor explicit host_network from spec (e.g. weknora's ports declare
|
|
1279
|
+
// `host_network: docker_bridge` so peer tasks reach the published port
|
|
1280
|
+
// via host.docker.internal). Verify the named network is actually
|
|
1281
|
+
// declared in nomad.hcl — otherwise validation rejects the start before
|
|
1282
|
+
// job submission. Falls back to "external" only when no explicit
|
|
1283
|
+
// host_network was requested.
|
|
1284
|
+
const requested = (port.host_network ?? "").trim();
|
|
1285
|
+
if (requested)
|
|
1286
|
+
return nomadConfigDeclaresHostNetwork(requested) ? requested : undefined;
|
|
1287
|
+
return nomadConfigDeclaresHostNetwork("external") ? "external" : undefined;
|
|
1288
|
+
}
|
|
1289
|
+
function requiredHostNetworksForPorts(ports) {
|
|
1290
|
+
const required = new Set();
|
|
1291
|
+
for (const port of ports) {
|
|
1292
|
+
const network = requiredHostNetworkForPort(port);
|
|
1293
|
+
if (network)
|
|
1294
|
+
required.add(network);
|
|
1295
|
+
}
|
|
1296
|
+
return required;
|
|
1297
|
+
}
|
|
1298
|
+
async function validateNomadPortHostNetworks(ports) {
|
|
1299
|
+
const requiredNetworks = requiredHostNetworksForPorts(ports);
|
|
1300
|
+
if (requiredNetworks.size === 0)
|
|
1301
|
+
return null;
|
|
1302
|
+
for (const network of requiredNetworks) {
|
|
1303
|
+
if (!nomadConfigDeclaresHostNetwork(network)) {
|
|
1304
|
+
return `Nomad 配置缺少 host_network "${network}"。请重新运行/修复 JishuShell 设置并重启 Nomad,再启动该应用。`;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
try {
|
|
1308
|
+
const resp = await nomadGet("/v1/agent/self");
|
|
1309
|
+
if (!resp.ok)
|
|
1310
|
+
return null;
|
|
1311
|
+
const self = await resp.json();
|
|
1312
|
+
const hostNetworks = Array.isArray(self?.config?.Client?.HostNetworks)
|
|
1313
|
+
? self.config.Client.HostNetworks
|
|
1314
|
+
: [];
|
|
1315
|
+
const loadedNetworks = new Set(hostNetworks
|
|
1316
|
+
.map((network) => String(network?.Name ?? "").trim())
|
|
1317
|
+
.filter(Boolean));
|
|
1318
|
+
for (const network of requiredNetworks) {
|
|
1319
|
+
if (!loadedNetworks.has(network)) {
|
|
1320
|
+
return `Nomad 运行中的 agent 尚未加载 host_network "${network}"。请先重启 Nomad,再启动该应用。`;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
catch {
|
|
1325
|
+
// Let the later job submission path report Nomad unreachable when needed.
|
|
1326
|
+
}
|
|
1327
|
+
return null;
|
|
1328
|
+
}
|
|
1329
|
+
UnifiedNomadJobs.validateNomadPortHostNetworks = validateNomadPortHostNetworks;
|
|
1330
|
+
async function validateRequiredHostNetworks(spec) {
|
|
1331
|
+
return validateNomadPortHostNetworks(spec.tasks.flatMap((task) => task.ports ?? []));
|
|
1332
|
+
}
|
|
1333
|
+
function buildNomadReservedPort(input) {
|
|
1334
|
+
const hostNetwork = hostNetworkForPort(input);
|
|
1335
|
+
return {
|
|
1336
|
+
Label: input.label,
|
|
1337
|
+
Value: input.value,
|
|
1338
|
+
...(input.to != null ? { To: input.to } : {}),
|
|
1339
|
+
...(hostNetwork ? { HostNetwork: hostNetwork } : {}),
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
UnifiedNomadJobs.buildNomadReservedPort = buildNomadReservedPort;
|
|
1343
|
+
async function maybeReallocateConflictingRuntimePorts(instanceId, reason) {
|
|
1344
|
+
if (!getInstance(instanceId))
|
|
1345
|
+
return { changed: false };
|
|
1346
|
+
const runtime = getInstanceRuntime(instanceId);
|
|
1347
|
+
const ports = Array.isArray(runtime?.ports)
|
|
1348
|
+
? runtime.ports.filter((port) => (port?.visibility ?? "external") !== "internal")
|
|
1349
|
+
: [];
|
|
1350
|
+
if (ports.length === 0) {
|
|
1351
|
+
return { changed: false };
|
|
1352
|
+
}
|
|
1353
|
+
let changed = false;
|
|
1354
|
+
const seen = new Set();
|
|
1355
|
+
for (const port of ports) {
|
|
1356
|
+
const currentHostPort = port?.hostPort;
|
|
1357
|
+
if (!Number.isInteger(currentHostPort) || currentHostPort <= 0) {
|
|
1358
|
+
return {
|
|
1359
|
+
changed,
|
|
1360
|
+
error: `Instance '${instanceId}' has an invalid canonical hostPort for ${port?.taskName ?? "task"}/${port?.name ?? "port"}`,
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
const conflictsWithOwnPort = seen.has(currentHostPort);
|
|
1364
|
+
seen.add(currentHostPort);
|
|
1365
|
+
if (!conflictsWithOwnPort && !(await isPortInUse(currentHostPort)))
|
|
1366
|
+
continue;
|
|
1367
|
+
try {
|
|
1368
|
+
const reallocation = await reallocateRuntimeHostPort(instanceId, {
|
|
1369
|
+
...(typeof port.taskName === "string" ? { taskName: port.taskName } : {}),
|
|
1370
|
+
name: String(port.name || ""),
|
|
1371
|
+
});
|
|
1372
|
+
seen.add(reallocation.to);
|
|
1373
|
+
changed = true;
|
|
1374
|
+
console.log(`[nomad] ${instanceId}: reallocated canonical port ${port?.taskName ?? "task"}/${port?.name ?? "port"} ` +
|
|
1375
|
+
`${reallocation.from} -> ${reallocation.to} (${reason})`);
|
|
1376
|
+
}
|
|
1377
|
+
catch (e) {
|
|
1378
|
+
return {
|
|
1379
|
+
changed,
|
|
1380
|
+
error: `Canonical port ${currentHostPort} for ${port?.taskName ?? "task"}/${port?.name ?? "port"} ` +
|
|
1381
|
+
`is held by another process and reallocation failed: ${e?.message ?? e}`,
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
return { changed };
|
|
1386
|
+
}
|
|
1387
|
+
// ── Deep merge utility ────────────────────────────────────────────────────
|
|
1388
|
+
function deepMerge(target, source) {
|
|
1389
|
+
const result = { ...target };
|
|
1390
|
+
for (const key of Object.keys(source)) {
|
|
1391
|
+
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key]) &&
|
|
1392
|
+
result[key] && typeof result[key] === "object" && !Array.isArray(result[key])) {
|
|
1393
|
+
result[key] = deepMerge(result[key], source[key]);
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
result[key] = source[key];
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
return result;
|
|
1400
|
+
}
|
|
1401
|
+
function interpolateEnvRequires(taskEnv, extraEnv) {
|
|
1402
|
+
const result = {};
|
|
1403
|
+
for (const [k, v] of Object.entries(taskEnv)) {
|
|
1404
|
+
result[k] = v.replace(/\$\{requires\.([^}]+)\}/g, (_, key) => extraEnv[key] ?? "");
|
|
1405
|
+
}
|
|
1406
|
+
return result;
|
|
1407
|
+
}
|
|
1408
|
+
function materializeInstanceIdTokens(value, instanceId) {
|
|
1409
|
+
if (typeof value === "string") {
|
|
1410
|
+
return value.replace(/\$\{instance\.id\}/g, instanceId);
|
|
1411
|
+
}
|
|
1412
|
+
if (Array.isArray(value)) {
|
|
1413
|
+
return value.map((entry) => materializeInstanceIdTokens(entry, instanceId));
|
|
1414
|
+
}
|
|
1415
|
+
if (value && typeof value === "object") {
|
|
1416
|
+
const result = {};
|
|
1417
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
1418
|
+
result[key] = materializeInstanceIdTokens(entry, instanceId);
|
|
1419
|
+
}
|
|
1420
|
+
return result;
|
|
1421
|
+
}
|
|
1422
|
+
return value;
|
|
1423
|
+
}
|
|
1424
|
+
// ── Process runtime helpers ──────────────────────────────────────────────
|
|
1425
|
+
/**
|
|
1426
|
+
* Check whether a binary process is already running on the host OS by
|
|
1427
|
+
* matching its command path via pgrep -f.
|
|
1428
|
+
*
|
|
1429
|
+
* Used by submitGenericAppSpecJob to skip Nomad submission when the binary is already
|
|
1430
|
+
* running (e.g. started outside of Nomad or when raw_exec driver is unavailable).
|
|
1431
|
+
*/
|
|
1432
|
+
async function isBinaryRunning(command) {
|
|
1433
|
+
if (!command)
|
|
1434
|
+
return false;
|
|
1435
|
+
const expanded = command.replace(/^~(?=\/|$)/, homedir());
|
|
1436
|
+
// Try full path first, then basename — covers symlinks & macOS App Translocation.
|
|
1437
|
+
const patterns = [expanded];
|
|
1438
|
+
const base = basename(expanded);
|
|
1439
|
+
if (base !== expanded)
|
|
1440
|
+
patterns.push(base);
|
|
1441
|
+
for (const pattern of patterns) {
|
|
1442
|
+
const found = await new Promise((resolve) => {
|
|
1443
|
+
execFileCb("pgrep", ["-f", pattern], { timeout: 3_000 }, (_err, stdout) => {
|
|
1444
|
+
resolve(stdout.trim().length > 0);
|
|
1445
|
+
});
|
|
1446
|
+
});
|
|
1447
|
+
if (found)
|
|
1448
|
+
return true;
|
|
1449
|
+
}
|
|
1450
|
+
return false;
|
|
1451
|
+
}
|
|
1452
|
+
UnifiedNomadJobs.isBinaryRunning = isBinaryRunning;
|
|
1453
|
+
function tryBindPort(port, host) {
|
|
1454
|
+
return new Promise((resolve) => {
|
|
1455
|
+
const server = netCreateServer();
|
|
1456
|
+
server.once("error", (error) => {
|
|
1457
|
+
if (error?.code === "EADDRINUSE") {
|
|
1458
|
+
resolve(true);
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
console.warn(`[port-probe] bind ${host}:${port} failed with ${error?.code ?? "unknown"}: ${error?.message}; treating as free`);
|
|
1462
|
+
resolve(false);
|
|
1463
|
+
});
|
|
1464
|
+
server.once("listening", () => {
|
|
1465
|
+
server.close(() => resolve(false));
|
|
1466
|
+
});
|
|
1467
|
+
server.listen(port, host);
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
async function isPortInUse(port) {
|
|
1471
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
1472
|
+
return false;
|
|
1473
|
+
// Probe sequentially so the wildcard probe does not race with the loopback
|
|
1474
|
+
// probe and falsely trigger EADDRINUSE against our own temporary socket.
|
|
1475
|
+
if (await tryBindPort(port, "0.0.0.0"))
|
|
1476
|
+
return true;
|
|
1477
|
+
return tryBindPort(port, "127.0.0.1");
|
|
1478
|
+
}
|
|
1479
|
+
function loadCanonicalSpecForInstance(instanceId) {
|
|
1480
|
+
return findInstalledRuntimeRoot(instanceId) ? readCanonicalSpecForInstance(instanceId) : null;
|
|
1481
|
+
}
|
|
1482
|
+
function externalHealthProbeTimeoutMs(task) {
|
|
1483
|
+
return Math.max(1_000, Math.floor(parseIntervalNs(task.health?.timeout, 5_000_000_000) / 1_000_000));
|
|
1484
|
+
}
|
|
1485
|
+
async function probeExternalTaskHealth(instanceId, task) {
|
|
1486
|
+
const health = task.health?.http;
|
|
1487
|
+
if (!health)
|
|
1488
|
+
return null;
|
|
1489
|
+
const url = `http://127.0.0.1:${health.port}${health.path}`;
|
|
1490
|
+
try {
|
|
1491
|
+
const resp = await fetch(url, { signal: AbortSignal.timeout(externalHealthProbeTimeoutMs(task)) });
|
|
1492
|
+
return {
|
|
1493
|
+
name: `${task.name}-health`,
|
|
1494
|
+
status: resp.ok ? "success" : "failure",
|
|
1495
|
+
service: `${instanceId}-${task.name}`,
|
|
1496
|
+
output: `external probe: HTTP ${resp.status}`,
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
catch (e) {
|
|
1500
|
+
return {
|
|
1501
|
+
name: `${task.name}-health`,
|
|
1502
|
+
status: "failure",
|
|
1503
|
+
service: `${instanceId}-${task.name}`,
|
|
1504
|
+
output: `external probe: ${e?.message ?? "request failed"}`,
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
const EXTERNAL_PROCESS_ADOPT_COMMAND = "/bin/sh";
|
|
1509
|
+
const EXTERNAL_PROCESS_ADOPT_ARGS = [
|
|
1510
|
+
"-c",
|
|
1511
|
+
"echo 'jishushell adopting external service'; trap 'exit 0' TERM INT; while true; do sleep 3600; done",
|
|
1512
|
+
];
|
|
1513
|
+
const EXTERNAL_STOP_POLL_INTERVAL_MS = 250;
|
|
1514
|
+
const EXTERNAL_STOP_SETTLE_TIMEOUT_MS = 4_000;
|
|
1515
|
+
function expandTaskCommand(command) {
|
|
1516
|
+
if (!command)
|
|
1517
|
+
return null;
|
|
1518
|
+
return command.replace(/^~(?=\/|$)/, homedir());
|
|
1519
|
+
}
|
|
1520
|
+
function commandLineMatchesTask(commandLine, task) {
|
|
1521
|
+
const normalized = commandLine.trim();
|
|
1522
|
+
const command = expandTaskCommand(task.command);
|
|
1523
|
+
if (!command)
|
|
1524
|
+
return false;
|
|
1525
|
+
const [actualCommand, ...actualArgs] = normalized.split(/\s+/);
|
|
1526
|
+
const expectedArgs = (task.args ?? []).map(String);
|
|
1527
|
+
const commandMatches = actualCommand === command || actualCommand === basename(command);
|
|
1528
|
+
if (!commandMatches)
|
|
1529
|
+
return false;
|
|
1530
|
+
const actualTail = actualArgs.join(" ").trim();
|
|
1531
|
+
const expectedTail = expectedArgs.join(" ").trim();
|
|
1532
|
+
if (!expectedTail)
|
|
1533
|
+
return true;
|
|
1534
|
+
return actualTail === expectedTail || actualTail.startsWith(`${expectedTail} `);
|
|
1535
|
+
}
|
|
1536
|
+
function parseExecFileError(error) {
|
|
1537
|
+
const stderr = typeof error?.stderr === "string" ? error.stderr.trim() : "";
|
|
1538
|
+
if (stderr)
|
|
1539
|
+
return stderr.split("\n")[0];
|
|
1540
|
+
const stdout = typeof error?.stdout === "string" ? error.stdout.trim() : "";
|
|
1541
|
+
if (stdout)
|
|
1542
|
+
return stdout.split("\n")[0];
|
|
1543
|
+
return String(error?.message ?? "command failed").trim();
|
|
1544
|
+
}
|
|
1545
|
+
async function listExternalTaskProcesses(task) {
|
|
1546
|
+
const command = expandTaskCommand(task.command);
|
|
1547
|
+
if (!command)
|
|
1548
|
+
return [];
|
|
1549
|
+
const execFileAsync = promisify(execFileCb);
|
|
1550
|
+
try {
|
|
1551
|
+
const { stdout } = await execFileAsync("ps", ["-eo", "pid=,user=,args="], { timeout: 5_000 });
|
|
1552
|
+
return stdout
|
|
1553
|
+
.split("\n")
|
|
1554
|
+
.map((line) => line.match(/^\s*(\d+)\s+(\S+)\s+(.*)$/))
|
|
1555
|
+
.filter((match) => Boolean(match))
|
|
1556
|
+
.map((match) => ({
|
|
1557
|
+
pid: Number(match[1]),
|
|
1558
|
+
user: match[2] || null,
|
|
1559
|
+
commandLine: match[3]?.trim() ?? "",
|
|
1560
|
+
}))
|
|
1561
|
+
.filter((entry) => entry.pid > 1 && commandLineMatchesTask(entry.commandLine, task));
|
|
1562
|
+
}
|
|
1563
|
+
catch {
|
|
1564
|
+
return [];
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
async function listExternalTaskBusyPorts(task) {
|
|
1568
|
+
const declaredPorts = (task.ports ?? [])
|
|
1569
|
+
.map((port) => port.port)
|
|
1570
|
+
.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535);
|
|
1571
|
+
const occupiedFlags = await Promise.all(declaredPorts.map((port) => isPortInUse(port)));
|
|
1572
|
+
return declaredPorts.filter((_port, index) => occupiedFlags[index]);
|
|
1573
|
+
}
|
|
1574
|
+
function parseSsPortLine(line) {
|
|
1575
|
+
const columns = line.trim().split(/\s+/);
|
|
1576
|
+
const local = columns[3] ?? "";
|
|
1577
|
+
if (!local)
|
|
1578
|
+
return null;
|
|
1579
|
+
if (local.startsWith("[")) {
|
|
1580
|
+
const end = local.indexOf("]:");
|
|
1581
|
+
if (end < 0)
|
|
1582
|
+
return null;
|
|
1583
|
+
const address = local.slice(1, end);
|
|
1584
|
+
const port = Number(local.slice(end + 2));
|
|
1585
|
+
return Number.isInteger(port) ? { address, port } : null;
|
|
1586
|
+
}
|
|
1587
|
+
const idx = local.lastIndexOf(":");
|
|
1588
|
+
if (idx < 0)
|
|
1589
|
+
return null;
|
|
1590
|
+
const address = local.slice(0, idx);
|
|
1591
|
+
const port = Number(local.slice(idx + 1));
|
|
1592
|
+
return Number.isInteger(port) ? { address, port } : null;
|
|
1593
|
+
}
|
|
1594
|
+
async function listListeningAddressesForPorts(ports) {
|
|
1595
|
+
const wanted = new Set(ports.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535));
|
|
1596
|
+
if (wanted.size === 0)
|
|
1597
|
+
return {};
|
|
1598
|
+
const execFileAsync = promisify(execFileCb);
|
|
1599
|
+
try {
|
|
1600
|
+
const { stdout } = await execFileAsync("ss", ["-ltnH"], { timeout: 5_000 });
|
|
1601
|
+
const result = {};
|
|
1602
|
+
for (const line of stdout.split("\n")) {
|
|
1603
|
+
const parsed = parseSsPortLine(line);
|
|
1604
|
+
if (!parsed || !wanted.has(parsed.port))
|
|
1605
|
+
continue;
|
|
1606
|
+
result[parsed.port] ??= [];
|
|
1607
|
+
if (!result[parsed.port].includes(parsed.address)) {
|
|
1608
|
+
result[parsed.port].push(parsed.address);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
return result;
|
|
1612
|
+
}
|
|
1613
|
+
catch {
|
|
1614
|
+
return {};
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
function portRequiresExternalBinding(task, port) {
|
|
1618
|
+
const portEntry = (task.ports ?? []).find((entry) => entry.port === port);
|
|
1619
|
+
return (portEntry?.visibility ?? "external") !== "internal";
|
|
1620
|
+
}
|
|
1621
|
+
function isNonLoopbackAddress(address) {
|
|
1622
|
+
const normalized = address.trim().replace(/^\[|\]$/g, "");
|
|
1623
|
+
if (!normalized || normalized === "*" || normalized === "0.0.0.0" || normalized === "::" || normalized === ":::") {
|
|
1624
|
+
return true;
|
|
1625
|
+
}
|
|
1626
|
+
if (normalized === "localhost" || normalized === "::1")
|
|
1627
|
+
return false;
|
|
1628
|
+
if (/^127\./.test(normalized))
|
|
1629
|
+
return false;
|
|
1630
|
+
return true;
|
|
1631
|
+
}
|
|
1632
|
+
function loopbackOnlyConflictDetail(task, occupiedPorts, listeningAddresses) {
|
|
1633
|
+
const invalidPorts = occupiedPorts.filter((port) => {
|
|
1634
|
+
if (!portRequiresExternalBinding(task, port))
|
|
1635
|
+
return false;
|
|
1636
|
+
const addresses = listeningAddresses[port] ?? [];
|
|
1637
|
+
return addresses.length > 0 && !addresses.some(isNonLoopbackAddress);
|
|
1638
|
+
});
|
|
1639
|
+
if (invalidPorts.length === 0)
|
|
1640
|
+
return null;
|
|
1641
|
+
const details = invalidPorts.map((port) => {
|
|
1642
|
+
const bindings = (listeningAddresses[port] ?? []).join(", ") || "127.0.0.1";
|
|
1643
|
+
return `${port} (${bindings})`;
|
|
1644
|
+
});
|
|
1645
|
+
return `Task "${task.name}" 端口 ${details.join(", ")} 当前仅监听在本地回环地址,无法作为可外部访问的应用接管`;
|
|
1646
|
+
}
|
|
1647
|
+
async function snapshotExternalTaskRuntime(task) {
|
|
1648
|
+
const [processes, occupiedPorts, healthCheck] = await Promise.all([
|
|
1649
|
+
listExternalTaskProcesses(task),
|
|
1650
|
+
listExternalTaskBusyPorts(task),
|
|
1651
|
+
probeExternalTaskHealth("external-stop", task),
|
|
1652
|
+
]);
|
|
1653
|
+
const healthy = healthCheck?.status === "success";
|
|
1654
|
+
return {
|
|
1655
|
+
running: processes.length > 0 || (occupiedPorts.length > 0 && (healthy || !task.health?.http)),
|
|
1656
|
+
processes,
|
|
1657
|
+
occupiedPorts,
|
|
1658
|
+
healthy,
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
async function waitForExternalTaskExit(task, timeoutMs = EXTERNAL_STOP_SETTLE_TIMEOUT_MS) {
|
|
1662
|
+
const deadline = Date.now() + timeoutMs;
|
|
1663
|
+
while (Date.now() < deadline) {
|
|
1664
|
+
const snapshot = await snapshotExternalTaskRuntime(task);
|
|
1665
|
+
if (!snapshot.running)
|
|
1666
|
+
return true;
|
|
1667
|
+
await new Promise((resolve) => setTimeout(resolve, EXTERNAL_STOP_POLL_INTERVAL_MS));
|
|
1668
|
+
}
|
|
1669
|
+
const finalSnapshot = await snapshotExternalTaskRuntime(task);
|
|
1670
|
+
return !finalSnapshot.running;
|
|
1671
|
+
}
|
|
1672
|
+
async function detectSystemdUnitForTask(task, processes) {
|
|
1673
|
+
if (process.platform !== "linux" || processes.length === 0)
|
|
1674
|
+
return null;
|
|
1675
|
+
const command = expandTaskCommand(task.command);
|
|
1676
|
+
if (!command)
|
|
1677
|
+
return null;
|
|
1678
|
+
const candidate = `${basename(command).replace(/\.[^.]+$/, "")}.service`;
|
|
1679
|
+
const execFileAsync = promisify(execFileCb);
|
|
1680
|
+
try {
|
|
1681
|
+
const { stdout } = await execFileAsync("systemctl", ["show", candidate, "--property=LoadState,ActiveState,MainPID,ExecStart"], { timeout: 5_000 });
|
|
1682
|
+
const props = Object.fromEntries(stdout
|
|
1683
|
+
.split("\n")
|
|
1684
|
+
.map((line) => line.trim())
|
|
1685
|
+
.filter(Boolean)
|
|
1686
|
+
.map((line) => {
|
|
1687
|
+
const idx = line.indexOf("=");
|
|
1688
|
+
return idx >= 0 ? [line.slice(0, idx), line.slice(idx + 1)] : [line, ""];
|
|
1689
|
+
}));
|
|
1690
|
+
if (props.LoadState === "not-found")
|
|
1691
|
+
return null;
|
|
1692
|
+
if (!["active", "activating", "reloading"].includes(props.ActiveState ?? ""))
|
|
1693
|
+
return null;
|
|
1694
|
+
const mainPid = Number(props.MainPID ?? 0);
|
|
1695
|
+
if (processes.some((entry) => entry.pid === mainPid)) {
|
|
1696
|
+
return candidate;
|
|
1697
|
+
}
|
|
1698
|
+
return props.ExecStart?.includes(command) ? candidate : null;
|
|
1699
|
+
}
|
|
1700
|
+
catch {
|
|
1701
|
+
return null;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
async function stopSystemdUnit(unit) {
|
|
1705
|
+
const execFileAsync = promisify(execFileCb);
|
|
1706
|
+
let lastError = null;
|
|
1707
|
+
try {
|
|
1708
|
+
await execFileAsync("systemctl", ["--no-ask-password", "stop", unit], { timeout: 15_000 });
|
|
1709
|
+
return null;
|
|
1710
|
+
}
|
|
1711
|
+
catch (error) {
|
|
1712
|
+
lastError = parseExecFileError(error);
|
|
1713
|
+
}
|
|
1714
|
+
try {
|
|
1715
|
+
await execFileAsync("sudo", ["-n", "systemctl", "stop", unit], { timeout: 15_000 });
|
|
1716
|
+
return null;
|
|
1717
|
+
}
|
|
1718
|
+
catch (error) {
|
|
1719
|
+
return parseExecFileError(error) || lastError;
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
function isProcessAlive(pid) {
|
|
1723
|
+
try {
|
|
1724
|
+
process.kill(pid, 0);
|
|
1725
|
+
return true;
|
|
1726
|
+
}
|
|
1727
|
+
catch (error) {
|
|
1728
|
+
return error?.code === "EPERM";
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
async function waitForPidExit(pid, timeoutMs) {
|
|
1732
|
+
const deadline = Date.now() + timeoutMs;
|
|
1733
|
+
while (Date.now() < deadline) {
|
|
1734
|
+
if (!isProcessAlive(pid))
|
|
1735
|
+
return true;
|
|
1736
|
+
await new Promise((resolve) => setTimeout(resolve, EXTERNAL_STOP_POLL_INTERVAL_MS));
|
|
1737
|
+
}
|
|
1738
|
+
return !isProcessAlive(pid);
|
|
1739
|
+
}
|
|
1740
|
+
async function terminateExternalProcess(pid) {
|
|
1741
|
+
try {
|
|
1742
|
+
process.kill(pid, "SIGTERM");
|
|
1743
|
+
}
|
|
1744
|
+
catch (error) {
|
|
1745
|
+
if (error?.code === "ESRCH")
|
|
1746
|
+
return null;
|
|
1747
|
+
return String(error?.message ?? error);
|
|
1748
|
+
}
|
|
1749
|
+
if (await waitForPidExit(pid, 2_500)) {
|
|
1750
|
+
return null;
|
|
1751
|
+
}
|
|
1752
|
+
try {
|
|
1753
|
+
process.kill(pid, "SIGKILL");
|
|
1754
|
+
}
|
|
1755
|
+
catch (error) {
|
|
1756
|
+
if (error?.code === "ESRCH")
|
|
1757
|
+
return null;
|
|
1758
|
+
return String(error?.message ?? error);
|
|
1759
|
+
}
|
|
1760
|
+
return (await waitForPidExit(pid, 1_500)) ? null : `pid ${pid} 在 SIGKILL 后仍存活`;
|
|
1761
|
+
}
|
|
1762
|
+
async function stopExternalProcessTask(task) {
|
|
1763
|
+
const initial = await snapshotExternalTaskRuntime(task);
|
|
1764
|
+
if (!initial.running) {
|
|
1765
|
+
return { detected: false, ok: true };
|
|
1766
|
+
}
|
|
1767
|
+
const errors = [];
|
|
1768
|
+
const systemdUnit = await detectSystemdUnitForTask(task, initial.processes);
|
|
1769
|
+
if (systemdUnit) {
|
|
1770
|
+
const stopError = await stopSystemdUnit(systemdUnit);
|
|
1771
|
+
if (stopError) {
|
|
1772
|
+
errors.push(`systemd unit "${systemdUnit}" 停止失败: ${stopError}`);
|
|
1773
|
+
}
|
|
1774
|
+
if (await waitForExternalTaskExit(task)) {
|
|
1775
|
+
return { detected: true, ok: true };
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
for (const proc of initial.processes) {
|
|
1779
|
+
const stopError = await terminateExternalProcess(proc.pid);
|
|
1780
|
+
if (stopError) {
|
|
1781
|
+
const owner = proc.user ? ` (${proc.user})` : "";
|
|
1782
|
+
errors.push(`无法停止进程 ${proc.pid}${owner}: ${stopError}`);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
if (await waitForExternalTaskExit(task)) {
|
|
1786
|
+
return { detected: true, ok: true };
|
|
1787
|
+
}
|
|
1788
|
+
const finalSnapshot = await snapshotExternalTaskRuntime(task);
|
|
1789
|
+
const details = [];
|
|
1790
|
+
if (finalSnapshot.processes.length > 0) {
|
|
1791
|
+
details.push(`进程 ${finalSnapshot.processes.map((proc) => `${proc.pid}${proc.user ? `(${proc.user})` : ""}`).join(", ")} 仍在运行`);
|
|
1792
|
+
}
|
|
1793
|
+
if (finalSnapshot.occupiedPorts.length > 0) {
|
|
1794
|
+
details.push(`端口 ${finalSnapshot.occupiedPorts.join(", ")} 仍被占用`);
|
|
1795
|
+
}
|
|
1796
|
+
if (systemdUnit) {
|
|
1797
|
+
details.push(`可手动执行 sudo systemctl stop ${systemdUnit}`);
|
|
1798
|
+
}
|
|
1799
|
+
return {
|
|
1800
|
+
detected: true,
|
|
1801
|
+
ok: false,
|
|
1802
|
+
error: `Task "${task.name}" 未能完全停止:${details.join(",")}${errors.length ? `;${errors.join("; ")}` : ""}`,
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
async function stopExternalProcessInstance(instanceId) {
|
|
1806
|
+
const spec = loadCanonicalSpecForInstance(instanceId);
|
|
1807
|
+
if (!spec) {
|
|
1808
|
+
return { detected: false, ok: true };
|
|
1809
|
+
}
|
|
1810
|
+
const processTasks = spec.tasks.filter((task) => task.runtime === "process" && (task.role ?? "service") === "service");
|
|
1811
|
+
if (processTasks.length === 0) {
|
|
1812
|
+
return { detected: false, ok: true };
|
|
1813
|
+
}
|
|
1814
|
+
const errors = [];
|
|
1815
|
+
let detected = false;
|
|
1816
|
+
for (const task of processTasks) {
|
|
1817
|
+
const result = await stopExternalProcessTask(task);
|
|
1818
|
+
detected ||= result.detected;
|
|
1819
|
+
if (!result.ok && result.error) {
|
|
1820
|
+
errors.push(result.error);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
return {
|
|
1824
|
+
detected,
|
|
1825
|
+
ok: errors.length === 0,
|
|
1826
|
+
...(errors.length ? { error: errors.join("; ") } : {}),
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
async function inspectExternalProcessTask(instanceId, task) {
|
|
1830
|
+
const commandRunning = task.command ? await isBinaryRunning(task.command) : false;
|
|
1831
|
+
const declaredPorts = (task.ports ?? [])
|
|
1832
|
+
.map((port) => port.port)
|
|
1833
|
+
.filter((port) => Number.isInteger(port) && port > 0 && port <= 65535);
|
|
1834
|
+
const occupiedFlags = await Promise.all(declaredPorts.map((port) => isPortInUse(port)));
|
|
1835
|
+
const busyPorts = declaredPorts.filter((_port, index) => occupiedFlags[index]);
|
|
1836
|
+
const listeningAddresses = await listListeningAddressesForPorts(busyPorts);
|
|
1837
|
+
const healthCheck = await probeExternalTaskHealth(instanceId, task);
|
|
1838
|
+
const healthMatched = healthCheck?.status === "success";
|
|
1839
|
+
const bindingConflict = loopbackOnlyConflictDetail(task, busyPorts, listeningAddresses);
|
|
1840
|
+
const hasDeclaredPorts = declaredPorts.length > 0;
|
|
1841
|
+
// External adoption must be conservative. A matching command name alone is
|
|
1842
|
+
// not enough evidence for service readiness because unrelated host processes
|
|
1843
|
+
// can share the same binary. When a health check exists, require it to pass.
|
|
1844
|
+
// Without a health check, require the service to actually occupy its declared
|
|
1845
|
+
// port(s); only port-less process tasks can fall back to command detection.
|
|
1846
|
+
const detected = !bindingConflict && ((Boolean(task.health?.http) && healthMatched)
|
|
1847
|
+
|| (!task.health?.http && hasDeclaredPorts && busyPorts.length > 0)
|
|
1848
|
+
|| (!task.health?.http && !hasDeclaredPorts && commandRunning));
|
|
1849
|
+
const conflict = Boolean(bindingConflict) || (busyPorts.length > 0 && !healthMatched && Boolean(task.health?.http));
|
|
1850
|
+
const status = {
|
|
1851
|
+
state: detected ? "running" : conflict ? "failed" : "stopped",
|
|
1852
|
+
restarts: 0,
|
|
1853
|
+
};
|
|
1854
|
+
if (healthCheck) {
|
|
1855
|
+
status.health_checks = [healthCheck];
|
|
1856
|
+
status.health_status = aggregateHealthStatus(status.health_checks);
|
|
1857
|
+
}
|
|
1858
|
+
return {
|
|
1859
|
+
detected,
|
|
1860
|
+
conflict,
|
|
1861
|
+
occupiedPorts: busyPorts,
|
|
1862
|
+
...(bindingConflict ? { conflictDetail: bindingConflict } : {}),
|
|
1863
|
+
status,
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
async function inspectExternalProcessInstance(instanceId, spec) {
|
|
1867
|
+
if (!findInstalledRuntimeRoot(instanceId)) {
|
|
1868
|
+
return { detected: false, conflicts: [], status: null };
|
|
1869
|
+
}
|
|
1870
|
+
const appSpec = spec ?? loadCanonicalSpecForInstance(instanceId);
|
|
1871
|
+
if (!appSpec)
|
|
1872
|
+
return { detected: false, conflicts: [], status: null };
|
|
1873
|
+
const serviceProcessTasks = appSpec.tasks.filter((task) => task.runtime === "process" && (task.role ?? "service") === "service");
|
|
1874
|
+
if (serviceProcessTasks.length === 0) {
|
|
1875
|
+
return { detected: false, conflicts: [], status: null };
|
|
1876
|
+
}
|
|
1877
|
+
const tasks = {};
|
|
1878
|
+
const conflicts = [];
|
|
1879
|
+
let detected = false;
|
|
1880
|
+
for (const task of appSpec.tasks) {
|
|
1881
|
+
if (task.runtime === "process" && (task.role ?? "service") === "service") {
|
|
1882
|
+
const inspection = await inspectExternalProcessTask(instanceId, task);
|
|
1883
|
+
tasks[task.name] = inspection.status;
|
|
1884
|
+
detected ||= inspection.detected;
|
|
1885
|
+
if (inspection.conflict) {
|
|
1886
|
+
if (inspection.conflictDetail) {
|
|
1887
|
+
conflicts.push(inspection.conflictDetail);
|
|
1888
|
+
}
|
|
1889
|
+
else {
|
|
1890
|
+
const ports = inspection.occupiedPorts.join(", ");
|
|
1891
|
+
const path = task.health?.http?.path ?? "/";
|
|
1892
|
+
conflicts.push(`Task "${task.name}" 端口 ${ports} 已被占用,但现有服务未通过健康检查 ${path}`);
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
continue;
|
|
1896
|
+
}
|
|
1897
|
+
tasks[task.name] = {
|
|
1898
|
+
state: (task.role ?? "service") === "init" ? "dead" : "unknown",
|
|
1899
|
+
restarts: 0,
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
if (!detected) {
|
|
1903
|
+
return { detected: false, conflicts, status: null };
|
|
1904
|
+
}
|
|
1905
|
+
const primaryTaskName = serviceProcessTasks[0]?.name ?? Object.keys(tasks)[0] ?? "";
|
|
1906
|
+
return {
|
|
1907
|
+
detected: true,
|
|
1908
|
+
conflicts,
|
|
1909
|
+
status: {
|
|
1910
|
+
status: "running",
|
|
1911
|
+
tasks,
|
|
1912
|
+
pid: null,
|
|
1913
|
+
uptime: null,
|
|
1914
|
+
memory_mb: null,
|
|
1915
|
+
cpu_percent: null,
|
|
1916
|
+
restarts: tasks[primaryTaskName]?.restarts ?? 0,
|
|
1917
|
+
},
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
async function buildExternalAdoptedInstanceSpec(instanceId, spec) {
|
|
1921
|
+
if (!findInstalledRuntimeRoot(instanceId)) {
|
|
1922
|
+
return { adopted: false, conflicts: [], spec };
|
|
1923
|
+
}
|
|
1924
|
+
const conflicts = [];
|
|
1925
|
+
let adopted = false;
|
|
1926
|
+
const tasks = await Promise.all(spec.tasks.map(async (task) => {
|
|
1927
|
+
if (task.runtime !== "process" || (task.role ?? "service") !== "service") {
|
|
1928
|
+
return task;
|
|
1929
|
+
}
|
|
1930
|
+
const inspection = await inspectExternalProcessTask(instanceId, task);
|
|
1931
|
+
if (inspection.conflict) {
|
|
1932
|
+
if (inspection.conflictDetail) {
|
|
1933
|
+
conflicts.push(inspection.conflictDetail);
|
|
1934
|
+
}
|
|
1935
|
+
else {
|
|
1936
|
+
const ports = inspection.occupiedPorts.join(", ");
|
|
1937
|
+
const path = task.health?.http?.path ?? "/";
|
|
1938
|
+
conflicts.push(`Task "${task.name}" 端口 ${ports} 已被占用,但现有服务未通过健康检查 ${path}`);
|
|
1939
|
+
}
|
|
1940
|
+
return task;
|
|
1941
|
+
}
|
|
1942
|
+
if (!inspection.detected) {
|
|
1943
|
+
return task;
|
|
1944
|
+
}
|
|
1945
|
+
adopted = true;
|
|
1946
|
+
return {
|
|
1947
|
+
...task,
|
|
1948
|
+
command: EXTERNAL_PROCESS_ADOPT_COMMAND,
|
|
1949
|
+
args: [...EXTERNAL_PROCESS_ADOPT_ARGS],
|
|
1950
|
+
env: {
|
|
1951
|
+
...(task.env ?? {}),
|
|
1952
|
+
JISHUSHELL_EXTERNAL_ADOPTED: "1",
|
|
1953
|
+
},
|
|
1954
|
+
};
|
|
1955
|
+
}));
|
|
1956
|
+
return {
|
|
1957
|
+
adopted,
|
|
1958
|
+
conflicts,
|
|
1959
|
+
spec: adopted ? { ...spec, tasks } : spec,
|
|
1960
|
+
};
|
|
1961
|
+
}
|
|
1962
|
+
// ── Job builder ───────────────────────────────────────────────────────────
|
|
1963
|
+
/**
|
|
1964
|
+
* Build a complete Nomad job payload from an AppSpec.
|
|
1965
|
+
*
|
|
1966
|
+
* @param spec The validated AppSpec.
|
|
1967
|
+
* @param instanceId A unique instance/run ID (used as job suffix).
|
|
1968
|
+
* @param driver "docker" | "raw_exec"
|
|
1969
|
+
* @param extraEnv Additional env vars injected into every task (e.g. capability addresses).
|
|
1970
|
+
*/
|
|
1971
|
+
function buildAppJob(spec, instanceId, _driver, extraEnv) {
|
|
1972
|
+
const runtimeByTaskName = buildRuntimePortViewByTaskName(instanceId, spec);
|
|
1973
|
+
return compileWorkload({
|
|
1974
|
+
instanceId,
|
|
1975
|
+
jobId: jobId(instanceId),
|
|
1976
|
+
groupName: spec.id,
|
|
1977
|
+
spec,
|
|
1978
|
+
extraEnv,
|
|
1979
|
+
runtimeByTaskName,
|
|
1980
|
+
}).nomadJob;
|
|
1981
|
+
}
|
|
1982
|
+
function buildRuntimePortViewByTaskName(instanceId, spec) {
|
|
1983
|
+
const runtime = getInstanceRuntime(instanceId);
|
|
1984
|
+
const ports = Array.isArray(runtime?.ports) ? runtime.ports : [];
|
|
1985
|
+
if (ports.length === 0)
|
|
1986
|
+
return undefined;
|
|
1987
|
+
const primaryTask = spec.tasks.find((task) => (task.role ?? "service") === "service") ?? spec.tasks[0];
|
|
1988
|
+
const out = {};
|
|
1989
|
+
for (const task of spec.tasks) {
|
|
1990
|
+
const taskPorts = ports.filter((port) => port?.taskName === task.name
|
|
1991
|
+
|| (port?.taskName === undefined
|
|
1992
|
+
&& task.name === primaryTask?.name));
|
|
1993
|
+
if (taskPorts.length === 0)
|
|
1994
|
+
continue;
|
|
1995
|
+
out[task.name] = {
|
|
1996
|
+
ports: taskPorts,
|
|
1997
|
+
...(task.name === primaryTask?.name && runtime?.health ? { health: runtime.health } : {}),
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
2001
|
+
}
|
|
2002
|
+
// ── Alloc helpers ─────────────────────────────────────────────────────────
|
|
2003
|
+
async function getAllocs(instanceId) {
|
|
2004
|
+
const jid = jobId(instanceId);
|
|
2005
|
+
try {
|
|
2006
|
+
const resp = await nomadGet(`/v1/job/${jid}/allocations`);
|
|
2007
|
+
if (resp.status === 404)
|
|
2008
|
+
return [];
|
|
2009
|
+
const allocs = await resp.json();
|
|
2010
|
+
return allocs;
|
|
2011
|
+
}
|
|
2012
|
+
catch {
|
|
2013
|
+
return [];
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
function pickLiveAlloc(allocs) {
|
|
2017
|
+
for (const clientStatus of ["running", "pending"]) {
|
|
2018
|
+
for (const alloc of allocs) {
|
|
2019
|
+
if (alloc.ClientStatus === clientStatus)
|
|
2020
|
+
return alloc;
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
return null;
|
|
2024
|
+
}
|
|
2025
|
+
function pickLatestTerminalAlloc(allocs) {
|
|
2026
|
+
const terminalAllocs = allocs
|
|
2027
|
+
.filter((alloc) => alloc.ClientStatus !== "running" && alloc.ClientStatus !== "pending")
|
|
2028
|
+
.sort((left, right) => allocTimestamp(right) - allocTimestamp(left));
|
|
2029
|
+
return terminalAllocs[0] ?? null;
|
|
2030
|
+
}
|
|
2031
|
+
async function getAllocClientStatus(allocId) {
|
|
2032
|
+
if (!/^[a-f0-9-]+$/i.test(allocId))
|
|
2033
|
+
return null;
|
|
2034
|
+
try {
|
|
2035
|
+
const resp = await nomadGet(`/v1/allocation/${allocId}`);
|
|
2036
|
+
if (resp.status === 404 || !resp.ok)
|
|
2037
|
+
return null;
|
|
2038
|
+
const alloc = await resp.json();
|
|
2039
|
+
return typeof alloc?.ClientStatus === "string" ? alloc.ClientStatus : null;
|
|
2040
|
+
}
|
|
2041
|
+
catch {
|
|
2042
|
+
return null;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
async function waitForAllocationsToStop(allocIds, timeoutMs = 30_000, pollIntervalMs = 1_000) {
|
|
2046
|
+
const pending = new Set(allocIds.filter((allocId) => /^[a-f0-9-]+$/i.test(allocId)));
|
|
2047
|
+
if (pending.size === 0)
|
|
2048
|
+
return true;
|
|
2049
|
+
const deadline = Date.now() + timeoutMs;
|
|
2050
|
+
while (Date.now() < deadline) {
|
|
2051
|
+
for (const allocId of [...pending]) {
|
|
2052
|
+
const status = await getAllocClientStatus(allocId);
|
|
2053
|
+
if (status == null || (status !== "running" && status !== "pending")) {
|
|
2054
|
+
pending.delete(allocId);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
if (pending.size === 0)
|
|
2058
|
+
return true;
|
|
2059
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
2060
|
+
}
|
|
2061
|
+
return pending.size === 0;
|
|
2062
|
+
}
|
|
2063
|
+
async function getAllocChecks(allocId) {
|
|
2064
|
+
try {
|
|
2065
|
+
const resp = await nomadGet(`/v1/allocation/${allocId}/checks`);
|
|
2066
|
+
if (resp.status === 404 || !resp.ok)
|
|
2067
|
+
return [];
|
|
2068
|
+
const checks = await resp.json();
|
|
2069
|
+
return Object.values(checks ?? {});
|
|
2070
|
+
}
|
|
2071
|
+
catch {
|
|
2072
|
+
return [];
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
function taskNameForAllocCheck(check, taskNames, instanceId) {
|
|
2076
|
+
const checkName = String(check.Check ?? "");
|
|
2077
|
+
for (const taskName of taskNames) {
|
|
2078
|
+
if (checkName === `${taskName}-health` || checkName.startsWith(`${taskName}-`)) {
|
|
2079
|
+
return taskName;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
const serviceName = String(check.Service ?? "");
|
|
2083
|
+
if (taskNames.includes(serviceName))
|
|
2084
|
+
return serviceName;
|
|
2085
|
+
const taskNamePrefix = `${instanceId}-`;
|
|
2086
|
+
if (serviceName.startsWith(taskNamePrefix)) {
|
|
2087
|
+
const candidate = serviceName.slice(taskNamePrefix.length);
|
|
2088
|
+
if (taskNames.includes(candidate))
|
|
2089
|
+
return candidate;
|
|
2090
|
+
}
|
|
2091
|
+
return null;
|
|
2092
|
+
}
|
|
2093
|
+
function aggregateHealthStatus(checks) {
|
|
2094
|
+
const statuses = checks.map((check) => String(check.status ?? "unknown").toLowerCase());
|
|
2095
|
+
if (statuses.length === 0)
|
|
2096
|
+
return "unknown";
|
|
2097
|
+
const healthy = new Set(["success", "passing", "healthy"]);
|
|
2098
|
+
const unhealthy = new Set(["failure", "critical", "warning", "unhealthy"]);
|
|
2099
|
+
if (statuses.every((status) => healthy.has(status)))
|
|
2100
|
+
return "healthy";
|
|
2101
|
+
if (statuses.some((status) => unhealthy.has(status)))
|
|
2102
|
+
return "unhealthy";
|
|
2103
|
+
if (statuses.some((status) => status === "pending" || status === "unknown" || status === "")) {
|
|
2104
|
+
return "unknown";
|
|
2105
|
+
}
|
|
2106
|
+
return statuses[0];
|
|
2107
|
+
}
|
|
2108
|
+
UnifiedNomadJobs.aggregateHealthStatus = aggregateHealthStatus;
|
|
2109
|
+
async function getRunningAlloc(instanceId) {
|
|
2110
|
+
return pickLiveAlloc(await getAllocs(instanceId));
|
|
2111
|
+
}
|
|
2112
|
+
// ── Public API ────────────────────────────────────────────────────────────
|
|
2113
|
+
/**
|
|
2114
|
+
* Returns true if this app job exists in Nomad and was NOT explicitly stopped.
|
|
2115
|
+
* Used at JishuShell startup to auto-restart apps that were running before reboot.
|
|
2116
|
+
*/
|
|
2117
|
+
async function shouldAutoStart(instanceId) {
|
|
2118
|
+
const jid = jobId(instanceId);
|
|
2119
|
+
try {
|
|
2120
|
+
const resp = await nomadGet(`/v1/job/${jid}`);
|
|
2121
|
+
if (!resp.ok || resp.status === 404)
|
|
2122
|
+
return false;
|
|
2123
|
+
const job = await resp.json();
|
|
2124
|
+
return job.Stop === false && job.Status !== "dead";
|
|
2125
|
+
}
|
|
2126
|
+
catch {
|
|
2127
|
+
return false;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
UnifiedNomadJobs.shouldAutoStart = shouldAutoStart;
|
|
2131
|
+
/**
|
|
2132
|
+
* Get the aggregated status of an app job.
|
|
2133
|
+
*
|
|
2134
|
+
* @param instanceId App instance ID.
|
|
2135
|
+
* @param primaryTask Task name to use for uptime/restarts summary.
|
|
2136
|
+
* Defaults to the first service task in the spec.
|
|
2137
|
+
* If omitted, the first task state found is used.
|
|
2138
|
+
*/
|
|
2139
|
+
async function getInstanceInstallRecordStatus(instanceId, primaryTask) {
|
|
2140
|
+
const jid = jobId(instanceId);
|
|
2141
|
+
const stopped = {
|
|
2142
|
+
status: "stopped",
|
|
2143
|
+
tasks: {},
|
|
2144
|
+
pid: null,
|
|
2145
|
+
uptime: null,
|
|
2146
|
+
memory_mb: null,
|
|
2147
|
+
cpu_percent: null,
|
|
2148
|
+
restarts: 0,
|
|
2149
|
+
};
|
|
2150
|
+
try {
|
|
2151
|
+
const resp = await nomadGet(`/v1/job/${jid}`);
|
|
2152
|
+
if (resp.status === 404)
|
|
2153
|
+
return stopped;
|
|
2154
|
+
const job = await resp.json();
|
|
2155
|
+
if (job.Stop)
|
|
2156
|
+
return stopped;
|
|
2157
|
+
}
|
|
2158
|
+
catch {
|
|
2159
|
+
return { ...stopped, status: "unknown", error: "Nomad unreachable" };
|
|
2160
|
+
}
|
|
2161
|
+
const allocs = await getAllocs(instanceId);
|
|
2162
|
+
const alloc = pickLiveAlloc(allocs) ?? pickLatestTerminalAlloc(allocs);
|
|
2163
|
+
// When Nomad has no allocation (e.g. raw_exec driver disabled), fall back to
|
|
2164
|
+
// external process detection for process-runtime apps.
|
|
2165
|
+
if (!alloc || alloc.ClientStatus === "pending") {
|
|
2166
|
+
const ext = await inspectExternalProcessInstance(instanceId);
|
|
2167
|
+
if (ext.detected && ext.status)
|
|
2168
|
+
return ext.status;
|
|
2169
|
+
if (!alloc)
|
|
2170
|
+
return { ...stopped, status: "pending" };
|
|
2171
|
+
}
|
|
2172
|
+
const allocId = alloc.ID;
|
|
2173
|
+
const taskStates = alloc.TaskStates ?? {};
|
|
2174
|
+
// Build per-task summary
|
|
2175
|
+
const tasks = {};
|
|
2176
|
+
for (const [name, state] of Object.entries(taskStates)) {
|
|
2177
|
+
const s = state;
|
|
2178
|
+
tasks[name] = {
|
|
2179
|
+
state: s.State ?? "unknown",
|
|
2180
|
+
restarts: s.Restarts ?? 0,
|
|
2181
|
+
started_at: s.StartedAt ?? undefined,
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2184
|
+
const allocChecks = await getAllocChecks(allocId);
|
|
2185
|
+
const taskNames = Object.keys(tasks);
|
|
2186
|
+
for (const check of allocChecks) {
|
|
2187
|
+
const taskName = taskNameForAllocCheck(check, taskNames, instanceId);
|
|
2188
|
+
if (!taskName || !tasks[taskName])
|
|
2189
|
+
continue;
|
|
2190
|
+
tasks[taskName].health_checks ??= [];
|
|
2191
|
+
tasks[taskName].health_checks.push({
|
|
2192
|
+
name: String(check.Check ?? "health"),
|
|
2193
|
+
status: String(check.Status ?? "unknown"),
|
|
2194
|
+
...(typeof check.Service === "string" ? { service: check.Service } : {}),
|
|
2195
|
+
...(typeof check.Output === "string" && check.Output ? { output: check.Output } : {}),
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
for (const task of Object.values(tasks)) {
|
|
2199
|
+
if (task.health_checks?.length) {
|
|
2200
|
+
task.health_status = aggregateHealthStatus(task.health_checks);
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
// Determine primary task for aggregated stats
|
|
2204
|
+
const ptName = primaryTask ?? Object.keys(tasks)[0] ?? "";
|
|
2205
|
+
const pt = tasks[ptName] ?? {};
|
|
2206
|
+
const result = {
|
|
2207
|
+
status: alloc.ClientStatus ?? "unknown",
|
|
2208
|
+
alloc_id: allocId,
|
|
2209
|
+
tasks,
|
|
2210
|
+
pid: null,
|
|
2211
|
+
uptime: null,
|
|
2212
|
+
memory_mb: null,
|
|
2213
|
+
cpu_percent: null,
|
|
2214
|
+
restarts: pt.restarts ?? 0,
|
|
2215
|
+
};
|
|
2216
|
+
// Uptime from primary task's StartedAt
|
|
2217
|
+
if (pt.started_at) {
|
|
2218
|
+
try {
|
|
2219
|
+
result.uptime = Math.floor((Date.now() - new Date(pt.started_at).getTime()) / 1000);
|
|
2220
|
+
}
|
|
2221
|
+
catch { /* ignore */ }
|
|
2222
|
+
}
|
|
2223
|
+
// Resource stats from Nomad alloc stats API
|
|
2224
|
+
try {
|
|
2225
|
+
const statsResp = await nomadGet(`/v1/client/allocation/${allocId}/stats`);
|
|
2226
|
+
if (statsResp.ok) {
|
|
2227
|
+
const stats = await statsResp.json();
|
|
2228
|
+
// raw_exec: stats nested under Tasks.<name>; docker: top-level ResourceUsage
|
|
2229
|
+
const taskStats = (ptName ? stats.Tasks?.[ptName]?.ResourceUsage : null) ??
|
|
2230
|
+
stats.ResourceUsage ??
|
|
2231
|
+
{};
|
|
2232
|
+
const memStats = taskStats.MemoryStats ?? {};
|
|
2233
|
+
const cpuStats = taskStats.CpuStats ?? {};
|
|
2234
|
+
const memBytes = memStats.RSS ?? memStats.Usage ?? 0;
|
|
2235
|
+
result.memory_mb = Math.round((memBytes / (1024 * 1024)) * 10) / 10;
|
|
2236
|
+
result.cpu_percent = Math.round((cpuStats.Percent ?? 0) * 10) / 10;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
catch { /* ignore */ }
|
|
2240
|
+
// Fallback: cgroup v2 (Pi / CIX) → Nomad alloc-stats are zero. Use the
|
|
2241
|
+
// shared cached `docker stats` snapshot rather than forking per-instance.
|
|
2242
|
+
if (!result.memory_mb && allocId && ptName && /^[a-f0-9-]+$/i.test(allocId)) {
|
|
2243
|
+
const containerName = `${ptName}-${allocId}`;
|
|
2244
|
+
const stat = (await getDockerMemSnapshot()).get(containerName);
|
|
2245
|
+
if (stat) {
|
|
2246
|
+
if (stat.memory_mb)
|
|
2247
|
+
result.memory_mb = stat.memory_mb;
|
|
2248
|
+
if (!result.cpu_percent && stat.cpu_percent)
|
|
2249
|
+
result.cpu_percent = stat.cpu_percent;
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
return result;
|
|
2253
|
+
}
|
|
2254
|
+
UnifiedNomadJobs.getInstanceInstallRecordStatus = getInstanceInstallRecordStatus;
|
|
2255
|
+
// ── Driver health check + auto-restart ────────────────────────────────────
|
|
2256
|
+
/**
|
|
2257
|
+
* Check whether a Nomad task driver is healthy on the local node.
|
|
2258
|
+
* Returns true if the driver is both detected and healthy.
|
|
2259
|
+
*/
|
|
2260
|
+
async function isNomadDriverHealthy(driverName) {
|
|
2261
|
+
try {
|
|
2262
|
+
const nodesResp = await nomadGet("/v1/nodes");
|
|
2263
|
+
if (!nodesResp.ok)
|
|
2264
|
+
return true; // assume healthy if we can't check
|
|
2265
|
+
const nodes = await nodesResp.json();
|
|
2266
|
+
if (nodes.length === 0)
|
|
2267
|
+
return true;
|
|
2268
|
+
const nodeId = nodes[0]?.ID;
|
|
2269
|
+
if (!nodeId)
|
|
2270
|
+
return true;
|
|
2271
|
+
const nodeResp = await nomadGet(`/v1/node/${nodeId}`);
|
|
2272
|
+
if (!nodeResp.ok)
|
|
2273
|
+
return true;
|
|
2274
|
+
const node = await nodeResp.json();
|
|
2275
|
+
const driver = node.Drivers?.[driverName];
|
|
2276
|
+
if (!driver)
|
|
2277
|
+
return false;
|
|
2278
|
+
return driver.Detected === true && driver.Healthy === true;
|
|
2279
|
+
}
|
|
2280
|
+
catch {
|
|
2281
|
+
return true; // don't block on transient errors
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* If the required Nomad driver is not healthy, restart Nomad so it picks up
|
|
2286
|
+
* the current config (e.g. raw_exec enabled = true). Driver plugin changes
|
|
2287
|
+
* require a full Nomad agent restart — SIGHUP / reload API are insufficient.
|
|
2288
|
+
*
|
|
2289
|
+
* Returns true if the driver is healthy (possibly after restart), false if it
|
|
2290
|
+
* could not be made healthy.
|
|
2291
|
+
*/
|
|
2292
|
+
async function ensureNomadDriverHealthy(driverName) {
|
|
2293
|
+
if (await isNomadDriverHealthy(driverName))
|
|
2294
|
+
return true;
|
|
2295
|
+
console.warn(`[nomad] Driver "${driverName}" is not healthy — restarting Nomad to apply config…`);
|
|
2296
|
+
try {
|
|
2297
|
+
const { stopNomad, startNomad } = await import("../../setup/setup-manager.js");
|
|
2298
|
+
const stopResult = await stopNomad();
|
|
2299
|
+
if (!stopResult.ok) {
|
|
2300
|
+
console.warn(`[nomad] Nomad stop failed: ${stopResult.error}`);
|
|
2301
|
+
}
|
|
2302
|
+
const startResult = await startNomad();
|
|
2303
|
+
if (!startResult.ok) {
|
|
2304
|
+
console.warn(`[nomad] Nomad start failed: ${startResult.error}`);
|
|
2305
|
+
return false;
|
|
2306
|
+
}
|
|
2307
|
+
// Wait up to 15s for the driver to become healthy after restart
|
|
2308
|
+
for (let i = 0; i < 15; i++) {
|
|
2309
|
+
await new Promise((r) => setTimeout(r, 1_000));
|
|
2310
|
+
if (await isNomadDriverHealthy(driverName))
|
|
2311
|
+
return true;
|
|
2312
|
+
}
|
|
2313
|
+
console.warn(`[nomad] Driver "${driverName}" still unhealthy after Nomad restart`);
|
|
2314
|
+
return false;
|
|
2315
|
+
}
|
|
2316
|
+
catch (e) {
|
|
2317
|
+
console.warn(`[nomad] Failed to restart Nomad: ${e.message}`);
|
|
2318
|
+
return false;
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Submit a Nomad job for an app.
|
|
2323
|
+
*
|
|
2324
|
+
* @param spec Validated AppSpec.
|
|
2325
|
+
* @param instanceId Unique instance ID (job name suffix).
|
|
2326
|
+
* @param extraEnv Env vars injected into every task (e.g. resolved capability addresses).
|
|
2327
|
+
*/
|
|
2328
|
+
async function submitGenericAppSpecJob(spec, instanceId, extraEnv = {}) {
|
|
2329
|
+
const status = await getInstanceInstallRecordStatus(instanceId);
|
|
2330
|
+
const adoptedExternal = await buildExternalAdoptedInstanceSpec(instanceId, spec);
|
|
2331
|
+
if (adoptedExternal.conflicts.length > 0) {
|
|
2332
|
+
return { ok: false, error: adoptedExternal.conflicts.join("; ") };
|
|
2333
|
+
}
|
|
2334
|
+
let effectiveSpec = adoptedExternal.spec;
|
|
2335
|
+
// Validate all images before submitting
|
|
2336
|
+
for (const task of effectiveSpec.tasks) {
|
|
2337
|
+
if (task.runtime === "container") {
|
|
2338
|
+
if (!task.image || !UnifiedNomadJobs.DOCKER_IMAGE_RE.test(task.image) || task.image.length > UnifiedNomadJobs.MAX_DOCKER_IMAGE_NAME_LEN) {
|
|
2339
|
+
return { ok: false, error: `Task "${task.name}": invalid docker image "${task.image ?? ""}"` };
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
// Determine predominant driver (first service task wins)
|
|
2344
|
+
const primaryTask = effectiveSpec.tasks.find((t) => (t.role ?? "service") === "service") ?? effectiveSpec.tasks[0];
|
|
2345
|
+
const driver = primaryTask?.runtime === "container" ? "docker" : "raw_exec";
|
|
2346
|
+
// Ensure the required Nomad driver is healthy; restart Nomad if needed.
|
|
2347
|
+
const driverOk = await ensureNomadDriverHealthy(driver);
|
|
2348
|
+
if (!driverOk) {
|
|
2349
|
+
if (driver === "raw_exec") {
|
|
2350
|
+
const rawExecError = await validateRawExecDriverAvailability();
|
|
2351
|
+
if (rawExecError) {
|
|
2352
|
+
return { ok: false, error: rawExecError };
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
return { ok: false, error: `Nomad driver "${driver}" is not available. Check Nomad configuration and restart Nomad.` };
|
|
2356
|
+
}
|
|
2357
|
+
const hostNetworkError = await validateRequiredHostNetworks(effectiveSpec);
|
|
2358
|
+
if (hostNetworkError) {
|
|
2359
|
+
return { ok: false, error: hostNetworkError };
|
|
2360
|
+
}
|
|
2361
|
+
if (status.status !== "running") {
|
|
2362
|
+
const preflight = await maybeReallocateConflictingRuntimePorts(instanceId, "host_port_busy");
|
|
2363
|
+
if (preflight.error)
|
|
2364
|
+
return { ok: false, error: preflight.error };
|
|
2365
|
+
}
|
|
2366
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
2367
|
+
let jobDef;
|
|
2368
|
+
try {
|
|
2369
|
+
jobDef = buildAppJob(effectiveSpec, instanceId, driver, extraEnv);
|
|
2370
|
+
}
|
|
2371
|
+
catch (e) {
|
|
2372
|
+
return { ok: false, error: `Job build failed: ${e.message}` };
|
|
2373
|
+
}
|
|
2374
|
+
let submitError = null;
|
|
2375
|
+
let netErr = false;
|
|
2376
|
+
try {
|
|
2377
|
+
const resp = await nomadPost("/v1/jobs", jobDef);
|
|
2378
|
+
if (resp.ok) {
|
|
2379
|
+
const data = await resp.json();
|
|
2380
|
+
// When the app was previously failed, verify it actually transitions
|
|
2381
|
+
// away from the failed state rather than reporting false success.
|
|
2382
|
+
if (status.status === "failed") {
|
|
2383
|
+
const recovered = await waitForRecovery(instanceId, 15_000, 2_000);
|
|
2384
|
+
if (!recovered) {
|
|
2385
|
+
return { ok: false, error: "App start submitted but instance remains in failed state. Check app logs for details.", eval_id: data.EvalID };
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
return { ok: true, eval_id: data.EvalID };
|
|
2389
|
+
}
|
|
2390
|
+
submitError = await resp.text();
|
|
2391
|
+
}
|
|
2392
|
+
catch (e) {
|
|
2393
|
+
netErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
|
|
2394
|
+
submitError = netErr ? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad` : e.message;
|
|
2395
|
+
}
|
|
2396
|
+
if (attempt === 0 && driver === "docker" && !netErr) {
|
|
2397
|
+
const retry = await maybeReallocateConflictingRuntimePorts(instanceId, "docker_race");
|
|
2398
|
+
if (retry.error)
|
|
2399
|
+
return { ok: false, error: retry.error };
|
|
2400
|
+
if (retry.changed) {
|
|
2401
|
+
continue;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
return { ok: false, error: submitError ?? "unknown error" };
|
|
2405
|
+
}
|
|
2406
|
+
return { ok: false, error: "start retry exhausted" };
|
|
2407
|
+
}
|
|
2408
|
+
UnifiedNomadJobs.submitGenericAppSpecJob = submitGenericAppSpecJob;
|
|
2409
|
+
/**
|
|
2410
|
+
* Poll until the app job reaches "running" status or times out.
|
|
2411
|
+
* Returns true if the job is running, false if timed out.
|
|
2412
|
+
*/
|
|
2413
|
+
async function waitForRunning(instanceId, timeoutMs = 120_000, pollIntervalMs = 3_000) {
|
|
2414
|
+
const deadline = Date.now() + timeoutMs;
|
|
2415
|
+
while (Date.now() < deadline) {
|
|
2416
|
+
const status = await getInstanceInstallRecordStatus(instanceId);
|
|
2417
|
+
if (status.status === "running")
|
|
2418
|
+
return true;
|
|
2419
|
+
if (status.status === "dead" || status.status === "failed")
|
|
2420
|
+
return false;
|
|
2421
|
+
await new Promise((r) => setTimeout(r, pollIntervalMs));
|
|
2422
|
+
}
|
|
2423
|
+
return false;
|
|
2424
|
+
}
|
|
2425
|
+
UnifiedNomadJobs.waitForRunning = waitForRunning;
|
|
2426
|
+
/**
|
|
2427
|
+
* Poll until the app job leaves the "failed" state or times out.
|
|
2428
|
+
* Used after start submission to verify actual recovery before reporting success.
|
|
2429
|
+
* Returns true if the app transitions away from "failed" (to pending/running/etc).
|
|
2430
|
+
*/
|
|
2431
|
+
async function waitForRecovery(instanceId, timeoutMs = 15_000, pollIntervalMs = 2_000) {
|
|
2432
|
+
const deadline = Date.now() + timeoutMs;
|
|
2433
|
+
while (Date.now() < deadline) {
|
|
2434
|
+
await new Promise((r) => setTimeout(r, pollIntervalMs));
|
|
2435
|
+
const status = await getInstanceInstallRecordStatus(instanceId);
|
|
2436
|
+
if (status.status !== "failed")
|
|
2437
|
+
return true;
|
|
2438
|
+
}
|
|
2439
|
+
return false;
|
|
2440
|
+
}
|
|
2441
|
+
async function checkDependencies(spec) {
|
|
2442
|
+
if (!spec.depends_on || Object.keys(spec.depends_on).length === 0) {
|
|
2443
|
+
return { ok: true, errors: [] };
|
|
2444
|
+
}
|
|
2445
|
+
const errors = [];
|
|
2446
|
+
for (const [depId, dep] of Object.entries(spec.depends_on)) {
|
|
2447
|
+
const status = await getInstanceInstallRecordStatus(depId);
|
|
2448
|
+
const condition = dep.condition ?? "started";
|
|
2449
|
+
const required = dep.required !== false;
|
|
2450
|
+
let satisfied = false;
|
|
2451
|
+
if (condition === "started") {
|
|
2452
|
+
satisfied = status.status !== "stopped" && status.status !== "unknown";
|
|
2453
|
+
}
|
|
2454
|
+
else if (condition === "healthy") {
|
|
2455
|
+
satisfied = status.status === "running";
|
|
2456
|
+
}
|
|
2457
|
+
else if (condition === "completed") {
|
|
2458
|
+
satisfied = status.status === "dead";
|
|
2459
|
+
}
|
|
2460
|
+
if (!satisfied) {
|
|
2461
|
+
const msg = `Dependency "${depId}" not satisfied (need: ${condition}, got: ${status.status})`;
|
|
2462
|
+
if (required) {
|
|
2463
|
+
errors.push(msg);
|
|
2464
|
+
}
|
|
2465
|
+
else {
|
|
2466
|
+
console.warn(` [depends_on] ${msg} (optional, continuing)`);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
return { ok: errors.length === 0, errors };
|
|
2471
|
+
}
|
|
2472
|
+
UnifiedNomadJobs.checkDependencies = checkDependencies;
|
|
2473
|
+
/**
|
|
2474
|
+
* Stop (and optionally purge) a Nomad app job.
|
|
2475
|
+
*/
|
|
2476
|
+
async function stopGenericAppSpecJob(instanceId, purge = false) {
|
|
2477
|
+
const jid = jobId(instanceId);
|
|
2478
|
+
const liveAllocIds = (await getAllocs(instanceId))
|
|
2479
|
+
.filter((alloc) => alloc?.ID && (alloc.ClientStatus === "running" || alloc.ClientStatus === "pending"))
|
|
2480
|
+
.map((alloc) => String(alloc.ID));
|
|
2481
|
+
let nomadStopped = false;
|
|
2482
|
+
let appMissing = false;
|
|
2483
|
+
let nomadError;
|
|
2484
|
+
try {
|
|
2485
|
+
const resp = await nomadDelete(`/v1/job/${jid}?purge=${purge}`);
|
|
2486
|
+
nomadStopped = resp.ok;
|
|
2487
|
+
appMissing = resp.status === 404;
|
|
2488
|
+
if (!resp.ok && !appMissing) {
|
|
2489
|
+
nomadError = await resp.text();
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
catch (e) {
|
|
2493
|
+
const isNetErr = e?.message === "fetch failed" || e?.cause?.code === "ECONNREFUSED";
|
|
2494
|
+
nomadError = isNetErr
|
|
2495
|
+
? `Nomad 服务不可达 (${getNomadAddr()}),请先启动 Nomad`
|
|
2496
|
+
: e.message;
|
|
2497
|
+
}
|
|
2498
|
+
const externalStop = await stopExternalProcessInstance(instanceId);
|
|
2499
|
+
if (!externalStop.ok) {
|
|
2500
|
+
return {
|
|
2501
|
+
ok: false,
|
|
2502
|
+
error: nomadError ? `${nomadError}; ${externalStop.error}` : externalStop.error,
|
|
2503
|
+
};
|
|
2504
|
+
}
|
|
2505
|
+
if (nomadStopped) {
|
|
2506
|
+
const allocsStopped = await waitForAllocationsToStop(liveAllocIds);
|
|
2507
|
+
if (!allocsStopped) {
|
|
2508
|
+
const lingeringAlloc = await getRunningAlloc(instanceId);
|
|
2509
|
+
if (!lingeringAlloc) {
|
|
2510
|
+
return { ok: true };
|
|
2511
|
+
}
|
|
2512
|
+
return { ok: false, error: `App '${instanceId}' allocations did not stop in time` };
|
|
2513
|
+
}
|
|
2514
|
+
return { ok: true };
|
|
2515
|
+
}
|
|
2516
|
+
if (nomadError)
|
|
2517
|
+
return { ok: false, error: nomadError };
|
|
2518
|
+
if (appMissing) {
|
|
2519
|
+
return externalStop.detected ? { ok: true } : { ok: false, error: "App is not running" };
|
|
2520
|
+
}
|
|
2521
|
+
return { ok: true };
|
|
2522
|
+
}
|
|
2523
|
+
UnifiedNomadJobs.stopGenericAppSpecJob = stopGenericAppSpecJob;
|
|
2524
|
+
/**
|
|
2525
|
+
* Fetch recent log lines for a task in an app job.
|
|
2526
|
+
*
|
|
2527
|
+
* @param instanceId App instance ID.
|
|
2528
|
+
* @param taskName Nomad task name (task.name from AppSpec).
|
|
2529
|
+
* @param lines Number of lines to return (default 200).
|
|
2530
|
+
* @param logType "stdout" | "stderr" (default "stderr").
|
|
2531
|
+
*/
|
|
2532
|
+
async function getInstanceInstallRecordLogs(instanceId, taskName = "", lines = 200, logType = "stderr") {
|
|
2533
|
+
if (!UnifiedNomadJobs.VALID_LOG_TYPES.has(logType))
|
|
2534
|
+
logType = "stderr";
|
|
2535
|
+
let alloc = await getRunningAlloc(instanceId);
|
|
2536
|
+
// If no running alloc, try the most recent alloc (for post-mortem logs).
|
|
2537
|
+
if (!alloc) {
|
|
2538
|
+
const jid = jobId(instanceId);
|
|
2539
|
+
try {
|
|
2540
|
+
const resp = await nomadGet(`/v1/job/${jid}/allocations`);
|
|
2541
|
+
if (resp.ok) {
|
|
2542
|
+
const allocs = await resp.json();
|
|
2543
|
+
if (allocs.length) {
|
|
2544
|
+
alloc = allocs.sort((a, b) => (b.CreateIndex ?? 0) - (a.CreateIndex ?? 0))[0];
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
catch { /* ignore */ }
|
|
2549
|
+
}
|
|
2550
|
+
if (!alloc)
|
|
2551
|
+
return [];
|
|
2552
|
+
const resolvedTask = taskName || (Object.keys(alloc.TaskStates ?? {})[0] ?? "");
|
|
2553
|
+
if (!resolvedTask)
|
|
2554
|
+
return [];
|
|
2555
|
+
// Primary: Nomad log API (works for both docker and raw_exec).
|
|
2556
|
+
try {
|
|
2557
|
+
const params = new URLSearchParams({
|
|
2558
|
+
task: resolvedTask,
|
|
2559
|
+
type: logType,
|
|
2560
|
+
plain: "true",
|
|
2561
|
+
origin: "end",
|
|
2562
|
+
offset: String(Math.max(lines * 512, 100_000)),
|
|
2563
|
+
follow: "false",
|
|
2564
|
+
});
|
|
2565
|
+
const resp = await nomadGet(`/v1/client/fs/logs/${alloc.ID}?${params}`);
|
|
2566
|
+
if (resp.ok) {
|
|
2567
|
+
const text = await resp.text();
|
|
2568
|
+
const trimmed = text.trim();
|
|
2569
|
+
if (trimmed)
|
|
2570
|
+
return trimmed.split("\n").slice(-lines);
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
catch { /* ignore */ }
|
|
2574
|
+
if (!/^[a-f0-9-]+$/i.test(alloc.ID))
|
|
2575
|
+
return [];
|
|
2576
|
+
const dockerLogLines = await readDockerStreamLogs(`${resolvedTask}-${alloc.ID}`, lines, logType);
|
|
2577
|
+
if (dockerLogLines.length > 0)
|
|
2578
|
+
return dockerLogLines;
|
|
2579
|
+
return [];
|
|
2580
|
+
}
|
|
2581
|
+
UnifiedNomadJobs.getInstanceInstallRecordLogs = getInstanceInstallRecordLogs;
|
|
2582
|
+
// ── Nomad WebSocket exec ─────────────────────────────────────────────────
|
|
2583
|
+
/**
|
|
2584
|
+
* Execute a command inside a running task via Nomad's WebSocket exec API.
|
|
2585
|
+
* Works for both `docker` and `raw_exec` tasks — Nomad proxies the exec
|
|
2586
|
+
* through the allocation without requiring direct Docker socket access.
|
|
2587
|
+
*
|
|
2588
|
+
* Protocol (https://developer.hashicorp.com/nomad/api-docs/client#stream-file):
|
|
2589
|
+
* - Upgrade: GET /v1/client/allocation/{id}/exec → 101 Switching Protocols
|
|
2590
|
+
* - Send stdin frames: {"stdin":{"data":"<base64>"}}
|
|
2591
|
+
* - Close stdin: {"stdin":{"close":true}}
|
|
2592
|
+
* - Recv stdout frames: {"stdout":{"data":"<base64>"}}
|
|
2593
|
+
* - Recv stderr frames: {"stderr":{"data":"<base64>"}}
|
|
2594
|
+
* - Recv exit frame: {"exited":true,"result":{"exit_code":0}}
|
|
2595
|
+
*
|
|
2596
|
+
* Authentication: Nomad token is passed as a query parameter because the
|
|
2597
|
+
* native WebSocket API (Node.js ≥21) does not support custom headers.
|
|
2598
|
+
*
|
|
2599
|
+
* @param allocId Nomad allocation UUID.
|
|
2600
|
+
* @param taskName Task name within the allocation.
|
|
2601
|
+
* @param command Command + args array.
|
|
2602
|
+
* @param stdin Optional stdin data to pipe in.
|
|
2603
|
+
* @param timeoutMs Execution timeout in ms (default 120 s).
|
|
2604
|
+
*/
|
|
2605
|
+
async function nomadWsExec(allocId, taskName, command, stdin, timeoutMs = 120_000) {
|
|
2606
|
+
return nomadWsExecStream(allocId, taskName, command, stdin, {}, timeoutMs);
|
|
2607
|
+
}
|
|
2608
|
+
function emitStreamChunk(handler, decoder, data) {
|
|
2609
|
+
const chunk = typeof data === "string" ? data : decoder.write(data);
|
|
2610
|
+
if (chunk)
|
|
2611
|
+
handler?.(chunk);
|
|
2612
|
+
return chunk;
|
|
2613
|
+
}
|
|
2614
|
+
function flushStreamChunk(handler, decoder) {
|
|
2615
|
+
const chunk = decoder.end();
|
|
2616
|
+
if (chunk)
|
|
2617
|
+
handler?.(chunk);
|
|
2618
|
+
return chunk;
|
|
2619
|
+
}
|
|
2620
|
+
async function streamSpawnedExec(file, args, handlers, timeoutMs, options) {
|
|
2621
|
+
return new Promise((resolve) => {
|
|
2622
|
+
const stdoutDecoder = new StringDecoder("utf8");
|
|
2623
|
+
const stderrDecoder = new StringDecoder("utf8");
|
|
2624
|
+
let stdoutBuf = "";
|
|
2625
|
+
let stderrBuf = "";
|
|
2626
|
+
let settled = false;
|
|
2627
|
+
const settle = (exitCode) => {
|
|
2628
|
+
if (settled)
|
|
2629
|
+
return;
|
|
2630
|
+
settled = true;
|
|
2631
|
+
stdoutBuf += flushStreamChunk(handlers.onStdout, stdoutDecoder);
|
|
2632
|
+
stderrBuf += flushStreamChunk(handlers.onStderr, stderrDecoder);
|
|
2633
|
+
resolve({ stdout: stdoutBuf, stderr: stderrBuf, exitCode });
|
|
2634
|
+
};
|
|
2635
|
+
const child = spawn(file, args, {
|
|
2636
|
+
...options,
|
|
2637
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
2638
|
+
timeout: timeoutMs,
|
|
2639
|
+
});
|
|
2640
|
+
child.stdout?.on("data", (data) => {
|
|
2641
|
+
stdoutBuf += emitStreamChunk(handlers.onStdout, stdoutDecoder, data);
|
|
2642
|
+
});
|
|
2643
|
+
child.stderr?.on("data", (data) => {
|
|
2644
|
+
stderrBuf += emitStreamChunk(handlers.onStderr, stderrDecoder, data);
|
|
2645
|
+
});
|
|
2646
|
+
child.on("error", (error) => {
|
|
2647
|
+
const message = error.message || String(error);
|
|
2648
|
+
stderrBuf += message;
|
|
2649
|
+
handlers.onStderr?.(message);
|
|
2650
|
+
settle(error.code === "ENOENT" ? 127 : 1);
|
|
2651
|
+
});
|
|
2652
|
+
child.on("close", (code) => {
|
|
2653
|
+
settle(code ?? 1);
|
|
2654
|
+
});
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
async function nomadWsExecStream(allocId, taskName, command, stdin, handlers, timeoutMs = 120_000) {
|
|
2658
|
+
const nomadAddr = getNomadAddr();
|
|
2659
|
+
// Convert http(s) → ws(s) for the WebSocket URL.
|
|
2660
|
+
const wsBase = nomadAddr.replace(/^http/, "ws");
|
|
2661
|
+
const params = new URLSearchParams({
|
|
2662
|
+
task: taskName,
|
|
2663
|
+
command: JSON.stringify(command),
|
|
2664
|
+
tty: "false",
|
|
2665
|
+
});
|
|
2666
|
+
// Native WebSocket does not support custom request headers;
|
|
2667
|
+
// Nomad also accepts the token as a query parameter.
|
|
2668
|
+
const token = getNomadToken();
|
|
2669
|
+
if (token)
|
|
2670
|
+
params.set("token", token);
|
|
2671
|
+
const url = `${wsBase}/v1/client/allocation/${allocId}/exec?${params}`;
|
|
2672
|
+
return new Promise((resolve, reject) => {
|
|
2673
|
+
// Node.js ≥21 ships a global WebSocket; engines field requires ≥22.
|
|
2674
|
+
const ws = new WebSocket(url);
|
|
2675
|
+
let stdoutBuf = "";
|
|
2676
|
+
let stderrBuf = "";
|
|
2677
|
+
let exitCode = 1;
|
|
2678
|
+
let settled = false;
|
|
2679
|
+
const settle = (result) => {
|
|
2680
|
+
if (settled)
|
|
2681
|
+
return;
|
|
2682
|
+
settled = true;
|
|
2683
|
+
clearTimeout(timer);
|
|
2684
|
+
ws.close();
|
|
2685
|
+
resolve(result);
|
|
2686
|
+
};
|
|
2687
|
+
const timer = setTimeout(() => {
|
|
2688
|
+
if (settled)
|
|
2689
|
+
return;
|
|
2690
|
+
settled = true;
|
|
2691
|
+
ws.close();
|
|
2692
|
+
reject(new Error(`nomad exec timed out after ${timeoutMs}ms`));
|
|
2693
|
+
}, timeoutMs);
|
|
2694
|
+
ws.onopen = () => {
|
|
2695
|
+
if (stdin) {
|
|
2696
|
+
ws.send(JSON.stringify({
|
|
2697
|
+
stdin: { data: Buffer.from(stdin, "utf-8").toString("base64") },
|
|
2698
|
+
}));
|
|
2699
|
+
}
|
|
2700
|
+
// Always close stdin so the remote process sees EOF.
|
|
2701
|
+
ws.send(JSON.stringify({ stdin: { close: true } }));
|
|
2702
|
+
};
|
|
2703
|
+
ws.onmessage = (event) => {
|
|
2704
|
+
try {
|
|
2705
|
+
const msg = JSON.parse(event.data);
|
|
2706
|
+
if (msg.stdout?.data) {
|
|
2707
|
+
const chunk = Buffer.from(msg.stdout.data, "base64").toString("utf-8");
|
|
2708
|
+
stdoutBuf += chunk;
|
|
2709
|
+
if (chunk)
|
|
2710
|
+
handlers.onStdout?.(chunk);
|
|
2711
|
+
}
|
|
2712
|
+
if (msg.stderr?.data) {
|
|
2713
|
+
const chunk = Buffer.from(msg.stderr.data, "base64").toString("utf-8");
|
|
2714
|
+
stderrBuf += chunk;
|
|
2715
|
+
if (chunk)
|
|
2716
|
+
handlers.onStderr?.(chunk);
|
|
2717
|
+
}
|
|
2718
|
+
if (msg.exited === true) {
|
|
2719
|
+
exitCode = msg.result?.exit_code ?? 1;
|
|
2720
|
+
settle({ stdout: stdoutBuf, stderr: stderrBuf, exitCode });
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
catch { /* ignore malformed frames */ }
|
|
2724
|
+
};
|
|
2725
|
+
ws.onerror = (event) => {
|
|
2726
|
+
if (settled)
|
|
2727
|
+
return;
|
|
2728
|
+
settled = true;
|
|
2729
|
+
clearTimeout(timer);
|
|
2730
|
+
// ErrorEvent has a .message; plain Event does not.
|
|
2731
|
+
const msg = event.message ?? "WebSocket error";
|
|
2732
|
+
reject(new Error(`[nomad-ws-exec] ${msg}`));
|
|
2733
|
+
};
|
|
2734
|
+
ws.onclose = () => {
|
|
2735
|
+
// Connection dropped before we received the exited frame.
|
|
2736
|
+
// Resolve with whatever we collected so the caller sees partial output.
|
|
2737
|
+
settle({ stdout: stdoutBuf, stderr: stderrBuf, exitCode });
|
|
2738
|
+
};
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Execute a command inside a running app task.
|
|
2743
|
+
*
|
|
2744
|
+
* Strategy:
|
|
2745
|
+
* 1. Try `docker exec` (fast path for docker-driver tasks, no Nomad dependency).
|
|
2746
|
+
* 2. If the container is not found, fall back to the Nomad WebSocket exec API
|
|
2747
|
+
* which works for both `docker` and `raw_exec` tasks.
|
|
2748
|
+
*
|
|
2749
|
+
* @param instanceId App instance ID.
|
|
2750
|
+
* @param taskName Task name from AppSpec.
|
|
2751
|
+
* @param command Command + args array.
|
|
2752
|
+
* @param timeoutMs Execution timeout in ms (default 120 s).
|
|
2753
|
+
*/
|
|
2754
|
+
async function execInApp(instanceId, taskName = "", command, timeoutMs = 120_000, options = {}) {
|
|
2755
|
+
const alloc = await getRunningAlloc(instanceId);
|
|
2756
|
+
if (!alloc || alloc.ClientStatus !== "running") {
|
|
2757
|
+
throw new Error("App is not running");
|
|
2758
|
+
}
|
|
2759
|
+
const allocId = alloc.ID;
|
|
2760
|
+
if (!/^[a-f0-9-]+$/i.test(allocId))
|
|
2761
|
+
throw new Error("invalid allocId");
|
|
2762
|
+
const resolvedTask = taskName || (Object.keys(alloc.TaskStates ?? {})[0] ?? "");
|
|
2763
|
+
if (!resolvedTask)
|
|
2764
|
+
throw new Error("No task found in alloc");
|
|
2765
|
+
const taskState = alloc.TaskStates?.[resolvedTask];
|
|
2766
|
+
if (!taskState)
|
|
2767
|
+
throw new Error(`Task "${resolvedTask}" not found in alloc`);
|
|
2768
|
+
// For process (raw_exec) apps, execute directly on the host — no container
|
|
2769
|
+
// or Nomad WebSocket overhead needed since the binary runs natively.
|
|
2770
|
+
const { getInstanceInstallRecord } = await import("../../app-common/service.js");
|
|
2771
|
+
const appData = getInstanceInstallRecord(instanceId);
|
|
2772
|
+
const matchedTask = appData?.spec.tasks.find((t) => t.name === resolvedTask);
|
|
2773
|
+
if (matchedTask?.runtime === "process") {
|
|
2774
|
+
if (options.user) {
|
|
2775
|
+
return {
|
|
2776
|
+
stdout: "",
|
|
2777
|
+
stderr: "app exec --user is only supported for container runtime tasks",
|
|
2778
|
+
exitCode: 1,
|
|
2779
|
+
};
|
|
2780
|
+
}
|
|
2781
|
+
const execFileAsync = promisify(execFileCb);
|
|
2782
|
+
try {
|
|
2783
|
+
const { stdout, stderr } = await execFileAsync(command[0], command.slice(1), {
|
|
2784
|
+
timeout: timeoutMs,
|
|
2785
|
+
env: { ...process.env, ...matchedTask.env },
|
|
2786
|
+
});
|
|
2787
|
+
return { stdout, stderr, exitCode: 0 };
|
|
2788
|
+
}
|
|
2789
|
+
catch (e) {
|
|
2790
|
+
return {
|
|
2791
|
+
stdout: e.stdout ?? "",
|
|
2792
|
+
stderr: e.stderr ?? e.message,
|
|
2793
|
+
exitCode: e.code ?? 1,
|
|
2794
|
+
};
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
// Fast path: docker exec (avoids WebSocket overhead for container tasks).
|
|
2798
|
+
const execFileAsync = promisify(execFileCb);
|
|
2799
|
+
const containerName = `${resolvedTask}-${allocId}`;
|
|
2800
|
+
const dockerExecArgs = options.user
|
|
2801
|
+
? ["exec", "--user", options.user, containerName, ...command]
|
|
2802
|
+
: ["exec", containerName, ...command];
|
|
2803
|
+
try {
|
|
2804
|
+
const { stdout, stderr } = await execFileAsync("docker", dockerExecArgs, { timeout: timeoutMs });
|
|
2805
|
+
return { stdout, stderr, exitCode: 0 };
|
|
2806
|
+
}
|
|
2807
|
+
catch (e) {
|
|
2808
|
+
const notFound = e?.stderr?.includes("No such container") ||
|
|
2809
|
+
e?.message?.includes("No such container") ||
|
|
2810
|
+
e?.code === 125; // docker CLI: container not found exit code
|
|
2811
|
+
if (!notFound) {
|
|
2812
|
+
// docker exec was found but the command itself failed — real error.
|
|
2813
|
+
return {
|
|
2814
|
+
stdout: e.stdout ?? "",
|
|
2815
|
+
stderr: e.stderr ?? e.message,
|
|
2816
|
+
exitCode: e.code ?? 1,
|
|
2817
|
+
};
|
|
2818
|
+
}
|
|
2819
|
+
if (options.user) {
|
|
2820
|
+
return {
|
|
2821
|
+
stdout: e.stdout ?? "",
|
|
2822
|
+
stderr: `app exec --user requires Docker exec support for task "${resolvedTask}"`,
|
|
2823
|
+
exitCode: e.code ?? 1,
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
// Container not found → likely raw_exec; fall through to Nomad WS exec.
|
|
2827
|
+
console.log(`[nomad] execInApp: container "${containerName}" not found, ` +
|
|
2828
|
+
`falling back to Nomad WebSocket exec for task "${resolvedTask}"`);
|
|
2829
|
+
}
|
|
2830
|
+
// Nomad WebSocket exec — works for raw_exec and docker without docker socket.
|
|
2831
|
+
return nomadWsExec(allocId, resolvedTask, command, undefined, timeoutMs);
|
|
2832
|
+
}
|
|
2833
|
+
UnifiedNomadJobs.execInApp = execInApp;
|
|
2834
|
+
async function streamExecInApp(instanceId, taskName = "", command, handlers = {}, timeoutMs = 120_000) {
|
|
2835
|
+
const alloc = await getRunningAlloc(instanceId);
|
|
2836
|
+
if (!alloc || alloc.ClientStatus !== "running") {
|
|
2837
|
+
throw new Error("App is not running");
|
|
2838
|
+
}
|
|
2839
|
+
const allocId = alloc.ID;
|
|
2840
|
+
if (!/^[a-f0-9-]+$/i.test(allocId))
|
|
2841
|
+
throw new Error("invalid allocId");
|
|
2842
|
+
const resolvedTask = taskName || (Object.keys(alloc.TaskStates ?? {})[0] ?? "");
|
|
2843
|
+
if (!resolvedTask)
|
|
2844
|
+
throw new Error("No task found in alloc");
|
|
2845
|
+
const taskState = alloc.TaskStates?.[resolvedTask];
|
|
2846
|
+
if (!taskState)
|
|
2847
|
+
throw new Error(`Task "${resolvedTask}" not found in alloc`);
|
|
2848
|
+
const { getInstanceInstallRecord } = await import("../../app-common/service.js");
|
|
2849
|
+
const appData = getInstanceInstallRecord(instanceId);
|
|
2850
|
+
const matchedTask = appData?.spec.tasks.find((task) => task.name === resolvedTask);
|
|
2851
|
+
if (matchedTask?.runtime === "process") {
|
|
2852
|
+
return streamSpawnedExec(command[0], command.slice(1), handlers, timeoutMs, { env: { ...process.env, ...matchedTask.env } });
|
|
2853
|
+
}
|
|
2854
|
+
const containerName = `${resolvedTask}-${allocId}`;
|
|
2855
|
+
const dockerResult = await streamSpawnedExec("docker", ["exec", containerName, ...command], handlers, timeoutMs);
|
|
2856
|
+
const notFound = dockerResult.stderr.includes("No such container") ||
|
|
2857
|
+
dockerResult.exitCode === 125;
|
|
2858
|
+
if (!notFound) {
|
|
2859
|
+
return dockerResult;
|
|
2860
|
+
}
|
|
2861
|
+
console.log(`[nomad] streamExecInApp: container "${containerName}" not found, ` +
|
|
2862
|
+
`falling back to Nomad WebSocket exec for task "${resolvedTask}"`);
|
|
2863
|
+
return nomadWsExecStream(allocId, resolvedTask, command, undefined, handlers, timeoutMs);
|
|
2864
|
+
}
|
|
2865
|
+
UnifiedNomadJobs.streamExecInApp = streamExecInApp;
|
|
2866
|
+
async function listInstanceIds() {
|
|
2867
|
+
try {
|
|
2868
|
+
const resp = await nomadGet("/v1/jobs");
|
|
2869
|
+
if (!resp.ok)
|
|
2870
|
+
return [];
|
|
2871
|
+
const jobs = await resp.json();
|
|
2872
|
+
return [...new Set(jobs.map((job) => readInstanceMeta(job.ID)?.id || job.ID))];
|
|
2873
|
+
}
|
|
2874
|
+
catch {
|
|
2875
|
+
return [];
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
UnifiedNomadJobs.listInstanceIds = listInstanceIds;
|
|
2879
|
+
function readInstanceMeta(nomadJobId) {
|
|
2880
|
+
const directMetaPath = instanceMetaPath(nomadJobId);
|
|
2881
|
+
try {
|
|
2882
|
+
if (existsSync(directMetaPath))
|
|
2883
|
+
return JSON.parse(readFileSync(directMetaPath, "utf-8"));
|
|
2884
|
+
}
|
|
2885
|
+
catch { }
|
|
2886
|
+
return null;
|
|
2887
|
+
}
|
|
2888
|
+
UnifiedNomadJobs.readInstanceMeta = readInstanceMeta;
|
|
2889
|
+
async function resolveInstanceId(id) {
|
|
2890
|
+
const ids = await listInstanceIds();
|
|
2891
|
+
if (ids.length === 0)
|
|
2892
|
+
throw new Error("No instances found.");
|
|
2893
|
+
if (id) {
|
|
2894
|
+
if (existsSync(instanceMetaPath(id))) {
|
|
2895
|
+
return id;
|
|
2896
|
+
}
|
|
2897
|
+
if (!ids.includes(id)) {
|
|
2898
|
+
throw new Error(`Instance "${id}" not found. Available: ${ids.join(", ")}`);
|
|
2899
|
+
}
|
|
2900
|
+
return id;
|
|
2901
|
+
}
|
|
2902
|
+
if (ids.length === 1)
|
|
2903
|
+
return ids[0];
|
|
2904
|
+
throw new Error(`Multiple instances exist. Specify an ID. Available: ${ids.join(", ")}`);
|
|
2905
|
+
}
|
|
2906
|
+
UnifiedNomadJobs.resolveInstanceId = resolveInstanceId;
|
|
2907
|
+
async function resolveInstanceForPairing(instanceId) {
|
|
2908
|
+
const ids = await listInstanceIds();
|
|
2909
|
+
if (ids.length === 0)
|
|
2910
|
+
throw new Error("No instances found.");
|
|
2911
|
+
if (instanceId) {
|
|
2912
|
+
if (existsSync(instanceMetaPath(instanceId)))
|
|
2913
|
+
return instanceId;
|
|
2914
|
+
if (!ids.includes(instanceId))
|
|
2915
|
+
throw new Error(`Instance "${instanceId}" not found.`);
|
|
2916
|
+
return instanceId;
|
|
2917
|
+
}
|
|
2918
|
+
if (ids.length === 1)
|
|
2919
|
+
return ids[0];
|
|
2920
|
+
const runningIds = [];
|
|
2921
|
+
for (const id of ids) {
|
|
2922
|
+
try {
|
|
2923
|
+
const st = await getInstanceStatus(id);
|
|
2924
|
+
if (st.status === "running")
|
|
2925
|
+
runningIds.push(id);
|
|
2926
|
+
}
|
|
2927
|
+
catch { }
|
|
2928
|
+
}
|
|
2929
|
+
if (runningIds.length === 1)
|
|
2930
|
+
return runningIds[0];
|
|
2931
|
+
if (runningIds.length === 0)
|
|
2932
|
+
throw new Error("No running instances found. Start an instance first.");
|
|
2933
|
+
throw new Error(`Multiple running instances: ${runningIds.join(", ")}. Use --instance <id>.`);
|
|
2934
|
+
}
|
|
2935
|
+
UnifiedNomadJobs.resolveInstanceForPairing = resolveInstanceForPairing;
|
|
2936
|
+
function ensureNomadToken() {
|
|
2937
|
+
if (process.env.NOMAD_TOKEN)
|
|
2938
|
+
return;
|
|
2939
|
+
const candidates = [
|
|
2940
|
+
join(homedir(), ".jishushell", "nomad.env"),
|
|
2941
|
+
"/etc/jishushell/nomad.env",
|
|
2942
|
+
];
|
|
2943
|
+
for (const f of candidates) {
|
|
2944
|
+
if (!existsSync(f))
|
|
2945
|
+
continue;
|
|
2946
|
+
try {
|
|
2947
|
+
const match = readFileSync(f, "utf-8").match(/^NOMAD_TOKEN=(.+)$/m);
|
|
2948
|
+
if (match) {
|
|
2949
|
+
process.env.NOMAD_TOKEN = match[1].trim();
|
|
2950
|
+
return;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
catch { }
|
|
2954
|
+
}
|
|
2955
|
+
const legacy = getCoreConfig().nomad_token;
|
|
2956
|
+
if (legacy)
|
|
2957
|
+
process.env.NOMAD_TOKEN = legacy;
|
|
2958
|
+
}
|
|
2959
|
+
UnifiedNomadJobs.ensureNomadToken = ensureNomadToken;
|
|
2960
|
+
// A historical instance-start helper lived here as a parallel lifecycle
|
|
2961
|
+
// codepath. It was superseded by lifecycle-service, then removed during the
|
|
2962
|
+
// canonical-only refactor because it duplicated capability-registry writes.
|
|
2963
|
+
// If a similar entrypoint is needed again, build it on top of lifecycle-service
|
|
2964
|
+
// so it inherits the observer-driven invariants.
|
|
2965
|
+
async function getInstanceStatus(nomadJobId) {
|
|
2966
|
+
const owner = tryResolveExecutionOwner(nomadJobId);
|
|
2967
|
+
if (owner?.type === "app-job") {
|
|
2968
|
+
const st = await getInstanceInstallRecordStatus(nomadJobId);
|
|
2969
|
+
return {
|
|
2970
|
+
status: st.status,
|
|
2971
|
+
pid: st.pid,
|
|
2972
|
+
uptime: st.uptime,
|
|
2973
|
+
memory_mb: st.memory_mb,
|
|
2974
|
+
cpu_percent: st.cpu_percent,
|
|
2975
|
+
};
|
|
2976
|
+
}
|
|
2977
|
+
if (owner?.type === "integration") {
|
|
2978
|
+
return instanceScheduler.getStatus(nomadJobId);
|
|
2979
|
+
}
|
|
2980
|
+
// Raw backend signal only. `status-refresh` translates this into the
|
|
2981
|
+
// canonical product status `{ phase: "failed", reason: "needs-migration" }`
|
|
2982
|
+
// before anything is persisted to instance.json.
|
|
2983
|
+
return {
|
|
2984
|
+
status: "needs-migration",
|
|
2985
|
+
pid: null,
|
|
2986
|
+
uptime: null,
|
|
2987
|
+
memory_mb: null,
|
|
2988
|
+
cpu_percent: null,
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
UnifiedNomadJobs.getInstanceStatus = getInstanceStatus;
|
|
2992
|
+
async function submitIntegrationRuntimeJob(nomadJobId) {
|
|
2993
|
+
// No event-path capability-sync. The shared status-observation path projects
|
|
2994
|
+
// capability-registry entries while lifecycle/API callers wait for or request
|
|
2995
|
+
// current status. Raw integration workload submission follows the same
|
|
2996
|
+
// observer convention as generic app jobs.
|
|
2997
|
+
const owner = tryResolveExecutionOwner(nomadJobId);
|
|
2998
|
+
if (owner?.type === "app-job") {
|
|
2999
|
+
return { ok: false, error: `App '${nomadJobId}' 必须通过 lifecycle-service 启动` };
|
|
3000
|
+
}
|
|
3001
|
+
if (owner?.type === "integration") {
|
|
3002
|
+
return await instanceScheduler.submitIntegrationRuntimeJob(nomadJobId);
|
|
3003
|
+
}
|
|
3004
|
+
return { ok: false, error: missingExecutionOwnerMessage(nomadJobId) };
|
|
3005
|
+
}
|
|
3006
|
+
UnifiedNomadJobs.submitIntegrationRuntimeJob = submitIntegrationRuntimeJob;
|
|
3007
|
+
async function stopIntegrationRuntimeJob(nomadJobId, purge = false) {
|
|
3008
|
+
// No event-path capability-sync — see submitIntegrationRuntimeJob.
|
|
3009
|
+
const owner = tryResolveExecutionOwner(nomadJobId);
|
|
3010
|
+
if (owner?.type === "app-job") {
|
|
3011
|
+
return { ok: false, error: `App '${nomadJobId}' 必须通过 lifecycle-service 停止` };
|
|
3012
|
+
}
|
|
3013
|
+
if (owner?.type === "integration") {
|
|
3014
|
+
return await instanceScheduler.stopIntegrationRuntimeJob(nomadJobId, purge);
|
|
3015
|
+
}
|
|
3016
|
+
return { ok: false, error: missingExecutionOwnerMessage(nomadJobId) };
|
|
3017
|
+
}
|
|
3018
|
+
UnifiedNomadJobs.stopIntegrationRuntimeJob = stopIntegrationRuntimeJob;
|
|
3019
|
+
async function getInstanceLogs(nomadJobId, lines = 200, logType = "stderr") {
|
|
3020
|
+
const owner = tryResolveExecutionOwner(nomadJobId);
|
|
3021
|
+
if (owner?.type === "app-job") {
|
|
3022
|
+
return getInstanceInstallRecordLogs(nomadJobId, "", lines, logType);
|
|
3023
|
+
}
|
|
3024
|
+
if (owner?.type === "integration") {
|
|
3025
|
+
return instanceScheduler.getLogs(nomadJobId, lines, logType);
|
|
3026
|
+
}
|
|
3027
|
+
return [];
|
|
3028
|
+
}
|
|
3029
|
+
UnifiedNomadJobs.getInstanceLogs = getInstanceLogs;
|
|
3030
|
+
async function execInInstance(nomadJobId, command, timeoutMs, options = {}) {
|
|
3031
|
+
const owner = tryResolveExecutionOwner(nomadJobId);
|
|
3032
|
+
if (owner?.type === "app-job") {
|
|
3033
|
+
return execInApp(nomadJobId, "", command, timeoutMs ?? 120_000, options);
|
|
3034
|
+
}
|
|
3035
|
+
if (owner?.type === "integration") {
|
|
3036
|
+
return instanceScheduler.exec(nomadJobId, command, timeoutMs, options);
|
|
3037
|
+
}
|
|
3038
|
+
return {
|
|
3039
|
+
stdout: "",
|
|
3040
|
+
stderr: missingExecutionOwnerMessage(nomadJobId),
|
|
3041
|
+
exitCode: 1,
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
UnifiedNomadJobs.execInInstance = execInInstance;
|
|
3045
|
+
async function streamExecInInstance(nomadJobId, command, handlers = {}, timeoutMs, taskName = "") {
|
|
3046
|
+
const owner = tryResolveExecutionOwner(nomadJobId);
|
|
3047
|
+
if (owner?.type === "app-job") {
|
|
3048
|
+
return streamExecInApp(nomadJobId, taskName, command, handlers, timeoutMs ?? 120_000);
|
|
3049
|
+
}
|
|
3050
|
+
if (owner?.type === "integration") {
|
|
3051
|
+
const result = await instanceScheduler.exec(nomadJobId, command, timeoutMs);
|
|
3052
|
+
if (result.stdout)
|
|
3053
|
+
handlers.onStdout?.(result.stdout);
|
|
3054
|
+
if (result.stderr)
|
|
3055
|
+
handlers.onStderr?.(result.stderr);
|
|
3056
|
+
return result;
|
|
3057
|
+
}
|
|
3058
|
+
const stderr = missingExecutionOwnerMessage(nomadJobId);
|
|
3059
|
+
handlers.onStderr?.(stderr);
|
|
3060
|
+
return { stdout: "", stderr, exitCode: 1 };
|
|
3061
|
+
}
|
|
3062
|
+
UnifiedNomadJobs.streamExecInInstance = streamExecInInstance;
|
|
3063
|
+
})(UnifiedNomadJobs || (UnifiedNomadJobs = {}));
|
|
3064
|
+
export const isAppJob = UnifiedNomadJobs.isAppJob;
|
|
3065
|
+
export const parseCpuMHz = UnifiedNomadJobs.parseCpuMHz;
|
|
3066
|
+
export const parseMemoryMB = UnifiedNomadJobs.parseMemoryMB;
|
|
3067
|
+
export const isBinaryRunning = UnifiedNomadJobs.isBinaryRunning;
|
|
3068
|
+
export const getInstanceInstallRecordStatus = UnifiedNomadJobs.getInstanceInstallRecordStatus;
|
|
3069
|
+
export const submitGenericAppSpecJob = UnifiedNomadJobs.submitGenericAppSpecJob;
|
|
3070
|
+
export const waitForRunning = UnifiedNomadJobs.waitForRunning;
|
|
3071
|
+
export const checkDependencies = UnifiedNomadJobs.checkDependencies;
|
|
3072
|
+
export const validateNomadPortHostNetworks = UnifiedNomadJobs.validateNomadPortHostNetworks;
|
|
3073
|
+
export const buildNomadReservedPort = UnifiedNomadJobs.buildNomadReservedPort;
|
|
3074
|
+
export const stopGenericAppSpecJob = UnifiedNomadJobs.stopGenericAppSpecJob;
|
|
3075
|
+
export const getInstanceInstallRecordLogs = UnifiedNomadJobs.getInstanceInstallRecordLogs;
|
|
3076
|
+
export const execInApp = UnifiedNomadJobs.execInApp;
|
|
3077
|
+
export const streamExecInApp = UnifiedNomadJobs.streamExecInApp;
|
|
3078
|
+
export const listInstanceIds = UnifiedNomadJobs.listInstanceIds;
|
|
3079
|
+
export const readInstanceMeta = UnifiedNomadJobs.readInstanceMeta;
|
|
3080
|
+
export const resolveInstanceId = UnifiedNomadJobs.resolveInstanceId;
|
|
3081
|
+
export const resolveInstanceForPairing = UnifiedNomadJobs.resolveInstanceForPairing;
|
|
3082
|
+
export const ensureNomadToken = UnifiedNomadJobs.ensureNomadToken;
|
|
3083
|
+
export const getInstanceStatus = UnifiedNomadJobs.getInstanceStatus;
|
|
3084
|
+
export const getInstanceLogs = UnifiedNomadJobs.getInstanceLogs;
|
|
3085
|
+
export const execInInstance = UnifiedNomadJobs.execInInstance;
|
|
3086
|
+
export const streamExecInInstance = UnifiedNomadJobs.streamExecInInstance;
|
|
3087
|
+
export const shouldAutoStartNomadJob = UnifiedNomadJobs.shouldAutoStart;
|
|
3088
|
+
export const submitIntegrationRuntimeJob = UnifiedNomadJobs.submitIntegrationRuntimeJob;
|
|
3089
|
+
export const stopIntegrationRuntimeJob = UnifiedNomadJobs.stopIntegrationRuntimeJob;
|
|
3090
|
+
// @internal — exposed for Phase 10.4 unit testing only.
|
|
3091
|
+
export const __aggregateHealthStatusForTests = UnifiedNomadJobs.aggregateHealthStatus;
|
|
3092
|
+
//# sourceMappingURL=nomad.js.map
|