@messenger-agent/client 0.33.0-alpha.5 → 0.33.0-alpha.7

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/exec.d.ts CHANGED
@@ -8,4 +8,5 @@ export declare function runCommand(command: string, args: string[], options?: {
8
8
  interactive?: boolean;
9
9
  env?: NodeJS.ProcessEnv;
10
10
  cwd?: string;
11
+ logCommand?: boolean;
11
12
  }): Promise<CommandResult>;
package/dist/exec.js CHANGED
@@ -1,2 +1,2 @@
1
- import{spawn as f}from"node:child_process";function a(e,o,r={}){return new Promise((c,s)=>{console.log(`$ ${e} ${o.join(" ")}`);const n=f(e,o,{stdio:r.interactive?"inherit":["ignore","pipe","pipe"],env:{...process.env,...r.env},cwd:r.cwd}),u=[],d=[];n.stdout?.on("data",t=>{u.push(t)}),n.stderr?.on("data",t=>{d.push(t)}),n.on("error",s),n.on("close",t=>{const i={status:t,stdout:Buffer.concat(u).toString("utf8"),stderr:Buffer.concat(d).toString("utf8")};if(!r.allowFailure&&t!==0){s(new Error(`${e} ${o.join(" ")} failed with status ${t}
1
+ import{spawn as f}from"node:child_process";function a(e,o,t={}){return new Promise((c,s)=>{t.logCommand!==!1&&console.log(`$ ${e} ${o.join(" ")}`);const n=f(e,o,{stdio:t.interactive?"inherit":["ignore","pipe","pipe"],env:{...process.env,...t.env},cwd:t.cwd}),u=[],d=[];n.stdout?.on("data",r=>{u.push(r)}),n.stderr?.on("data",r=>{d.push(r)}),n.on("error",s),n.on("close",r=>{const i={status:r,stdout:Buffer.concat(u).toString("utf8"),stderr:Buffer.concat(d).toString("utf8")};if(!t.allowFailure&&r!==0){s(new Error(`${e} ${o.join(" ")} failed with status ${r}
2
2
  ${i.stderr||i.stdout}`));return}c(i)})})}export{a as runCommand};
package/dist/service.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type CommandResult } from "./exec.js";
1
+ import { runCommand, type CommandResult } from "./exec.js";
2
2
  export { launchdLabel, serviceName } from "./identity.js";
3
3
  export type ServiceInstallOptions = {
4
4
  configPath: string;
@@ -35,7 +35,14 @@ type LingerDependencies = {
35
35
  };
36
36
  export declare function ensureSystemdUserLinger(user: string, dependencies?: LingerDependencies): Promise<void>;
37
37
  export declare function installService(options: ServiceInstallOptions): Promise<ServiceInstallResult>;
38
- export declare function verifyServiceHealth(platform?: NodeJS.Platform, uid?: number | undefined): Promise<void>;
38
+ export declare function verifyServiceHealth(platform?: NodeJS.Platform, uid?: number | undefined, dependencies?: {
39
+ stderrPath?: string;
40
+ stderrOffset?: number;
41
+ run?: typeof runCommand;
42
+ wait?: (milliseconds: number) => Promise<unknown>;
43
+ attempts?: number;
44
+ intervalMs?: number;
45
+ }): Promise<void>;
39
46
  export declare function linuxCommands(): ServiceCommands;
40
47
  export declare function legacyLinuxCommands(): ServiceCommands;
41
48
  export declare function darwinCommands(dataDir?: string): ServiceCommands;
package/dist/service.js CHANGED
@@ -1,3 +1,4 @@
1
- import{access as A,chmod as h,mkdir as g,unlink as d,writeFile as f}from"node:fs/promises";import{userInfo as P}from"node:os";import{dirname as y,join as a}from"node:path";import{runCommand as n}from"./exec.js";import{legacyCodingAgentPaths as $}from"./paths.js";import{launchdLabel as c,legacyLaunchdLabel as u,legacyServiceName as i,productName as w,serviceName as s}from"./identity.js";import{launchdLabel as J,serviceName as Q}from"./identity.js";function m(e){return`'${e.replaceAll("'","'\\''")}'`}function O(e){return["[Unit]",`Description=${w}`,"After=network-online.target","","[Service]","Type=simple",`ExecStart=${v(e.serviceCommandPath)}`,"Restart=always","RestartSec=5",`WorkingDirectory=${v(e.workspacePath)}`,`Environment=${E("AGENT_CONFIG_PATH",e.configPath)}`,...e.path?[`Environment=${E("PATH",e.path)}`]:[],"","[Install]","WantedBy=default.target",""].join(`
2
- `)}function v(e){return e.replaceAll("\\","\\\\").replaceAll(" ","\\x20")}function E(e,t){return`${e}="${t.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function l(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function S(e){const t=a(e.dataDir,"logs","client-service.out.log"),r=a(e.dataDir,"logs","client-service.err.log");return['<?xml version="1.0" encoding="UTF-8"?>','<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">','<plist version="1.0">',"<dict>"," <key>Label</key>",` <string>${l(c)}</string>`," <key>ProgramArguments</key>"," <array>",` <string>${l(e.serviceCommandPath)}</string>`," </array>"," <key>WorkingDirectory</key>",` <string>${l(e.workspacePath)}</string>`," <key>EnvironmentVariables</key>"," <dict>"," <key>AGENT_CONFIG_PATH</key>",` <string>${l(e.configPath)}</string>`,...e.path?[" <key>PATH</key>",` <string>${l(e.path)}</string>`]:[]," </dict>"," <key>RunAtLoad</key>"," <true/>"," <key>KeepAlive</key>"," <true/>"," <key>StandardOutPath</key>",` <string>${l(t)}</string>`," <key>StandardErrorPath</key>",` <string>${l(r)}</string>`,"</dict>","</plist>",""].join(`
3
- `)}async function p(e){const t=(process.env.PATH??"").split(":").filter(Boolean);for(const r of t)try{return await A(a(r,e)),!0}catch{}return!1}const F={commandExists:p,runCommand:n};async function C(e,t=F){if(!await t.commandExists("loginctl"))throw new Error(`loginctl is required to keep the user service running after logout. Enable linger for ${e} and retry installation.`);if(await b(e,t.runCommand))return;if(console.log(`Enabling login persistence for ${e}`),(await t.runCommand("loginctl",["enable-linger",e],{allowFailure:!0,interactive:!0})).status!==0)throw new Error(`Unable to enable login persistence for ${e}. Run 'sudo loginctl enable-linger ${e}' and retry installation.`);if(!await b(e,t.runCommand))throw new Error(`Login persistence is still disabled for ${e}. Run 'sudo loginctl enable-linger ${e}' and retry installation.`)}async function b(e,t){const r=await t("loginctl",["show-user",e,"-p","Linger"],{allowFailure:!0});return r.status===0&&r.stdout.trim()==="Linger=yes"}async function G(e){const t=e.platform??process.platform;if(t==="linux")return N(e);if(t==="darwin")return T(e);throw new Error("Only Linux and macOS are supported")}async function N(e){if(!await p("systemctl"))throw new Error("systemctl is required to install the user service");const t=e.user??process.env.USER??P().username;await C(t);const r=a(process.env.HOME??"",".config","systemd","user",`${s}.service`);return await g(y(r),{recursive:!0,mode:448}),await f(r,O(e),{mode:384}),await h(r,384),await n("systemctl",["--user","daemon-reload"]),await n("systemctl",["--user","enable","--now",`${s}.service`]),await n("systemctl",["--user","restart",`${s}.service`]),await L("linux"),{servicePath:r,commands:x(),warnings:[]}}async function T(e){if(!await p("launchctl"))throw new Error("launchctl is required to install the LaunchAgent");const t=a(process.env.HOME??"","Library","LaunchAgents",`${c}.plist`);await g(y(t),{recursive:!0,mode:448}),await f(t,S(e),{mode:384}),await h(t,384);const r=e.uid??process.getuid?.();if(r===void 0)throw new Error("Unable to determine current uid for launchctl");const o=`gui/${r}`;return await n("launchctl",["bootout",o,t],{allowFailure:!0}),await n("launchctl",["bootstrap",o,t]),await L("darwin",e.uid),{servicePath:t,commands:k(),warnings:[]}}async function L(e=process.platform,t=process.getuid?.()){if(e==="linux"){if((await n("systemctl",["--user","is-active","--quiet",`${s}.service`],{allowFailure:!0})).status!==0)throw new Error(`${w} systemd service did not become active`);return}if(e==="darwin"){if(t===void 0)throw new Error("Unable to determine current uid for launchctl");const r=await n("launchctl",["print",`gui/${t}/${c}`],{allowFailure:!0});if(r.status!==0||!r.stdout.includes("state = running"))throw new Error(`${w} LaunchAgent did not become active`);return}throw new Error("Only Linux and macOS are supported")}function x(){return{status:`systemctl --user status ${s}.service`,logs:`journalctl --user -u ${s}.service -n 100 -f`,start:`systemctl --user start ${s}.service`,restart:`systemctl --user restart ${s}.service`,stop:`systemctl --user stop ${s}.service`,uninstall:`systemctl --user disable --now ${s}.service && rm -f ~/.config/systemd/user/${s}.service && systemctl --user daemon-reload`}}function D(){return{status:`systemctl --user status ${i}.service`,logs:`journalctl --user -u ${i}.service -n 100 -f`,start:`systemctl --user start ${i}.service`,restart:`systemctl --user restart ${i}.service`,stop:`systemctl --user stop ${i}.service`,uninstall:`systemctl --user disable --now ${i}.service && rm -f ~/.config/systemd/user/${i}.service && systemctl --user daemon-reload`}}function k(e=a(process.env.HOME??"",".messenger-agent","data")){const t="gui/$(id -u)",r=`~/Library/LaunchAgents/${c}.plist`;return{status:`launchctl print ${t}/${c}`,logs:`tail -f ${m(a(e,"logs","client-service.out.log"))} ${m(a(e,"logs","client-service.err.log"))}`,start:`launchctl bootstrap ${t} ${r}`,restart:`launchctl kickstart -k ${t}/${c} 2>/dev/null || launchctl bootstrap ${t} ${r}`,stop:`launchctl bootout ${t} ${r}`,uninstall:`launchctl bootout ${t} ${r}; rm -f ${r}`}}function H(){const e="gui/$(id -u)",t=`~/Library/LaunchAgents/${u}.plist`,r=$().dataDir;return{status:`launchctl print ${e}/${u}`,logs:`tail -f ${m(a(r,"logs","client-service.out.log"))} ${m(a(r,"logs","client-service.err.log"))}`,start:`launchctl bootstrap ${e} ${t}`,restart:`launchctl kickstart -k ${e}/${u} 2>/dev/null || launchctl bootstrap ${e} ${t}`,stop:`launchctl bootout ${e} ${t}`,uninstall:`launchctl bootout ${e} ${t}; rm -f ${t}`}}function _(e){const t=e===$().configPath;return process.platform==="darwin"?t?H():k():t?D():x()}async function B(e=process.platform){if(e==="linux"){await n("systemctl",["--user","disable","--now",`${i}.service`],{allowFailure:!0}),await d(a(process.env.HOME??"",".config","systemd","user",`${i}.service`)).catch(t=>{if(t.code!=="ENOENT")throw t}),await n("systemctl",["--user","daemon-reload"],{allowFailure:!0});return}if(e==="darwin"){const t=process.getuid?.();if(t===void 0)throw new Error("Unable to determine current uid for launchctl");const r=a(process.env.HOME??"","Library","LaunchAgents",`${u}.plist`);await n("launchctl",["bootout",`gui/${t}`,r],{allowFailure:!0}),await d(r).catch(o=>{if(o.code!=="ENOENT")throw o});return}throw new Error("Only Linux and macOS are supported")}async function W(e=process.platform){if(e==="linux"){await n("systemctl",["--user","stop",`${i}.service`],{allowFailure:!0});return}if(e==="darwin"){const t=process.getuid?.();if(t===void 0)throw new Error("Unable to determine current uid for launchctl");const r=a(process.env.HOME??"","Library","LaunchAgents",`${u}.plist`);await n("launchctl",["bootout",`gui/${t}`,r],{allowFailure:!0});return}throw new Error("Only Linux and macOS are supported")}async function K(e=process.platform){if(e==="linux"){await n("systemctl",["--user","start",`${i}.service`],{allowFailure:!0});return}if(e==="darwin"){const t=process.getuid?.();if(t===void 0)throw new Error("Unable to determine current uid for launchctl");const r=a(process.env.HOME??"","Library","LaunchAgents",`${u}.plist`);await n("launchctl",["bootstrap",`gui/${t}`,r],{allowFailure:!0});return}throw new Error("Only Linux and macOS are supported")}async function V(e=process.platform){if(e==="linux"){await n("systemctl",["--user","disable","--now",`${s}.service`],{allowFailure:!0}),await d(a(process.env.HOME??"",".config","systemd","user",`${s}.service`)).catch(t=>{if(t.code!=="ENOENT")throw t}),await n("systemctl",["--user","daemon-reload"],{allowFailure:!0});return}if(e==="darwin"){const t=process.getuid?.();if(t===void 0)throw new Error("Unable to determine current uid for launchctl");const r=a(process.env.HOME??"","Library","LaunchAgents",`${c}.plist`);await n("launchctl",["bootout",`gui/${t}`,r],{allowFailure:!0}),await d(r).catch(o=>{if(o.code!=="ENOENT")throw o});return}throw new Error("Only Linux and macOS are supported")}export{S as createLaunchdPlist,O as createSystemdService,k as darwinCommands,C as ensureSystemdUserLinger,G as installService,J as launchdLabel,H as legacyDarwinCommands,D as legacyLinuxCommands,x as linuxCommands,_ as serviceCommandsForConfig,Q as serviceName,m as shellEscape,K as startLegacyService,W as stopLegacyService,B as uninstallLegacyService,V as uninstallService,L as verifyServiceHealth};
1
+ import{access as C,chmod as b,mkdir as L,open as D,stat as H,unlink as h,writeFile as x}from"node:fs/promises";import{userInfo as M}from"node:os";import{dirname as k,join as s}from"node:path";import{setTimeout as U}from"node:timers/promises";import{runCommand as n}from"./exec.js";import{legacyCodingAgentPaths as O}from"./paths.js";import{launchdLabel as u,legacyLaunchdLabel as f,legacyServiceName as c,productName as y,serviceName as i}from"./identity.js";import{launchdLabel as ut,serviceName as dt}from"./identity.js";function g(t){return`'${t.replaceAll("'","'\\''")}'`}function j(t){return["[Unit]",`Description=${y}`,"After=network-online.target","","[Service]","Type=simple",`ExecStart=${P(t.serviceCommandPath)}`,"Restart=always","RestartSec=5",`WorkingDirectory=${P(t.workspacePath)}`,`Environment=${A("AGENT_CONFIG_PATH",t.configPath)}`,...t.path?[`Environment=${A("PATH",t.path)}`]:[],"","[Install]","WantedBy=default.target",""].join(`
2
+ `)}function P(t){return t.replaceAll("\\","\\\\").replaceAll(" ","\\x20")}function A(t,e){return`${t}="${e.replaceAll("\\","\\\\").replaceAll('"','\\"')}"`}function d(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function I(t){const e=s(t.dataDir,"logs","client-service.out.log"),r=s(t.dataDir,"logs","client-service.err.log");return['<?xml version="1.0" encoding="UTF-8"?>','<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">','<plist version="1.0">',"<dict>"," <key>Label</key>",` <string>${d(u)}</string>`," <key>ProgramArguments</key>"," <array>",` <string>${d(t.serviceCommandPath)}</string>`," </array>"," <key>WorkingDirectory</key>",` <string>${d(t.workspacePath)}</string>`," <key>EnvironmentVariables</key>"," <dict>"," <key>AGENT_CONFIG_PATH</key>",` <string>${d(t.configPath)}</string>`,...t.path?[" <key>PATH</key>",` <string>${d(t.path)}</string>`]:[]," </dict>"," <key>RunAtLoad</key>"," <true/>"," <key>KeepAlive</key>"," <true/>"," <key>StandardOutPath</key>",` <string>${d(e)}</string>`," <key>StandardErrorPath</key>",` <string>${d(r)}</string>`,"</dict>","</plist>",""].join(`
3
+ `)}async function $(t){const e=(process.env.PATH??"").split(":").filter(Boolean);for(const r of e)try{return await C(s(r,t)),!0}catch{}return!1}const R={commandExists:$,runCommand:n};async function _(t,e=R){if(!await e.commandExists("loginctl"))throw new Error(`loginctl is required to keep the user service running after logout. Enable linger for ${t} and retry installation.`);if(await S(t,e.runCommand))return;if(console.log(`Enabling login persistence for ${t}`),(await e.runCommand("loginctl",["enable-linger",t],{allowFailure:!0,interactive:!0})).status!==0)throw new Error(`Unable to enable login persistence for ${t}. Run 'sudo loginctl enable-linger ${t}' and retry installation.`);if(!await S(t,e.runCommand))throw new Error(`Login persistence is still disabled for ${t}. Run 'sudo loginctl enable-linger ${t}' and retry installation.`)}async function S(t,e){const r=await e("loginctl",["show-user",t,"-p","Linger"],{allowFailure:!0});return r.status===0&&r.stdout.trim()==="Linger=yes"}async function rt(t){const e=t.platform??process.platform;if(e==="linux")return q(t);if(e==="darwin")return B(t);throw new Error("Only Linux and macOS are supported")}async function q(t){if(!await $("systemctl"))throw new Error("systemctl is required to install the user service");const e=t.user??process.env.USER??M().username;await _(e);const r=s(process.env.HOME??"",".config","systemd","user",`${i}.service`);return await L(k(r),{recursive:!0,mode:448}),await x(r,j(t),{mode:384}),await b(r,384),await n("systemctl",["--user","daemon-reload"]),await n("systemctl",["--user","enable","--now",`${i}.service`]),await n("systemctl",["--user","restart",`${i}.service`]),await F("linux"),{servicePath:r,commands:N(),warnings:[]}}async function B(t){if(!await $("launchctl"))throw new Error("launchctl is required to install the LaunchAgent");const e=s(process.env.HOME??"","Library","LaunchAgents",`${u}.plist`);await L(k(e),{recursive:!0,mode:448}),await x(e,I(t),{mode:384}),await b(e,384);const r=t.uid??process.getuid?.();if(r===void 0)throw new Error("Unable to determine current uid for launchctl");const a=`gui/${r}`,o=s(t.dataDir,"logs","client-service.err.log"),l=await G(o);return await n("launchctl",["bootout",a,e],{allowFailure:!0}),await n("launchctl",["bootstrap",a,e]),await F("darwin",t.uid,{stderrPath:o,stderrOffset:l}),{servicePath:e,commands:T(),warnings:[]}}async function F(t=process.platform,e=process.getuid?.(),r={}){if(t==="linux"){if((await n("systemctl",["--user","is-active","--quiet",`${i}.service`],{allowFailure:!0})).status!==0)throw new Error(`${y} systemd service did not become active`);return}if(t==="darwin"){if(e===void 0)throw new Error("Unable to determine current uid for launchctl");const a=r.run??n,o=r.wait??U,l=r.attempts??40,m=r.intervalMs??250;let w={status:1,stdout:"",stderr:""};for(let p=0;p<l;p+=1){if(w=await a("launchctl",["print",`gui/${e}/${u}`],{allowFailure:!0,logCommand:!1}),w.status===0&&w.stdout.includes("state = running"))return;p+1<l&&await o(m)}const v=z(w),E=r.stderrPath?await W(r.stderrPath,r.stderrOffset):void 0;throw new Error([`${y} LaunchAgent did not become active after ${l*m}ms`,v?`launchctl: ${v}`:void 0,E?`service stderr: ${E}`:void 0].filter(Boolean).join("; "))}throw new Error("Only Linux and macOS are supported")}function z(t){const e=t.stdout||t.stderr,r=e.split(`
4
+ `).map(o=>o.trim()).filter(o=>/^(state|last exit code|reason|runs|pid)\s*=/.test(o));return(r.length>0?r.join(", "):e.trim()).slice(-2e3)}async function G(t){try{return(await H(t)).size}catch(e){if(e.code==="ENOENT")return 0;throw e}}async function W(t,e=0){let r;try{r=await D(t,"r");const a=(await r.stat()).size,o=a>=e?e:0;if(a<=o)return;const l=Math.max(o,a-4e3),m=Buffer.alloc(a-l);return await r.read(m,0,m.length,l),m.toString("utf8").trim()||void 0}catch(a){return a.code==="ENOENT"?void 0:`unable to read ${t}: ${String(a)}`}finally{await r?.close()}}function N(){return{status:`systemctl --user status ${i}.service`,logs:`journalctl --user -u ${i}.service -n 100 -f`,start:`systemctl --user start ${i}.service`,restart:`systemctl --user restart ${i}.service`,stop:`systemctl --user stop ${i}.service`,uninstall:`systemctl --user disable --now ${i}.service && rm -f ~/.config/systemd/user/${i}.service && systemctl --user daemon-reload`}}function K(){return{status:`systemctl --user status ${c}.service`,logs:`journalctl --user -u ${c}.service -n 100 -f`,start:`systemctl --user start ${c}.service`,restart:`systemctl --user restart ${c}.service`,stop:`systemctl --user stop ${c}.service`,uninstall:`systemctl --user disable --now ${c}.service && rm -f ~/.config/systemd/user/${c}.service && systemctl --user daemon-reload`}}function T(t=s(process.env.HOME??"",".messenger-agent","data")){const e="gui/$(id -u)",r=`~/Library/LaunchAgents/${u}.plist`;return{status:`launchctl print ${e}/${u}`,logs:`tail -f ${g(s(t,"logs","client-service.out.log"))} ${g(s(t,"logs","client-service.err.log"))}`,start:`launchctl bootstrap ${e} ${r}`,restart:`launchctl kickstart -k ${e}/${u} 2>/dev/null || launchctl bootstrap ${e} ${r}`,stop:`launchctl bootout ${e} ${r}`,uninstall:`launchctl bootout ${e} ${r}; rm -f ${r}`}}function V(){const t="gui/$(id -u)",e=`~/Library/LaunchAgents/${f}.plist`,r=O().dataDir;return{status:`launchctl print ${t}/${f}`,logs:`tail -f ${g(s(r,"logs","client-service.out.log"))} ${g(s(r,"logs","client-service.err.log"))}`,start:`launchctl bootstrap ${t} ${e}`,restart:`launchctl kickstart -k ${t}/${f} 2>/dev/null || launchctl bootstrap ${t} ${e}`,stop:`launchctl bootout ${t} ${e}`,uninstall:`launchctl bootout ${t} ${e}; rm -f ${e}`}}function at(t){const e=t===O().configPath;return process.platform==="darwin"?e?V():T():e?K():N()}async function nt(t=process.platform){if(t==="linux"){await n("systemctl",["--user","disable","--now",`${c}.service`],{allowFailure:!0}),await h(s(process.env.HOME??"",".config","systemd","user",`${c}.service`)).catch(e=>{if(e.code!=="ENOENT")throw e}),await n("systemctl",["--user","daemon-reload"],{allowFailure:!0});return}if(t==="darwin"){const e=process.getuid?.();if(e===void 0)throw new Error("Unable to determine current uid for launchctl");const r=s(process.env.HOME??"","Library","LaunchAgents",`${f}.plist`);await n("launchctl",["bootout",`gui/${e}`,r],{allowFailure:!0}),await h(r).catch(a=>{if(a.code!=="ENOENT")throw a});return}throw new Error("Only Linux and macOS are supported")}async function st(t=process.platform){if(t==="linux"){await n("systemctl",["--user","stop",`${c}.service`],{allowFailure:!0});return}if(t==="darwin"){const e=process.getuid?.();if(e===void 0)throw new Error("Unable to determine current uid for launchctl");const r=s(process.env.HOME??"","Library","LaunchAgents",`${f}.plist`);await n("launchctl",["bootout",`gui/${e}`,r],{allowFailure:!0});return}throw new Error("Only Linux and macOS are supported")}async function it(t=process.platform){if(t==="linux"){await n("systemctl",["--user","start",`${c}.service`],{allowFailure:!0});return}if(t==="darwin"){const e=process.getuid?.();if(e===void 0)throw new Error("Unable to determine current uid for launchctl");const r=s(process.env.HOME??"","Library","LaunchAgents",`${f}.plist`);await n("launchctl",["bootstrap",`gui/${e}`,r],{allowFailure:!0});return}throw new Error("Only Linux and macOS are supported")}async function ot(t=process.platform){if(t==="linux"){await n("systemctl",["--user","disable","--now",`${i}.service`],{allowFailure:!0}),await h(s(process.env.HOME??"",".config","systemd","user",`${i}.service`)).catch(e=>{if(e.code!=="ENOENT")throw e}),await n("systemctl",["--user","daemon-reload"],{allowFailure:!0});return}if(t==="darwin"){const e=process.getuid?.();if(e===void 0)throw new Error("Unable to determine current uid for launchctl");const r=s(process.env.HOME??"","Library","LaunchAgents",`${u}.plist`);await n("launchctl",["bootout",`gui/${e}`,r],{allowFailure:!0}),await h(r).catch(a=>{if(a.code!=="ENOENT")throw a});return}throw new Error("Only Linux and macOS are supported")}export{I as createLaunchdPlist,j as createSystemdService,T as darwinCommands,_ as ensureSystemdUserLinger,rt as installService,ut as launchdLabel,V as legacyDarwinCommands,K as legacyLinuxCommands,N as linuxCommands,at as serviceCommandsForConfig,dt as serviceName,g as shellEscape,it as startLegacyService,st as stopLegacyService,nt as uninstallLegacyService,ot as uninstallService,F as verifyServiceHealth};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@messenger-agent/client",
3
- "version": "0.33.0-alpha.5",
3
+ "version": "0.33.0-alpha.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,10 +21,10 @@
21
21
  "dependencies": {
22
22
  "cac": "^7.0.0",
23
23
  "yaml": "^2.9.0",
24
- "@messenger-agent/codex-agent": "0.33.0-alpha.5",
25
- "@messenger-agent/messenger-agent": "0.33.0-alpha.5",
26
- "@messenger-agent/claude-agent": "0.33.0-alpha.5",
27
- "@messenger-agent/shared": "0.33.0-alpha.5"
24
+ "@messenger-agent/claude-agent": "0.33.0-alpha.7",
25
+ "@messenger-agent/shared": "0.33.0-alpha.7",
26
+ "@messenger-agent/messenger-agent": "0.33.0-alpha.7",
27
+ "@messenger-agent/codex-agent": "0.33.0-alpha.7"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "rm -rf dist && tsc -p tsconfig.json && node ../../scripts/copy-client-assets.mjs && chmod +x dist/index.js",