@kianwoon/modelweaver 0.3.13 → 0.3.14

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.
@@ -24,7 +24,7 @@ ${M} Generated configuration:${d}
24
24
  `).map($=>` ${$}`).join(`
25
25
  `));let{confirm:v}=await p({type:"confirm",name:"confirm",message:`[Step 2 of ${u}] Write this configuration?`,initial:!0},g);if(v)break;console.log(`
26
26
  Restarting quick setup...
27
- `)}await ae(n,s,r,a,u,!0,!!t)}async function ae(i,t,o,e,n,s,r){let a=N(process.env.HOME||process.env.USERPROFILE||"",".modelweaver");ne(a,{recursive:!0});let u=N(a,"config.yaml");oe(u)&&r?_(`Updating existing config at ${u}`):_(`Writing new config to ${u}`),te(u,e),Ee(i);try{let{readPidFile:c,isProcessAlive:v}=await import("./daemon-57XX5JCT.js"),$=await c();if($&&v($)){if(process.platform!=="win32")try{process.kill($,"SIGUSR1")}catch{}else console.log(" Windows does not support SIGUSR1 \u2014 run 'modelweaver reload' to pick up new config.");_("ModelWeaver daemon reloaded with new config")}}catch{}let l=await xe(t);if(l){let c=o.host==="localhost"?`http://localhost:${o.port}`:`http://${o.host}:${o.port}`;V()&&console.log(" Backed up existing settings to settings.json.bak");let $=z(),h=J($,{baseUrl:c,defaultModel:l.defaultModel,availableModels:l.availableModels});Q(h),_(`Claude Code settings updated at ${Y()}`),console.log(` Proxy endpoint: ${c}`),console.log(` Default model: ${l.defaultModel}`),console.log(` Available models: ${l.availableModels.join(", ")}`),console.log(),console.log(` ${ie}Restart Claude Code to apply changes.${d}`)}return l}var B=0,L=1,D=2,ee=3;async function Ge(i){if(i?.quick)return Ae();process.stdin.isTTY||(console.error("Error: modelweaver init requires an interactive terminal."),process.exit(1));let{peekConfig:t}=await import("./config-P34YQCFG.js"),o=t(),e=o?.providers??new Map,n=o?.modelRouting??new Map,s=e.size>0,r=[],a=[],u=[],l={port:3456,host:"localhost"},c,v=null,$=s,h=B;for(;;){if(h<=B){if(F(),console.log(`
27
+ `)}await ae(n,s,r,a,u,!0,!!t)}async function ae(i,t,o,e,n,s,r){let a=N(process.env.HOME||process.env.USERPROFILE||"",".modelweaver");ne(a,{recursive:!0});let u=N(a,"config.yaml");oe(u)&&r?_(`Updating existing config at ${u}`):_(`Writing new config to ${u}`),te(u,e),Ee(i);try{let{readPidFile:c,isProcessAlive:v}=await import("./daemon-27GXX25D.js"),$=await c();if($&&v($)){if(process.platform!=="win32")try{process.kill($,"SIGUSR1")}catch{}else console.log(" Windows does not support SIGUSR1 \u2014 run 'modelweaver reload' to pick up new config.");_("ModelWeaver daemon reloaded with new config")}}catch{}let l=await xe(t);if(l){let c=o.host==="localhost"?`http://localhost:${o.port}`:`http://${o.host}:${o.port}`;V()&&console.log(" Backed up existing settings to settings.json.bak");let $=z(),h=J($,{baseUrl:c,defaultModel:l.defaultModel,availableModels:l.availableModels});Q(h),_(`Claude Code settings updated at ${Y()}`),console.log(` Proxy endpoint: ${c}`),console.log(` Default model: ${l.defaultModel}`),console.log(` Available models: ${l.availableModels.join(", ")}`),console.log(),console.log(` ${ie}Restart Claude Code to apply changes.${d}`)}return l}var B=0,L=1,D=2,ee=3;async function Ge(i){if(i?.quick)return Ae();process.stdin.isTTY||(console.error("Error: modelweaver init requires an interactive terminal."),process.exit(1));let{peekConfig:t}=await import("./config-P34YQCFG.js"),o=t(),e=o?.providers??new Map,n=o?.modelRouting??new Map,s=e.size>0,r=[],a=[],u=[],l={port:3456,host:"localhost"},c,v=null,$=s,h=B;for(;;){if(h<=B){if(F(),console.log(`
28
28
  ${M}${m}\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\u2500
