@nextclaw/service 0.1.14 → 0.1.16
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/cli/commands/agent/agent-runtime.utils.d.ts +2 -1
- package/dist/cli/commands/agent/agent-runtime.utils.d.ts.map +1 -0
- package/dist/cli/commands/agent/agent-runtime.utils.js +3 -1
- package/dist/cli/commands/agent/agent-runtime.utils.js.map +1 -0
- package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts +2 -1
- package/dist/cli/commands/agent/cli-agent-runner.utils.d.ts.map +1 -0
- package/dist/cli/commands/agent/cli-agent-runner.utils.js +3 -5
- package/dist/cli/commands/agent/cli-agent-runner.utils.js.map +1 -0
- package/dist/cli/commands/agent/services/agent-commands.service.d.ts +2 -1
- package/dist/cli/commands/agent/services/agent-commands.service.d.ts.map +1 -0
- package/dist/cli/commands/agent/services/agent-commands.service.js +2 -0
- package/dist/cli/commands/agent/services/agent-commands.service.js.map +1 -0
- package/dist/cli/commands/config/services/config-commands.service.d.ts +2 -1
- package/dist/cli/commands/config/services/config-commands.service.d.ts.map +1 -0
- package/dist/cli/commands/config/services/config-commands.service.js +2 -0
- package/dist/cli/commands/config/services/config-commands.service.js.map +1 -0
- package/dist/cli/commands/cron/services/cron-commands.service.d.ts +2 -1
- package/dist/cli/commands/cron/services/cron-commands.service.d.ts.map +1 -0
- package/dist/cli/commands/cron/services/cron-commands.service.js +2 -0
- package/dist/cli/commands/cron/services/cron-commands.service.js.map +1 -0
- package/dist/cli/commands/cron/services/cron-local.service.d.ts +2 -1
- package/dist/cli/commands/cron/services/cron-local.service.d.ts.map +1 -0
- package/dist/cli/commands/cron/services/cron-local.service.js +2 -0
- package/dist/cli/commands/cron/services/cron-local.service.js.map +1 -0
- package/dist/cli/commands/cron/utils/cron-job.utils.d.ts +2 -1
- package/dist/cli/commands/cron/utils/cron-job.utils.d.ts.map +1 -0
- package/dist/cli/commands/cron/utils/cron-job.utils.js +2 -0
- package/dist/cli/commands/cron/utils/cron-job.utils.js.map +1 -0
- package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts +4 -1
- package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js +40 -14
- package/dist/cli/commands/diagnostics/services/diagnostics-commands.service.js.map +1 -0
- package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts +2 -1
- package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js +8 -0
- package/dist/cli/commands/diagnostics/utils/diagnostics-render.utils.js.map +1 -0
- package/dist/cli/commands/gateway/index.d.ts +2 -1
- package/dist/cli/commands/gateway/index.d.ts.map +1 -0
- package/dist/cli/commands/gateway/index.js +2 -0
- package/dist/cli/commands/gateway/index.js.map +1 -0
- package/dist/cli/commands/logs/index.d.ts +2 -1
- package/dist/cli/commands/logs/index.d.ts.map +1 -0
- package/dist/cli/commands/logs/index.js +2 -0
- package/dist/cli/commands/logs/index.js.map +1 -0
- package/dist/cli/commands/mcp/index.d.ts +2 -1
- package/dist/cli/commands/mcp/index.d.ts.map +1 -0
- package/dist/cli/commands/mcp/index.js +2 -0
- package/dist/cli/commands/mcp/index.js.map +1 -0
- package/dist/cli/commands/restart/index.d.ts +2 -1
- package/dist/cli/commands/restart/index.d.ts.map +1 -0
- package/dist/cli/commands/restart/index.js +2 -0
- package/dist/cli/commands/restart/index.js.map +1 -0
- package/dist/cli/commands/secrets/index.d.ts +2 -1
- package/dist/cli/commands/secrets/index.d.ts.map +1 -0
- package/dist/cli/commands/secrets/index.js +2 -0
- package/dist/cli/commands/secrets/index.js.map +1 -0
- package/dist/cli/commands/serve/index.d.ts +2 -1
- package/dist/cli/commands/serve/index.d.ts.map +1 -0
- package/dist/cli/commands/serve/index.js +2 -0
- package/dist/cli/commands/serve/index.js.map +1 -0
- package/dist/cli/commands/skills/index.d.ts +2 -1
- package/dist/cli/commands/skills/index.d.ts.map +1 -0
- package/dist/cli/commands/skills/index.js +2 -0
- package/dist/cli/commands/skills/index.js.map +1 -0
- package/dist/cli/commands/skills/marketplace-client.d.ts +2 -1
- package/dist/cli/commands/skills/marketplace-client.d.ts.map +1 -0
- package/dist/cli/commands/skills/marketplace-client.js +2 -0
- package/dist/cli/commands/skills/marketplace-client.js.map +1 -0
- package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts +2 -1
- package/dist/cli/commands/skills/marketplace-command-options.utils.d.ts.map +1 -0
- package/dist/cli/commands/skills/marketplace-command-options.utils.js +2 -0
- package/dist/cli/commands/skills/marketplace-command-options.utils.js.map +1 -0
- package/dist/cli/commands/skills/marketplace-identity.utils.d.ts +2 -1
- package/dist/cli/commands/skills/marketplace-identity.utils.d.ts.map +1 -0
- package/dist/cli/commands/skills/marketplace-identity.utils.js +2 -0
- package/dist/cli/commands/skills/marketplace-identity.utils.js.map +1 -0
- package/dist/cli/commands/skills/marketplace-network-retry.d.ts +2 -1
- package/dist/cli/commands/skills/marketplace-network-retry.d.ts.map +1 -0
- package/dist/cli/commands/skills/marketplace-network-retry.js +2 -0
- package/dist/cli/commands/skills/marketplace-network-retry.js.map +1 -0
- package/dist/cli/commands/skills/marketplace.metadata.d.ts +2 -1
- package/dist/cli/commands/skills/marketplace.metadata.d.ts.map +1 -0
- package/dist/cli/commands/skills/marketplace.metadata.js +2 -0
- package/dist/cli/commands/skills/marketplace.metadata.js.map +1 -0
- package/dist/cli/commands/skills/marketplace.utils.d.ts +2 -1
- package/dist/cli/commands/skills/marketplace.utils.d.ts.map +1 -0
- package/dist/cli/commands/skills/marketplace.utils.js +2 -0
- package/dist/cli/commands/skills/marketplace.utils.js.map +1 -0
- package/dist/cli/commands/skills/skills-query.service.d.ts +2 -1
- package/dist/cli/commands/skills/skills-query.service.d.ts.map +1 -0
- package/dist/cli/commands/skills/skills-query.service.js +2 -0
- package/dist/cli/commands/skills/skills-query.service.js.map +1 -0
- package/dist/cli/commands/start/index.d.ts +2 -1
- package/dist/cli/commands/start/index.d.ts.map +1 -0
- package/dist/cli/commands/start/index.js +2 -0
- package/dist/cli/commands/start/index.js.map +1 -0
- package/dist/cli/commands/stop/index.d.ts +2 -1
- package/dist/cli/commands/stop/index.d.ts.map +1 -0
- package/dist/cli/commands/stop/index.js +2 -0
- package/dist/cli/commands/stop/index.js.map +1 -0
- package/dist/cli/commands/ui/index.d.ts +2 -1
- package/dist/cli/commands/ui/index.d.ts.map +1 -0
- package/dist/cli/commands/ui/index.js +2 -0
- package/dist/cli/commands/ui/index.js.map +1 -0
- package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts +2 -1
- package/dist/cli/commands/usage/services/llm-usage-command.service.d.ts.map +1 -0
- package/dist/cli/commands/usage/services/llm-usage-command.service.js +2 -0
- package/dist/cli/commands/usage/services/llm-usage-command.service.js.map +1 -0
- package/dist/commands/channel/channel-config-view.d.ts +2 -1
- package/dist/commands/channel/channel-config-view.d.ts.map +1 -0
- package/dist/commands/channel/channel-config-view.js +2 -0
- package/dist/commands/channel/channel-config-view.js.map +1 -0
- package/dist/commands/channel/channel-list-view.service.d.ts +2 -1
- package/dist/commands/channel/channel-list-view.service.d.ts.map +1 -0
- package/dist/commands/channel/channel-list-view.service.js +2 -0
- package/dist/commands/channel/channel-list-view.service.js.map +1 -0
- package/dist/commands/channel/index.d.ts +2 -1
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +2 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/platform-auth/services/account-status.service.d.ts +2 -1
- package/dist/commands/platform-auth/services/account-status.service.d.ts.map +1 -0
- package/dist/commands/platform-auth/services/account-status.service.js +2 -0
- package/dist/commands/platform-auth/services/account-status.service.js.map +1 -0
- package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts +2 -1
- package/dist/commands/platform-auth/services/platform-auth-commands.service.d.ts.map +1 -0
- package/dist/commands/platform-auth/services/platform-auth-commands.service.js +2 -0
- package/dist/commands/platform-auth/services/platform-auth-commands.service.js.map +1 -0
- package/dist/commands/platform-auth/utils/payload.utils.d.ts +2 -1
- package/dist/commands/platform-auth/utils/payload.utils.d.ts.map +1 -0
- package/dist/commands/platform-auth/utils/payload.utils.js +2 -0
- package/dist/commands/platform-auth/utils/payload.utils.js.map +1 -0
- package/dist/commands/plugin/index.d.ts +2 -1
- package/dist/commands/plugin/index.d.ts.map +1 -0
- package/dist/commands/plugin/index.js +2 -0
- package/dist/commands/plugin/index.js.map +1 -0
- package/dist/commands/plugin/plugin-command.utils.d.ts +2 -1
- package/dist/commands/plugin/plugin-command.utils.d.ts.map +1 -0
- package/dist/commands/plugin/plugin-command.utils.js +2 -0
- package/dist/commands/plugin/plugin-command.utils.js.map +1 -0
- package/dist/commands/plugin/plugin-mutation-actions.utils.d.ts +2 -1
- package/dist/commands/plugin/plugin-mutation-actions.utils.d.ts.map +1 -0
- package/dist/commands/plugin/plugin-mutation-actions.utils.js +2 -0
- package/dist/commands/plugin/plugin-mutation-actions.utils.js.map +1 -0
- package/dist/commands/remote/index.d.ts +2 -1
- package/dist/commands/remote/index.d.ts.map +1 -0
- package/dist/commands/remote/index.js +2 -0
- package/dist/commands/remote/index.js.map +1 -0
- package/dist/commands/remote/services/remote-access-host.service.d.ts +2 -1
- package/dist/commands/remote/services/remote-access-host.service.d.ts.map +1 -0
- package/dist/commands/remote/services/remote-access-host.service.js +2 -0
- package/dist/commands/remote/services/remote-access-host.service.js.map +1 -0
- package/dist/commands/remote/services/remote-service-control.service.d.ts +2 -1
- package/dist/commands/remote/services/remote-service-control.service.d.ts.map +1 -0
- package/dist/commands/remote/services/remote-service-control.service.js +134 -75
- package/dist/commands/remote/services/remote-service-control.service.js.map +1 -0
- package/dist/commands/remote/utils/platform-api-base.utils.d.ts +2 -1
- package/dist/commands/remote/utils/platform-api-base.utils.d.ts.map +1 -0
- package/dist/commands/remote/utils/platform-api-base.utils.js +2 -0
- package/dist/commands/remote/utils/platform-api-base.utils.js.map +1 -0
- package/dist/commands/remote/utils/remote-runtime-support.utils.d.ts +2 -1
- package/dist/commands/remote/utils/remote-runtime-support.utils.d.ts.map +1 -0
- package/dist/commands/remote/utils/remote-runtime-support.utils.js +2 -0
- package/dist/commands/remote/utils/remote-runtime-support.utils.js.map +1 -0
- package/dist/commands/service/index.d.ts +2 -1
- package/dist/commands/service/index.d.ts.map +1 -0
- package/dist/commands/service/index.js +2 -0
- package/dist/commands/service/index.js.map +1 -0
- package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts +2 -1
- package/dist/commands/service/services/autostart/host-autostart-command.service.d.ts.map +1 -0
- package/dist/commands/service/services/autostart/host-autostart-command.service.js +2 -0
- package/dist/commands/service/services/autostart/host-autostart-command.service.js.map +1 -0
- package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts +2 -1
- package/dist/commands/service/services/autostart/host-autostart-runtime.service.d.ts.map +1 -0
- package/dist/commands/service/services/autostart/host-autostart-runtime.service.js +2 -0
- package/dist/commands/service/services/autostart/host-autostart-runtime.service.js.map +1 -0
- package/dist/commands/service/services/autostart/host-autostart.service.d.ts +2 -1
- package/dist/commands/service/services/autostart/host-autostart.service.d.ts.map +1 -0
- package/dist/commands/service/services/autostart/host-autostart.service.js +2 -0
- package/dist/commands/service/services/autostart/host-autostart.service.js.map +1 -0
- package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts +2 -1
- package/dist/commands/service/services/autostart/linux-systemd-autostart.service.d.ts.map +1 -0
- package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js +2 -0
- package/dist/commands/service/services/autostart/linux-systemd-autostart.service.js.map +1 -0
- package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts +2 -1
- package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.d.ts.map +1 -0
- package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js +2 -0
- package/dist/commands/service/services/autostart/macos-launch-agent-autostart.service.js.map +1 -0
- package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts +2 -1
- package/dist/commands/service/services/autostart/windows-task-autostart.service.d.ts.map +1 -0
- package/dist/commands/service/services/autostart/windows-task-autostart.service.js +2 -0
- package/dist/commands/service/services/autostart/windows-task-autostart.service.js.map +1 -0
- package/dist/commands/service/types/autostart/host-autostart.types.d.ts +2 -1
- package/dist/commands/service/types/autostart/host-autostart.types.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-bundle-layout.store.d.ts +2 -1
- package/dist/launcher/npm-runtime-bundle-layout.store.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-bundle-layout.store.js +2 -0
- package/dist/launcher/npm-runtime-bundle-layout.store.js.map +1 -0
- package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts +2 -1
- package/dist/launcher/npm-runtime-bundle-manifest.service.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-bundle-manifest.service.js +2 -0
- package/dist/launcher/npm-runtime-bundle-manifest.service.js.map +1 -0
- package/dist/launcher/npm-runtime-bundle.service.d.ts +2 -1
- package/dist/launcher/npm-runtime-bundle.service.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-bundle.service.js +2 -0
- package/dist/launcher/npm-runtime-bundle.service.js.map +1 -0
- package/dist/launcher/npm-runtime-bundle.types.d.ts +2 -1
- package/dist/launcher/npm-runtime-bundle.types.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-launcher.service.d.ts +2 -1
- package/dist/launcher/npm-runtime-launcher.service.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-launcher.service.js +2 -0
- package/dist/launcher/npm-runtime-launcher.service.js.map +1 -0
- package/dist/launcher/npm-runtime-update-command.service.d.ts +5 -1
- package/dist/launcher/npm-runtime-update-command.service.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-update-command.service.js +32 -0
- package/dist/launcher/npm-runtime-update-command.service.js.map +1 -0
- package/dist/launcher/npm-runtime-update-source.service.d.ts +2 -1
- package/dist/launcher/npm-runtime-update-source.service.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-update-source.service.js +2 -0
- package/dist/launcher/npm-runtime-update-source.service.js.map +1 -0
- package/dist/launcher/npm-runtime-update-state.store.d.ts +2 -1
- package/dist/launcher/npm-runtime-update-state.store.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-update-state.store.js +2 -0
- package/dist/launcher/npm-runtime-update-state.store.js.map +1 -0
- package/dist/launcher/npm-runtime-update.manager.d.ts +2 -1
- package/dist/launcher/npm-runtime-update.manager.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-update.manager.js +2 -0
- package/dist/launcher/npm-runtime-update.manager.js.map +1 -0
- package/dist/launcher/npm-runtime-update.service.d.ts +2 -1
- package/dist/launcher/npm-runtime-update.service.d.ts.map +1 -0
- package/dist/launcher/npm-runtime-update.service.js +2 -0
- package/dist/launcher/npm-runtime-update.service.js.map +1 -0
- package/dist/service-runtime.service.d.ts +2 -1
- package/dist/service-runtime.service.d.ts.map +1 -0
- package/dist/service-runtime.service.js +6 -1
- package/dist/service-runtime.service.js.map +1 -0
- package/dist/shared/controllers/gateway.controller.d.ts +2 -1
- package/dist/shared/controllers/gateway.controller.d.ts.map +1 -0
- package/dist/shared/controllers/gateway.controller.js +2 -0
- package/dist/shared/controllers/gateway.controller.js.map +1 -0
- package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts +2 -1
- package/dist/shared/services/gateway/gateway-restart-wake.service.d.ts.map +1 -0
- package/dist/shared/services/gateway/gateway-restart-wake.service.js +2 -0
- package/dist/shared/services/gateway/gateway-restart-wake.service.js.map +1 -0
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts +2 -1
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.d.ts.map +1 -0
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.js +2 -0
- package/dist/shared/services/gateway/managers/gateway-plugin.manager.js.map +1 -0
- package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts +2 -1
- package/dist/shared/services/gateway/managers/gateway-remote.manager.d.ts.map +1 -0
- package/dist/shared/services/gateway/managers/gateway-remote.manager.js +2 -0
- package/dist/shared/services/gateway/managers/gateway-remote.manager.js.map +1 -0
- package/dist/shared/services/gateway/nextclaw-app.service.d.ts +2 -1
- package/dist/shared/services/gateway/nextclaw-app.service.d.ts.map +1 -0
- package/dist/shared/services/gateway/nextclaw-app.service.js +2 -0
- package/dist/shared/services/gateway/nextclaw-app.service.js.map +1 -0
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts +2 -1
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.d.ts.map +1 -0
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js +2 -0
- package/dist/shared/services/gateway/nextclaw-gateway-runtime.service.js.map +1 -0
- package/dist/shared/services/gateway/service-bootstrap-status.service.d.ts +2 -1
- package/dist/shared/services/gateway/service-bootstrap-status.service.d.ts.map +1 -0
- package/dist/shared/services/gateway/service-bootstrap-status.service.js +2 -0
- package/dist/shared/services/gateway/service-bootstrap-status.service.js.map +1 -0
- package/dist/shared/services/gateway/service-startup-support.service.d.ts +2 -1
- package/dist/shared/services/gateway/service-startup-support.service.d.ts.map +1 -0
- package/dist/shared/services/gateway/service-startup-support.service.js +2 -0
- package/dist/shared/services/gateway/service-startup-support.service.js.map +1 -0
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.d.ts +2 -1
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.d.ts.map +1 -0
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.js +2 -0
- package/dist/shared/services/gateway/utils/cron-job-handler.utils.js.map +1 -0
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts +2 -1
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.d.ts.map +1 -0
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js +2 -0
- package/dist/shared/services/gateway/utils/gateway-runtime-lifecycle.utils.js.map +1 -0
- package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts +2 -1
- package/dist/shared/services/marketplace/service-marketplace-installer.service.d.ts.map +1 -0
- package/dist/shared/services/marketplace/service-marketplace-installer.service.js +2 -0
- package/dist/shared/services/marketplace/service-marketplace-installer.service.js.map +1 -0
- package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts +2 -1
- package/dist/shared/services/marketplace/service-mcp-marketplace-ops.d.ts.map +1 -0
- package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js +2 -0
- package/dist/shared/services/marketplace/service-mcp-marketplace-ops.js.map +1 -0
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts +2 -1
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.d.ts.map +1 -0
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js +2 -0
- package/dist/shared/services/plugin/utils/plugin-dev-hot-reload.utils.js.map +1 -0
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts +2 -1
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.d.ts.map +1 -0
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js +2 -1
- package/dist/shared/services/plugin/utils/plugin-runtime-bridge.utils.js.map +1 -0
- package/dist/shared/services/restart/restart-coordinator.service.d.ts +2 -1
- package/dist/shared/services/restart/restart-coordinator.service.d.ts.map +1 -0
- package/dist/shared/services/restart/restart-coordinator.service.js +2 -0
- package/dist/shared/services/restart/restart-coordinator.service.js.map +1 -0
- package/dist/shared/services/restart/restart-sentinel.service.d.ts +2 -1
- package/dist/shared/services/restart/restart-sentinel.service.d.ts.map +1 -0
- package/dist/shared/services/restart/restart-sentinel.service.js +2 -0
- package/dist/shared/services/restart/restart-sentinel.service.js.map +1 -0
- package/dist/shared/services/restart/runtime-restart-request.service.d.ts +2 -1
- package/dist/shared/services/restart/runtime-restart-request.service.d.ts.map +1 -0
- package/dist/shared/services/restart/runtime-restart-request.service.js +2 -0
- package/dist/shared/services/restart/runtime-restart-request.service.js.map +1 -0
- package/dist/shared/services/runtime/managed-service-supervisor.service.d.ts +85 -0
- package/dist/shared/services/runtime/managed-service-supervisor.service.d.ts.map +1 -0
- package/dist/shared/services/runtime/managed-service-supervisor.service.js +271 -0
- package/dist/shared/services/runtime/managed-service-supervisor.service.js.map +1 -0
- package/dist/shared/services/runtime/nextclaw-distribution.service.d.ts +2 -1
- package/dist/shared/services/runtime/nextclaw-distribution.service.d.ts.map +1 -0
- package/dist/shared/services/runtime/nextclaw-distribution.service.js +2 -0
- package/dist/shared/services/runtime/nextclaw-distribution.service.js.map +1 -0
- package/dist/shared/services/runtime/runtime-command.service.d.ts +3 -1
- package/dist/shared/services/runtime/runtime-command.service.d.ts.map +1 -0
- package/dist/shared/services/runtime/runtime-command.service.js +5 -0
- package/dist/shared/services/runtime/runtime-command.service.js.map +1 -0
- package/dist/shared/services/runtime/runtime-config-init.service.d.ts +2 -1
- package/dist/shared/services/runtime/runtime-config-init.service.d.ts.map +1 -0
- package/dist/shared/services/runtime/runtime-config-init.service.js +2 -0
- package/dist/shared/services/runtime/runtime-config-init.service.js.map +1 -0
- package/dist/shared/services/runtime/service-managed-startup.service.d.ts +4 -32
- package/dist/shared/services/runtime/service-managed-startup.service.d.ts.map +1 -0
- package/dist/shared/services/runtime/service-managed-startup.service.js +10 -92
- package/dist/shared/services/runtime/service-managed-startup.service.js.map +1 -0
- package/dist/shared/services/runtime/utils/managed-service-routing.utils.d.ts +2 -1
- package/dist/shared/services/runtime/utils/managed-service-routing.utils.d.ts.map +1 -0
- package/dist/shared/services/runtime/utils/managed-service-routing.utils.js +2 -0
- package/dist/shared/services/runtime/utils/managed-service-routing.utils.js.map +1 -0
- package/dist/shared/services/runtime/utils/service-remote-runtime.utils.d.ts +5 -2
- package/dist/shared/services/runtime/utils/service-remote-runtime.utils.d.ts.map +1 -0
- package/dist/shared/services/runtime/utils/service-remote-runtime.utils.js +23 -17
- package/dist/shared/services/runtime/utils/service-remote-runtime.utils.js.map +1 -0
- package/dist/shared/services/ui/companion-runtime.service.d.ts +2 -1
- package/dist/shared/services/ui/companion-runtime.service.d.ts.map +1 -0
- package/dist/shared/services/ui/companion-runtime.service.js +2 -0
- package/dist/shared/services/ui/companion-runtime.service.js.map +1 -0
- package/dist/shared/services/ui/local-ui-discovery.service.d.ts +2 -1
- package/dist/shared/services/ui/local-ui-discovery.service.d.ts.map +1 -0
- package/dist/shared/services/ui/local-ui-discovery.service.js +2 -0
- package/dist/shared/services/ui/local-ui-discovery.service.js.map +1 -0
- package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts +2 -1
- package/dist/shared/services/ui/npm-runtime-update-host.service.d.ts.map +1 -0
- package/dist/shared/services/ui/npm-runtime-update-host.service.js +2 -0
- package/dist/shared/services/ui/npm-runtime-update-host.service.js.map +1 -0
- package/dist/shared/services/ui/runtime-control-host.service.d.ts +2 -1
- package/dist/shared/services/ui/runtime-control-host.service.d.ts.map +1 -0
- package/dist/shared/services/ui/runtime-control-host.service.js +2 -0
- package/dist/shared/services/ui/runtime-control-host.service.js.map +1 -0
- package/dist/shared/services/ui/service-remote-access.service.d.ts +2 -1
- package/dist/shared/services/ui/service-remote-access.service.d.ts.map +1 -0
- package/dist/shared/services/ui/service-remote-access.service.js +2 -0
- package/dist/shared/services/ui/service-remote-access.service.js.map +1 -0
- package/dist/shared/services/ui/ui-bridge-api.service.d.ts +2 -1
- package/dist/shared/services/ui/ui-bridge-api.service.d.ts.map +1 -0
- package/dist/shared/services/ui/ui-bridge-api.service.js +2 -0
- package/dist/shared/services/ui/ui-bridge-api.service.js.map +1 -0
- package/dist/shared/services/workspace/workspace-manager.service.d.ts +2 -1
- package/dist/shared/services/workspace/workspace-manager.service.d.ts.map +1 -0
- package/dist/shared/services/workspace/workspace-manager.service.js +2 -0
- package/dist/shared/services/workspace/workspace-manager.service.js.map +1 -0
- package/dist/shared/stores/companion-runtime.store.d.ts +2 -1
- package/dist/shared/stores/companion-runtime.store.d.ts.map +1 -0
- package/dist/shared/stores/companion-runtime.store.js +2 -0
- package/dist/shared/stores/companion-runtime.store.js.map +1 -0
- package/dist/shared/stores/local-ui-runtime.store.d.ts +2 -1
- package/dist/shared/stores/local-ui-runtime.store.d.ts.map +1 -0
- package/dist/shared/stores/local-ui-runtime.store.js +2 -0
- package/dist/shared/stores/local-ui-runtime.store.js.map +1 -0
- package/dist/shared/stores/managed-service-state.store.d.ts +19 -1
- package/dist/shared/stores/managed-service-state.store.d.ts.map +1 -0
- package/dist/shared/stores/managed-service-state.store.js +2 -0
- package/dist/shared/stores/managed-service-state.store.js.map +1 -0
- package/dist/shared/stores/pending-restart.store.d.ts +2 -1
- package/dist/shared/stores/pending-restart.store.d.ts.map +1 -0
- package/dist/shared/stores/pending-restart.store.js +2 -0
- package/dist/shared/stores/pending-restart.store.js.map +1 -0
- package/dist/shared/types/cli.types.d.ts +16 -1
- package/dist/shared/types/cli.types.d.ts.map +1 -0
- package/dist/shared/types/distribution.types.d.ts +2 -1
- package/dist/shared/types/distribution.types.d.ts.map +1 -0
- package/dist/shared/utils/cli.utils.d.ts +2 -1
- package/dist/shared/utils/cli.utils.d.ts.map +1 -0
- package/dist/shared/utils/cli.utils.js +2 -0
- package/dist/shared/utils/cli.utils.js.map +1 -0
- package/dist/shared/utils/config-path.d.ts +2 -1
- package/dist/shared/utils/config-path.d.ts.map +1 -0
- package/dist/shared/utils/config-path.js +2 -0
- package/dist/shared/utils/config-path.js.map +1 -0
- package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts +2 -1
- package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.d.ts.map +1 -0
- package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js +2 -0
- package/dist/shared/utils/marketplace/cli-subcommand-launch.utils.js.map +1 -0
- package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts +2 -1
- package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.d.ts.map +1 -0
- package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js +2 -0
- package/dist/shared/utils/marketplace/service-marketplace-helpers.utils.js.map +1 -0
- package/dist/shared/utils/package/package-manifest.utils.d.ts +2 -1
- package/dist/shared/utils/package/package-manifest.utils.d.ts.map +1 -0
- package/dist/shared/utils/package/package-manifest.utils.js +2 -0
- package/dist/shared/utils/package/package-manifest.utils.js.map +1 -0
- package/dist/shared/utils/runtime-helpers.d.ts +2 -1
- package/dist/shared/utils/runtime-helpers.d.ts.map +1 -0
- package/dist/shared/utils/runtime-helpers.js +2 -0
- package/dist/shared/utils/runtime-helpers.js.map +1 -0
- package/dist/shared/utils/service-port-probe.utils.d.ts +2 -1
- package/dist/shared/utils/service-port-probe.utils.d.ts.map +1 -0
- package/dist/shared/utils/service-port-probe.utils.js +2 -0
- package/dist/shared/utils/service-port-probe.utils.js.map +1 -0
- package/dist/shared/utils/startup-trace.d.ts +2 -1
- package/dist/shared/utils/startup-trace.d.ts.map +1 -0
- package/dist/shared/utils/startup-trace.js +2 -0
- package/dist/shared/utils/startup-trace.js.map +1 -0
- package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts +2 -1
- package/dist/shared/utils/top-level-nextclaw-command-env.utils.d.ts.map +1 -0
- package/dist/shared/utils/top-level-nextclaw-command-env.utils.js +2 -0
- package/dist/shared/utils/top-level-nextclaw-command-env.utils.js.map +1 -0
- package/package.json +20 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-access-host.service.js","names":[],"sources":["../../../../src/commands/remote/services/remote-access-host.service.ts"],"sourcesContent":["import { getConfigPath, loadConfig } from \"@nextclaw/core\";\nimport { readPlatformSessionTokenState } from \"@nextclaw/remote\";\nimport type {\n RemoteAccessView,\n RemoteAccountView,\n RemoteBrowserAuthPollRequest,\n RemoteBrowserAuthPollResult,\n RemoteBrowserAuthStartRequest,\n RemoteBrowserAuthStartResult,\n RemoteDoctorView,\n RemoteRuntimeView,\n RemoteServiceAction,\n RemoteServiceActionResult,\n RemoteSettingsUpdateRequest,\n UiRemoteAccessHost\n} from \"@nextclaw/server\";\nimport type { PlatformAuthCommands } from \"../../platform-auth/index.js\";\nimport type { RemoteCommands } from \"../index.js\";\nimport {\n controlRemoteService,\n resolveRemoteServiceView,\n type RemoteAccessHostServiceCommands,\n type RemoteRuntimeController\n} from \"./remote-service-control.service.js\";\n\nfunction normalizeOptionalString(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : null;\n}\n\nfunction toRemoteRuntimeView(runtime: ReturnType<RemoteCommands[\"getStatusView\"]>[\"runtime\"]): RemoteRuntimeView | null {\n if (!runtime) {\n return null;\n }\n return {\n enabled: runtime.enabled,\n mode: runtime.mode,\n state: runtime.state,\n deviceId: runtime.deviceId,\n deviceName: runtime.deviceName,\n platformBase: runtime.platformBase,\n localOrigin: runtime.localOrigin,\n lastConnectedAt: runtime.lastConnectedAt,\n lastError: runtime.lastError,\n updatedAt: runtime.updatedAt\n };\n}\n\nexport class RemoteAccessHost implements UiRemoteAccessHost {\n constructor(\n private readonly deps: {\n serviceCommands: RemoteAccessHostServiceCommands;\n requestManagedServiceRestart: (options?: { uiPort?: number; reason?: string }) => Promise<void>;\n remoteCommands: RemoteCommands;\n platformAuthCommands: PlatformAuthCommands;\n currentUi?: {\n host: string;\n port: number;\n };\n remoteRuntimeController?: RemoteRuntimeController | null;\n }\n ) {}\n\n getStatus = (): RemoteAccessView => {\n const config = loadConfig(getConfigPath());\n const status = this.deps.remoteCommands.getStatusView();\n const account = this.readAccountView({\n token: normalizeOptionalString(config.providers.nextclaw?.apiKey),\n apiBase: normalizeOptionalString(config.providers.nextclaw?.apiBase),\n platformBase: status.platformBase\n });\n return {\n account,\n settings: {\n enabled: config.remote.enabled,\n deviceName: config.remote.deviceName,\n platformApiBase: config.remote.platformApiBase\n },\n service: resolveRemoteServiceView(this.deps.currentUi),\n localOrigin: status.localOrigin,\n configuredEnabled: status.configuredEnabled,\n platformBase: status.platformBase,\n runtime: toRemoteRuntimeView(status.runtime)\n };\n };\n\n login = async (input: {\n email: string;\n password: string;\n apiBase?: string;\n }): Promise<RemoteAccessView> => {\n await this.deps.platformAuthCommands.loginResult(input);\n return this.getStatus();\n };\n\n startBrowserAuth = async (input: RemoteBrowserAuthStartRequest): Promise<RemoteBrowserAuthStartResult> => {\n const result = await this.deps.platformAuthCommands.startBrowserAuth({\n apiBase: input.apiBase\n });\n return {\n sessionId: result.sessionId,\n verificationUri: result.verificationUri,\n expiresAt: result.expiresAt,\n intervalMs: result.intervalMs\n };\n };\n\n pollBrowserAuth = async (input: RemoteBrowserAuthPollRequest): Promise<RemoteBrowserAuthPollResult> => {\n const config = loadConfig(getConfigPath());\n const result = await this.deps.platformAuthCommands.pollBrowserAuth({\n apiBase: normalizeOptionalString(input.apiBase)\n ?? normalizeOptionalString(config.remote.platformApiBase)\n ?? normalizeOptionalString(config.providers.nextclaw?.apiBase)\n ?? undefined,\n sessionId: input.sessionId\n });\n if (result.status !== \"authorized\") {\n return result;\n }\n return {\n status: \"authorized\",\n email: result.email,\n role: result.role\n };\n };\n\n logout = (): RemoteAccessView => {\n this.deps.platformAuthCommands.logout();\n return this.getStatus();\n };\n\n updateSettings = (input: RemoteSettingsUpdateRequest): RemoteAccessView => {\n this.deps.remoteCommands.updateConfig({\n enabled: input.enabled,\n apiBase: input.platformApiBase,\n name: input.deviceName\n });\n return this.getStatus();\n };\n\n runDoctor = async (): Promise<RemoteDoctorView> => {\n const report = await this.deps.remoteCommands.getDoctorView();\n return {\n generatedAt: report.generatedAt,\n checks: report.checks,\n snapshot: {\n configuredEnabled: report.snapshot.configuredEnabled,\n runtime: toRemoteRuntimeView(report.snapshot.runtime)\n }\n };\n };\n\n controlService = async (action: RemoteServiceAction): Promise<RemoteServiceActionResult> => {\n return controlRemoteService(action, this.deps);\n };\n\n private readAccountView = (params: {\n token: string | null;\n apiBase: string | null;\n platformBase: string | null;\n }): RemoteAccountView => {\n const { apiBase, platformBase, token } = params;\n const tokenState = readPlatformSessionTokenState(token);\n if (!tokenState.valid) {\n return {\n loggedIn: false,\n apiBase,\n platformBase\n };\n }\n const payload = tokenState.payload;\n const email = typeof payload?.email === \"string\" ? payload.email : undefined;\n const username = typeof payload?.username === \"string\" ? payload.username : undefined;\n const role = typeof payload?.role === \"string\" ? payload.role : undefined;\n return {\n loggedIn: true,\n email,\n username,\n role,\n apiBase,\n platformBase\n };\n };\n\n updateProfile = async (input: { username: string }): Promise<RemoteAccessView> => {\n await this.deps.platformAuthCommands.updateProfile({\n username: input.username\n });\n return this.getStatus();\n };\n}\n"],"mappings":";;;;AAyBA,SAAS,wBAAwB,OAA+B;AAC9D,KAAI,OAAO,UAAU,SACnB,QAAO;CAET,MAAM,UAAU,MAAM,MAAM;AAC5B,QAAO,QAAQ,SAAS,IAAI,UAAU;;AAGxC,SAAS,oBAAoB,SAA2F;AACtH,KAAI,CAAC,QACH,QAAO;AAET,QAAO;EACL,SAAS,QAAQ;EACjB,MAAM,QAAQ;EACd,OAAO,QAAQ;EACf,UAAU,QAAQ;EAClB,YAAY,QAAQ;EACpB,cAAc,QAAQ;EACtB,aAAa,QAAQ;EACrB,iBAAiB,QAAQ;EACzB,WAAW,QAAQ;EACnB,WAAW,QAAQ;EACpB;;AAGH,IAAa,mBAAb,MAA4D;CAC1D,YACE,MAWA;AAXiB,OAAA,OAAA;;CAanB,kBAAoC;EAClC,MAAM,SAAS,WAAW,eAAe,CAAC;EAC1C,MAAM,SAAS,KAAK,KAAK,eAAe,eAAe;AAMvD,SAAO;GACL,SANc,KAAK,gBAAgB;IACnC,OAAO,wBAAwB,OAAO,UAAU,UAAU,OAAO;IACjE,SAAS,wBAAwB,OAAO,UAAU,UAAU,QAAQ;IACpE,cAAc,OAAO;IACtB,CAAC;GAGA,UAAU;IACR,SAAS,OAAO,OAAO;IACvB,YAAY,OAAO,OAAO;IAC1B,iBAAiB,OAAO,OAAO;IAChC;GACD,SAAS,yBAAyB,KAAK,KAAK,UAAU;GACtD,aAAa,OAAO;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AAK;;CAGhD,mBAA2B,WAIF;EACvB,MAAM,EAAE,SAAS,cAAc,UAAU;EACzC,MAAM,aAAa,8BAA8B,MAAM;AACvD,MAAI,CAAC,WAAW,MACd,QAAO;GACL,UAAU;GACV;GACA;GACD;EAEH,MAAM,UAAU,WAAW;AAI3B,SAAO;GACL,UAAU;GACV,OALY,OAAO,SAAS,UAAU,WAAW,QAAQ,QAAQ,KAAA;GAMjE,UALe,OAAO,SAAS,aAAa,WAAW,QAAQ,WAAW,KAAA;GAM1E,MALW,OAAO,SAAS,SAAS,WAAW,QAAQ,OAAO,KAAA;GAM9D;GACA;GACD;;CAGH,gBAAgB,OAAO,UAA2D;AAChF,QAAM,KAAK,KAAK,qBAAqB,cAAc,EACjD,UAAU,MAAM,UACjB,CAAC;AACF,SAAO,KAAK,WAAW"}
|
|
@@ -30,4 +30,5 @@ type RemoteServiceControlDeps = {
|
|
|
30
30
|
declare function resolveRemoteServiceView(currentUi?: CurrentUi): RemoteServiceView;
|
|
31
31
|
declare function controlRemoteService(action: RemoteServiceAction, deps: RemoteServiceControlDeps): Promise<RemoteServiceActionResult>;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { RemoteAccessHostServiceCommands, RemoteRuntimeController, controlRemoteService, resolveRemoteServiceView };
|
|
33
|
+
export { RemoteAccessHostServiceCommands, RemoteRuntimeController, controlRemoteService, resolveRemoteServiceView };
|
|
34
|
+
//# sourceMappingURL=remote-service-control.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-service-control.service.d.ts","names":[],"sources":["../../../../src/commands/remote/services/remote-service-control.service.ts"],"mappings":";;;;KAOY,+BAAA;EACV,YAAA,GAAe,OAAA;IAAW,WAAA,EAAa,OAAA,CAAQ,UAAA,QAAkB,eAAA;IAAmB,IAAA;EAAA,MAAoB,OAAA;EACxG,WAAA,QAAmB,OAAA;AAAA;AAAA,KAGT,uBAAA;EACV,KAAA,QAAa,OAAA;EACb,IAAA,QAAY,OAAA;EACZ,OAAA,QAAe,OAAA;AAAA;AAAA,KAGZ,SAAA;EACH,IAAA;EACA,IAAA;AAAA;AAAA,KAGG,wBAAA;EACH,eAAA,EAAiB,+BAAA;EACjB,4BAAA,GAA+B,OAAA;IAAY,MAAA;IAAiB,MAAA;EAAA,MAAsB,OAAA;EAClF,SAAA,GAAY,SAAA;EACZ,uBAAA,GAA0B,uBAAA;AAAA;AAAA,iBA6MZ,wBAAA,CAAyB,SAAA,GAAY,SAAA,GAAY,iBAAA;AAAA,iBAI3C,oBAAA,CACpB,MAAA,EAAQ,mBAAA,EACR,IAAA,EAAM,wBAAA,GACL,OAAA,CAAQ,yBAAA"}
|
|
@@ -1,66 +1,84 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveUiApiBase, resolveUiConfig } from "../../../shared/utils/cli.utils.js";
|
|
2
2
|
import { managedServiceStateStore } from "../../../shared/stores/managed-service-state.store.js";
|
|
3
|
+
import { ManagedServiceSupervisor } from "../../../shared/services/runtime/managed-service-supervisor.service.js";
|
|
3
4
|
import { getConfigPath, loadConfig } from "@nextclaw/core";
|
|
4
5
|
import { spawn } from "node:child_process";
|
|
5
6
|
//#region src/commands/remote/services/remote-service-control.service.ts
|
|
6
7
|
const FORCED_PUBLIC_UI_HOST = "0.0.0.0";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var RemoteServiceControlService = class {
|
|
9
|
+
managedServiceSupervisor = new ManagedServiceSupervisor();
|
|
10
|
+
resolveView = (currentUi) => {
|
|
11
|
+
if (currentUi) return {
|
|
12
|
+
running: true,
|
|
13
|
+
currentProcess: true,
|
|
14
|
+
pid: process.pid,
|
|
15
|
+
uiUrl: resolveUiApiBase(currentUi.host, currentUi.port),
|
|
16
|
+
uiPort: currentUi.port
|
|
17
|
+
};
|
|
18
|
+
const serviceState = managedServiceStateStore.read();
|
|
19
|
+
const liveness = this.managedServiceSupervisor.resolveStateLiveness(serviceState);
|
|
20
|
+
const serviceRunning = Boolean(serviceState && liveness.running);
|
|
21
|
+
return {
|
|
22
|
+
running: serviceRunning,
|
|
23
|
+
currentProcess: Boolean(serviceRunning && serviceState?.pid === process.pid),
|
|
24
|
+
...serviceState?.pid ? { pid: serviceState.pid } : {},
|
|
25
|
+
...serviceState?.uiUrl ? { uiUrl: serviceState.uiUrl } : {},
|
|
26
|
+
...typeof serviceState?.uiPort === "number" ? { uiPort: serviceState.uiPort } : {}
|
|
27
|
+
};
|
|
14
28
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
running: serviceRunning,
|
|
19
|
-
currentProcess: Boolean(serviceRunning && serviceState?.pid === process.pid),
|
|
20
|
-
...serviceState?.pid ? { pid: serviceState.pid } : {},
|
|
21
|
-
...serviceState?.uiUrl ? { uiUrl: serviceState.uiUrl } : {},
|
|
22
|
-
...typeof serviceState?.uiPort === "number" ? { uiPort: serviceState.uiPort } : {}
|
|
29
|
+
control = async (action, deps) => {
|
|
30
|
+
if (deps.remoteRuntimeController) return this.controlCurrentProcessRuntime(action, deps.remoteRuntimeController);
|
|
31
|
+
return this.controlManagedService(action, deps);
|
|
23
32
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
controlCurrentProcessRuntime = async (action, controller) => {
|
|
34
|
+
if (action === "start") {
|
|
35
|
+
await controller.start();
|
|
36
|
+
return {
|
|
37
|
+
accepted: true,
|
|
38
|
+
action,
|
|
39
|
+
message: "Remote runtime started."
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (action === "stop") {
|
|
43
|
+
await controller.stop();
|
|
44
|
+
return {
|
|
45
|
+
accepted: true,
|
|
46
|
+
action,
|
|
47
|
+
message: "Remote runtime stopped."
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
await controller.restart();
|
|
32
51
|
return {
|
|
33
52
|
accepted: true,
|
|
34
53
|
action,
|
|
35
|
-
message: "Remote runtime
|
|
54
|
+
message: "Remote runtime restarted."
|
|
36
55
|
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
};
|
|
57
|
+
controlManagedService = async (action, deps) => {
|
|
58
|
+
const serviceState = this.resolveManagedServiceControlState();
|
|
59
|
+
const uiOverrides = this.resolveManagedUiOverrides();
|
|
60
|
+
if (action === "start") return this.startManagedService(action, deps, serviceState, uiOverrides);
|
|
61
|
+
if (!serviceState.running) return this.controlStoppedManagedService(action, deps, serviceState, uiOverrides);
|
|
62
|
+
if (serviceState.currentProcess) return this.controlCurrentManagedProcess(action, deps, uiOverrides);
|
|
63
|
+
return this.controlExternalManagedProcess(action, deps, uiOverrides);
|
|
64
|
+
};
|
|
65
|
+
resolveManagedServiceControlState = () => {
|
|
66
|
+
const state = managedServiceStateStore.read();
|
|
67
|
+
const liveness = this.managedServiceSupervisor.resolveStateLiveness(state);
|
|
68
|
+
const running = Boolean(state && liveness.running);
|
|
40
69
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
70
|
+
currentProcess: Boolean(running && state?.pid === process.pid),
|
|
71
|
+
recordedProcessExists: Boolean(state && liveness.processExists),
|
|
72
|
+
running
|
|
44
73
|
};
|
|
45
|
-
}
|
|
46
|
-
await controller.restart();
|
|
47
|
-
return {
|
|
48
|
-
accepted: true,
|
|
49
|
-
action,
|
|
50
|
-
message: "Remote runtime restarted."
|
|
51
74
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const state = managedServiceStateStore.read();
|
|
55
|
-
const running = Boolean(state && isProcessRunning(state.pid));
|
|
56
|
-
const currentProcess = Boolean(running && state?.pid === process.pid);
|
|
57
|
-
const uiOverrides = resolveManagedUiOverrides();
|
|
58
|
-
if (action === "start") {
|
|
59
|
-
if (running) return {
|
|
75
|
+
startManagedService = async (action, deps, serviceState, uiOverrides) => {
|
|
76
|
+
if (serviceState.running) return {
|
|
60
77
|
accepted: true,
|
|
61
78
|
action,
|
|
62
|
-
message: currentProcess ? "Managed service is already running for this UI." : "Managed service is already running."
|
|
79
|
+
message: serviceState.currentProcess ? "Managed service is already running for this UI." : "Managed service is already running."
|
|
63
80
|
};
|
|
81
|
+
if (serviceState.recordedProcessExists) return this.controlStaleManagedServiceProcess(action, deps, uiOverrides);
|
|
64
82
|
await deps.serviceCommands.startService({
|
|
65
83
|
uiOverrides,
|
|
66
84
|
open: false
|
|
@@ -70,8 +88,9 @@ async function controlManagedService(action, deps) {
|
|
|
70
88
|
action,
|
|
71
89
|
message: "Managed service started."
|
|
72
90
|
};
|
|
73
|
-
}
|
|
74
|
-
|
|
91
|
+
};
|
|
92
|
+
controlStoppedManagedService = async (action, deps, serviceState, uiOverrides) => {
|
|
93
|
+
if (serviceState.recordedProcessExists) return this.controlStaleManagedServiceProcess(action, deps, uiOverrides);
|
|
75
94
|
if (action === "restart") {
|
|
76
95
|
await deps.serviceCommands.startService({
|
|
77
96
|
uiOverrides,
|
|
@@ -88,49 +107,87 @@ async function controlManagedService(action, deps) {
|
|
|
88
107
|
action,
|
|
89
108
|
message: "No managed service is currently running."
|
|
90
109
|
};
|
|
91
|
-
}
|
|
92
|
-
|
|
110
|
+
};
|
|
111
|
+
controlStaleManagedServiceProcess = async (action, deps, uiOverrides) => {
|
|
112
|
+
if (action === "stop") {
|
|
113
|
+
await deps.serviceCommands.stopService();
|
|
114
|
+
return {
|
|
115
|
+
accepted: true,
|
|
116
|
+
action,
|
|
117
|
+
message: "Stale managed service process stopped."
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (action === "restart") {
|
|
121
|
+
await deps.serviceCommands.stopService();
|
|
122
|
+
await deps.serviceCommands.startService({
|
|
123
|
+
uiOverrides,
|
|
124
|
+
open: false
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
accepted: true,
|
|
128
|
+
action,
|
|
129
|
+
message: "Stale managed service process replaced."
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
await deps.serviceCommands.stopService();
|
|
133
|
+
await deps.serviceCommands.startService({
|
|
134
|
+
uiOverrides,
|
|
135
|
+
open: false
|
|
136
|
+
});
|
|
137
|
+
return {
|
|
138
|
+
accepted: true,
|
|
139
|
+
action,
|
|
140
|
+
message: "Stale managed service process replaced."
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
controlCurrentManagedProcess = async (action, deps, uiOverrides) => {
|
|
93
144
|
if (action === "restart") await deps.requestManagedServiceRestart({ uiPort: uiOverrides.port ?? 55667 });
|
|
94
|
-
else
|
|
145
|
+
else launchManagedSelfControl();
|
|
95
146
|
return {
|
|
96
147
|
accepted: true,
|
|
97
148
|
action,
|
|
98
149
|
message: action === "restart" ? "Restart scheduled. This page may disconnect for a few seconds." : "Stop scheduled. This page will disconnect shortly."
|
|
99
150
|
};
|
|
100
|
-
}
|
|
101
|
-
|
|
151
|
+
};
|
|
152
|
+
controlExternalManagedProcess = async (action, deps, uiOverrides) => {
|
|
153
|
+
if (action === "stop") {
|
|
154
|
+
await deps.serviceCommands.stopService();
|
|
155
|
+
return {
|
|
156
|
+
accepted: true,
|
|
157
|
+
action,
|
|
158
|
+
message: "Managed service stopped."
|
|
159
|
+
};
|
|
160
|
+
}
|
|
102
161
|
await deps.serviceCommands.stopService();
|
|
162
|
+
await deps.serviceCommands.startService({
|
|
163
|
+
uiOverrides,
|
|
164
|
+
open: false
|
|
165
|
+
});
|
|
103
166
|
return {
|
|
104
167
|
accepted: true,
|
|
105
168
|
action,
|
|
106
|
-
message: "Managed service
|
|
169
|
+
message: "Managed service restarted."
|
|
107
170
|
};
|
|
108
|
-
}
|
|
109
|
-
await deps.serviceCommands.stopService();
|
|
110
|
-
await deps.serviceCommands.startService({
|
|
111
|
-
uiOverrides,
|
|
112
|
-
open: false
|
|
113
|
-
});
|
|
114
|
-
return {
|
|
115
|
-
accepted: true,
|
|
116
|
-
action,
|
|
117
|
-
message: "Managed service restarted."
|
|
118
171
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return {
|
|
122
|
-
enabled: true,
|
|
123
|
-
host: FORCED_PUBLIC_UI_HOST,
|
|
124
|
-
open: false,
|
|
125
|
-
port: resolveUiConfig(loadConfig(getConfigPath()), {
|
|
172
|
+
resolveManagedUiOverrides = () => {
|
|
173
|
+
return {
|
|
126
174
|
enabled: true,
|
|
127
175
|
host: FORCED_PUBLIC_UI_HOST,
|
|
128
|
-
open: false
|
|
129
|
-
|
|
176
|
+
open: false,
|
|
177
|
+
port: resolveUiConfig(loadConfig(getConfigPath()), {
|
|
178
|
+
enabled: true,
|
|
179
|
+
host: FORCED_PUBLIC_UI_HOST,
|
|
180
|
+
open: false
|
|
181
|
+
}).port
|
|
182
|
+
};
|
|
130
183
|
};
|
|
184
|
+
};
|
|
185
|
+
const remoteServiceControlService = new RemoteServiceControlService();
|
|
186
|
+
function resolveRemoteServiceView(currentUi) {
|
|
187
|
+
return remoteServiceControlService.resolveView(currentUi);
|
|
131
188
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
189
|
+
async function controlRemoteService(action, deps) {
|
|
190
|
+
return remoteServiceControlService.control(action, deps);
|
|
134
191
|
}
|
|
135
192
|
function launchManagedSelfControl(params = {}) {
|
|
136
193
|
const script = [
|
|
@@ -186,3 +243,5 @@ function launchManagedSelfControl(params = {}) {
|
|
|
186
243
|
}
|
|
187
244
|
//#endregion
|
|
188
245
|
export { controlRemoteService, resolveRemoteServiceView };
|
|
246
|
+
|
|
247
|
+
//# sourceMappingURL=remote-service-control.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-service-control.service.js","names":[],"sources":["../../../../src/commands/remote/services/remote-service-control.service.ts"],"sourcesContent":["import { getConfigPath, loadConfig } from \"@nextclaw/core\";\nimport type { RemoteServiceAction, RemoteServiceActionResult, RemoteServiceView } from \"@nextclaw/server\";\nimport { spawn } from \"node:child_process\";\nimport { resolveUiApiBase, resolveUiConfig } from \"../../../shared/utils/cli.utils.js\";\nimport { managedServiceStateStore } from \"../../../shared/stores/managed-service-state.store.js\";\nimport { ManagedServiceSupervisor } from \"../../../shared/services/runtime/managed-service-supervisor.service.js\";\n\nexport type RemoteAccessHostServiceCommands = {\n startService: (options: { uiOverrides: Partial<ReturnType<typeof resolveUiConfig>>; open: boolean }) => Promise<void>;\n stopService: () => Promise<void>;\n};\n\nexport type RemoteRuntimeController = {\n start: () => Promise<void> | null;\n stop: () => Promise<void>;\n restart: () => Promise<void>;\n};\n\ntype CurrentUi = {\n host: string;\n port: number;\n};\n\ntype RemoteServiceControlDeps = {\n serviceCommands: RemoteAccessHostServiceCommands;\n requestManagedServiceRestart: (options?: { uiPort?: number; reason?: string }) => Promise<void>;\n currentUi?: CurrentUi;\n remoteRuntimeController?: RemoteRuntimeController | null;\n};\n\nconst FORCED_PUBLIC_UI_HOST = \"0.0.0.0\";\ntype ManagedServiceControlState = {\n currentProcess: boolean;\n recordedProcessExists: boolean;\n running: boolean;\n};\n\nclass RemoteServiceControlService {\n private readonly managedServiceSupervisor = new ManagedServiceSupervisor();\n\n readonly resolveView = (currentUi?: CurrentUi): RemoteServiceView => {\n if (currentUi) {\n return {\n running: true,\n currentProcess: true,\n pid: process.pid,\n uiUrl: resolveUiApiBase(currentUi.host, currentUi.port),\n uiPort: currentUi.port\n };\n }\n\n const serviceState = managedServiceStateStore.read();\n const liveness = this.managedServiceSupervisor.resolveStateLiveness(serviceState);\n const serviceRunning = Boolean(serviceState && liveness.running);\n return {\n running: serviceRunning,\n currentProcess: Boolean(serviceRunning && serviceState?.pid === process.pid),\n ...(serviceState?.pid ? { pid: serviceState.pid } : {}),\n ...(serviceState?.uiUrl ? { uiUrl: serviceState.uiUrl } : {}),\n ...(typeof serviceState?.uiPort === \"number\" ? { uiPort: serviceState.uiPort } : {})\n };\n };\n\n readonly control = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps\n ): Promise<RemoteServiceActionResult> => {\n if (deps.remoteRuntimeController) {\n return this.controlCurrentProcessRuntime(action, deps.remoteRuntimeController);\n }\n\n return this.controlManagedService(action, deps);\n };\n\n private readonly controlCurrentProcessRuntime = async (\n action: RemoteServiceAction,\n controller: RemoteRuntimeController\n ): Promise<RemoteServiceActionResult> => {\n if (action === \"start\") {\n await controller.start();\n return { accepted: true, action, message: \"Remote runtime started.\" };\n }\n if (action === \"stop\") {\n await controller.stop();\n return { accepted: true, action, message: \"Remote runtime stopped.\" };\n }\n await controller.restart();\n return { accepted: true, action, message: \"Remote runtime restarted.\" };\n };\n\n private readonly controlManagedService = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps\n ): Promise<RemoteServiceActionResult> => {\n const serviceState = this.resolveManagedServiceControlState();\n const uiOverrides = this.resolveManagedUiOverrides();\n\n if (action === \"start\") {\n return this.startManagedService(action, deps, serviceState, uiOverrides);\n }\n if (!serviceState.running) {\n return this.controlStoppedManagedService(action, deps, serviceState, uiOverrides);\n }\n if (serviceState.currentProcess) {\n return this.controlCurrentManagedProcess(action, deps, uiOverrides);\n }\n return this.controlExternalManagedProcess(action, deps, uiOverrides);\n };\n\n private readonly resolveManagedServiceControlState = (): ManagedServiceControlState => {\n const state = managedServiceStateStore.read();\n const liveness = this.managedServiceSupervisor.resolveStateLiveness(state);\n const running = Boolean(state && liveness.running);\n return {\n currentProcess: Boolean(running && state?.pid === process.pid),\n recordedProcessExists: Boolean(state && liveness.processExists),\n running\n };\n };\n\n private readonly startManagedService = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps,\n serviceState: ManagedServiceControlState,\n uiOverrides: Partial<ReturnType<typeof resolveUiConfig>>\n ): Promise<RemoteServiceActionResult> => {\n if (serviceState.running) {\n return {\n accepted: true,\n action,\n message: serviceState.currentProcess ? \"Managed service is already running for this UI.\" : \"Managed service is already running.\"\n };\n }\n if (serviceState.recordedProcessExists) {\n return this.controlStaleManagedServiceProcess(action, deps, uiOverrides);\n }\n await deps.serviceCommands.startService({ uiOverrides, open: false });\n return { accepted: true, action, message: \"Managed service started.\" };\n };\n\n private readonly controlStoppedManagedService = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps,\n serviceState: ManagedServiceControlState,\n uiOverrides: Partial<ReturnType<typeof resolveUiConfig>>\n ): Promise<RemoteServiceActionResult> => {\n if (serviceState.recordedProcessExists) {\n return this.controlStaleManagedServiceProcess(action, deps, uiOverrides);\n }\n if (action === \"restart\") {\n await deps.serviceCommands.startService({ uiOverrides, open: false });\n return {\n accepted: true,\n action,\n message: \"Managed service was not running and has been started.\"\n };\n }\n return { accepted: true, action, message: \"No managed service is currently running.\" };\n };\n\n private readonly controlStaleManagedServiceProcess = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps,\n uiOverrides: Partial<ReturnType<typeof resolveUiConfig>>\n ): Promise<RemoteServiceActionResult> => {\n if (action === \"stop\") {\n await deps.serviceCommands.stopService();\n return { accepted: true, action, message: \"Stale managed service process stopped.\" };\n }\n if (action === \"restart\") {\n await deps.serviceCommands.stopService();\n await deps.serviceCommands.startService({ uiOverrides, open: false });\n return { accepted: true, action, message: \"Stale managed service process replaced.\" };\n }\n await deps.serviceCommands.stopService();\n await deps.serviceCommands.startService({ uiOverrides, open: false });\n return { accepted: true, action, message: \"Stale managed service process replaced.\" };\n };\n\n private readonly controlCurrentManagedProcess = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps,\n uiOverrides: Partial<ReturnType<typeof resolveUiConfig>>\n ): Promise<RemoteServiceActionResult> => {\n if (action === \"restart\") {\n await deps.requestManagedServiceRestart({ uiPort: uiOverrides.port ?? 55667 });\n } else {\n launchManagedSelfControl();\n }\n return {\n accepted: true,\n action,\n message:\n action === \"restart\"\n ? \"Restart scheduled. This page may disconnect for a few seconds.\"\n : \"Stop scheduled. This page will disconnect shortly.\"\n };\n };\n\n private readonly controlExternalManagedProcess = async (\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps,\n uiOverrides: Partial<ReturnType<typeof resolveUiConfig>>\n ): Promise<RemoteServiceActionResult> => {\n if (action === \"stop\") {\n await deps.serviceCommands.stopService();\n return { accepted: true, action, message: \"Managed service stopped.\" };\n }\n\n await deps.serviceCommands.stopService();\n await deps.serviceCommands.startService({ uiOverrides, open: false });\n return { accepted: true, action, message: \"Managed service restarted.\" };\n };\n\n private readonly resolveManagedUiOverrides = (): Partial<ReturnType<typeof resolveUiConfig>> => {\n const config = loadConfig(getConfigPath());\n const resolved = resolveUiConfig(config, {\n enabled: true,\n host: FORCED_PUBLIC_UI_HOST,\n open: false\n });\n return {\n enabled: true,\n host: FORCED_PUBLIC_UI_HOST,\n open: false,\n port: resolved.port\n };\n };\n}\n\nconst remoteServiceControlService = new RemoteServiceControlService();\n\nexport function resolveRemoteServiceView(currentUi?: CurrentUi): RemoteServiceView {\n return remoteServiceControlService.resolveView(currentUi);\n}\n\nexport async function controlRemoteService(\n action: RemoteServiceAction,\n deps: RemoteServiceControlDeps\n): Promise<RemoteServiceActionResult> {\n return remoteServiceControlService.control(action, deps);\n}\n\nfunction launchManagedSelfControl(params: {\n command?: string;\n args?: string[];\n} = {}): void {\n const script = [\n 'const { spawn } = require(\"node:child_process\");',\n 'const { rmSync } = require(\"node:fs\");',\n `const parentPid = ${process.pid};`,\n `const serviceStatePath = ${JSON.stringify(managedServiceStateStore.path)};`,\n `const command = ${JSON.stringify(params.command ?? null)};`,\n `const args = ${JSON.stringify(params.args ?? [])};`,\n `const cwd = ${JSON.stringify(process.cwd())};`,\n \"const env = process.env;\",\n \"function isRunning(pid) {\",\n \" try {\",\n \" process.kill(pid, 0);\",\n \" return true;\",\n \" } catch {\",\n \" return false;\",\n \" }\",\n \"}\",\n \"setTimeout(() => {\",\n \" try {\",\n \" process.kill(parentPid, 'SIGTERM');\",\n \" } catch {}\",\n \"}, 150);\",\n \"const startedAt = Date.now();\",\n \"const maxWaitMs = 30000;\",\n \"const timer = setInterval(() => {\",\n \" if (isRunning(parentPid)) {\",\n \" if (Date.now() - startedAt > maxWaitMs) {\",\n \" try {\",\n \" process.kill(parentPid, 'SIGKILL');\",\n \" } catch {}\",\n \" }\",\n \" return;\",\n \" }\",\n \" clearInterval(timer);\",\n \" try {\",\n \" rmSync(serviceStatePath, { force: true });\",\n \" } catch {}\",\n \" if (command) {\",\n \" const child = spawn(command, args, { detached: true, stdio: 'ignore', cwd, env });\",\n \" child.unref();\",\n \" }\",\n \" process.exit(0);\",\n \"}, 250);\"\n ].join(\"\");\n const helper = spawn(process.execPath, [\"-e\", script], {\n detached: true,\n stdio: \"ignore\",\n env: process.env,\n cwd: process.cwd()\n });\n helper.unref();\n}\n"],"mappings":";;;;;;AA8BA,MAAM,wBAAwB;AAO9B,IAAM,8BAAN,MAAkC;CAChC,2BAA4C,IAAI,0BAA0B;CAE1E,eAAwB,cAA6C;AACnE,MAAI,UACF,QAAO;GACL,SAAS;GACT,gBAAgB;GAChB,KAAK,QAAQ;GACb,OAAO,iBAAiB,UAAU,MAAM,UAAU,KAAK;GACvD,QAAQ,UAAU;GACnB;EAGH,MAAM,eAAe,yBAAyB,MAAM;EACpD,MAAM,WAAW,KAAK,yBAAyB,qBAAqB,aAAa;EACjF,MAAM,iBAAiB,QAAQ,gBAAgB,SAAS,QAAQ;AAChE,SAAO;GACL,SAAS;GACT,gBAAgB,QAAQ,kBAAkB,cAAc,QAAQ,QAAQ,IAAI;GAC5E,GAAI,cAAc,MAAM,EAAE,KAAK,aAAa,KAAK,GAAG,EAAE;GACtD,GAAI,cAAc,QAAQ,EAAE,OAAO,aAAa,OAAO,GAAG,EAAE;GAC5D,GAAI,OAAO,cAAc,WAAW,WAAW,EAAE,QAAQ,aAAa,QAAQ,GAAG,EAAE;GACpF;;CAGH,UAAmB,OACjB,QACA,SACuC;AACvC,MAAI,KAAK,wBACP,QAAO,KAAK,6BAA6B,QAAQ,KAAK,wBAAwB;AAGhF,SAAO,KAAK,sBAAsB,QAAQ,KAAK;;CAGjD,+BAAgD,OAC9C,QACA,eACuC;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1E,kCAAgG;AAO9F,SAAO;GACL,SAAS;GACT,MAAM;GACN,MAAM;GACN,MATe,gBADF,WAAW,eAAe,CAAC,EACD;IACvC,SAAS;IACT,MAAM;IACN,MAAM;IACP,CAAC,CAKe;GAChB;;;AAIL,MAAM,8BAA8B,IAAI,6BAA6B;AAErE,SAAgB,yBAAyB,WAA0C;AACjF,QAAO,4BAA4B,YAAY,UAAU;;AAG3D,eAAsB,qBACpB,QACA,MACoC;AACpC,QAAO,4BAA4B,QAAQ,QAAQ,KAAK;;AAG1D,SAAS,yBAAyB,SAG9B,EAAE,EAAQ;CACZ,MAAM,SAAS;EACb;EACA;EACA,qBAAqB,QAAQ,IAAI;EACjC,4BAA4B,KAAK,UAAU,yBAAyB,KAAK,CAAC;EAC1E,mBAAmB,KAAK,UAAU,OAAO,WAAW,KAAK,CAAC;EAC1D,gBAAgB,KAAK,UAAU,OAAO,QAAQ,EAAE,CAAC,CAAC;EAClD,eAAe,KAAK,UAAU,QAAQ,KAAK,CAAC,CAAC;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,GAAG;AACK,OAAM,QAAQ,UAAU,CAAC,MAAM,OAAO,EAAE;EACrD,UAAU;EACV,OAAO;EACP,KAAK,QAAQ;EACb,KAAK,QAAQ,KAAK;EACnB,CAAC,CACK,OAAO"}
|
|
@@ -11,4 +11,5 @@ declare function resolvePlatformApiBase(params: {
|
|
|
11
11
|
};
|
|
12
12
|
declare function buildPlatformApiBaseErrorMessage(inputApiBase: string, rawMessage: string): string;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { buildPlatformApiBaseErrorMessage, resolvePlatformApiBase };
|
|
14
|
+
export { buildPlatformApiBaseErrorMessage, resolvePlatformApiBase };
|
|
15
|
+
//# sourceMappingURL=platform-api-base.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-api-base.utils.d.ts","names":[],"sources":["../../../../src/commands/remote/utils/platform-api-base.utils.ts"],"mappings":";iBAgBgB,sBAAA,CAAuB,MAAA;EACrC,eAAA;EACA,iBAAA;EACA,eAAA;EACA,iBAAA;AAAA;EAEA,YAAA;EACA,MAAA;EACA,YAAA;AAAA;AAAA,iBAkCc,gCAAA,CAAiC,YAAA,UAAsB,UAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-api-base.utils.js","names":[],"sources":["../../../../src/commands/remote/utils/platform-api-base.utils.ts"],"sourcesContent":["const DEFAULT_PLATFORM_API_BASE = \"https://ai-gateway-api.nextclaw.io/v1\";\nconst INVALID_PLATFORM_HINT =\n `Use ${DEFAULT_PLATFORM_API_BASE} or the platform root URL without a trailing path.`;\n\nfunction trimTrailingSlash(value: string): string {\n return value.replace(/\\/+$/, \"\");\n}\n\nfunction normalizeExplicitApiBase(rawApiBase: string): string {\n const trimmed = trimTrailingSlash(rawApiBase.trim());\n if (!trimmed) {\n return \"\";\n }\n return trimmed.replace(/\\/v1?$/i, \"\");\n}\n\nexport function resolvePlatformApiBase(params: {\n explicitApiBase?: string | null;\n configuredApiBase?: string | null;\n fallbackApiBase?: string;\n requireConfigured?: boolean;\n}): {\n platformBase: string;\n v1Base: string;\n inputApiBase: string;\n} {\n const explicitApiBase = typeof params.explicitApiBase === \"string\" ? params.explicitApiBase.trim() : \"\";\n const configuredApiBase = typeof params.configuredApiBase === \"string\" ? params.configuredApiBase.trim() : \"\";\n const fallbackApiBase = params.fallbackApiBase ?? DEFAULT_PLATFORM_API_BASE;\n const inputApiBase = explicitApiBase || configuredApiBase || (params.requireConfigured ? \"\" : fallbackApiBase);\n if (!inputApiBase) {\n throw new Error(\"Platform API base is missing. Pass --api-base or run nextclaw login.\");\n }\n\n const platformBase = normalizeExplicitApiBase(inputApiBase);\n if (!platformBase) {\n throw new Error(`Invalid --api-base \"${inputApiBase}\". ${INVALID_PLATFORM_HINT}`);\n }\n\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(platformBase);\n } catch {\n throw new Error(`Invalid --api-base \"${inputApiBase}\". ${INVALID_PLATFORM_HINT}`);\n }\n\n if (parsedUrl.pathname !== \"\" && parsedUrl.pathname !== \"/\") {\n throw new Error(`Invalid --api-base \"${inputApiBase}\". ${INVALID_PLATFORM_HINT}`);\n }\n\n const normalizedPlatformBase = trimTrailingSlash(parsedUrl.toString());\n return {\n platformBase: normalizedPlatformBase,\n v1Base: `${normalizedPlatformBase}/v1`,\n inputApiBase\n };\n}\n\nexport function buildPlatformApiBaseErrorMessage(inputApiBase: string, rawMessage: string): string {\n if (\n rawMessage.includes(\"Remote session cookie missing\") ||\n rawMessage.includes(\"endpoint not found\") ||\n rawMessage.includes(\"NOT_FOUND\")\n ) {\n return `Invalid --api-base \"${inputApiBase}\". ${INVALID_PLATFORM_HINT}`;\n }\n return rawMessage;\n}\n"],"mappings":";AAAA,MAAM,4BAA4B;AAClC,MAAM,wBACJ,OAAO,0BAA0B;AAEnC,SAAS,kBAAkB,OAAuB;AAChD,QAAO,MAAM,QAAQ,QAAQ,GAAG;;AAGlC,SAAS,yBAAyB,YAA4B;CAC5D,MAAM,UAAU,kBAAkB,WAAW,MAAM,CAAC;AACpD,KAAI,CAAC,QACH,QAAO;AAET,QAAO,QAAQ,QAAQ,WAAW,GAAG;;AAGvC,SAAgB,uBAAuB,QASrC;CACA,MAAM,kBAAkB,OAAO,OAAO,oBAAoB,WAAW,OAAO,gBAAgB,MAAM,GAAG;CACrG,MAAM,oBAAoB,OAAO,OAAO,sBAAsB,WAAW,OAAO,kBAAkB,MAAM,GAAG;CAC3G,MAAM,kBAAkB,OAAO,mBAAmB;CAClD,MAAM,eAAe,mBAAmB,sBAAsB,OAAO,oBAAoB,KAAK;AAC9F,KAAI,CAAC,aACH,OAAM,IAAI,MAAM,uEAAuE;CAGzF,MAAM,eAAe,yBAAyB,aAAa;AAC3D,KAAI,CAAC,aACH,OAAM,IAAI,MAAM,uBAAuB,aAAa,KAAK,wBAAwB;CAGnF,IAAI;AACJ,KAAI;AACF,cAAY,IAAI,IAAI,aAAa;SAC3B;AACN,QAAM,IAAI,MAAM,uBAAuB,aAAa,KAAK,wBAAwB;;AAGnF,KAAI,UAAU,aAAa,MAAM,UAAU,aAAa,IACtD,OAAM,IAAI,MAAM,uBAAuB,aAAa,KAAK,wBAAwB;CAGnF,MAAM,yBAAyB,kBAAkB,UAAU,UAAU,CAAC;AACtE,QAAO;EACL,cAAc;EACd,QAAQ,GAAG,uBAAuB;EAClC;EACD;;AAGH,SAAgB,iCAAiC,cAAsB,YAA4B;AACjG,KACE,WAAW,SAAS,gCAAgC,IACpD,WAAW,SAAS,qBAAqB,IACzC,WAAW,SAAS,YAAY,CAEhC,QAAO,uBAAuB,aAAa,KAAK;AAElD,QAAO"}
|
|
@@ -12,4 +12,5 @@ declare function buildNextclawConfiguredRemoteState(config: Config): RemoteRunti
|
|
|
12
12
|
declare function readCurrentNextclawRemoteRuntimeState(): RemoteRuntimeState | null;
|
|
13
13
|
declare function resolveNextclawRemoteStatusSnapshot(config: Config): RemoteStatusSnapshot;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemotePlatformClient, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, readCurrentNextclawRemoteRuntimeState, resolveNextclawRemoteStatusSnapshot };
|
|
15
|
+
export { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemotePlatformClient, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, readCurrentNextclawRemoteRuntimeState, resolveNextclawRemoteStatusSnapshot };
|
|
16
|
+
//# sourceMappingURL=remote-runtime-support.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-runtime-support.utils.d.ts","names":[],"sources":["../../../../src/commands/remote/utils/remote-runtime-support.utils.ts"],"mappings":";;;;iBAqBgB,gCAAA,CAAA;AAAA,iBAKA,kCAAA,CAAA,GAAsC,oBAAA;AAAA,iBAwBtC,6BAAA,CAA8B,MAAA;EAC5C,MAAA,GAAS,YAAA;AAAA,IACF,eAAA;AAAA,iBAOO,+BAAA,CACd,IAAA,EAAM,kBAAA,UAA4B,QAAA,IAAY,IAAA,EAAM,kBAAA,YACnD,iBAAA;AAAA,iBAwBa,kCAAA,CAAmC,MAAA,EAAQ,MAAA,GAAS,kBAAA;AAAA,iBAIpD,qCAAA,CAAA,GAAyC,kBAAA;AAAA,iBAqBzC,mCAAA,CAAoC,MAAA,EAAQ,MAAA,GAAS,oBAAA"}
|
|
@@ -78,3 +78,5 @@ function resolveNextclawRemoteStatusSnapshot(config) {
|
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
80
|
export { buildNextclawConfiguredRemoteState, createNextclawRemoteConnector, createNextclawRemotePlatformClient, createNextclawRemoteStatusStore, hasRunningNextclawManagedService, readCurrentNextclawRemoteRuntimeState, resolveNextclawRemoteStatusSnapshot };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=remote-runtime-support.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-runtime-support.utils.js","names":[],"sources":["../../../../src/commands/remote/utils/remote-runtime-support.utils.ts"],"sourcesContent":["import { getConfigPath, getDataDir, loadConfig, type Config } from \"@nextclaw/core\";\nimport {\n RemoteConnector,\n RemotePlatformClient,\n RemoteStatusStore,\n buildConfiguredRemoteState,\n resolveRemoteStatusSnapshot,\n type RemoteLogger,\n type RemoteRuntimeState,\n type RemoteStatusSnapshot\n} from \"@nextclaw/remote\";\nimport {\n getPackageVersion,\n isProcessRunning\n} from \"../../../shared/utils/cli.utils.js\";\nimport { localUiRuntimeStore } from \"../../../shared/stores/local-ui-runtime.store.js\";\nimport { managedServiceStateStore } from \"../../../shared/stores/managed-service-state.store.js\";\nimport { resolvePlatformApiBase } from \"../utils/platform-api-base.utils.js\";\n\nlet currentProcessRemoteRuntimeState: RemoteRuntimeState | null = null;\n\nexport function hasRunningNextclawManagedService(): boolean {\n const state = managedServiceStateStore.read();\n return Boolean(state && isProcessRunning(state.pid));\n}\n\nexport function createNextclawRemotePlatformClient(): RemotePlatformClient {\n return new RemotePlatformClient({\n loadConfig: () => loadConfig(getConfigPath()),\n getDataDir,\n getPackageVersion,\n resolvePlatformBase: (rawApiBase) =>\n resolvePlatformApiBase({\n explicitApiBase: rawApiBase,\n requireConfigured: true\n }).platformBase,\n readManagedServiceState: () => {\n const state = managedServiceStateStore.read();\n if (!state) {\n return null;\n }\n return {\n pid: state.pid,\n uiPort: state.uiPort\n };\n },\n isProcessRunning\n });\n}\n\nexport function createNextclawRemoteConnector(params: {\n logger?: RemoteLogger;\n} = {}): RemoteConnector {\n return new RemoteConnector({\n platformClient: createNextclawRemotePlatformClient(),\n logger: params.logger\n });\n}\n\nexport function createNextclawRemoteStatusStore(\n mode: RemoteRuntimeState[\"mode\"], onChange?: (next: RemoteRuntimeState) => void\n): RemoteStatusStore {\n return new RemoteStatusStore(mode, {\n writeRemoteState: (next) => {\n currentProcessRemoteRuntimeState = next;\n onChange?.(next);\n const uiRuntimeState = localUiRuntimeStore.read();\n if (uiRuntimeState?.pid === process.pid) {\n localUiRuntimeStore.update((state) => ({\n ...state,\n remote: next\n }));\n }\n const serviceState = managedServiceStateStore.read();\n if (!serviceState || serviceState.pid !== process.pid) {\n return;\n }\n managedServiceStateStore.update((state) => ({\n ...state,\n remote: next\n }));\n }\n });\n}\n\nexport function buildNextclawConfiguredRemoteState(config: Config): RemoteRuntimeState {\n return buildConfiguredRemoteState(config);\n}\n\nexport function readCurrentNextclawRemoteRuntimeState(): RemoteRuntimeState | null {\n const uiRuntimeState = localUiRuntimeStore.read();\n const serviceState = managedServiceStateStore.read();\n const currentRemoteState = currentProcessRemoteRuntimeState ?? uiRuntimeState?.remote ?? serviceState?.remote ?? null;\n if (!currentRemoteState) {\n return null;\n }\n\n const owningRuntime = uiRuntimeState ?? serviceState;\n if (!owningRuntime || isProcessRunning(owningRuntime.pid)) {\n return currentRemoteState;\n }\n\n return {\n ...currentRemoteState,\n state: currentRemoteState.enabled ? \"disconnected\" : \"disabled\",\n lastError: currentRemoteState.lastError ?? \"Managed service is not running.\",\n updatedAt: new Date().toISOString()\n };\n}\n\nexport function resolveNextclawRemoteStatusSnapshot(config: Config): RemoteStatusSnapshot {\n return resolveRemoteStatusSnapshot({\n config,\n currentRemoteState: readCurrentNextclawRemoteRuntimeState()\n });\n}\n"],"mappings":";;;;;;;;AAmBA,IAAI,mCAA8D;AAElE,SAAgB,mCAA4C;CAC1D,MAAM,QAAQ,yBAAyB,MAAM;AAC7C,QAAO,QAAQ,SAAS,iBAAiB,MAAM,IAAI,CAAC;;AAGtD,SAAgB,qCAA2D;AACzE,QAAO,IAAI,qBAAqB;EAC9B,kBAAkB,WAAW,eAAe,CAAC;EAC7C;EACA,mBAAA;EACA,sBAAsB,eACpB,uBAAuB;GACrB,iBAAiB;GACjB,mBAAmB;GACpB,CAAC,CAAC;EACL,+BAA+B;GAC7B,MAAM,QAAQ,yBAAyB,MAAM;AAC7C,OAAI,CAAC,MACH,QAAO;AAET,UAAO;IACL,KAAK,MAAM;IACX,QAAQ,MAAM;IACf;;EAEH;EACD,CAAC;;AAGJ,SAAgB,8BAA8B,SAE1C,EAAE,EAAmB;AACvB,QAAO,IAAI,gBAAgB;EACzB,gBAAgB,oCAAoC;EACpD,QAAQ,OAAO;EAChB,CAAC;;AAGJ,SAAgB,gCACd,MAAkC,UACf;AACnB,QAAO,IAAI,kBAAkB,MAAM,EACjC,mBAAmB,SAAS;AAC1B,qCAAmC;AACnC,aAAW,KAAK;AAEhB,MADuB,oBAAoB,MAAM,EAC7B,QAAQ,QAAQ,IAClC,qBAAoB,QAAQ,WAAW;GACrC,GAAG;GACH,QAAQ;GACT,EAAE;EAEL,MAAM,eAAe,yBAAyB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AAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/commands/service/index.ts"],"sourcesContent":["import { HostAutostartCommandService } from \"@nextclaw-service/commands/service/services/autostart/host-autostart-command.service.js\";\nimport type { ServiceAutostartCommandOptions } from \"@nextclaw-service/shared/types/cli.types.js\";\n\nexport class ServiceCommands {\n private readonly hostAutostartCommandService = new HostAutostartCommandService();\n\n installSystemd = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.installSystemd(options);\n };\n\n uninstallSystemd = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.uninstallSystemd(options);\n };\n\n installLaunchAgent = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.installLaunchAgent(options);\n };\n\n uninstallLaunchAgent = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.uninstallLaunchAgent(options);\n };\n\n installWindowsTask = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.installWindowsTask(options);\n };\n\n uninstallWindowsTask = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.uninstallWindowsTask(options);\n };\n\n autostartStatus = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.autostartStatus(options);\n };\n\n autostartDoctor = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n await this.hostAutostartCommandService.autostartDoctor(options);\n };\n}\n"],"mappings":";;AAGA,IAAa,kBAAb,MAA6B;CAC3B,8BAA+C,IAAI,6BAA6B;CAEhF,iBAAiB,OAAO,UAA0C,EAAE,KAAoB;AACtF,QAAM,KAAK,4BAA4B,eAAe,QAAQ;;CAGhE,mBAAmB,OAAO,UAA0C,EAAE,KAAoB;AACxF,QAAM,KAAK,4BAA4B,iBAAiB,QAAQ;;CAGlE,qBAAqB,OAAO,UAA0C,EAAE,KAAoB;AAC1F,QAAM,KAAK,4BAA4B,mBAAmB,QAAQ;;CAGpE,uBAAuB,OAAO,UAA0C,EAAE,KAAoB;AAC5F,QAAM,KAAK,4BAA4B,qBAAqB,QAAQ;;CAGtE,qBAAqB,OAAO,UAA0C,EAAE,KAAoB;AAC1F,QAAM,KAAK,4BAA4B,mBAAmB,QAAQ;;CAGpE,uBAAuB,OAAO,UAA0C,EAAE,KAAoB;AAC5F,QAAM,KAAK,4BAA4B,qBAAqB,QAAQ;;CAGtE,kBAAkB,OAAO,UAA0C,EAAE,KAAoB;AACvF,QAAM,KAAK,4BAA4B,gBAAgB,QAAQ;;CAGjE,kBAAkB,OAAO,UAA0C,EAAE,KAAoB;AACvF,QAAM,KAAK,4BAA4B,gBAAgB,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-autostart-command.service.d.ts","names":[],"sources":["../../../../../src/commands/service/services/autostart/host-autostart-command.service.ts"],"mappings":";;;;KAYK,kCAAA;EACH,oBAAA,GAAuB,oBAAA;AAAA;AAAA,cAGZ,2BAAA;EAAA,iBACM,oBAAA;cAEL,OAAA,GAAS,kCAAA;EAIrB,cAAA,GAAwB,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAYvE,gBAAA,GAA0B,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAYzE,kBAAA,GAA4B,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAO3E,oBAAA,GAA8B,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAO7E,kBAAA,GAA4B,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAO3E,oBAAA,GAA8B,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAO7E,eAAA,GAAyB,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAgBxE,eAAA,GAAyB,OAAA,GAAS,8BAAA,KAAsC,OAAA;EAAA,QAgBhE,mBAAA;EAAA,QAoBA,qBAAA;EAAA,QAuBA,sBAAA;EAAA,QA6BA,2BAAA;EAAA,QAQA,2BAAA;EAAA,QAeA,oBAAA;EAAA,QAoCA,oBAAA;EAAA,QAQA,WAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-autostart-command.service.js","names":[],"sources":["../../../../../src/commands/service/services/autostart/host-autostart-command.service.ts"],"sourcesContent":["import type { ServiceAutostartCommandOptions } from \"../../../../shared/types/cli.types.js\";\nimport { HostAutostartService } from \"./host-autostart.service.js\";\nimport type {\n HostAutostartDoctorReport,\n HostAutostartInstallResult,\n HostAutostartOwner,\n HostAutostartScope,\n HostAutostartStatus,\n HostAutostartUninstallResult,\n SystemdScopeFlags,\n} from \"../../types/autostart/host-autostart.types.js\";\n\ntype HostAutostartCommandServiceOptions = {\n hostAutostartService?: HostAutostartService;\n};\n\nexport class HostAutostartCommandService {\n private readonly hostAutostartService: HostAutostartService;\n\n constructor(options: HostAutostartCommandServiceOptions = {}) {\n this.hostAutostartService = options.hostAutostartService ?? new HostAutostartService();\n }\n\n installSystemd = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const scope = this.resolveRequiredSystemdScope(options);\n if (!scope) {\n process.exitCode = 1;\n return;\n }\n const result = await this.hostAutostartService.installSystemd(scope, {\n dryRun: Boolean(options.dryRun),\n });\n this.handleInstallResult(result, options, \"systemd autostart installed.\");\n };\n\n uninstallSystemd = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const scope = this.resolveRequiredSystemdScope(options);\n if (!scope) {\n process.exitCode = 1;\n return;\n }\n const result = await this.hostAutostartService.uninstallSystemd(scope, {\n dryRun: Boolean(options.dryRun),\n });\n this.handleUninstallResult(result, options, \"systemd autostart uninstalled.\");\n };\n\n installLaunchAgent = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const result = await this.hostAutostartService.installLaunchAgent({\n dryRun: Boolean(options.dryRun),\n });\n this.handleInstallResult(result, options, \"LaunchAgent autostart installed.\");\n };\n\n uninstallLaunchAgent = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const result = await this.hostAutostartService.uninstallLaunchAgent({\n dryRun: Boolean(options.dryRun),\n });\n this.handleUninstallResult(result, options, \"LaunchAgent autostart uninstalled.\");\n };\n\n installWindowsTask = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const result = await this.hostAutostartService.installWindowsTask({\n dryRun: Boolean(options.dryRun),\n });\n this.handleInstallResult(result, options, \"Windows task autostart installed.\");\n };\n\n uninstallWindowsTask = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const result = await this.hostAutostartService.uninstallWindowsTask({\n dryRun: Boolean(options.dryRun),\n });\n this.handleUninstallResult(result, options, \"Windows task autostart uninstalled.\");\n };\n\n autostartStatus = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const scope = this.resolveOptionalSystemdScope(options);\n if (scope === \"invalid\") {\n process.exitCode = 1;\n return;\n }\n const status = await this.hostAutostartService.status(scope ?? undefined);\n if (options.json) {\n console.log(JSON.stringify(status, null, 2));\n process.exitCode = 0;\n return;\n }\n this.printAutostartStatus(status);\n process.exitCode = 0;\n };\n\n autostartDoctor = async (options: ServiceAutostartCommandOptions = {}): Promise<void> => {\n const scope = this.resolveOptionalSystemdScope(options);\n if (scope === \"invalid\") {\n process.exitCode = 1;\n return;\n }\n const report = await this.hostAutostartService.doctor(scope ?? undefined);\n if (options.json) {\n console.log(JSON.stringify(report, null, 2));\n process.exitCode = report.exitCode;\n return;\n }\n this.printAutostartDoctor(report);\n process.exitCode = report.exitCode;\n };\n\n private handleInstallResult = (\n result: HostAutostartInstallResult,\n options: ServiceAutostartCommandOptions,\n successMessage: string,\n ): void => {\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n process.exitCode = result.ok ? 0 : 1;\n return;\n }\n if (!result.ok) {\n process.exitCode = 1;\n console.error(`Error: ${result.reasonIfUnavailable ?? \"host autostart install failed.\"}`);\n return;\n }\n this.printInstallLikeResult(result);\n console.log(result.dryRun ? \"Dry run complete.\" : successMessage);\n process.exitCode = 0;\n };\n\n private handleUninstallResult = (\n result: HostAutostartUninstallResult,\n options: ServiceAutostartCommandOptions,\n successMessage: string,\n ): void => {\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n process.exitCode = result.ok ? 0 : 1;\n return;\n }\n if (!result.ok) {\n process.exitCode = 1;\n console.error(`Error: ${result.reasonIfUnavailable ?? \"host autostart uninstall failed.\"}`);\n return;\n }\n this.printInstallLikeResult(result);\n if (!result.removed) {\n console.log(\"No installed host autostart resource was found.\");\n }\n console.log(result.dryRun ? \"Dry run complete.\" : successMessage);\n process.exitCode = 0;\n };\n\n private printInstallLikeResult = (\n result: HostAutostartInstallResult | HostAutostartUninstallResult,\n ): void => {\n if (result.hostOwner) {\n console.log(`Host autostart owner: ${this.formatOwner(result.hostOwner)}`);\n }\n if (result.scope) {\n console.log(`Scope: ${result.scope}`);\n }\n if (result.resourceName) {\n console.log(`Resource: ${result.resourceName}`);\n }\n if (result.resourcePath) {\n console.log(`Resource path: ${result.resourcePath}`);\n }\n if (\"homeDir\" in result && result.homeDir) {\n console.log(`Home: ${result.homeDir}`);\n }\n if (\"command\" in result && result.command) {\n console.log(`Command: ${result.command}`);\n }\n if (result.logHint) {\n console.log(`Logs: ${result.logHint}`);\n }\n for (const action of result.actions) {\n console.log(`- ${action}`);\n }\n };\n\n private resolveRequiredSystemdScope = (options: SystemdScopeFlags): HostAutostartScope | null => {\n if (Boolean(options.user) === Boolean(options.system)) {\n console.error(\"Error: Choose exactly one scope: --user or --system.\");\n return null;\n }\n return options.system ? \"system\" : \"user\";\n };\n\n private resolveOptionalSystemdScope = (options: SystemdScopeFlags): HostAutostartScope | \"invalid\" | null => {\n const { system, user } = options;\n if (user && system) {\n console.error(\"Error: Choose at most one scope: --user or --system.\");\n return \"invalid\";\n }\n if (system) {\n return \"system\";\n }\n if (user) {\n return \"user\";\n }\n return null;\n };\n\n private printAutostartStatus = (status: HostAutostartStatus): void => {\n console.log(\"Host autostart status:\");\n console.log(`- Supported: ${status.supported ? \"yes\" : \"no\"}`);\n console.log(`- Installed: ${status.installed ? \"yes\" : \"no\"}`);\n if (status.scope) {\n console.log(`- Scope: ${status.scope}`);\n }\n if (status.hostOwner) {\n console.log(`- Owner: ${this.formatOwner(status.hostOwner)}`);\n }\n if (status.resourceName) {\n console.log(`- Resource: ${status.resourceName}`);\n }\n if (status.resourcePath) {\n console.log(`- Resource path: ${status.resourcePath}`);\n }\n if (status.homeDir) {\n console.log(`- Home: ${status.homeDir}`);\n }\n if (status.command) {\n console.log(`- Command: ${status.command}`);\n }\n if (status.enabled !== null) {\n console.log(`- Enabled: ${status.enabled ? \"yes\" : \"no\"}`);\n }\n if (status.active !== null) {\n console.log(`- Active: ${status.active ? \"yes\" : \"no\"}`);\n }\n if (status.logHint) {\n console.log(`- Logs: ${status.logHint}`);\n }\n if (status.reasonIfUnavailable) {\n console.log(`- Note: ${status.reasonIfUnavailable}`);\n }\n };\n\n private printAutostartDoctor = (report: HostAutostartDoctorReport): void => {\n this.printAutostartStatus(report.status);\n console.log(\"Autostart doctor:\");\n for (const check of report.checks) {\n console.log(`- [${check.status}] ${check.name}: ${check.detail}`);\n }\n };\n\n private formatOwner = (owner: HostAutostartOwner): string => {\n if (owner === \"systemd-user-service\") {\n return \"systemd user service\";\n }\n if (owner === \"systemd-system-service\") {\n return \"systemd system service\";\n }\n if (owner === \"launchd-launch-agent\") {\n return \"launchd LaunchAgent\";\n }\n return \"Windows Scheduled Task\";\n };\n}\n"],"mappings":";;AAgBA,IAAa,8BAAb,MAAyC;CACvC;CAEA,YAAY,UAA8C,EAAE,EAAE;AAC5D,OAAK,uBAAuB,QAAQ,wBAAwB,IAAI,sBAAsB;;CAGxF,iBAAiB,OAAO,UAA0C,EAAE,KAAoB;EACtF,MAAM,QAAQ,KAAK,4BAA4B,QAAQ;AACvD,MAAI,CAAC,OAAO;AACV,WAAQ,WAAW;AACnB;;EAEF,MAAM,SAAS,MAAM,KAAK,qBAAqB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GAAG;AAE/D,MAAI,OAAO,aACT,SAAQ,IAAI,eAAe,OAAO,eAAe;AAEnD,MAAI,OAAO,aACT,SAAQ,IAAI,oBAAoB,OAAO,eAAe;AAExD,MAAI,OAAO,QACT,SAAQ,IAAI,WAAW,OAAO,UAAU;AAE1C,MAAI,OAAO,QACT,SAAQ,IAAI,cAAc,OAAO,UAAU;AAE7C,MAAI,OAAO,YAAY,KACrB,SAAQ,IAAI,cAAc,OAAO,UAAU,QAAQ,OAAO;AAE5D,MAAI,OAAO,WAAW,KACpB,SAAQ,IAAI,aAAa,OAAO,SAAS,QAAQ,OAAO;AAE1D,MAAI,OAAO,QACT,SAAQ,IAAI,WAAW,OAAO,UAAU;AAE1C,MAAI,OAAO,oBACT,SAAQ,IAAI,WAAW,OAAO,sBAAsB;;CAIxD,wBAAgC,WAA4C;AAC1E,OAAK,qBAAqB,OAAO,OAAO;AACxC,UAAQ,IAAI,oBAAoB;AAChC,OAAK,MAAM,SAAS,OAAO,OACzB,SAAQ,IAAI,MAAM,MAAM,OAAO,IAAI,MAAM,KAAK,IAAI,MAAM,SAAS;;CAIrE,eAAuB,UAAsC;AAC3D,MAAI,UAAU,uBACZ,QAAO;AAET,MAAI,UAAU,yBACZ,QAAO;AAET,MAAI,UAAU,uBACZ,QAAO;AAET,SAAO"}
|
|
@@ -20,4 +20,5 @@ declare class HostAutostartRuntimeService {
|
|
|
20
20
|
private resolveCliEntry;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
-
export { HostAutostartLaunchPlan, HostAutostartRuntimeService };
|
|
23
|
+
export { HostAutostartLaunchPlan, HostAutostartRuntimeService };
|
|
24
|
+
//# sourceMappingURL=host-autostart-runtime.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-autostart-runtime.service.d.ts","names":[],"sources":["../../../../../src/commands/service/services/autostart/host-autostart-runtime.service.ts"],"mappings":";KAKK,kCAAA;EACH,QAAA;EACA,SAAA;EACA,aAAA;EACA,UAAA;AAAA;AAAA,KAGU,uBAAA;EACV,OAAA;EACA,OAAA;EACA,IAAA;AAAA;AAAA,cAkBW,2BAAA;EAAA,iBACM,QAAA;EAAA,iBACA,SAAA;EAAA,iBACA,aAAA;EAAA,iBACA,kBAAA;cAEL,OAAA,GAAS,kCAAA;EAOrB,4BAAA,QAAmC,uBAAA;EAAA,QAW3B,eAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-autostart-runtime.service.js","names":["windowsPath"],"sources":["../../../../../src/commands/service/services/autostart/host-autostart-runtime.service.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { extname, isAbsolute, resolve, win32 as windowsPath } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { getDataDir } from \"@nextclaw/core\";\n\ntype HostAutostartRuntimeServiceOptions = {\n nodePath?: string;\n argvEntry?: string;\n importMetaUrl?: string;\n getDataDir?: () => string;\n};\n\nexport type HostAutostartLaunchPlan = {\n homeDir: string;\n command: string;\n args: string[];\n};\n\nconst TYPESCRIPT_EXTENSIONS = new Set([\".ts\", \".tsx\", \".mts\", \".cts\"]);\nconst require = createRequire(import.meta.url);\n\nconst resolveCliAppEntryFromImportMeta = (importMetaUrl: string): string => {\n const modulePath = fileURLToPath(importMetaUrl);\n const normalizedPath = modulePath.replace(/\\\\/g, \"/\");\n const cliRootIndex = normalizedPath.lastIndexOf(\"/cli/\");\n if (cliRootIndex === -1) {\n return fileURLToPath(new URL(\"../../../app/index.js\", importMetaUrl));\n }\n const extension = extname(modulePath) || \".js\";\n const cliRootPath = modulePath.slice(0, cliRootIndex + \"/cli/\".length);\n return resolve(cliRootPath, \"app\", `index${extension}`);\n};\n\nexport class HostAutostartRuntimeService {\n private readonly nodePath: string;\n private readonly argvEntry: string | undefined;\n private readonly importMetaUrl: string;\n private readonly getResolvedDataDir: () => string;\n\n constructor(options: HostAutostartRuntimeServiceOptions = {}) {\n this.nodePath = options.nodePath ?? process.execPath;\n this.argvEntry = options.argvEntry ?? process.argv[1];\n this.importMetaUrl = options.importMetaUrl ?? import.meta.url;\n this.getResolvedDataDir = options.getDataDir ?? getDataDir;\n }\n\n resolveForegroundServeLaunch = (): HostAutostartLaunchPlan => {\n const cliEntry = this.resolveCliEntry();\n return {\n homeDir: this.getResolvedDataDir(),\n command: this.nodePath,\n args: TYPESCRIPT_EXTENSIONS.has(extname(cliEntry).toLowerCase())\n ? [require.resolve(\"tsx/cli\"), cliEntry, \"serve\"]\n : [cliEntry, \"serve\"],\n };\n };\n\n private resolveCliEntry = (): string => {\n const argvEntry = this.argvEntry?.trim();\n if (argvEntry) {\n if (isAbsolute(argvEntry) || windowsPath.isAbsolute(argvEntry)) {\n return argvEntry;\n }\n return resolve(argvEntry);\n }\n return resolveCliAppEntryFromImportMeta(this.importMetaUrl);\n };\n}\n"],"mappings":";;;;;AAkBA,MAAM,wBAAwB,IAAI,IAAI;CAAC;CAAO;CAAQ;CAAQ;CAAO,CAAC;AACtE,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,MAAM,oCAAoC,kBAAkC;CAC1E,MAAM,aAAa,cAAc,cAAc;CAE/C,MAAM,eADiB,WAAW,QAAQ,OAAO,IAAI,CACjB,YAAY,QAAQ;AACxD,KAAI,iBAAiB,GACnB,QAAO,cAAc,IAAI,IAAI,yBAAyB,cAAc,CAAC;CAEvE,MAAM,YAAY,QAAQ,WAAW,IAAI;AAEzC,QAAO,QADa,WAAW,MAAM,GAAG,eAAe,EAAe,EAC1C,OAAO,QAAQ,YAAY;;AAGzD,IAAa,8BAAb,MAAyC;CACvC;CACA;CACA;CACA;CAEA,YAAY,UAA8C,EAAE,EAAE;AAC5D,OAAK,WAAW,QAAQ,YAAY,QAAQ;AAC5C,OAAK,YAAY,QAAQ,aAAa,QAAQ,KAAK;AACnD,OAAK,gBAAgB,QAAQ,iBAAiB,OAAO,KAAK;AAC1D,OAAK,qBAAqB,QAAQ,cAAc;;CAGlD,qCAA8D;EAC5D,MAAM,WAAW,KAAK,iBAAiB;AACvC,SAAO;GACL,SAAS,KAAK,oBAAoB;GAClC,SAAS,KAAK;GACd,MAAM,sBAAsB,IAAI,QAAQ,SAAS,CAAC,aAAa,CAAC,GAC5D;IAAC,QAAQ,QAAQ,UAAU;IAAE;IAAU;IAAQ,GAC/C,CAAC,UAAU,QAAQ;GACxB;;CAGH,wBAAwC;EACtC,MAAM,YAAY,KAAK,WAAW,MAAM;AACxC,MAAI,WAAW;AACb,OAAI,WAAW,UAAU,IAAIA,MAAY,WAAW,UAAU,CAC5D,QAAO;AAET,UAAO,QAAQ,UAAU;;AAE3B,SAAO,iCAAiC,KAAK,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-autostart.service.d.ts","names":[],"sources":["../../../../../src/commands/service/services/autostart/host-autostart.service.ts"],"mappings":";;;;;;KAWK,2BAAA;EACH,mBAAA,GAAsB,4BAAA;EACtB,uBAAA,GAA0B,gCAAA;EAC1B,kBAAA,GAAqB,2BAAA;EACrB,QAAA,GAAW,MAAA,CAAO,QAAA;AAAA;AAAA,cAGP,oBAAA;EAAA,iBACM,QAAA;EAAA,iBACA,mBAAA;EAAA,iBACA,uBAAA;EAAA,iBACA,kBAAA;cAEL,OAAA,GAAS,2BAAA;EAOrB,cAAA,GAAwB,KAAA,EAAO,kBAAA,EAAoB,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,0BAAA;EAIhG,gBAAA,GAA0B,KAAA,EAAO,kBAAA,EAAoB,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,4BAAA;EAIlG,kBAAA,GAA4B,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,0BAAA;EAIzE,oBAAA,GAA8B,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,4BAAA;EAI3E,kBAAA,GAA4B,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,0BAAA;EAIzE,oBAAA,GAA8B,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,4BAAA;EAI3E,MAAA,GAAgB,KAAA,GAAQ,kBAAA,KAAqB,OAAA,CAAQ,mBAAA;EAarD,MAAA,GAAgB,KAAA,GAAQ,kBAAA,KAAqB,OAAA,CAAQ,yBAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-autostart.service.js","names":[],"sources":["../../../../../src/commands/service/services/autostart/host-autostart.service.ts"],"sourcesContent":["import type {\n HostAutostartDoctorReport,\n HostAutostartInstallResult,\n HostAutostartScope,\n HostAutostartStatus,\n HostAutostartUninstallResult,\n} from \"../../types/autostart/host-autostart.types.js\";\nimport { LinuxSystemdAutostartService } from \"./linux-systemd-autostart.service.js\";\nimport { MacosLaunchAgentAutostartService } from \"./macos-launch-agent-autostart.service.js\";\nimport { WindowsTaskAutostartService } from \"./windows-task-autostart.service.js\";\n\ntype HostAutostartServiceOptions = {\n linuxSystemdService?: LinuxSystemdAutostartService;\n macosLaunchAgentService?: MacosLaunchAgentAutostartService;\n windowsTaskService?: WindowsTaskAutostartService;\n platform?: NodeJS.Platform;\n};\n\nexport class HostAutostartService {\n private readonly platform: NodeJS.Platform;\n private readonly linuxSystemdService: LinuxSystemdAutostartService;\n private readonly macosLaunchAgentService: MacosLaunchAgentAutostartService;\n private readonly windowsTaskService: WindowsTaskAutostartService;\n\n constructor(options: HostAutostartServiceOptions = {}) {\n this.platform = options.platform ?? process.platform;\n this.linuxSystemdService = options.linuxSystemdService ?? new LinuxSystemdAutostartService();\n this.macosLaunchAgentService = options.macosLaunchAgentService ?? new MacosLaunchAgentAutostartService();\n this.windowsTaskService = options.windowsTaskService ?? new WindowsTaskAutostartService();\n }\n\n installSystemd = async (scope: HostAutostartScope, options: { dryRun?: boolean } = {}): Promise<HostAutostartInstallResult> => {\n return await this.linuxSystemdService.install(scope, options);\n };\n\n uninstallSystemd = async (scope: HostAutostartScope, options: { dryRun?: boolean } = {}): Promise<HostAutostartUninstallResult> => {\n return await this.linuxSystemdService.uninstall(scope, options);\n };\n\n installLaunchAgent = async (options: { dryRun?: boolean } = {}): Promise<HostAutostartInstallResult> => {\n return await this.macosLaunchAgentService.install(\"user\", options);\n };\n\n uninstallLaunchAgent = async (options: { dryRun?: boolean } = {}): Promise<HostAutostartUninstallResult> => {\n return await this.macosLaunchAgentService.uninstall(\"user\", options);\n };\n\n installWindowsTask = async (options: { dryRun?: boolean } = {}): Promise<HostAutostartInstallResult> => {\n return await this.windowsTaskService.install(\"user\", options);\n };\n\n uninstallWindowsTask = async (options: { dryRun?: boolean } = {}): Promise<HostAutostartUninstallResult> => {\n return await this.windowsTaskService.uninstall(\"user\", options);\n };\n\n status = async (scope?: HostAutostartScope): Promise<HostAutostartStatus> => {\n if (this.platform === \"linux\") {\n return await this.linuxSystemdService.status(scope);\n }\n if (this.platform === \"darwin\") {\n return await this.macosLaunchAgentService.status(scope);\n }\n if (this.platform === \"win32\") {\n return await this.windowsTaskService.status(scope);\n }\n return await this.linuxSystemdService.status(scope);\n };\n\n doctor = async (scope?: HostAutostartScope): Promise<HostAutostartDoctorReport> => {\n if (this.platform === \"linux\") {\n return await this.linuxSystemdService.doctor(scope);\n }\n if (this.platform === \"darwin\") {\n return await this.macosLaunchAgentService.doctor(scope);\n }\n if (this.platform === \"win32\") {\n return await this.windowsTaskService.doctor(scope);\n }\n return await this.linuxSystemdService.doctor(scope);\n };\n}\n"],"mappings":";;;;AAkBA,IAAa,uBAAb,MAAkC;CAChC;CACA;CACA;CACA;CAEA,YAAY,UAAuC,EAAE,EAAE;AACrD,OAAK,WAAW,QAAQ,YAAY,QAAQ;AAC5C,OAAK,sBAAsB,QAAQ,uBAAuB,IAAI,8BAA8B;AAC5F,OAAK,0BAA0B,QAAQ,2BAA2B,IAAI,kCAAkC;AACxG,OAAK,qBAAqB,QAAQ,sBAAsB,IAAI,6BAA6B;;CAG3F,iBAAiB,OAAO,OAA2B,UAAgC,EA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autostart.service.ts"],"mappings":";;;;;KAsBK,mCAAA;EACH,QAAA,GAAW,MAAA,CAAO,QAAA;EAClB,GAAA,GAAM,MAAA,CAAO,UAAA;EACb,UAAA;EACA,UAAA,IAAc,IAAA;EACd,SAAA,UAAmB,SAAA;EACnB,aAAA,UAAuB,aAAA;EACvB,MAAA,UAAgB,MAAA;EAChB,UAAA,GAAa,uBAAA;EACb,cAAA,GAAiB,2BAAA;AAAA;AAAA,cAWN,4BAAA;EAAA,iBACM,QAAA;EAAA,iBACA,GAAA;EAAA,iBACA,UAAA;EAAA,iBACA,UAAA;EAAA,iBACA,SAAA;EAAA,iBACA,SAAA;EAAA,iBACA,UAAA;EAAA,iBACA,cAAA;EAAA,iBACA,cAAA;cAEL,OAAA,GAAS,mCAAA;EAYrB,OAAA,GAAiB,KAAA,EAAO,kBAAA,EAAoB,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,0BAAA;EA6DzF,SAAA,GAAmB,KAAA,EAAO,kBAAA,EAAoB,OAAA;IAAW,MAAA;EAAA,MAA0B,OAAA,CAAQ,4BAAA;EAgF3F,MAAA,GAAgB,cAAA,GAAiB,kBAAA,KAAqB,OAAA,CAAQ,mBAAA;EA6D9D,MAAA,GAAgB,cAAA,GAAiB,kBAAA,KAAqB,OAAA,CAAQ,yBAAA;EAAA,QAuDtD,WAAA;EAAA,QAIA,oBAAA;EAAA,QAIA,uBAAA;EAAA,QAiBA,8BAAA;EAAA,QAiBA,mBAAA;EAAA,QAqBA,SAAA;EAAA,QA4CA,WAAA;EAAA,QASA,kBAAA;EAAA,QAOA,aAAA;EAAA,QAIA,iBAAA;AAAA"}
|