feat(agent): add Windows service management via PM2#38
Open
mikekidder wants to merge 2 commits intoearlyaidopters:mainfrom
Open
feat(agent): add Windows service management via PM2#38mikekidder wants to merge 2 commits intoearlyaidopters:mainfrom
mikekidder wants to merge 2 commits intoearlyaidopters:mainfrom
Conversation
Adds win32 support to agent service lifecycle (create, activate, deactivate) using PM2 as the process manager. Previously, only macOS (launchd) and Linux (systemd) were supported, with Windows returning an 'Unsupported platform' error. Changes: - agent-create.ts: generatePm2Config(), activatePm2(), deactivatePm2() - security.ts: win32 branch in killSwitch() using pm2 kill PM2 is commonly available on Windows via npm and provides reliable process management with auto-restart, log rotation, and monitoring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Calls pm2-startup install after pm2 save during Windows agent activation so processes survive reboots. Logs a warning if pm2-windows-startup is not installed globally. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent-create.ts:generatePm2Config()creates anecosystem.config.cjs,activatePm2()starts the agent via PM2, and the deactivate path stops/deletes the PM2 processwin32branch insecurity.ts's emergency kill switch that runspm2 killto halt all ClaudeClaw servicesactivatePm2()now callspm2-startup installto register a Windows boot hook so processes survive reboots. Logs a warning if the package is not installedPrerequisites (Windows)
PM2 alone does not persist processes across reboots on Windows. Users need:
The activation flow calls
pm2-startup installautomatically afterpm2 save. If the package is missing, activation still succeeds but a warning is logged that reboot persistence is unavailable.Test plan
npm run buildto verify TypeScript compiles without errorsecosystem.config.cjsis generated in PROJECT_ROOT with correct app name, script path, args, and log file pathspm2 listshows the process running with the expectedclaudeclaw-<agentId>namepm2 list, and thatpm2 savepersists the changepm2-startup installis called during activation and registers the Windows boot hook🤖 Generated with Claude Code