29
29
  \u2551 Welcome to ModelWeaver! \u2551
30
30
  \u2551 \u2551
@@ -60,4 +60,4 @@ ${v?`\u2551 Claude Code settings have been updated. \u2551
60
60
  \u2551 claude \u2551`}
61
61
  \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D${d}
62
62
  `)}export{Ge as runInit,X as testApiKey};
63
- //# sourceMappingURL=init-BWJF5P6D.js.map
63
+ //# sourceMappingURL=init-VLTKSOZN.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kianwoon/modelweaver",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Multi-provider model orchestration proxy for Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import{spawn as N,execFile as W,execFileSync as $}from"child_process";import{access as L,readFile as E,writeFile as M,unlink as I,mkdir as G}from"fs/promises";import{join as f}from"path";import{dirname as U}from"path";import{fileURLToPath as _}from"url";import{createServer as O}from"net";function d(){return process.platform==="win32"}var m=f(process.env.HOME||process.env.USERPROFILE||"",".modelweaver"),D=null;function Q(n){D=n}function y(){return f(m,"modelweaver.pid")}function c(){return f(m,"modelweaver.log")}async function R(){try{await L(m)}catch{await G(m,{recursive:!0})}}async function Y(n){await R();try{await M(y(),`${n}
3
- `,{flag:"wx"})}catch(e){if(e.code==="EEXIST")return;throw e}}async function w(){let n=y();try{let e=await E(n,"utf-8"),t=parseInt(e.trim(),10);return isNaN(t)?null:t}catch{return null}}async function u(){let n=y();try{await I(n)}catch{}}function b(){return f(m,"modelweaver.worker.pid")}async function Z(n){await R(),await M(b(),`${n}
4
- `)}async function v(){let n=b();try{let e=await E(n,"utf-8"),t=parseInt(e.trim(),10);return isNaN(t)?null:t}catch{return null}}async function P(){let n=b();try{await I(n)}catch{}}function a(n){try{return process.kill(n,0),!0}catch{return!1}}function x(n){return new Promise(e=>{if(d()){try{W("netstat",["-ano"],{encoding:"utf-8",timeout:3e3},(t,r)=>{if(t){e([]);return}let i=[];for(let o of(r||"").split(`
5
- `))if(o.includes("LISTENING")&&o.includes(`:${n}`)){let s=o.trim().split(/\s+/),l=parseInt(s[s.length-1],10);!isNaN(l)&&l>0&&i.push(l)}e(i)})}catch{e([]);return}return}W("lsof",["-ti",`:${n}`,"-sTCP:LISTEN"],{encoding:"utf-8",timeout:3e3},(t,r)=>{if(t){e([]);return}let i=(r||"").trim();e(i?i.split(`
6
- `).map(Number).filter(o=>!isNaN(o)):[])})})}async function h(n){if(D!==null)return D;try{let{loadConfig:e}=await import("./config-P34YQCFG.js"),{config:t}=await e(n??void 0);return t.server.port}catch{return 3456}}async function T(n,e=5e3){for(let r of n)try{process.kill(r,"SIGTERM")}catch{}let t=Date.now()+e;for(;Date.now()<t;){if(n.every(r=>!a(r)))return!0;await new Promise(r=>setTimeout(r,200))}for(let r of n)if(d())try{$("taskkill",["/F","/PID",String(r),"/T"],{stdio:"ignore"})}catch{}else try{process.kill(r,"SIGKILL")}catch{}return!0}async function C(n){let e=await w();if(e===null){let t=n??await h();if(t!==null&&t>0){let r=await x(t);if(r.length>0){let i=r.filter(o=>a(o));if(i.length>0)return{running:!0,pid:i[0],message:`ModelWeaver is running (PID ${i[0]}, detected on port ${t}; PID file missing)`}}}return{running:!1,message:"ModelWeaver is not running (no PID file found)"}}return a(e)?{running:!0,pid:e,message:`ModelWeaver is running (PID ${e})`}:(await u(),{running:!1,message:"ModelWeaver is not running (stale PID file cleaned up)"})}function A(n){return new Promise(e=>{let t=O();t.once("error",r=>{r.code==="EADDRINUSE"?e(!0):e(!1)}),t.once("listening",()=>{t.close(()=>e(!1))}),t.listen(n)})}async function ee(n,e,t){let r=await C(e);if(r.running)return{success:!1,pid:r.pid,message:`ModelWeaver is already running (PID ${r.pid})`,logPath:c()};let i=e??await h()??3456;if(await A(i))return{success:!1,message:`Port ${i} is already in use. Is ModelWeaver or another process running on it?`,logPath:c()};let o=_(import.meta.url),s=U(o),p=[f(s,"index.js"),"--monitor"];n&&p.push("--config",n),e&&p.push("--port",String(e)),t&&p.push("--verbose"),N(process.execPath,p,{detached:!0,stdio:"ignore",env:{...process.env}}).unref();let g;for(let S=0;S<20;S++){let k=await w();if(k!==null){g=k;break}await new Promise(F=>setTimeout(F,100))}return g?{success:!0,pid:g,message:`ModelWeaver started in background (PID ${g})`,logPath:c()}:{success:!1,message:"Daemon started but PID file was not created. Check logs at "+c(),logPath:c()}}async function K(n){let e=await w();if(e===null){let r=n??await h();if(r!==null&&r>0){let o=(await x(r)).filter(s=>a(s));if(o.length>0){let s=await v(),l=[...o];return s!==null&&a(s)&&!l.includes(s)&&l.push(s),await T(l),await P(),{success:!0,message:`ModelWeaver stopped (found on port ${r}, PIDs ${o.join(", ")}; PID file was missing)`}}}return{success:!1,message:"ModelWeaver is not running (no PID file found)"}}if(!a(e)){let r=await v();return r!==null&&a(r)&&(await T([r]),await P()),await u(),{success:!1,message:"ModelWeaver is not running (stale PID file cleaned up)"}}try{process.kill(e,"SIGTERM")}catch{return{success:!1,message:`Failed to stop daemon (PID ${e})`}}let t=Date.now()+5e3;for(;Date.now()<t;){if(!a(e))return await u(),{success:!0,message:`ModelWeaver stopped (PID ${e})`};await new Promise(r=>setTimeout(r,100))}try{d()?$("taskkill",["/F","/PID",String(e),"/T"],{stdio:"ignore"}):process.kill(e,"SIGKILL")}catch{}return await u(),await P(),{success:!0,message:`ModelWeaver force-stopped (PID ${e})`}}async function j(){let n=c();try{await I(n)}catch{}}async function ne(){let n=await K();return await j(),await P(),{success:n.success||n.message.includes("not running"),message:n.success?"ModelWeaver stopped and cleaned up (PID file + log file removed)":n.message.includes("not running")?"ModelWeaver is not running. Log file cleaned up.":n.message}}async function te(n){let e=await w();if(e===null){let t=n??await h();if(t!==null&&t>0){let i=(await x(t)).filter(o=>a(o));if(i.length>0){for(let o of i)try{d()?console.log(` Windows detected \u2014 reload signal not supported for PID ${o}. Use 'modelweaver stop && modelweaver start' instead.`):process.kill(o,"SIGHUP")}catch{}console.log(` Sent reload signal to ${i.length} process(es) on port ${t}.`);return}}console.log(" Daemon is not running.");return}if(!a(e)){await u(),console.log(" Daemon is not running (stale PID file cleaned up).");return}try{if(d()){let t=await v();t!==null?(process.kill(t,"SIGTERM"),console.log(` Killed worker (PID ${t}) on Windows \u2014 monitor will restart it.`)):console.log(" No worker PID file found \u2014 cannot reload.")}else process.kill(e,"SIGHUP"),console.log(` Sent reload signal to daemon (PID ${e}).`)}catch{console.log(" Failed to send reload signal \u2014 daemon may not be running.")}}function re(n,e=300){let t=null;return{reload(){t&&clearTimeout(t),t=setTimeout(()=>{t=null,n()},e)},dispose(){t&&(clearTimeout(t),t=null)}}}export{Q as a,y as b,c,R as d,Y as e,w as f,u as g,b as h,Z as i,v as j,P as k,a as l,x as m,h as n,C as o,A as p,ee as q,K as r,j as s,ne as t,te as u,re as v};
7
- //# sourceMappingURL=chunk-DIRPR744.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/daemon.ts"],"sourcesContent":["// src/daemon.ts — Daemon lifecycle management for background mode\nimport { spawn, execFile, execFileSync } from \"node:child_process\";\nimport { access, readFile, writeFile, unlink, mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createServer } from \"node:net\";\n\nfunction isWindows(): boolean {\n return process.platform === \"win32\";\n}\n\n// ---------------------------------------------------------------------------\n// Paths\n// ---------------------------------------------------------------------------\n\nconst MODELWEAVER_DIR = join(\n process.env.HOME || process.env.USERPROFILE || \"\",\n \".modelweaver\"\n);\n\n/** Override for getConfigPort — used by tests to prevent port scanning */\nlet _configPortOverride: number | null = null;\n\n/** Set a config port override (0 = skip port-based discovery). Used by tests. */\nexport function _setConfigPortOverride(port: number | null): void {\n _configPortOverride = port;\n}\n\nexport function getPidPath(): string {\n return join(MODELWEAVER_DIR, \"modelweaver.pid\");\n}\n\nexport function getLogPath(): string {\n return join(MODELWEAVER_DIR, \"modelweaver.log\");\n}\n\n// ---------------------------------------------------------------------------\n// Directory & PID helpers\n// ---------------------------------------------------------------------------\n\nexport async function ensureDir(): Promise<void> {\n try {\n await access(MODELWEAVER_DIR);\n } catch {\n await mkdir(MODELWEAVER_DIR, { recursive: true });\n }\n}\n\nexport async function writePidFile(pid: number): Promise<void> {\n await ensureDir();\n try {\n await writeFile(getPidPath(), `${pid}\\n`, { flag: 'wx' });\n } catch (err: unknown) {\n if ((err as NodeJS.ErrnoException).code === 'EEXIST') {\n // PID file already exists — another instance is likely running\n return;\n }\n throw err;\n }\n}\n\nexport async function readPidFile(): Promise<number | null> {\n const pidPath = getPidPath();\n try {\n const content = await readFile(pidPath, \"utf-8\");\n const pid = parseInt(content.trim(), 10);\n return isNaN(pid) ? null : pid;\n } catch {\n return null;\n }\n}\n\nexport async function removePidFile(): Promise<void> {\n const pidPath = getPidPath();\n try {\n await unlink(pidPath);\n } catch {\n // File doesn't exist — nothing to do\n }\n}\n\n// ---------------------------------------------------------------------------\n// Worker PID helpers (used by monitor to track daemon child)\n// ---------------------------------------------------------------------------\n\nexport function getWorkerPidPath(): string {\n return join(MODELWEAVER_DIR, \"modelweaver.worker.pid\");\n}\n\nexport async function writeWorkerPidFile(pid: number): Promise<void> {\n await ensureDir();\n await writeFile(getWorkerPidPath(), `${pid}\\n`);\n}\n\nexport async function readWorkerPidFile(): Promise<number | null> {\n const pidPath = getWorkerPidPath();\n try {\n const content = await readFile(pidPath, \"utf-8\");\n const pid = parseInt(content.trim(), 10);\n return isNaN(pid) ? null : pid;\n } catch {\n return null;\n }\n}\n\nexport async function removeWorkerPidFile(): Promise<void> {\n const pidPath = getWorkerPidPath();\n try {\n await unlink(pidPath);\n } catch {\n // File doesn't exist — nothing to do\n }\n}\n\nexport function isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0); // Signal 0 = check existence without sending signal\n return true;\n } catch {\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Port-based process discovery (fallback when PID file is missing)\n// ---------------------------------------------------------------------------\n\n/** Find PIDs of processes listening on the given TCP port via lsof (async).\n * NOTE: lsof is unavailable on Windows — port-based discovery silently skips on that platform.\n */\nexport function findPidsOnPort(port: number): Promise<number[]> {\n return new Promise((resolve) => {\n if (isWindows()) {\n try {\n execFile(\"netstat\", [\"-ano\"], { encoding: \"utf-8\", timeout: 3000 }, (err, out) => {\n if (err) { resolve([]); return; }\n const pids: number[] = [];\n for (const line of (out || \"\").split(\"\\n\")) {\n if (line.includes(\"LISTENING\") && line.includes(`:${port}`)) {\n const parts = line.trim().split(/\\s+/);\n const pid = parseInt(parts[parts.length - 1], 10);\n if (!isNaN(pid) && pid > 0) pids.push(pid);\n }\n }\n resolve(pids);\n });\n } catch {\n resolve([]);\n return;\n }\n return;\n }\n execFile(\"lsof\", [\"-ti\", `:${port}`, \"-sTCP:LISTEN\"], {\n encoding: \"utf-8\",\n timeout: 3000,\n }, (err, out) => {\n if (err) {\n // lsof returns non-zero when nothing is listening on the port\n resolve([]);\n return;\n }\n const trimmed = (out || \"\").trim();\n resolve(trimmed ? trimmed.split(\"\\n\").map(Number).filter((n) => !isNaN(n)) : []);\n });\n });\n}\n\n/** Attempt to load the configured port from the config file (dynamic import to avoid circular deps). */\nexport async function getConfigPort(configPath?: string | null): Promise<number | null> {\n if (_configPortOverride !== null) return _configPortOverride;\n try {\n const { loadConfig } = await import(\"./config.js\");\n const { config } = await loadConfig(configPath ?? undefined);\n return config.server.port;\n } catch {\n // Config file missing or invalid — fall back to default\n return 3456;\n }\n}\n\n/**\n * Kill a process tree: send SIGTERM, wait up to `timeoutMs`, then SIGKILL.\n * Handles the process and any known child (worker PID file).\n */\nasync function killProcessTree(pids: number[], timeoutMs: number = 5000): Promise<boolean> {\n for (const pid of pids) {\n try { process.kill(pid, \"SIGTERM\"); } catch { /* already dead */ }\n }\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n if (pids.every((p) => !isProcessAlive(p))) return true;\n await new Promise((r) => setTimeout(r, 200));\n }\n // Force kill anything still alive\n for (const pid of pids) {\n if (isWindows()) {\n try {\n execFileSync(\"taskkill\", [\"/F\", \"/PID\", String(pid), \"/T\"], { stdio: \"ignore\" });\n } catch {\n // taskkill may fail if process already exited\n }\n } else {\n try { process.kill(pid, \"SIGKILL\"); } catch { /* already dead */ }\n }\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Daemon status\n// ---------------------------------------------------------------------------\n\nexport interface DaemonStatus {\n running: boolean;\n pid?: number;\n message: string;\n}\n\nexport async function statusDaemon(portOverride?: number): Promise<DaemonStatus> {\n const pid = await readPidFile();\n if (pid === null) {\n // PID file missing — try to find the process by configured port\n const port = portOverride ?? await getConfigPort();\n if (port !== null && port > 0) {\n const portPids = await findPidsOnPort(port);\n if (portPids.length > 0) {\n const livePids = portPids.filter((p) => isProcessAlive(p));\n if (livePids.length > 0) {\n return {\n running: true,\n pid: livePids[0],\n message: `ModelWeaver is running (PID ${livePids[0]}, detected on port ${port}; PID file missing)`,\n };\n }\n }\n }\n return { running: false, message: \"ModelWeaver is not running (no PID file found)\" };\n }\n if (isProcessAlive(pid)) {\n return { running: true, pid, message: `ModelWeaver is running (PID ${pid})` };\n }\n // Stale PID file — process is dead but file remains\n await removePidFile();\n return { running: false, message: `ModelWeaver is not running (stale PID file cleaned up)` };\n}\n\n// ---------------------------------------------------------------------------\n// Daemon start\n// ---------------------------------------------------------------------------\n\nexport interface DaemonStartResult {\n success: boolean;\n pid?: number;\n message: string;\n logPath: string;\n}\n\nexport function isPortInUse(port: number): Promise<boolean> {\n return new Promise((resolve) => {\n const server = createServer();\n server.once(\"error\", (err: NodeJS.ErrnoException) => {\n if (err.code === \"EADDRINUSE\") {\n resolve(true);\n } else {\n resolve(false);\n }\n });\n server.once(\"listening\", () => {\n server.close(() => resolve(false));\n });\n server.listen(port);\n });\n}\n\nexport async function startDaemon(\n configPath?: string,\n port?: number,\n verbose?: boolean,\n): Promise<DaemonStartResult> {\n // Check if already running (now uses port-based fallback too)\n const currentStatus = await statusDaemon(port);\n if (currentStatus.running) {\n return {\n success: false,\n pid: currentStatus.pid,\n message: `ModelWeaver is already running (PID ${currentStatus.pid})`,\n logPath: getLogPath(),\n };\n }\n\n // Check if port is already in use\n const effectivePort = port ?? await getConfigPort() ?? 3456;\n if (await isPortInUse(effectivePort)) {\n return {\n success: false,\n message: `Port ${effectivePort} is already in use. Is ModelWeaver or another process running on it?`,\n logPath: getLogPath(),\n };\n }\n\n // Resolve the entry script path\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = dirname(__filename);\n // Use dist/index.js (built output) — works with both npx and direct node\n const entryScript = join(__dirname, \"index.js\");\n\n // Build args — spawn a monitor process; monitor spawns the actual daemon child\n const childArgs: string[] = [entryScript, \"--monitor\"];\n if (configPath) childArgs.push(\"--config\", configPath);\n if (port) childArgs.push(\"--port\", String(port));\n if (verbose) childArgs.push(\"--verbose\");\n\n const child = spawn(process.execPath, childArgs, {\n detached: true,\n stdio: \"ignore\",\n env: { ...process.env },\n });\n\n // Allow parent to exit independently\n child.unref();\n\n // Wait briefly for child to start and write PID file\n // (child process writes PID file in its startup sequence)\n let pid: number | undefined;\n for (let i = 0; i < 20; i++) {\n const checkPid = await readPidFile();\n if (checkPid !== null) {\n pid = checkPid;\n break;\n }\n // Sleep 100ms\n await new Promise(r => setTimeout(r, 100));\n }\n\n if (!pid) {\n return {\n success: false,\n message: \"Daemon started but PID file was not created. Check logs at \" + getLogPath(),\n logPath: getLogPath(),\n };\n }\n\n return {\n success: true,\n pid,\n message: `ModelWeaver started in background (PID ${pid})`,\n logPath: getLogPath(),\n };\n}\n\n// ---------------------------------------------------------------------------\n// Daemon stop\n// ---------------------------------------------------------------------------\n\nexport interface DaemonStopResult {\n success: boolean;\n message: string;\n}\n\nexport async function stopDaemon(portOverride?: number): Promise<DaemonStopResult> {\n const pid = await readPidFile();\n if (pid === null) {\n // PID file missing — try to find the process by configured port\n const port = portOverride ?? await getConfigPort();\n if (port !== null && port > 0) {\n const portPids = await findPidsOnPort(port);\n const livePids = portPids.filter((p) => isProcessAlive(p));\n if (livePids.length > 0) {\n // Also include the worker PID file if present\n const workerPid = await readWorkerPidFile();\n const pidsToKill = [...livePids];\n if (workerPid !== null && isProcessAlive(workerPid) && !pidsToKill.includes(workerPid)) {\n pidsToKill.push(workerPid);\n }\n await killProcessTree(pidsToKill);\n await removeWorkerPidFile();\n return {\n success: true,\n message: `ModelWeaver stopped (found on port ${port}, PIDs ${livePids.join(\", \")}; PID file was missing)`,\n };\n }\n }\n return { success: false, message: \"ModelWeaver is not running (no PID file found)\" };\n }\n\n if (!isProcessAlive(pid)) {\n // Monitor is dead — check for orphaned worker and kill it\n const workerPid = await readWorkerPidFile();\n if (workerPid !== null && isProcessAlive(workerPid)) {\n await killProcessTree([workerPid]);\n await removeWorkerPidFile();\n }\n await removePidFile();\n return { success: false, message: \"ModelWeaver is not running (stale PID file cleaned up)\" };\n }\n\n try {\n process.kill(pid, \"SIGTERM\");\n } catch {\n return { success: false, message: `Failed to stop daemon (PID ${pid})` };\n }\n\n // Wait up to 5 seconds for graceful shutdown\n const deadline = Date.now() + 5000;\n while (Date.now() < deadline) {\n if (!isProcessAlive(pid)) {\n await removePidFile();\n return { success: true, message: `ModelWeaver stopped (PID ${pid})` };\n }\n await new Promise(r => setTimeout(r, 100));\n }\n\n // Force kill if still running\n try {\n if (isWindows()) {\n execFileSync(\"taskkill\", [\"/F\", \"/PID\", String(pid), \"/T\"], { stdio: \"ignore\" });\n } else {\n process.kill(pid, \"SIGKILL\");\n }\n } catch {\n // Already dead\n }\n\n await removePidFile();\n await removeWorkerPidFile();\n return { success: true, message: `ModelWeaver force-stopped (PID ${pid})` };\n}\n\n// ---------------------------------------------------------------------------\n// Remove (stop + cleanup)\n// ---------------------------------------------------------------------------\n\nexport async function removeLogFile(): Promise<void> {\n const logPath = getLogPath();\n try {\n await unlink(logPath);\n } catch {\n // File doesn't exist — nothing to do\n }\n}\n\nexport async function removeDaemon(): Promise<DaemonStopResult> {\n const stopResult = await stopDaemon();\n await removeLogFile();\n await removeWorkerPidFile();\n return {\n success: stopResult.success || stopResult.message.includes(\"not running\"),\n message: stopResult.success\n ? \"ModelWeaver stopped and cleaned up (PID file + log file removed)\"\n : stopResult.message.includes(\"not running\")\n ? \"ModelWeaver is not running. Log file cleaned up.\"\n : stopResult.message,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Daemon reload (SIGHUP to monitor → restart worker with fresh code)\n// ---------------------------------------------------------------------------\n\nexport async function reloadDaemon(portOverride?: number): Promise<void> {\n const pid = await readPidFile();\n if (pid === null) {\n // PID file missing — try to find the process by configured port\n const port = portOverride ?? await getConfigPort();\n if (port !== null && port > 0) {\n const portPids = await findPidsOnPort(port);\n const livePids = portPids.filter((p) => isProcessAlive(p));\n if (livePids.length > 0) {\n for (const p of livePids) {\n try {\n if (isWindows()) {\n // SIGHUP not available on Windows — just inform user\n console.log(` Windows detected — reload signal not supported for PID ${p}. Use 'modelweaver stop && modelweaver start' instead.`);\n } else {\n process.kill(p, \"SIGHUP\");\n }\n } catch { /* ignore */ }\n }\n console.log(` Sent reload signal to ${livePids.length} process(es) on port ${port}.`);\n return;\n }\n }\n console.log(\" Daemon is not running.\");\n return;\n }\n\n if (!isProcessAlive(pid)) {\n await removePidFile();\n console.log(\" Daemon is not running (stale PID file cleaned up).\");\n return;\n }\n\n try {\n if (isWindows()) {\n // Windows has no SIGHUP — kill the worker directly so monitor restarts it\n const workerPid = await readWorkerPidFile();\n if (workerPid !== null) {\n process.kill(workerPid, \"SIGTERM\");\n console.log(` Killed worker (PID ${workerPid}) on Windows — monitor will restart it.`);\n } else {\n console.log(\" No worker PID file found — cannot reload.\");\n }\n } else {\n process.kill(pid, \"SIGHUP\");\n console.log(` Sent reload signal to daemon (PID ${pid}).`);\n }\n } catch {\n console.log(\" Failed to send reload signal — daemon may not be running.\");\n }\n}\n\n// ---------------------------------------------------------------------------\n// Debounced watcher\n// ---------------------------------------------------------------------------\n\nexport function createDebouncedReload(\n callback: () => void,\n debounceMs: number = 300,\n): { reload: () => void; dispose: () => void } {\n let timer: ReturnType<typeof setTimeout> | null = null;\n\n return {\n reload() {\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n timer = null;\n callback();\n }, debounceMs);\n },\n dispose() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n },\n };\n}\n"],"mappings":";AACA,OAAS,SAAAA,EAAO,YAAAC,EAAU,gBAAAC,MAAoB,gBAC9C,OAAS,UAAAC,EAAQ,YAAAC,EAAU,aAAAC,EAAW,UAAAC,EAAQ,SAAAC,MAAa,cAC3D,OAAS,QAAAC,MAAY,OACrB,OAAS,WAAAC,MAAe,OACxB,OAAS,iBAAAC,MAAqB,MAC9B,OAAS,gBAAAC,MAAoB,MAE7B,SAASC,GAAqB,CAC5B,OAAO,QAAQ,WAAa,OAC9B,CAMA,IAAMC,EAAkBL,EACtB,QAAQ,IAAI,MAAQ,QAAQ,IAAI,aAAe,GAC/C,cACF,EAGIM,EAAqC,KAGlC,SAASC,EAAuBC,EAA2B,CAChEF,EAAsBE,CACxB,CAEO,SAASC,GAAqB,CACnC,OAAOT,EAAKK,EAAiB,iBAAiB,CAChD,CAEO,SAASK,GAAqB,CACnC,OAAOV,EAAKK,EAAiB,iBAAiB,CAChD,CAMA,eAAsBM,GAA2B,CAC/C,GAAI,CACF,MAAMhB,EAAOU,CAAe,CAC9B,MAAQ,CACN,MAAMN,EAAMM,EAAiB,CAAE,UAAW,EAAK,CAAC,CAClD,CACF,CAEA,eAAsBO,EAAaC,EAA4B,CAC7D,MAAMF,EAAU,EAChB,GAAI,CACF,MAAMd,EAAUY,EAAW,EAAG,GAAGI,CAAG;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,CAE5B,MAAQ,CAAe,CAEzB,QAAQ,IAAI,2BAA2BI,EAAS,MAAM,wBAAwBnC,CAAI,GAAG,EACrF,MACF,CACF,CACA,QAAQ,IAAI,0BAA0B,EACtC,MACF,CAEA,GAAI,CAACe,EAAeV,CAAG,EAAG,CACxB,MAAMK,EAAc,EACpB,QAAQ,IAAI,sDAAsD,EAClE,MACF,CAEA,GAAI,CACF,GAAId,EAAU,EAAG,CAEf,IAAMqD,EAAY,MAAMpC,EAAkB,EACtCoC,IAAc,MAChB,QAAQ,KAAKA,EAAW,SAAS,EACjC,QAAQ,IAAI,wBAAwBA,CAAS,8CAAyC,GAEtF,QAAQ,IAAI,kDAA6C,CAE7D,MACE,QAAQ,KAAK5C,EAAK,QAAQ,EAC1B,QAAQ,IAAI,uCAAuCA,CAAG,IAAI,CAE9D,MAAQ,CACN,QAAQ,IAAI,kEAA6D,CAC3E,CACF,CAMO,SAASmD,GACdC,EACAC,EAAqB,IACwB,CAC7C,IAAIC,EAA8C,KAElD,MAAO,CACL,QAAS,CACHA,GAAO,aAAaA,CAAK,EAC7BA,EAAQ,WAAW,IAAM,CACvBA,EAAQ,KACRF,EAAS,CACX,EAAGC,CAAU,CACf,EACA,SAAU,CACJC,IACF,aAAaA,CAAK,EAClBA,EAAQ,KAEZ,CACF,CACF","names":["spawn","execFile","execFileSync","access","readFile","writeFile","unlink","mkdir","join","dirname","fileURLToPath","createServer","isWindows","MODELWEAVER_DIR","_configPortOverride","_setConfigPortOverride","port","getPidPath","getLogPath","ensureDir","writePidFile","pid","err","readPidFile","pidPath","content","removePidFile","getWorkerPidPath","writeWorkerPidFile","readWorkerPidFile","removeWorkerPidFile","isProcessAlive","findPidsOnPort","resolve","out","pids","line","parts","trimmed","n","getConfigPort","configPath","loadConfig","config","killProcessTree","timeoutMs","deadline","p","statusDaemon","portOverride","portPids","livePids","isPortInUse","server","startDaemon","verbose","currentStatus","effectivePort","__filename","__dirname","childArgs","i","checkPid","r","stopDaemon","workerPid","pidsToKill","removeLogFile","logPath","removeDaemon","stopResult","reloadDaemon","createDebouncedReload","callback","debounceMs","timer"]}