@lobu/gateway 2.8.0
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/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +6 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/platform.d.ts +92 -0
- package/dist/api/platform.d.ts.map +1 -0
- package/dist/api/platform.js +236 -0
- package/dist/api/platform.js.map +1 -0
- package/dist/api/response-renderer.d.ts +44 -0
- package/dist/api/response-renderer.d.ts.map +1 -0
- package/dist/api/response-renderer.js +123 -0
- package/dist/api/response-renderer.js.map +1 -0
- package/dist/auth/agent-metadata-store.d.ts +64 -0
- package/dist/auth/agent-metadata-store.d.ts.map +1 -0
- package/dist/auth/agent-metadata-store.js +115 -0
- package/dist/auth/agent-metadata-store.js.map +1 -0
- package/dist/auth/api-auth-middleware.d.ts +19 -0
- package/dist/auth/api-auth-middleware.d.ts.map +1 -0
- package/dist/auth/api-auth-middleware.js +61 -0
- package/dist/auth/api-auth-middleware.js.map +1 -0
- package/dist/auth/api-key-provider-module.d.ts +60 -0
- package/dist/auth/api-key-provider-module.d.ts.map +1 -0
- package/dist/auth/api-key-provider-module.js +148 -0
- package/dist/auth/api-key-provider-module.js.map +1 -0
- package/dist/auth/base-provider-module.d.ts +70 -0
- package/dist/auth/base-provider-module.d.ts.map +1 -0
- package/dist/auth/base-provider-module.js +118 -0
- package/dist/auth/base-provider-module.js.map +1 -0
- package/dist/auth/chatgpt/chatgpt-oauth-module.d.ts +34 -0
- package/dist/auth/chatgpt/chatgpt-oauth-module.d.ts.map +1 -0
- package/dist/auth/chatgpt/chatgpt-oauth-module.js +136 -0
- package/dist/auth/chatgpt/chatgpt-oauth-module.js.map +1 -0
- package/dist/auth/chatgpt/device-code-client.d.ts +40 -0
- package/dist/auth/chatgpt/device-code-client.d.ts.map +1 -0
- package/dist/auth/chatgpt/device-code-client.js +165 -0
- package/dist/auth/chatgpt/device-code-client.js.map +1 -0
- package/dist/auth/chatgpt/index.d.ts +2 -0
- package/dist/auth/chatgpt/index.d.ts.map +1 -0
- package/dist/auth/chatgpt/index.js +6 -0
- package/dist/auth/chatgpt/index.js.map +1 -0
- package/dist/auth/claude/oauth-module.d.ts +29 -0
- package/dist/auth/claude/oauth-module.d.ts.map +1 -0
- package/dist/auth/claude/oauth-module.js +201 -0
- package/dist/auth/claude/oauth-module.js.map +1 -0
- package/dist/auth/cli/token-service.d.ts +35 -0
- package/dist/auth/cli/token-service.d.ts.map +1 -0
- package/dist/auth/cli/token-service.js +171 -0
- package/dist/auth/cli/token-service.js.map +1 -0
- package/dist/auth/external/client.d.ts +65 -0
- package/dist/auth/external/client.d.ts.map +1 -0
- package/dist/auth/external/client.js +348 -0
- package/dist/auth/external/client.js.map +1 -0
- package/dist/auth/external/device-code-client.d.ts +41 -0
- package/dist/auth/external/device-code-client.d.ts.map +1 -0
- package/dist/auth/external/device-code-client.js +128 -0
- package/dist/auth/external/device-code-client.js.map +1 -0
- package/dist/auth/mcp/config-service.d.ts +70 -0
- package/dist/auth/mcp/config-service.d.ts.map +1 -0
- package/dist/auth/mcp/config-service.js +269 -0
- package/dist/auth/mcp/config-service.js.map +1 -0
- package/dist/auth/mcp/proxy.d.ts +68 -0
- package/dist/auth/mcp/proxy.d.ts.map +1 -0
- package/dist/auth/mcp/proxy.js +783 -0
- package/dist/auth/mcp/proxy.js.map +1 -0
- package/dist/auth/mcp/string-substitution.d.ts +11 -0
- package/dist/auth/mcp/string-substitution.d.ts.map +1 -0
- package/dist/auth/mcp/string-substitution.js +21 -0
- package/dist/auth/mcp/string-substitution.js.map +1 -0
- package/dist/auth/mcp/tool-cache.d.ts +26 -0
- package/dist/auth/mcp/tool-cache.d.ts.map +1 -0
- package/dist/auth/mcp/tool-cache.js +58 -0
- package/dist/auth/mcp/tool-cache.js.map +1 -0
- package/dist/auth/oauth/base-client.d.ts +54 -0
- package/dist/auth/oauth/base-client.d.ts.map +1 -0
- package/dist/auth/oauth/base-client.js +191 -0
- package/dist/auth/oauth/base-client.js.map +1 -0
- package/dist/auth/oauth/client.d.ts +35 -0
- package/dist/auth/oauth/client.d.ts.map +1 -0
- package/dist/auth/oauth/client.js +96 -0
- package/dist/auth/oauth/client.js.map +1 -0
- package/dist/auth/oauth/credentials.d.ts +8 -0
- package/dist/auth/oauth/credentials.d.ts.map +1 -0
- package/dist/auth/oauth/credentials.js +3 -0
- package/dist/auth/oauth/credentials.js.map +1 -0
- package/dist/auth/oauth/providers.d.ts +44 -0
- package/dist/auth/oauth/providers.d.ts.map +1 -0
- package/dist/auth/oauth/providers.js +37 -0
- package/dist/auth/oauth/providers.js.map +1 -0
- package/dist/auth/oauth/state-store.d.ts +62 -0
- package/dist/auth/oauth/state-store.d.ts.map +1 -0
- package/dist/auth/oauth/state-store.js +84 -0
- package/dist/auth/oauth/state-store.js.map +1 -0
- package/dist/auth/oauth-templates.d.ts +15 -0
- package/dist/auth/oauth-templates.d.ts.map +1 -0
- package/dist/auth/oauth-templates.js +161 -0
- package/dist/auth/oauth-templates.js.map +1 -0
- package/dist/auth/provider-catalog.d.ts +52 -0
- package/dist/auth/provider-catalog.d.ts.map +1 -0
- package/dist/auth/provider-catalog.js +155 -0
- package/dist/auth/provider-catalog.js.map +1 -0
- package/dist/auth/provider-model-options.d.ts +3 -0
- package/dist/auth/provider-model-options.d.ts.map +1 -0
- package/dist/auth/provider-model-options.js +29 -0
- package/dist/auth/provider-model-options.js.map +1 -0
- package/dist/auth/settings/agent-settings-store.d.ts +112 -0
- package/dist/auth/settings/agent-settings-store.d.ts.map +1 -0
- package/dist/auth/settings/agent-settings-store.js +376 -0
- package/dist/auth/settings/agent-settings-store.js.map +1 -0
- package/dist/auth/settings/auth-profiles-manager.d.ts +26 -0
- package/dist/auth/settings/auth-profiles-manager.d.ts.map +1 -0
- package/dist/auth/settings/auth-profiles-manager.js +146 -0
- package/dist/auth/settings/auth-profiles-manager.js.map +1 -0
- package/dist/auth/settings/index.d.ts +4 -0
- package/dist/auth/settings/index.d.ts.map +1 -0
- package/dist/auth/settings/index.js +9 -0
- package/dist/auth/settings/index.js.map +1 -0
- package/dist/auth/settings/model-preference-store.d.ts +25 -0
- package/dist/auth/settings/model-preference-store.d.ts.map +1 -0
- package/dist/auth/settings/model-preference-store.js +50 -0
- package/dist/auth/settings/model-preference-store.js.map +1 -0
- package/dist/auth/settings/model-selection.d.ts +11 -0
- package/dist/auth/settings/model-selection.d.ts.map +1 -0
- package/dist/auth/settings/model-selection.js +83 -0
- package/dist/auth/settings/model-selection.js.map +1 -0
- package/dist/auth/settings/resolved-settings-view.d.ts +45 -0
- package/dist/auth/settings/resolved-settings-view.d.ts.map +1 -0
- package/dist/auth/settings/resolved-settings-view.js +152 -0
- package/dist/auth/settings/resolved-settings-view.js.map +1 -0
- package/dist/auth/settings/template-utils.d.ts +3 -0
- package/dist/auth/settings/template-utils.d.ts.map +1 -0
- package/dist/auth/settings/template-utils.js +43 -0
- package/dist/auth/settings/template-utils.js.map +1 -0
- package/dist/auth/settings/token-service.d.ts +86 -0
- package/dist/auth/settings/token-service.d.ts.map +1 -0
- package/dist/auth/settings/token-service.js +3 -0
- package/dist/auth/settings/token-service.js.map +1 -0
- package/dist/auth/system-env-store.d.ts +26 -0
- package/dist/auth/system-env-store.d.ts.map +1 -0
- package/dist/auth/system-env-store.js +92 -0
- package/dist/auth/system-env-store.js.map +1 -0
- package/dist/auth/user-agents-store.d.ts +31 -0
- package/dist/auth/user-agents-store.d.ts.map +1 -0
- package/dist/auth/user-agents-store.js +54 -0
- package/dist/auth/user-agents-store.js.map +1 -0
- package/dist/channels/binding-service.d.ts +69 -0
- package/dist/channels/binding-service.d.ts.map +1 -0
- package/dist/channels/binding-service.js +144 -0
- package/dist/channels/binding-service.js.map +1 -0
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +6 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/cli/gateway.d.ts +31 -0
- package/dist/cli/gateway.d.ts.map +1 -0
- package/dist/cli/gateway.js +1062 -0
- package/dist/cli/gateway.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +56 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/built-in-commands.d.ts +10 -0
- package/dist/commands/built-in-commands.d.ts.map +1 -0
- package/dist/commands/built-in-commands.js +63 -0
- package/dist/commands/built-in-commands.js.map +1 -0
- package/dist/commands/command-dispatcher.d.ts +25 -0
- package/dist/commands/command-dispatcher.d.ts.map +1 -0
- package/dist/commands/command-dispatcher.js +50 -0
- package/dist/commands/command-dispatcher.js.map +1 -0
- package/dist/commands/command-reply-adapters.d.ts +3 -0
- package/dist/commands/command-reply-adapters.d.ts.map +1 -0
- package/dist/commands/command-reply-adapters.js +60 -0
- package/dist/commands/command-reply-adapters.js.map +1 -0
- package/dist/config/file-loader.d.ts +23 -0
- package/dist/config/file-loader.d.ts.map +1 -0
- package/dist/config/file-loader.js +495 -0
- package/dist/config/file-loader.js.map +1 -0
- package/dist/config/index.d.ts +96 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +357 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/network-allowlist.d.ts +18 -0
- package/dist/config/network-allowlist.d.ts.map +1 -0
- package/dist/config/network-allowlist.js +60 -0
- package/dist/config/network-allowlist.js.map +1 -0
- package/dist/connections/chat-instance-manager.d.ts +107 -0
- package/dist/connections/chat-instance-manager.d.ts.map +1 -0
- package/dist/connections/chat-instance-manager.js +886 -0
- package/dist/connections/chat-instance-manager.js.map +1 -0
- package/dist/connections/chat-response-bridge.d.ts +31 -0
- package/dist/connections/chat-response-bridge.d.ts.map +1 -0
- package/dist/connections/chat-response-bridge.js +465 -0
- package/dist/connections/chat-response-bridge.js.map +1 -0
- package/dist/connections/index.d.ts +4 -0
- package/dist/connections/index.d.ts.map +1 -0
- package/dist/connections/index.js +8 -0
- package/dist/connections/index.js.map +1 -0
- package/dist/connections/interaction-bridge.d.ts +7 -0
- package/dist/connections/interaction-bridge.d.ts.map +1 -0
- package/dist/connections/interaction-bridge.js +593 -0
- package/dist/connections/interaction-bridge.js.map +1 -0
- package/dist/connections/message-handler-bridge.d.ts +21 -0
- package/dist/connections/message-handler-bridge.d.ts.map +1 -0
- package/dist/connections/message-handler-bridge.js +314 -0
- package/dist/connections/message-handler-bridge.js.map +1 -0
- package/dist/connections/platform-auth-methods.d.ts +5 -0
- package/dist/connections/platform-auth-methods.d.ts.map +1 -0
- package/dist/connections/platform-auth-methods.js +13 -0
- package/dist/connections/platform-auth-methods.js.map +1 -0
- package/dist/connections/types.d.ts +52 -0
- package/dist/connections/types.d.ts.map +1 -0
- package/dist/connections/types.js +20 -0
- package/dist/connections/types.js.map +1 -0
- package/dist/gateway/connection-manager.d.ts +87 -0
- package/dist/gateway/connection-manager.d.ts.map +1 -0
- package/dist/gateway/connection-manager.js +216 -0
- package/dist/gateway/connection-manager.js.map +1 -0
- package/dist/gateway/index.d.ts +71 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +509 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/gateway/job-router.d.ts +60 -0
- package/dist/gateway/job-router.d.ts.map +1 -0
- package/dist/gateway/job-router.js +148 -0
- package/dist/gateway/job-router.js.map +1 -0
- package/dist/gateway-main.d.ts +81 -0
- package/dist/gateway-main.d.ts.map +1 -0
- package/dist/gateway-main.js +143 -0
- package/dist/gateway-main.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/queue/index.d.ts +8 -0
- package/dist/infrastructure/queue/index.d.ts.map +1 -0
- package/dist/infrastructure/queue/index.js +12 -0
- package/dist/infrastructure/queue/index.js.map +1 -0
- package/dist/infrastructure/queue/queue-producer.d.ts +68 -0
- package/dist/infrastructure/queue/queue-producer.d.ts.map +1 -0
- package/dist/infrastructure/queue/queue-producer.js +72 -0
- package/dist/infrastructure/queue/queue-producer.js.map +1 -0
- package/dist/infrastructure/queue/redis-queue.d.ts +45 -0
- package/dist/infrastructure/queue/redis-queue.d.ts.map +1 -0
- package/dist/infrastructure/queue/redis-queue.js +273 -0
- package/dist/infrastructure/queue/redis-queue.js.map +1 -0
- package/dist/infrastructure/queue/types.d.ts +107 -0
- package/dist/infrastructure/queue/types.d.ts.map +1 -0
- package/dist/infrastructure/queue/types.js +7 -0
- package/dist/infrastructure/queue/types.js.map +1 -0
- package/dist/infrastructure/redis/system-message-limiter.d.ts +35 -0
- package/dist/infrastructure/redis/system-message-limiter.d.ts.map +1 -0
- package/dist/infrastructure/redis/system-message-limiter.js +61 -0
- package/dist/infrastructure/redis/system-message-limiter.js.map +1 -0
- package/dist/interactions/config-request-store.d.ts +41 -0
- package/dist/interactions/config-request-store.d.ts.map +1 -0
- package/dist/interactions/config-request-store.js +103 -0
- package/dist/interactions/config-request-store.js.map +1 -0
- package/dist/interactions.d.ts +134 -0
- package/dist/interactions.d.ts.map +1 -0
- package/dist/interactions.js +175 -0
- package/dist/interactions.js.map +1 -0
- package/dist/lobu.d.ts +78 -0
- package/dist/lobu.d.ts.map +1 -0
- package/dist/lobu.js +248 -0
- package/dist/lobu.js.map +1 -0
- package/dist/metrics/prometheus.d.ts +6 -0
- package/dist/metrics/prometheus.d.ts.map +1 -0
- package/dist/metrics/prometheus.js +78 -0
- package/dist/metrics/prometheus.js.map +1 -0
- package/dist/modules/module-system.d.ts +82 -0
- package/dist/modules/module-system.d.ts.map +1 -0
- package/dist/modules/module-system.js +53 -0
- package/dist/modules/module-system.js.map +1 -0
- package/dist/orchestration/base-deployment-manager.d.ts +173 -0
- package/dist/orchestration/base-deployment-manager.d.ts.map +1 -0
- package/dist/orchestration/base-deployment-manager.js +553 -0
- package/dist/orchestration/base-deployment-manager.js.map +1 -0
- package/dist/orchestration/deployment-utils.d.ts +25 -0
- package/dist/orchestration/deployment-utils.d.ts.map +1 -0
- package/dist/orchestration/deployment-utils.js +65 -0
- package/dist/orchestration/deployment-utils.js.map +1 -0
- package/dist/orchestration/impl/docker-deployment.d.ts +43 -0
- package/dist/orchestration/impl/docker-deployment.d.ts.map +1 -0
- package/dist/orchestration/impl/docker-deployment.js +480 -0
- package/dist/orchestration/impl/docker-deployment.js.map +1 -0
- package/dist/orchestration/impl/embedded-deployment.d.ts +16 -0
- package/dist/orchestration/impl/embedded-deployment.d.ts.map +1 -0
- package/dist/orchestration/impl/embedded-deployment.js +195 -0
- package/dist/orchestration/impl/embedded-deployment.js.map +1 -0
- package/dist/orchestration/impl/index.d.ts +8 -0
- package/dist/orchestration/impl/index.d.ts.map +1 -0
- package/dist/orchestration/impl/index.js +14 -0
- package/dist/orchestration/impl/index.js.map +1 -0
- package/dist/orchestration/impl/k8s/deployment.d.ts +204 -0
- package/dist/orchestration/impl/k8s/deployment.d.ts.map +1 -0
- package/dist/orchestration/impl/k8s/deployment.js +620 -0
- package/dist/orchestration/impl/k8s/deployment.js.map +1 -0
- package/dist/orchestration/impl/k8s/helpers.d.ts +34 -0
- package/dist/orchestration/impl/k8s/helpers.d.ts.map +1 -0
- package/dist/orchestration/impl/k8s/helpers.js +377 -0
- package/dist/orchestration/impl/k8s/helpers.js.map +1 -0
- package/dist/orchestration/impl/k8s/index.d.ts +2 -0
- package/dist/orchestration/impl/k8s/index.d.ts.map +1 -0
- package/dist/orchestration/impl/k8s/index.js +6 -0
- package/dist/orchestration/impl/k8s/index.js.map +1 -0
- package/dist/orchestration/index.d.ts +53 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +257 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/message-consumer.d.ts +49 -0
- package/dist/orchestration/message-consumer.d.ts.map +1 -0
- package/dist/orchestration/message-consumer.js +406 -0
- package/dist/orchestration/message-consumer.js.map +1 -0
- package/dist/orchestration/scheduled-wakeup.d.ts +110 -0
- package/dist/orchestration/scheduled-wakeup.d.ts.map +1 -0
- package/dist/orchestration/scheduled-wakeup.js +500 -0
- package/dist/orchestration/scheduled-wakeup.js.map +1 -0
- package/dist/permissions/approval-policy.d.ts +28 -0
- package/dist/permissions/approval-policy.d.ts.map +1 -0
- package/dist/permissions/approval-policy.js +33 -0
- package/dist/permissions/approval-policy.js.map +1 -0
- package/dist/permissions/grant-store.d.ts +52 -0
- package/dist/permissions/grant-store.d.ts.map +1 -0
- package/dist/permissions/grant-store.js +192 -0
- package/dist/permissions/grant-store.js.map +1 -0
- package/dist/platform/file-handler.d.ts +51 -0
- package/dist/platform/file-handler.d.ts.map +1 -0
- package/dist/platform/file-handler.js +6 -0
- package/dist/platform/file-handler.js.map +1 -0
- package/dist/platform/link-buttons.d.ts +21 -0
- package/dist/platform/link-buttons.d.ts.map +1 -0
- package/dist/platform/link-buttons.js +43 -0
- package/dist/platform/link-buttons.js.map +1 -0
- package/dist/platform/renderer-utils.d.ts +10 -0
- package/dist/platform/renderer-utils.d.ts.map +1 -0
- package/dist/platform/renderer-utils.js +42 -0
- package/dist/platform/renderer-utils.js.map +1 -0
- package/dist/platform/response-renderer.d.ts +66 -0
- package/dist/platform/response-renderer.d.ts.map +1 -0
- package/dist/platform/response-renderer.js +8 -0
- package/dist/platform/response-renderer.js.map +1 -0
- package/dist/platform/unified-thread-consumer.d.ts +41 -0
- package/dist/platform/unified-thread-consumer.d.ts.map +1 -0
- package/dist/platform/unified-thread-consumer.js +143 -0
- package/dist/platform/unified-thread-consumer.js.map +1 -0
- package/dist/platform.d.ts +255 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +40 -0
- package/dist/platform.js.map +1 -0
- package/dist/proxy/http-proxy.d.ts +32 -0
- package/dist/proxy/http-proxy.d.ts.map +1 -0
- package/dist/proxy/http-proxy.js +636 -0
- package/dist/proxy/http-proxy.js.map +1 -0
- package/dist/proxy/proxy-manager.d.ts +13 -0
- package/dist/proxy/proxy-manager.d.ts.map +1 -0
- package/dist/proxy/proxy-manager.js +68 -0
- package/dist/proxy/proxy-manager.js.map +1 -0
- package/dist/proxy/secret-proxy.d.ts +78 -0
- package/dist/proxy/secret-proxy.d.ts.map +1 -0
- package/dist/proxy/secret-proxy.js +309 -0
- package/dist/proxy/secret-proxy.js.map +1 -0
- package/dist/proxy/token-refresh-job.d.ts +29 -0
- package/dist/proxy/token-refresh-job.d.ts.map +1 -0
- package/dist/proxy/token-refresh-job.js +104 -0
- package/dist/proxy/token-refresh-job.js.map +1 -0
- package/dist/routes/internal/audio.d.ts +14 -0
- package/dist/routes/internal/audio.d.ts.map +1 -0
- package/dist/routes/internal/audio.js +118 -0
- package/dist/routes/internal/audio.js.map +1 -0
- package/dist/routes/internal/device-auth.d.ts +42 -0
- package/dist/routes/internal/device-auth.d.ts.map +1 -0
- package/dist/routes/internal/device-auth.js +397 -0
- package/dist/routes/internal/device-auth.js.map +1 -0
- package/dist/routes/internal/files.d.ts +9 -0
- package/dist/routes/internal/files.d.ts.map +1 -0
- package/dist/routes/internal/files.js +175 -0
- package/dist/routes/internal/files.js.map +1 -0
- package/dist/routes/internal/history.d.ts +9 -0
- package/dist/routes/internal/history.d.ts.map +1 -0
- package/dist/routes/internal/history.js +55 -0
- package/dist/routes/internal/history.js.map +1 -0
- package/dist/routes/internal/images.d.ts +10 -0
- package/dist/routes/internal/images.d.ts.map +1 -0
- package/dist/routes/internal/images.js +101 -0
- package/dist/routes/internal/images.js.map +1 -0
- package/dist/routes/internal/interactions.d.ts +9 -0
- package/dist/routes/internal/interactions.d.ts.map +1 -0
- package/dist/routes/internal/interactions.js +53 -0
- package/dist/routes/internal/interactions.js.map +1 -0
- package/dist/routes/internal/middleware.d.ts +7 -0
- package/dist/routes/internal/middleware.d.ts.map +1 -0
- package/dist/routes/internal/middleware.js +24 -0
- package/dist/routes/internal/middleware.js.map +1 -0
- package/dist/routes/internal/schedule.d.ts +14 -0
- package/dist/routes/internal/schedule.d.ts.map +1 -0
- package/dist/routes/internal/schedule.js +169 -0
- package/dist/routes/internal/schedule.js.map +1 -0
- package/dist/routes/internal/types.d.ts +22 -0
- package/dist/routes/internal/types.d.ts.map +1 -0
- package/dist/routes/internal/types.js +6 -0
- package/dist/routes/internal/types.js.map +1 -0
- package/dist/routes/openapi-auto.d.ts +8 -0
- package/dist/routes/openapi-auto.d.ts.map +1 -0
- package/dist/routes/openapi-auto.js +196 -0
- package/dist/routes/openapi-auto.js.map +1 -0
- package/dist/routes/public/agent-access.d.ts +11 -0
- package/dist/routes/public/agent-access.d.ts.map +1 -0
- package/dist/routes/public/agent-access.js +11 -0
- package/dist/routes/public/agent-access.js.map +1 -0
- package/dist/routes/public/agent-config.d.ts +42 -0
- package/dist/routes/public/agent-config.d.ts.map +1 -0
- package/dist/routes/public/agent-config.js +415 -0
- package/dist/routes/public/agent-config.js.map +1 -0
- package/dist/routes/public/agent-history.d.ts +17 -0
- package/dist/routes/public/agent-history.d.ts.map +1 -0
- package/dist/routes/public/agent-history.js +335 -0
- package/dist/routes/public/agent-history.js.map +1 -0
- package/dist/routes/public/agent-schedules.d.ts +18 -0
- package/dist/routes/public/agent-schedules.d.ts.map +1 -0
- package/dist/routes/public/agent-schedules.js +242 -0
- package/dist/routes/public/agent-schedules.js.map +1 -0
- package/dist/routes/public/agent.d.ts +23 -0
- package/dist/routes/public/agent.d.ts.map +1 -0
- package/dist/routes/public/agent.js +864 -0
- package/dist/routes/public/agent.js.map +1 -0
- package/dist/routes/public/agents.d.ts +22 -0
- package/dist/routes/public/agents.d.ts.map +1 -0
- package/dist/routes/public/agents.js +257 -0
- package/dist/routes/public/agents.js.map +1 -0
- package/dist/routes/public/channels.d.ts +23 -0
- package/dist/routes/public/channels.d.ts.map +1 -0
- package/dist/routes/public/channels.js +131 -0
- package/dist/routes/public/channels.js.map +1 -0
- package/dist/routes/public/cli-auth.d.ts +12 -0
- package/dist/routes/public/cli-auth.d.ts.map +1 -0
- package/dist/routes/public/cli-auth.js +552 -0
- package/dist/routes/public/cli-auth.js.map +1 -0
- package/dist/routes/public/connections.d.ts +20 -0
- package/dist/routes/public/connections.d.ts.map +1 -0
- package/dist/routes/public/connections.js +464 -0
- package/dist/routes/public/connections.js.map +1 -0
- package/dist/routes/public/landing.d.ts +3 -0
- package/dist/routes/public/landing.d.ts.map +1 -0
- package/dist/routes/public/landing.js +17 -0
- package/dist/routes/public/landing.js.map +1 -0
- package/dist/routes/public/oauth.d.ts +24 -0
- package/dist/routes/public/oauth.d.ts.map +1 -0
- package/dist/routes/public/oauth.js +108 -0
- package/dist/routes/public/oauth.js.map +1 -0
- package/dist/routes/public/settings-auth.d.ts +28 -0
- package/dist/routes/public/settings-auth.d.ts.map +1 -0
- package/dist/routes/public/settings-auth.js +90 -0
- package/dist/routes/public/settings-auth.js.map +1 -0
- package/dist/routes/public/slack.d.ts +4 -0
- package/dist/routes/public/slack.d.ts.map +1 -0
- package/dist/routes/public/slack.js +119 -0
- package/dist/routes/public/slack.js.map +1 -0
- package/dist/routes/shared/agent-ownership.d.ts +15 -0
- package/dist/routes/shared/agent-ownership.d.ts.map +1 -0
- package/dist/routes/shared/agent-ownership.js +61 -0
- package/dist/routes/shared/agent-ownership.js.map +1 -0
- package/dist/routes/shared/token-verifier.d.ts +21 -0
- package/dist/routes/shared/token-verifier.d.ts.map +1 -0
- package/dist/routes/shared/token-verifier.js +25 -0
- package/dist/routes/shared/token-verifier.js.map +1 -0
- package/dist/services/core-services.d.ts +133 -0
- package/dist/services/core-services.d.ts.map +1 -0
- package/dist/services/core-services.js +728 -0
- package/dist/services/core-services.js.map +1 -0
- package/dist/services/image-generation-service.d.ts +38 -0
- package/dist/services/image-generation-service.d.ts.map +1 -0
- package/dist/services/image-generation-service.js +167 -0
- package/dist/services/image-generation-service.js.map +1 -0
- package/dist/services/instruction-service.d.ts +41 -0
- package/dist/services/instruction-service.d.ts.map +1 -0
- package/dist/services/instruction-service.js +252 -0
- package/dist/services/instruction-service.js.map +1 -0
- package/dist/services/mcp-registry.d.ts +31 -0
- package/dist/services/mcp-registry.d.ts.map +1 -0
- package/dist/services/mcp-registry.js +69 -0
- package/dist/services/mcp-registry.js.map +1 -0
- package/dist/services/platform-helpers.d.ts +47 -0
- package/dist/services/platform-helpers.d.ts.map +1 -0
- package/dist/services/platform-helpers.js +200 -0
- package/dist/services/platform-helpers.js.map +1 -0
- package/dist/services/session-manager.d.ts +72 -0
- package/dist/services/session-manager.d.ts.map +1 -0
- package/dist/services/session-manager.js +199 -0
- package/dist/services/session-manager.js.map +1 -0
- package/dist/services/settings-resolver.d.ts +25 -0
- package/dist/services/settings-resolver.d.ts.map +1 -0
- package/dist/services/settings-resolver.js +55 -0
- package/dist/services/settings-resolver.js.map +1 -0
- package/dist/services/system-config-resolver.d.ts +25 -0
- package/dist/services/system-config-resolver.d.ts.map +1 -0
- package/dist/services/system-config-resolver.js +73 -0
- package/dist/services/system-config-resolver.js.map +1 -0
- package/dist/services/system-skills-service.d.ts +38 -0
- package/dist/services/system-skills-service.d.ts.map +1 -0
- package/dist/services/system-skills-service.js +186 -0
- package/dist/services/system-skills-service.js.map +1 -0
- package/dist/services/transcription-service.d.ts +91 -0
- package/dist/services/transcription-service.d.ts.map +1 -0
- package/dist/services/transcription-service.js +465 -0
- package/dist/services/transcription-service.js.map +1 -0
- package/dist/session.d.ts +75 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +19 -0
- package/dist/session.js.map +1 -0
- package/dist/spaces/index.d.ts +2 -0
- package/dist/spaces/index.d.ts.map +1 -0
- package/dist/spaces/index.js +18 -0
- package/dist/spaces/index.js.map +1 -0
- package/dist/spaces/space-resolver.d.ts +10 -0
- package/dist/spaces/space-resolver.d.ts.map +1 -0
- package/dist/spaces/space-resolver.js +17 -0
- package/dist/spaces/space-resolver.js.map +1 -0
- package/dist/stores/in-memory-agent-store.d.ts +57 -0
- package/dist/stores/in-memory-agent-store.d.ts.map +1 -0
- package/dist/stores/in-memory-agent-store.js +304 -0
- package/dist/stores/in-memory-agent-store.js.map +1 -0
- package/dist/stores/redis-agent-store.d.ts +57 -0
- package/dist/stores/redis-agent-store.d.ts.map +1 -0
- package/dist/stores/redis-agent-store.js +163 -0
- package/dist/stores/redis-agent-store.js.map +1 -0
- package/dist/utils/public-url.d.ts +6 -0
- package/dist/utils/public-url.d.ts.map +1 -0
- package/dist/utils/public-url.js +33 -0
- package/dist/utils/public-url.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +32 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +56 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.K8sDeploymentManager = exports.IMAGE_PULL_FAILURE_REASONS = exports.WORKER_SECURITY = exports.LOBU_FINALIZER = void 0;
|
|
37
|
+
const k8s = __importStar(require("@kubernetes/client-node"));
|
|
38
|
+
const core_1 = require("@lobu/core");
|
|
39
|
+
const base_deployment_manager_1 = require("../../base-deployment-manager");
|
|
40
|
+
const deployment_utils_1 = require("../../deployment-utils");
|
|
41
|
+
const helpers_1 = require("./helpers");
|
|
42
|
+
exports.LOBU_FINALIZER = "lobu.io/cleanup";
|
|
43
|
+
exports.WORKER_SECURITY = {
|
|
44
|
+
USER_ID: 1001,
|
|
45
|
+
GROUP_ID: 1001,
|
|
46
|
+
TMP_SIZE_LIMIT: "100Mi",
|
|
47
|
+
};
|
|
48
|
+
const WORKER_SELECTOR_LABELS = {
|
|
49
|
+
"app.kubernetes.io/name": deployment_utils_1.BASE_WORKER_LABELS["app.kubernetes.io/name"],
|
|
50
|
+
"app.kubernetes.io/component": deployment_utils_1.BASE_WORKER_LABELS["app.kubernetes.io/component"],
|
|
51
|
+
};
|
|
52
|
+
exports.IMAGE_PULL_FAILURE_REASONS = new Set([
|
|
53
|
+
"ImagePullBackOff",
|
|
54
|
+
"ErrImagePull",
|
|
55
|
+
"InvalidImageName",
|
|
56
|
+
"RegistryUnavailable",
|
|
57
|
+
]);
|
|
58
|
+
const logger = (0, core_1.createLogger)("k8s-deployment");
|
|
59
|
+
class K8sDeploymentManager extends base_deployment_manager_1.BaseDeploymentManager {
|
|
60
|
+
constructor(config, moduleEnvVarsBuilder, providerModules = []) {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
super(config, moduleEnvVarsBuilder, providerModules);
|
|
63
|
+
this.informer = null;
|
|
64
|
+
this.informerInitializing = false;
|
|
65
|
+
const kc = new k8s.KubeConfig();
|
|
66
|
+
try {
|
|
67
|
+
// Try in-cluster config first, then fall back to default
|
|
68
|
+
if (process.env.KUBERNETES_SERVICE_HOST) {
|
|
69
|
+
try {
|
|
70
|
+
kc.loadFromCluster();
|
|
71
|
+
}
|
|
72
|
+
catch (_clusterError) {
|
|
73
|
+
kc.loadFromDefault();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
kc.loadFromDefault();
|
|
78
|
+
}
|
|
79
|
+
// For development environments, disable TLS verification to avoid certificate issues
|
|
80
|
+
if (process.env.NODE_ENV === "development" ||
|
|
81
|
+
((_a = process.env.KUBERNETES_SERVICE_HOST) === null || _a === void 0 ? void 0 : _a.includes("127.0.0.1")) ||
|
|
82
|
+
((_b = process.env.KUBERNETES_SERVICE_HOST) === null || _b === void 0 ? void 0 : _b.includes("192.168")) ||
|
|
83
|
+
((_c = process.env.KUBERNETES_SERVICE_HOST) === null || _c === void 0 ? void 0 : _c.includes("localhost"))) {
|
|
84
|
+
const cluster = kc.getCurrentCluster();
|
|
85
|
+
if (cluster &&
|
|
86
|
+
typeof cluster === "object" &&
|
|
87
|
+
cluster.skipTLSVerify !== true) {
|
|
88
|
+
// Safely set skipTLSVerify property with type checking
|
|
89
|
+
Object.defineProperty(cluster, "skipTLSVerify", {
|
|
90
|
+
value: true,
|
|
91
|
+
writable: true,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
configurable: true,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
logger.error("❌ Failed to load Kubernetes config:", error);
|
|
100
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Failed to initialize Kubernetes client: ${error instanceof Error ? error.message : String(error)}`, { error }, true);
|
|
101
|
+
}
|
|
102
|
+
// Store KubeConfig for informer creation
|
|
103
|
+
this.kc = kc;
|
|
104
|
+
// Configure K8s API clients
|
|
105
|
+
this.appsV1Api = kc.makeApiClient(k8s.AppsV1Api);
|
|
106
|
+
this.coreV1Api = kc.makeApiClient(k8s.CoreV1Api);
|
|
107
|
+
this.nodeV1Api = kc.makeApiClient(k8s.NodeV1Api);
|
|
108
|
+
// API clients are already configured with authentication through makeApiClient
|
|
109
|
+
logger.info(`🔧 K8s client initialized for namespace: ${this.config.kubernetes.namespace}`);
|
|
110
|
+
// Validate namespace exists and we have access
|
|
111
|
+
this.validateNamespace();
|
|
112
|
+
// Check runtime class availability on initialization (like Docker's gVisor check)
|
|
113
|
+
this.checkRuntimeClassAvailability();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Validate that the target namespace exists and we have access to it
|
|
117
|
+
*/
|
|
118
|
+
async validateNamespace() {
|
|
119
|
+
const namespace = this.config.kubernetes.namespace;
|
|
120
|
+
try {
|
|
121
|
+
await this.coreV1Api.readNamespace(namespace);
|
|
122
|
+
logger.info(`✅ Namespace '${namespace}' validated`);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
const k8sError = error;
|
|
126
|
+
if (k8sError.statusCode === 404) {
|
|
127
|
+
logger.error(`❌ Namespace '${namespace}' does not exist. ` +
|
|
128
|
+
`Create it with: kubectl create namespace ${namespace}`);
|
|
129
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Namespace '${namespace}' does not exist`, { namespace }, true);
|
|
130
|
+
}
|
|
131
|
+
else if (k8sError.statusCode === 403) {
|
|
132
|
+
// 403 Forbidden for namespace read is expected with namespace-scoped Roles
|
|
133
|
+
// The gateway can still create resources in the namespace without cluster-level namespace read permission
|
|
134
|
+
logger.info(`ℹ️ Namespace '${namespace}' access check skipped (namespace-scoped RBAC). ` +
|
|
135
|
+
`Will validate via resource operations.`);
|
|
136
|
+
// Don't throw - we're running in this namespace so it exists
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
logger.warn(`⚠️ Could not validate namespace '${namespace}': ${error instanceof Error ? error.message : String(error)}`);
|
|
140
|
+
// Don't throw - let operations fail with more specific errors
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Check if the configured RuntimeClass exists in the cluster
|
|
146
|
+
* Similar to Docker's checkGvisorAvailability()
|
|
147
|
+
*/
|
|
148
|
+
async checkRuntimeClassAvailability() {
|
|
149
|
+
const runtimeClassName = this.config.worker.runtimeClassName || "kata";
|
|
150
|
+
try {
|
|
151
|
+
await this.nodeV1Api.readRuntimeClass(runtimeClassName);
|
|
152
|
+
logger.info(`✅ RuntimeClass '${runtimeClassName}' verified and will be used for worker isolation`);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const k8sError = error;
|
|
156
|
+
if (k8sError.statusCode === 404) {
|
|
157
|
+
logger.warn(`⚠️ RuntimeClass '${runtimeClassName}' not found in cluster. ` +
|
|
158
|
+
`Workers will use default runtime. Consider installing ${runtimeClassName} for enhanced isolation.`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
logger.warn(`⚠️ Failed to verify RuntimeClass '${runtimeClassName}': ${error instanceof Error ? error.message : String(error)}`);
|
|
162
|
+
}
|
|
163
|
+
// Clear runtime class if not available or verification failed (workers will use default)
|
|
164
|
+
this.config.worker.runtimeClassName = undefined;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
getWorkerServiceAccountName() {
|
|
168
|
+
return this.config.worker.serviceAccountName || "lobu-worker";
|
|
169
|
+
}
|
|
170
|
+
getWorkerImagePullSecrets() {
|
|
171
|
+
const configured = this.config.worker.imagePullSecrets || [];
|
|
172
|
+
const names = configured.map((name) => name.trim()).filter(Boolean);
|
|
173
|
+
if (names.length === 0)
|
|
174
|
+
return undefined;
|
|
175
|
+
return names.map((name) => ({ name }));
|
|
176
|
+
}
|
|
177
|
+
getWorkerStartupTimeoutMs() {
|
|
178
|
+
var _a;
|
|
179
|
+
const timeoutSeconds = (_a = this.config.worker.startupTimeoutSeconds) !== null && _a !== void 0 ? _a : 90;
|
|
180
|
+
return Math.max(timeoutSeconds, 5) * 1000;
|
|
181
|
+
}
|
|
182
|
+
async listRawWorkerDeployments() {
|
|
183
|
+
var _a;
|
|
184
|
+
const k8sDeployments = await this.appsV1Api.listNamespacedDeployment(this.config.kubernetes.namespace, undefined, // pretty
|
|
185
|
+
undefined, // allowWatchBookmarks
|
|
186
|
+
undefined, // _continue
|
|
187
|
+
undefined, // fieldSelector
|
|
188
|
+
"app.kubernetes.io/component=worker" // labelSelector - only worker deployments
|
|
189
|
+
);
|
|
190
|
+
const response = k8sDeployments;
|
|
191
|
+
return ((_a = response.body) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Validate that the worker image exists and is pullable
|
|
195
|
+
* Called on gateway startup to ensure workers can be created
|
|
196
|
+
*/
|
|
197
|
+
async validateWorkerImage() {
|
|
198
|
+
const imageName = this.getWorkerImageReference();
|
|
199
|
+
logger.info(`ℹ️ Worker image configured: ${imageName} (pullPolicy: ${this.config.worker.image.pullPolicy || "Always"})`);
|
|
200
|
+
if (this.config.worker.image.pullPolicy === "Never") {
|
|
201
|
+
logger.warn(`⚠️ Worker image pullPolicy is 'Never'. Ensure image ${imageName} is pre-loaded on all nodes.`);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
await (0, helpers_1.runImagePullPreflight)(this.coreV1Api, this.config.kubernetes.namespace, imageName, this.config.worker.image.pullPolicy || "Always", this.getWorkerServiceAccountName(), this.getWorkerImagePullSecrets());
|
|
205
|
+
}
|
|
206
|
+
async reconcileWorkerDeploymentImages() {
|
|
207
|
+
await (0, helpers_1.reconcileWorkerDeploymentImages)(this.appsV1Api, this.config.kubernetes.namespace, this.getWorkerImageReference(), this.config.worker.image.pullPolicy || "Always", this.getWorkerServiceAccountName(), this.getWorkerImagePullSecrets(), () => this.listRawWorkerDeployments());
|
|
208
|
+
}
|
|
209
|
+
async listDeployments() {
|
|
210
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
211
|
+
try {
|
|
212
|
+
const now = Date.now();
|
|
213
|
+
const idleThresholdMinutes = this.config.worker.idleCleanupMinutes;
|
|
214
|
+
const veryOldDays = (0, deployment_utils_1.getVeryOldThresholdDays)(this.config);
|
|
215
|
+
const results = [];
|
|
216
|
+
for (const deployment of await this.listRawWorkerDeployments()) {
|
|
217
|
+
const deploymentName = ((_a = deployment.metadata) === null || _a === void 0 ? void 0 : _a.name) || "";
|
|
218
|
+
// Clean up orphaned finalizers on Terminating deployments (avoids extra API call)
|
|
219
|
+
if (((_b = deployment.metadata) === null || _b === void 0 ? void 0 : _b.deletionTimestamp) &&
|
|
220
|
+
((_d = (_c = deployment.metadata) === null || _c === void 0 ? void 0 : _c.finalizers) === null || _d === void 0 ? void 0 : _d.includes(exports.LOBU_FINALIZER))) {
|
|
221
|
+
logger.info(`Removing orphaned finalizer from Terminating deployment ${deploymentName}`);
|
|
222
|
+
(0, helpers_1.removeFinalizerFromResource)(this.appsV1Api, this.coreV1Api, this.config.kubernetes.namespace, "deployment", deploymentName).catch((err) => logger.warn(`Failed to remove orphaned finalizer from ${deploymentName}:`, err instanceof Error ? err.message : String(err)));
|
|
223
|
+
continue; // Skip Terminating deployments from the active list
|
|
224
|
+
}
|
|
225
|
+
// Get last activity from annotations or fallback to creation time
|
|
226
|
+
const lastActivityStr = ((_f = (_e = deployment.metadata) === null || _e === void 0 ? void 0 : _e.annotations) === null || _f === void 0 ? void 0 : _f["lobu.io/last-activity"]) ||
|
|
227
|
+
((_h = (_g = deployment.metadata) === null || _g === void 0 ? void 0 : _g.annotations) === null || _h === void 0 ? void 0 : _h["lobu.io/created"]) ||
|
|
228
|
+
((_j = deployment.metadata) === null || _j === void 0 ? void 0 : _j.creationTimestamp);
|
|
229
|
+
const lastActivity = lastActivityStr
|
|
230
|
+
? new Date(lastActivityStr)
|
|
231
|
+
: new Date();
|
|
232
|
+
const replicas = ((_k = deployment.spec) === null || _k === void 0 ? void 0 : _k.replicas) || 0;
|
|
233
|
+
results.push((0, deployment_utils_1.buildDeploymentInfoSummary)({
|
|
234
|
+
deploymentName,
|
|
235
|
+
lastActivity,
|
|
236
|
+
now,
|
|
237
|
+
idleThresholdMinutes,
|
|
238
|
+
veryOldDays,
|
|
239
|
+
replicas,
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
return results;
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Failed to list deployments: ${error instanceof Error ? error.message : String(error)}`, { error }, true);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async createDeployment(deploymentName, username, userId, messageData) {
|
|
249
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
250
|
+
// Extract traceparent for distributed tracing
|
|
251
|
+
const traceparent = (_a = messageData === null || messageData === void 0 ? void 0 : messageData.platformMetadata) === null || _a === void 0 ? void 0 : _a.traceparent;
|
|
252
|
+
logger.info({ traceparent, deploymentName, userId }, "Creating K8s deployment");
|
|
253
|
+
// Use agentId for PVC naming (shared across threads in same space)
|
|
254
|
+
const agentId = messageData === null || messageData === void 0 ? void 0 : messageData.agentId;
|
|
255
|
+
if (!agentId) {
|
|
256
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, "Missing agentId in message payload");
|
|
257
|
+
}
|
|
258
|
+
const pvcName = `lobu-workspace-${agentId}`;
|
|
259
|
+
// Check if Nix packages are configured (need init container + subPath mounts)
|
|
260
|
+
const hasNixConfig = ((_d = (_c = (_b = messageData === null || messageData === void 0 ? void 0 : messageData.nixConfig) === null || _b === void 0 ? void 0 : _b.packages) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0 ||
|
|
261
|
+
!!((_e = messageData === null || messageData === void 0 ? void 0 : messageData.nixConfig) === null || _e === void 0 ? void 0 : _e.flakeUrl);
|
|
262
|
+
// Use larger PVC when Nix packages are configured (Chromium etc. need space)
|
|
263
|
+
const pvcSize = hasNixConfig ? "5Gi" : undefined;
|
|
264
|
+
await (0, helpers_1.createPVC)(this.coreV1Api, this.config.kubernetes.namespace, pvcName, agentId, (_f = this.config.worker.persistence) === null || _f === void 0 ? void 0 : _f.storageClass, traceparent, pvcSize, (_g = this.config.worker.persistence) === null || _g === void 0 ? void 0 : _g.size);
|
|
265
|
+
// Get environment variables before creating the deployment spec
|
|
266
|
+
// Include secrets (same as Docker behavior) - secrets are passed via env vars
|
|
267
|
+
const envVars = await this.generateEnvironmentVariables(username, userId, deploymentName, messageData, true // Include secrets to match Docker behavior
|
|
268
|
+
);
|
|
269
|
+
const platform = (messageData === null || messageData === void 0 ? void 0 : messageData.platform) || "unknown";
|
|
270
|
+
const workerImage = this.getWorkerImageReference();
|
|
271
|
+
const deployment = {
|
|
272
|
+
apiVersion: "apps/v1",
|
|
273
|
+
kind: "Deployment",
|
|
274
|
+
metadata: {
|
|
275
|
+
name: deploymentName,
|
|
276
|
+
namespace: this.config.kubernetes.namespace,
|
|
277
|
+
labels: Object.assign(Object.assign({}, deployment_utils_1.BASE_WORKER_LABELS), { "lobu.io/platform": platform, "lobu.io/agent-id": agentId }),
|
|
278
|
+
annotations: {
|
|
279
|
+
"lobu.io/status": "running",
|
|
280
|
+
"lobu.io/created": new Date().toISOString(),
|
|
281
|
+
},
|
|
282
|
+
finalizers: [exports.LOBU_FINALIZER],
|
|
283
|
+
},
|
|
284
|
+
spec: {
|
|
285
|
+
replicas: 1,
|
|
286
|
+
selector: {
|
|
287
|
+
matchLabels: Object.assign({}, WORKER_SELECTOR_LABELS),
|
|
288
|
+
},
|
|
289
|
+
template: {
|
|
290
|
+
metadata: {
|
|
291
|
+
annotations: Object.assign(Object.assign(Object.assign({}, (0, deployment_utils_1.resolvePlatformDeploymentMetadata)(messageData)), { "lobu.io/created": new Date().toISOString(), "lobu.io/agent-id": agentId }), (traceparent ? { "lobu.io/traceparent": traceparent } : {})),
|
|
292
|
+
labels: Object.assign(Object.assign({}, deployment_utils_1.BASE_WORKER_LABELS), { "lobu.io/platform": platform }),
|
|
293
|
+
},
|
|
294
|
+
spec: Object.assign(Object.assign(Object.assign(Object.assign({ serviceAccountName: this.getWorkerServiceAccountName(), imagePullSecrets: this.getWorkerImagePullSecrets() }, (this.config.worker.runtimeClassName
|
|
295
|
+
? { runtimeClassName: this.config.worker.runtimeClassName }
|
|
296
|
+
: {})), { securityContext: {
|
|
297
|
+
fsGroup: exports.WORKER_SECURITY.GROUP_ID,
|
|
298
|
+
fsGroupChangePolicy: "OnRootMismatch",
|
|
299
|
+
} }), (hasNixConfig
|
|
300
|
+
? {
|
|
301
|
+
initContainers: [
|
|
302
|
+
{
|
|
303
|
+
name: "nix-bootstrap",
|
|
304
|
+
image: workerImage,
|
|
305
|
+
imagePullPolicy: this.config.worker.image.pullPolicy || "Always",
|
|
306
|
+
command: [
|
|
307
|
+
"bash",
|
|
308
|
+
"-c",
|
|
309
|
+
"if [ ! -f /workspace/.nix-bootstrapped ]; then " +
|
|
310
|
+
'echo "Bootstrapping Nix store to PVC..." && ' +
|
|
311
|
+
"cp -a /nix/store /workspace/.nix-store && " +
|
|
312
|
+
"cp -a /nix/var /workspace/.nix-var && " +
|
|
313
|
+
"mkdir -p /workspace/.nix-store/.nix-pvc-mounted && " +
|
|
314
|
+
"touch /workspace/.nix-bootstrapped && " +
|
|
315
|
+
'echo "Nix bootstrap complete"; ' +
|
|
316
|
+
'else echo "Nix store already bootstrapped"; fi',
|
|
317
|
+
],
|
|
318
|
+
securityContext: {
|
|
319
|
+
runAsUser: exports.WORKER_SECURITY.USER_ID,
|
|
320
|
+
runAsGroup: exports.WORKER_SECURITY.GROUP_ID,
|
|
321
|
+
},
|
|
322
|
+
volumeMounts: [
|
|
323
|
+
{
|
|
324
|
+
name: "workspace",
|
|
325
|
+
mountPath: "/workspace",
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
}
|
|
331
|
+
: {})), { containers: [
|
|
332
|
+
{
|
|
333
|
+
name: "worker",
|
|
334
|
+
image: workerImage,
|
|
335
|
+
imagePullPolicy: this.config.worker.image.pullPolicy || "Always",
|
|
336
|
+
securityContext: {
|
|
337
|
+
runAsUser: exports.WORKER_SECURITY.USER_ID,
|
|
338
|
+
runAsGroup: exports.WORKER_SECURITY.GROUP_ID,
|
|
339
|
+
runAsNonRoot: true,
|
|
340
|
+
// Enable read-only root filesystem for security (matches Docker behavior)
|
|
341
|
+
readOnlyRootFilesystem: true,
|
|
342
|
+
// Prevent privilege escalation
|
|
343
|
+
allowPrivilegeEscalation: false,
|
|
344
|
+
// Drop all capabilities (matches Docker CAP_DROP: ALL)
|
|
345
|
+
capabilities: {
|
|
346
|
+
drop: ["ALL"],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
env: [
|
|
350
|
+
// Common environment variables from base class
|
|
351
|
+
// (includes HTTP_PROXY, HTTPS_PROXY, NO_PROXY, NODE_ENV, DEBUG)
|
|
352
|
+
...Object.entries(envVars).map(([key, value]) => ({
|
|
353
|
+
name: key,
|
|
354
|
+
value: value,
|
|
355
|
+
})),
|
|
356
|
+
// Add traceparent for distributed tracing (passed to worker)
|
|
357
|
+
...(traceparent
|
|
358
|
+
? [{ name: "TRACEPARENT", value: traceparent }]
|
|
359
|
+
: []),
|
|
360
|
+
],
|
|
361
|
+
resources: {
|
|
362
|
+
requests: this.config.worker.resources.requests,
|
|
363
|
+
limits: this.config.worker.resources.limits,
|
|
364
|
+
},
|
|
365
|
+
volumeMounts: [
|
|
366
|
+
{
|
|
367
|
+
name: "workspace",
|
|
368
|
+
mountPath: "/workspace",
|
|
369
|
+
},
|
|
370
|
+
// Tmpfs mounts for writable directories (matches Docker behavior)
|
|
371
|
+
{
|
|
372
|
+
name: "tmp",
|
|
373
|
+
mountPath: "/tmp",
|
|
374
|
+
},
|
|
375
|
+
// /dev/shm for shared memory (needed by Chromium and other apps)
|
|
376
|
+
{
|
|
377
|
+
name: "dshm",
|
|
378
|
+
mountPath: "/dev/shm",
|
|
379
|
+
},
|
|
380
|
+
// When Nix packages configured, mount PVC subpaths at /nix/store and /nix/var
|
|
381
|
+
...(hasNixConfig
|
|
382
|
+
? [
|
|
383
|
+
{
|
|
384
|
+
name: "workspace",
|
|
385
|
+
mountPath: "/nix/store",
|
|
386
|
+
subPath: ".nix-store",
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
name: "workspace",
|
|
390
|
+
mountPath: "/nix/var",
|
|
391
|
+
subPath: ".nix-var",
|
|
392
|
+
},
|
|
393
|
+
]
|
|
394
|
+
: []),
|
|
395
|
+
],
|
|
396
|
+
},
|
|
397
|
+
], volumes: [
|
|
398
|
+
{
|
|
399
|
+
name: "workspace",
|
|
400
|
+
// Use per-deployment PVC for session persistence across scale-to-zero
|
|
401
|
+
persistentVolumeClaim: {
|
|
402
|
+
claimName: pvcName,
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
// Tmpfs volumes for temporary files (in-memory, matches Docker Tmpfs)
|
|
406
|
+
{
|
|
407
|
+
name: "tmp",
|
|
408
|
+
emptyDir: {
|
|
409
|
+
medium: "Memory",
|
|
410
|
+
sizeLimit: exports.WORKER_SECURITY.TMP_SIZE_LIMIT,
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
// Shared memory for Chromium and other apps requiring /dev/shm
|
|
414
|
+
{
|
|
415
|
+
name: "dshm",
|
|
416
|
+
emptyDir: {
|
|
417
|
+
medium: "Memory",
|
|
418
|
+
sizeLimit: "256Mi",
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
] }),
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
};
|
|
425
|
+
// Create child span for worker creation (linked to parent via traceparent)
|
|
426
|
+
const workerSpan = (0, core_1.createChildSpan)("worker_creation", traceparent, {
|
|
427
|
+
"lobu.deployment_name": deploymentName,
|
|
428
|
+
"lobu.user_id": userId,
|
|
429
|
+
"lobu.agent_id": agentId,
|
|
430
|
+
});
|
|
431
|
+
logger.info({ traceparent, deploymentName }, "Submitting deployment to K8s API");
|
|
432
|
+
try {
|
|
433
|
+
const response = await this.appsV1Api.createNamespacedDeployment(this.config.kubernetes.namespace, deployment);
|
|
434
|
+
await (0, helpers_1.waitForWorkerReady)(this.appsV1Api, this.coreV1Api, this.config.kubernetes.namespace, deploymentName, this.getWorkerStartupTimeoutMs());
|
|
435
|
+
const statusResponse = response;
|
|
436
|
+
workerSpan === null || workerSpan === void 0 ? void 0 : workerSpan.setAttribute("http.status_code", ((_h = statusResponse.response) === null || _h === void 0 ? void 0 : _h.statusCode) || 0);
|
|
437
|
+
workerSpan === null || workerSpan === void 0 ? void 0 : workerSpan.setStatus({ code: core_1.SpanStatusCode.OK });
|
|
438
|
+
workerSpan === null || workerSpan === void 0 ? void 0 : workerSpan.end();
|
|
439
|
+
logger.info({ deploymentName, status: (_j = statusResponse.response) === null || _j === void 0 ? void 0 : _j.statusCode }, "Deployment created and worker became ready");
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
const k8sError = error;
|
|
443
|
+
// Log detailed error information
|
|
444
|
+
logger.error(`❌ Failed to create deployment ${deploymentName}:`, {
|
|
445
|
+
statusCode: k8sError.statusCode,
|
|
446
|
+
message: k8sError.message,
|
|
447
|
+
body: k8sError.body,
|
|
448
|
+
response: (_k = k8sError.response) === null || _k === void 0 ? void 0 : _k.statusMessage,
|
|
449
|
+
});
|
|
450
|
+
// Clean up the PVC that was created before the deployment failed
|
|
451
|
+
try {
|
|
452
|
+
await this.coreV1Api.deleteNamespacedPersistentVolumeClaim(pvcName, this.config.kubernetes.namespace);
|
|
453
|
+
logger.info(`Cleaned up orphaned PVC ${pvcName} after deployment creation failure`);
|
|
454
|
+
}
|
|
455
|
+
catch (pvcCleanupError) {
|
|
456
|
+
const pvcError = pvcCleanupError;
|
|
457
|
+
if (pvcError.statusCode === 404) {
|
|
458
|
+
logger.debug(`PVC ${pvcName} already deleted, skipping cleanup`);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
logger.error(`Failed to clean up orphaned PVC ${pvcName}:`, pvcCleanupError instanceof Error
|
|
462
|
+
? pvcCleanupError.message
|
|
463
|
+
: String(pvcCleanupError));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
// End span with error
|
|
467
|
+
workerSpan === null || workerSpan === void 0 ? void 0 : workerSpan.setStatus({
|
|
468
|
+
code: core_1.SpanStatusCode.ERROR,
|
|
469
|
+
message: k8sError.message || "Deployment failed",
|
|
470
|
+
});
|
|
471
|
+
workerSpan === null || workerSpan === void 0 ? void 0 : workerSpan.end();
|
|
472
|
+
// Check for specific error conditions and throw OrchestratorError
|
|
473
|
+
if (k8sError.statusCode === 409) {
|
|
474
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Deployment ${deploymentName} already exists`, { deploymentName, statusCode: 409 }, false);
|
|
475
|
+
}
|
|
476
|
+
else if (k8sError.statusCode === 403) {
|
|
477
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Insufficient permissions to create deployment ${deploymentName}`, { deploymentName, statusCode: 403 }, true);
|
|
478
|
+
}
|
|
479
|
+
else if (k8sError.statusCode === 422) {
|
|
480
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Invalid deployment specification for ${deploymentName}: ${JSON.stringify(k8sError.body)}`, { deploymentName, statusCode: 422, body: k8sError.body }, true);
|
|
481
|
+
}
|
|
482
|
+
else if (((_l = k8sError.message) === null || _l === void 0 ? void 0 : _l.includes("timeout")) ||
|
|
483
|
+
k8sError.code === "ETIMEDOUT") {
|
|
484
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `Timeout creating deployment ${deploymentName} - K8s API may be overloaded`, { deploymentName, code: k8sError.code }, true);
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_CREATE_FAILED, `HTTP request failed: ${k8sError.message || ((_m = k8sError.response) === null || _m === void 0 ? void 0 : _m.statusMessage) || "Unknown error"}`, { deploymentName, error }, true);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
async scaleDeployment(deploymentName, replicas) {
|
|
492
|
+
var _a, _b;
|
|
493
|
+
try {
|
|
494
|
+
const deployment = await this.appsV1Api.readNamespacedDeployment(deploymentName, this.config.kubernetes.namespace);
|
|
495
|
+
if (((_b = (_a = deployment.body) === null || _a === void 0 ? void 0 : _a.spec) === null || _b === void 0 ? void 0 : _b.replicas) !== replicas) {
|
|
496
|
+
const patch = {
|
|
497
|
+
metadata: {
|
|
498
|
+
annotations: {
|
|
499
|
+
"lobu.io/status": replicas > 0 ? "running" : "scaled-down",
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
spec: {
|
|
503
|
+
replicas: replicas,
|
|
504
|
+
},
|
|
505
|
+
};
|
|
506
|
+
await this.appsV1Api.patchNamespacedDeployment(deploymentName, this.config.kubernetes.namespace, patch, undefined, undefined, undefined, undefined, undefined, {
|
|
507
|
+
headers: {
|
|
508
|
+
"Content-Type": "application/strategic-merge-patch+json",
|
|
509
|
+
},
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
if (replicas > 0) {
|
|
513
|
+
await (0, helpers_1.waitForWorkerReady)(this.appsV1Api, this.coreV1Api, this.config.kubernetes.namespace, deploymentName, this.getWorkerStartupTimeoutMs());
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
throw new core_1.OrchestratorError(core_1.ErrorCode.DEPLOYMENT_SCALE_FAILED, `Failed to scale deployment ${deploymentName}: ${error instanceof Error ? error.message : String(error)}`, { deploymentName, replicas, error }, true);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
async deleteDeployment(deploymentName) {
|
|
521
|
+
// Remove our finalizer before deleting so the resource can be garbage-collected
|
|
522
|
+
await (0, helpers_1.removeFinalizerFromResource)(this.appsV1Api, this.coreV1Api, this.config.kubernetes.namespace, "deployment", deploymentName);
|
|
523
|
+
// Delete the deployment with propagation policy
|
|
524
|
+
try {
|
|
525
|
+
await this.appsV1Api.deleteNamespacedDeployment(deploymentName, this.config.kubernetes.namespace, undefined, undefined, undefined, undefined, "Foreground" // Wait for pods to terminate before returning
|
|
526
|
+
);
|
|
527
|
+
logger.info(`✅ Deleted deployment: ${deploymentName}`);
|
|
528
|
+
}
|
|
529
|
+
catch (error) {
|
|
530
|
+
const k8sError = error;
|
|
531
|
+
if (k8sError.statusCode === 404) {
|
|
532
|
+
logger.info(`⚠️ Deployment ${deploymentName} not found (already deleted)`);
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
throw error;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
// NOTE: Space PVCs are NOT deleted on deployment deletion
|
|
539
|
+
// They are shared across threads in the same space and persist
|
|
540
|
+
// for future conversations. Cleanup is done manually or via separate process.
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Override reconcileDeployments to also clean up orphaned PVC finalizers.
|
|
544
|
+
* Deployment orphan cleanup is handled inside listDeployments() to avoid
|
|
545
|
+
* duplicate API calls (listDeployments already iterates raw K8s objects).
|
|
546
|
+
*/
|
|
547
|
+
async reconcileDeployments() {
|
|
548
|
+
await this.reconcileWorkerDeploymentImages();
|
|
549
|
+
await (0, helpers_1.cleanupOrphanedPvcFinalizers)(this.appsV1Api, this.coreV1Api, this.config.kubernetes.namespace);
|
|
550
|
+
await super.reconcileDeployments();
|
|
551
|
+
}
|
|
552
|
+
async updateDeploymentActivity(deploymentName) {
|
|
553
|
+
try {
|
|
554
|
+
const timestamp = new Date().toISOString();
|
|
555
|
+
const patch = {
|
|
556
|
+
metadata: {
|
|
557
|
+
annotations: {
|
|
558
|
+
"lobu.io/last-activity": timestamp,
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
await this.appsV1Api.patchNamespacedDeployment(deploymentName, this.config.kubernetes.namespace, patch, undefined, undefined, undefined, undefined, undefined, {
|
|
563
|
+
headers: { "Content-Type": "application/strategic-merge-patch+json" },
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
logger.error(`❌ Failed to update activity for deployment ${deploymentName}:`, error instanceof Error ? error.message : String(error));
|
|
568
|
+
// Don't throw - activity tracking should not block message processing
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
getDispatcherHost() {
|
|
572
|
+
const dispatcherService = process.env.DISPATCHER_SERVICE_NAME || "lobu-dispatcher";
|
|
573
|
+
return `${dispatcherService}.${this.config.kubernetes.namespace}.svc.cluster.local`;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Start a watch-based informer for worker deployments.
|
|
577
|
+
* The informer maintains a local cache that is updated via K8s watch events,
|
|
578
|
+
* reducing the need for frequent list API calls.
|
|
579
|
+
*/
|
|
580
|
+
async startInformer() {
|
|
581
|
+
if (this.informer || this.informerInitializing)
|
|
582
|
+
return;
|
|
583
|
+
this.informerInitializing = true;
|
|
584
|
+
const namespace = this.config.kubernetes.namespace;
|
|
585
|
+
const listFn = () => this.appsV1Api.listNamespacedDeployment(namespace, undefined, undefined, undefined, undefined, "app.kubernetes.io/component=worker");
|
|
586
|
+
try {
|
|
587
|
+
this.informer = k8s.makeInformer(this.kc, `/apis/apps/v1/namespaces/${namespace}/deployments`, listFn, "app.kubernetes.io/component=worker");
|
|
588
|
+
this.informer.on("error", (err) => {
|
|
589
|
+
logger.warn("Informer error, will auto-restart:", err instanceof Error ? err.message : String(err));
|
|
590
|
+
});
|
|
591
|
+
await this.informer.start();
|
|
592
|
+
logger.info("K8s deployment informer started");
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
logger.warn("Failed to start informer, falling back to polling:", error instanceof Error ? error.message : String(error));
|
|
596
|
+
this.informer = null;
|
|
597
|
+
}
|
|
598
|
+
finally {
|
|
599
|
+
this.informerInitializing = false;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Stop the informer and clear the cache.
|
|
604
|
+
*/
|
|
605
|
+
async stopInformer() {
|
|
606
|
+
if (this.informer) {
|
|
607
|
+
this.informer.stop();
|
|
608
|
+
this.informer = null;
|
|
609
|
+
logger.info("K8s deployment informer stopped");
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Whether the informer is active and has a populated cache.
|
|
614
|
+
*/
|
|
615
|
+
isInformerActive() {
|
|
616
|
+
return this.informer !== null;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
exports.K8sDeploymentManager = K8sDeploymentManager;
|
|
620
|
+
//# sourceMappingURL=deployment.js.map
|