@messenger-agent/client 0.32.2 → 0.33.0-alpha.10
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/args.d.ts +8 -1
- package/dist/args.js +3 -3
- package/dist/assets/skills/{manage-coding-agent-client → manage-messenger-agent}/SKILL.md +24 -22
- package/dist/control.js +2 -2
- package/dist/exec.d.ts +2 -0
- package/dist/exec.js +2 -2
- package/dist/identity.d.ts +10 -0
- package/dist/identity.js +1 -0
- package/dist/index.js +4 -4
- package/dist/install.d.ts +26 -2
- package/dist/install.js +3 -1
- package/dist/migration.d.ts +10 -0
- package/dist/migration.js +2 -0
- package/dist/native-dependencies.d.ts +1 -0
- package/dist/native-dependencies.js +1 -0
- package/dist/paths.d.ts +11 -0
- package/dist/paths.js +1 -1
- package/dist/runtime.d.ts +30 -3
- package/dist/runtime.js +3 -3
- package/dist/service.d.ts +17 -5
- package/dist/service.js +4 -3
- package/dist/supervisor.d.ts +13 -0
- package/dist/supervisor.js +1 -1
- package/package.json +6 -5
package/dist/args.d.ts
CHANGED
|
@@ -23,6 +23,13 @@ export type UpgradeArgs = {
|
|
|
23
23
|
export type VersionArgs = {
|
|
24
24
|
command: "version";
|
|
25
25
|
};
|
|
26
|
+
export type SelfCheckArgs = {
|
|
27
|
+
command: "self-check";
|
|
28
|
+
};
|
|
29
|
+
export type CompleteMigrationArgs = {
|
|
30
|
+
command: "complete-migration";
|
|
31
|
+
handoffPath: string;
|
|
32
|
+
};
|
|
26
33
|
export type SessionsArgs = {
|
|
27
34
|
command: "sessions";
|
|
28
35
|
json: boolean;
|
|
@@ -60,7 +67,7 @@ export type UninstallArgs = {
|
|
|
60
67
|
delaySeconds?: number;
|
|
61
68
|
allowWaiting: boolean;
|
|
62
69
|
};
|
|
63
|
-
export type CliArgs = InstallArgs | UpgradeArgs | VersionArgs | SessionsArgs | MaintenanceArgs | RunServiceArgs | StatusArgs | StartArgs | RestartArgs | StopArgs | UninstallArgs;
|
|
70
|
+
export type CliArgs = InstallArgs | UpgradeArgs | VersionArgs | SelfCheckArgs | CompleteMigrationArgs | SessionsArgs | MaintenanceArgs | RunServiceArgs | StatusArgs | StartArgs | RestartArgs | StopArgs | UninstallArgs;
|
|
64
71
|
export declare class UsageError extends Error {
|
|
65
72
|
}
|
|
66
73
|
export declare function parseCliArgs(argv: string[], env?: NodeJS.ProcessEnv): CliArgs;
|
package/dist/args.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import U from"cac";import{defaultConfigPath as u,defaultDataDir as $,resolvePath as d}from"./paths.js";import{normalizeReleaseChannel as C}from"./runtime.js";import{cliName as m,productName as p}from"./identity.js";const N="MESSENGER_AGENT_TUNNEL_SERVER_URL",E="CODING_AGENT_TUNNEL_SERVER_URL",W=["install","upgrade","sessions","maintenance","status","start","restart","stop","uninstall"],b=[...W,"run-service","self-check","complete-migration"];class r extends Error{}function L(n,t=process.env){if(n[0]==="--version"||n[0]==="-v"){if(n.length>1)throw new r(`Unknown option for version: ${n[1]}`);return{command:"version"}}const o=n[0];if(!o||o==="--help"||o==="-h")throw new r(P());if(n.includes("--"))throw new r(`Unknown option for ${o}: --`);I(n);let a;const e=g({env:t,includeInternalCommands:!0,onParsed(i){a=i}});try{e.parse(["node",m,...n])}catch(i){const s=i instanceof Error?i.message:String(i);throw new r(A(s,n))}if(!a)throw new r(`Unknown command: ${o}`);return a}function P(){const n=g({includeInternalCommands:!1});return n.help(),`${x(()=>n.outputHelp())}
|
|
2
2
|
|
|
3
3
|
Global Options:
|
|
4
|
-
-v, --version Show the installed client version`}function
|
|
5
|
-
`)}function
|
|
4
|
+
-v, --version Show the installed client version`}function g(n){const t=U(m),o=n.env??process.env,a=n.onParsed??(()=>{});t.command("install",`Install and configure the local ${p} service`).option("--tunnel-id <id>","Tunnel id").option("--token <token>","Tunnel token").option("--workspace <path>","Workspace path (default: ~/messenger-workspace)").option("--server <url>","Agent bridge server URL").option("--server-url <wss-url>","Tunnel server URL").option("--config <path>","Config file path",{default:u}).option("--data-dir <path>","Data directory",{default:$}).option("--workspace-id <id>","Workspace id").option("--workspace-name <name>","Workspace display name").option("--channel <channel>","Auto-upgrade release channel: latest, beta, or alpha").action(e=>{const i=c(e.tunnelId),s=c(e.token),l=c(e.workspace);a({command:"install",tunnelId:i,token:s,workspace:l?d(l):void 0,server:c(e.server),serverUrl:c(e.serverUrl)??o[N]??o[E],configPath:d(f(e.config,"--config")),dataDir:d(f(e.dataDir,"--data-dir")),workspaceId:c(e.workspaceId),workspaceName:c(e.workspaceName),channel:k(e.channel)})}),t.command("upgrade",`Upgrade the local ${p} runtime`).option("--version <version>","Runtime version or release channel",{default:"latest"}).option("--channel <channel>","Auto-upgrade release channel: latest, beta, or alpha").option("--config <path>","Config file path",{default:u}).option("--delay <seconds>","Schedule the upgrade after a delay").option("--allow-waiting","Allow upgrade while sessions wait for user input").action(e=>{const i=h(e.delay),s=e.allowWaiting===!0;w(s,i),a({command:"upgrade",version:f(e.version,"--version"),configPath:d(f(e.config,"--config")),delaySeconds:i,allowWaiting:s,channel:k(e.channel)})}),t.command("sessions","Show active and waiting client sessions").option("--json","Print machine-readable JSON").option("--config <path>","Config file path",{default:u}).action(e=>{a({command:"sessions",json:e.json===!0,configPath:d(f(e.config,"--config"))})}),t.command("maintenance <action>","Inspect or cancel scheduled maintenance").option("--json","Print machine-readable JSON").option("--config <path>","Config file path",{default:u}).action((e,i)=>{if(e!=="status"&&e!=="cancel")throw new r(`Unknown maintenance action: ${e}`);a({command:"maintenance",action:e,json:i.json===!0,configPath:d(f(i.config,"--config"))})});for(const e of["status","start"])t.command(e,`${S(e)} the local ${p} service`).action(()=>{a({command:e})});t.command("restart [agent]","Restart the local service or a specific agent").option("--delay <seconds>","Schedule the restart after a delay").option("--allow-waiting","Allow restart while sessions wait for user input").action((e,i)=>{if(e!==void 0&&e!=="codex"&&e!=="claude")throw new r(`Unknown agent for restart: ${e}`);const s=h(i.delay),l=i.allowWaiting===!0;w(l,s),a({command:"restart",agent:e,delaySeconds:s,allowWaiting:l})});for(const e of["stop","uninstall"])t.command(e,`${S(e)} the local ${p} service`).option("--delay <seconds>",`Schedule the ${e} after a delay`).option("--allow-waiting",`Allow ${e} while sessions wait for user input`).action(i=>{const s=h(i.delay),l=i.allowWaiting===!0;w(l,s),a({command:e,delaySeconds:s,allowWaiting:l})});return n.includeInternalCommands&&(t.command("run-service","Run the managed service supervisor").option("--config <path>","Config file path").action(e=>{const i=c(e.config);a({command:"run-service",configPath:i?d(i):void 0})}),t.command("self-check","Validate the bundled runtime").action(()=>{a({command:"self-check"})}),t.command("complete-migration","Complete a prepared service migration").option("--handoff <path>","Migration handoff state").action(e=>{a({command:"complete-migration",handoffPath:d(f(e.handoff,"--handoff"))})})),t}function f(n,t){const o=c(n);if(!o)throw new r(`Missing value for ${t}`);return o}function c(n){return typeof n=="string"?n:void 0}function k(n){const t=c(n);if(t!==void 0)try{return C(t)}catch{throw new r(`Unknown release channel for --channel: ${t} (expected latest, beta, or alpha)`)}}function h(n){if(n===void 0)return;const t=typeof n=="number"?String(n):f(n,"--delay");if(!/^\d+$/.test(t))throw new r("--delay must be an integer between 1 and 86400 seconds");const o=Number.parseInt(t,10);if(o<1||o>86400)throw new r("--delay must be an integer between 1 and 86400 seconds");return o}function w(n,t){if(n&&t===void 0)throw new r("--allow-waiting requires --delay")}function A(n,t){if(n.startsWith("Unknown option `")){const o=y(t);if(o)return`Unknown option for ${t[0]}: ${o}`}if(n.startsWith("option `")){const o=/^option `([^` ]+)/.exec(n);if(o)return`Missing value for ${o[1]}`}if(n.startsWith("Unused args:")){const o=t.slice(1).find(a=>!a.startsWith("-"));if(o)return`Unknown option for ${t[0]}: ${o}`}return n}function y(n){const t=n[0];if(!t||!v(t))return n.find(a=>a.startsWith("-"));const o=R(t);for(const a of n.slice(1)){if(!a.startsWith("-"))continue;const e=a.includes("=")?a.slice(0,a.indexOf("=")):a;if(!o.has(e))return e}}function I(n){const t=n[0];if(!t||!v(t))return;const o=y(n);if(o)throw new r(`Unknown option for ${t}: ${o}`)}function R(n){switch(n){case"install":return new Set(["--tunnel-id","--token","--workspace","--server","--server-url","--config","--data-dir","--workspace-id","--workspace-name","--channel"]);case"upgrade":return new Set(["--version","--channel","--config","--delay","--allow-waiting"]);case"sessions":case"maintenance":return new Set(["--json","--config"]);case"restart":case"stop":case"uninstall":return new Set(["--delay","--allow-waiting"]);case"run-service":return new Set(["--config"]);case"complete-migration":return new Set(["--handoff"]);default:return new Set}}function v(n){return b.includes(n)}function x(n){const t=console.info,o=[];console.info=(...a)=>{o.push(a.map(String).join(" "))};try{n()}finally{console.info=t}return o.join(`
|
|
5
|
+
`)}function S(n){return`${n.charAt(0).toUpperCase()}${n.slice(1)}`}export{r as UsageError,L as parseCliArgs,P as usage};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: manage-
|
|
3
|
-
description: 管理本机
|
|
2
|
+
name: manage-messenger-agent
|
|
3
|
+
description: 管理本机 Messenger Agent,包括查询版本和会话状态、升级、启动、停止、重启 Codex/Claude、查看日志和卸载。用户要求检查、升级、重启、停止、排查或卸载 Messenger Agent 时使用。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# 管理
|
|
6
|
+
# 管理 Messenger Agent
|
|
7
7
|
|
|
8
8
|
始终使用安装后生成的稳定命令:
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
~/.
|
|
11
|
+
~/.messenger-agent/bin/messenger-agent
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
+
若该路径尚不存在但 `~/.coding-agent/bin/messenger-agent` 存在,说明客户端正处于兼容桥接阶段;本次使用旧目录中的同名命令。即时执行一次 `upgrade` 或重新执行 `install` 后,目录和服务标识会完成迁移。
|
|
15
|
+
|
|
14
16
|
## 检查状态
|
|
15
17
|
|
|
16
18
|
查询版本和服务状态:
|
|
17
19
|
|
|
18
20
|
```bash
|
|
19
|
-
~/.
|
|
20
|
-
~/.
|
|
21
|
+
~/.messenger-agent/bin/messenger-agent --version
|
|
22
|
+
~/.messenger-agent/bin/messenger-agent status
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
执行任何会中断 Agent 的操作前,先查询会话:
|
|
24
26
|
|
|
25
27
|
```bash
|
|
26
|
-
~/.
|
|
28
|
+
~/.messenger-agent/bin/messenger-agent sessions --json
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
按以下规则处理结果:
|
|
@@ -40,13 +42,13 @@ description: 管理本机 coding-agent client,包括查询版本和会话状
|
|
|
40
42
|
默认延后 10 秒:
|
|
41
43
|
|
|
42
44
|
```bash
|
|
43
|
-
~/.
|
|
44
|
-
~/.
|
|
45
|
-
~/.
|
|
46
|
-
~/.
|
|
47
|
-
~/.
|
|
48
|
-
~/.
|
|
49
|
-
~/.
|
|
45
|
+
~/.messenger-agent/bin/messenger-agent upgrade --delay 10
|
|
46
|
+
~/.messenger-agent/bin/messenger-agent upgrade --version <version> --delay 10
|
|
47
|
+
~/.messenger-agent/bin/messenger-agent restart --delay 10
|
|
48
|
+
~/.messenger-agent/bin/messenger-agent restart codex --delay 10
|
|
49
|
+
~/.messenger-agent/bin/messenger-agent restart claude --delay 10
|
|
50
|
+
~/.messenger-agent/bin/messenger-agent stop --delay 10
|
|
51
|
+
~/.messenger-agent/bin/messenger-agent uninstall --delay 10
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
存在 waiting 会话且用户已经确认时,追加:
|
|
@@ -66,8 +68,8 @@ description: 管理本机 coding-agent client,包括查询版本和会话状
|
|
|
66
68
|
查询或取消任务:
|
|
67
69
|
|
|
68
70
|
```bash
|
|
69
|
-
~/.
|
|
70
|
-
~/.
|
|
71
|
+
~/.messenger-agent/bin/messenger-agent maintenance status
|
|
72
|
+
~/.messenger-agent/bin/messenger-agent maintenance cancel
|
|
71
73
|
```
|
|
72
74
|
|
|
73
75
|
同一时间只能有一个延后任务。新会话中可使用 `maintenance status`、`--version` 和 `status` 验证升级结果。
|
|
@@ -84,9 +86,9 @@ description: 管理本机 coding-agent client,包括查询版本和会话状
|
|
|
84
86
|
client 的自动升级默认跟踪稳定版本(`latest` 通道)。用户要求使用预发布版本或回到稳定版时,切换发布通道:
|
|
85
87
|
|
|
86
88
|
```bash
|
|
87
|
-
~/.
|
|
88
|
-
~/.
|
|
89
|
-
~/.
|
|
89
|
+
~/.messenger-agent/bin/messenger-agent upgrade --channel beta --delay 10
|
|
90
|
+
~/.messenger-agent/bin/messenger-agent upgrade --channel alpha --delay 10
|
|
91
|
+
~/.messenger-agent/bin/messenger-agent upgrade --channel latest --delay 10
|
|
90
92
|
```
|
|
91
93
|
|
|
92
94
|
切换通道会更新自动升级跟踪的 npm dist-tag,并把 runtime 升级到该通道的最新版本。之后自动升级会持续跟踪同一通道,直到用户再次切换。
|
|
@@ -101,14 +103,14 @@ client 的自动升级默认跟踪稳定版本(`latest` 通道)。用户要
|
|
|
101
103
|
Linux:
|
|
102
104
|
|
|
103
105
|
```bash
|
|
104
|
-
journalctl --user -u
|
|
106
|
+
journalctl --user -u messenger-agent.service -n 100 --no-pager
|
|
105
107
|
```
|
|
106
108
|
|
|
107
109
|
macOS:
|
|
108
110
|
|
|
109
111
|
```bash
|
|
110
|
-
tail -n 100 ~/.
|
|
111
|
-
tail -n 100 ~/.
|
|
112
|
+
tail -n 100 ~/.messenger-agent/data/logs/client-service.out.log
|
|
113
|
+
tail -n 100 ~/.messenger-agent/data/logs/client-service.err.log
|
|
112
114
|
```
|
|
113
115
|
|
|
114
116
|
提醒用户在分享日志前检查并隐藏 token、服务地址和敏感路径。
|
package/dist/control.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{chmod as d,mkdir as
|
|
2
|
-
`))})});return await
|
|
1
|
+
import{chmod as d,mkdir as m,rm as s}from"node:fs/promises";import{createConnection as w,createServer as g}from"node:net";import{dirname as y,join as p}from"node:path";import{readConfigYaml as v}from"./config-file.js";import{productName as c}from"./identity.js";import{defaultDataDir as S}from"./paths.js";async function u(e){const n=await v(e),t=typeof n.data_dir=="string"&&n.data_dir.trim()?n.data_dir:S;return p(t,"runtime","client.sock")}async function I(e,n){await m(y(e),{recursive:!0,mode:448}),await s(e,{force:!0});const t=g({allowHalfOpen:!0},r=>{let a="";r.setEncoding("utf8"),r.on("error",()=>{}),r.on("data",o=>{a+=o}),r.on("end",()=>{h(a,n).then(o=>r.end(`${JSON.stringify(o)}
|
|
2
|
+
`))})});return await k(t,e),await d(e,384),{async close(){await E(t),await s(e,{force:!0})}}}async function A(e,n){const t=await u(e),r=await l(t,{action:"restart",agent:n}).catch(a=>{const o=a instanceof Error?a.message:String(a);throw new Error(`Unable to contact the ${c} service: ${o}`)});if(!r.ok)throw new Error(r.error??`Failed to restart ${n} agent`)}async function D(e){return i(e,{action:"activity"})}async function J(e,n){return i(e,{action:"schedule-maintenance",...n})}async function M(e){return i(e,{action:"maintenance-status"})}async function R(e){return i(e,{action:"maintenance-cancel"})}async function h(e,n){try{const t=JSON.parse(e);switch(t.action){case"restart":return t.agent!=="codex"&&t.agent!=="claude"?{ok:!1,error:"Invalid control request"}:(await n.restartAgent(t.agent),{ok:!0});case"activity":return{ok:!0,data:await n.getActivity()};case"schedule-maintenance":return!q(t.operation)||!Number.isInteger(t.delaySeconds)||typeof t.allowWaiting!="boolean"?{ok:!1,error:"Invalid maintenance request"}:{ok:!0,data:await n.maintenance.schedule({operation:t.operation,delaySeconds:t.delaySeconds,allowWaiting:t.allowWaiting})};case"maintenance-status":return{ok:!0,data:n.maintenance.getTask()};case"maintenance-cancel":return{ok:!0,data:await n.maintenance.cancel()};default:return{ok:!1,error:"Invalid control request"}}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function q(e){return!e||typeof e!="object"||!("type"in e)?!1:e.type==="upgrade"?"version"in e&&typeof e.version=="string"&&e.version.length>0:e.type==="restart"?!("agent"in e&&e.agent!==void 0&&e.agent!=="codex"&&e.agent!=="claude"):e.type==="stop"||e.type==="uninstall"}async function i(e,n){const t=await u(e),r=await l(t,n).catch(a=>{const o=a instanceof Error?a.message:String(a);throw new Error(`Unable to contact the ${c} service: ${o}`)});if(!r.ok)throw new Error(r.error??"Client control request failed");return r.data}function k(e,n){return new Promise((t,r)=>{e.once("error",r),e.listen(n,()=>{e.off("error",r),t()})})}function E(e){return new Promise((n,t)=>{e.close(r=>r?t(r):n())})}function l(e,n){return new Promise((t,r)=>{const a=w(e);let o="";a.setEncoding("utf8"),a.once("error",r),a.on("data",f=>{o+=f}),a.once("connect",()=>a.end(JSON.stringify(n))),a.once("end",()=>{try{t(JSON.parse(o))}catch{r(new Error(`Invalid response from the ${c} service`))}})})}export{u as readControlSocketPath,A as requestAgentRestart,D as requestClientActivity,R as requestMaintenanceCancel,M as requestMaintenanceStatus,J as requestScheduleMaintenance,I as startControlServer};
|
package/dist/exec.d.ts
CHANGED
package/dist/exec.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{spawn as f}from"node:child_process";function
|
|
2
|
-
${i.stderr||i.stdout}`));return}c(i)})})}export{
|
|
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
|
+
${i.stderr||i.stdout}`));return}c(i)})})}export{a as runCommand};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const productName = "Messenger Agent";
|
|
2
|
+
export declare const cliName = "messenger-agent";
|
|
3
|
+
export declare const legacyCliName = "coding-agent";
|
|
4
|
+
export declare const serviceName = "messenger-agent";
|
|
5
|
+
export declare const legacyServiceName = "coding-agent-client";
|
|
6
|
+
export declare const launchdLabel = "vip.elevo.messenger.agent";
|
|
7
|
+
export declare const legacyLaunchdLabel = "vip.elevo.coding-agent.client";
|
|
8
|
+
export declare const appBundleIdentifier = "vip.elevo.messenger.agent";
|
|
9
|
+
export declare const helperBundleIdentifier = "vip.elevo.messenger.agent.helper";
|
|
10
|
+
export declare const runtimePackageScope = "@messenger-agent";
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="Messenger Agent",n="messenger-agent",t="coding-agent",o="messenger-agent",c="coding-agent-client",r="vip.elevo.messenger.agent",s="vip.elevo.coding-agent.client",a="vip.elevo.messenger.agent",g="vip.elevo.messenger.agent.helper",p="@messenger-agent";export{a as appBundleIdentifier,n as cliName,g as helperBundleIdentifier,r as launchdLabel,t as legacyCliName,s as legacyLaunchdLabel,c as legacyServiceName,e as productName,p as runtimePackageScope,o as serviceName};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{parseCliArgs as
|
|
3
|
-
`)}function
|
|
4
|
-
`):"No maintenance task has been scheduled"}function
|
|
2
|
+
import{parseCliArgs as S,UsageError as N,usage as d}from"./args.js";import{activateMigratedService as A,completeMigrationHandoff as T,installClient as W}from"./install.js";import{currentPackageVersion as f,installRuntime as b,normalizeUpgradeVersion as G,rollbackRuntime as O}from"./runtime.js";import{serviceCommandsForConfig as p,serviceName as h,uninstallLegacyService as _,uninstallService as E,verifyServiceHealth as H}from"./service.js";import{runSupervisor as M}from"./supervisor.js";import{runCommand as D}from"./exec.js";import{defaultConfigPath as r,preferredClientPaths as l}from"./paths.js";import{readClientPath as F,writeClientPath as w,writeUpgradeChannel as $}from"./config-file.js";import{requestAgentRestart as I,requestClientActivity as R,requestMaintenanceCancel as U,requestMaintenanceStatus as k,requestScheduleMaintenance as q}from"./control.js";import{cliName as L,productName as j}from"./identity.js";import{migrateLegacyClient as x}from"./migration.js";import{assertPlatformNativeDependencies as z}from"./native-dependencies.js";async function B(){const e=S(process.argv.slice(2));if(e.command==="version"){console.log(`${L} ${await f()}`);return}if(e.command==="self-check"){await f(),z(),console.log(`${j} runtime is healthy`);return}if(e.command==="complete-migration"){await T(e.handoffPath);return}if(e.command==="run-service"){await M(e.configPath??process.env.AGENT_CONFIG_PATH??r);return}if(e.command==="install"){const t=await W(e);console.log(`Installed ${h}`),console.log(`Config: ${t.configPath}`),console.log(`Data: ${t.dataDir}`),console.log(`Runtime: ${t.runtime.currentLink}`),console.log(`Command: ${t.runtime.cliWrapperPath}`),console.log(`Service file: ${t.service.servicePath}`),console.log(`Upgrade: ${t.runtime.cliWrapperPath} upgrade`),console.log(`Restart: ${t.runtime.cliWrapperPath} restart`),console.log(`Status: ${t.runtime.cliWrapperPath} status`),console.log(`Logs: ${t.service.commands.logs}`);for(const n of t.service.warnings)console.warn(`Warning: ${n}`);return}if(e.command==="upgrade"){const{version:t,channel:n}=G(e.version,e.channel),a=process.env.PATH,o=e.configPath===r?l().configPath:e.configPath;if(a&&await w(o,a),n&&(await $(o,n),console.log(`Auto-upgrade channel: ${n}`)),e.delaySeconds!==void 0){await m(o,{type:"upgrade",version:t,path:a},e.delaySeconds,e.allowWaiting);return}const c=await x(),i=o===c.legacyPaths.configPath?c.paths.configPath:o;a&&i!==o&&await w(i,a),n&&i!==o&&await $(i,n);const s=await b({version:t,configPath:i,runtimeDir:c.paths.runtimeDir,binDir:c.paths.binDir,path:a??await F(i)});if(!await A(c,s,i,a)){const u=p(i);try{await g(u.restart),await H()}catch(y){throw await O(s),await g(u.restart).catch(()=>{}),y}}console.log(`Upgraded runtime to ${s.version}`),console.log(`Runtime: ${s.currentLink}`),console.log(`Command: ${s.cliWrapperPath}`),console.log(`Status: ${s.cliWrapperPath} status`);return}if(e.command==="sessions"){const t=await R(P(e.configPath));console.log(e.json?JSON.stringify(t):J(t));return}if(e.command==="maintenance"){const t=P(e.configPath),n=e.action==="cancel"?await U(t):await k(t);console.log(e.json?JSON.stringify(n??null):V(n));return}if(e.command==="restart"&&e.agent){if(e.delaySeconds!==void 0){await m(process.env.AGENT_CONFIG_PATH??r,{type:"restart",agent:e.agent},e.delaySeconds,e.allowWaiting);return}await I(process.env.AGENT_CONFIG_PATH??r,e.agent),console.log(`Restarted ${e.agent} agent`);return}if(e.command==="status"||e.command==="start"||e.command==="restart"||e.command==="stop"){if((e.command==="restart"||e.command==="stop")&&e.delaySeconds!==void 0){await m(process.env.AGENT_CONFIG_PATH??r,{type:e.command},e.delaySeconds,e.allowWaiting);return}const t=l().configPath,n=p(t),a=e.command==="status"?n.status:e.command==="start"?n.start:e.command==="restart"?n.restart:n.stop;await g(a);return}if(e.command==="uninstall"){if(e.delaySeconds!==void 0){await m(process.env.AGENT_CONFIG_PATH??r,{type:"uninstall"},e.delaySeconds,e.allowWaiting);return}l().configPath===r?await E():await _(),console.log(`Uninstalled ${h}`);return}}function P(e){return e===r?l().configPath:e}async function m(e,t,n,a){const o=await q(e,{operation:t,delaySeconds:n,allowWaiting:a});console.log(`Scheduled maintenance task ${o.id}`),console.log(`Operation: ${v(o.operation)}`),console.log(`Not before: ${o.notBefore}`)}function J(e){const t=[`Active sessions: ${e.active}`,`Waiting sessions: ${e.waiting}`];for(const n of["codex","claude"]){const a=e.agents[n];t.push(a.available?`${C(n)}: active=${a.active}, waiting=${a.waiting}`:`${C(n)}: unavailable (${a.error})`)}return t.join(`
|
|
3
|
+
`)}function V(e){return e?[`Task: ${e.id}`,`Operation: ${v(e.operation)}`,`Status: ${e.status}`,`Not before: ${e.notBefore}`,...e.message?[`Message: ${e.message}`]:[]].join(`
|
|
4
|
+
`):"No maintenance task has been scheduled"}function v(e){return e.type==="upgrade"?`upgrade to ${e.version}`:e.type==="restart"?e.agent?`restart ${e.agent}`:"restart client":e.type}function C(e){return`${e.charAt(0).toUpperCase()}${e.slice(1)}`}async function g(e){const t=await D("/bin/sh",["-lc",e],{allowFailure:!0});if(t.stdout&&process.stdout.write(t.stdout),t.stderr&&process.stderr.write(t.stderr),t.status!==0)throw new Error(t.stderr||t.stdout||`Command failed: ${e}`)}B().catch(e=>{if(e instanceof N){const n=e.message===d()?e.message:`${e.message}
|
|
5
5
|
|
|
6
|
-
${
|
|
6
|
+
${d()}`;console.error(n),process.exit(2)}const t=e instanceof Error?e.message:String(e);console.error(t),process.exit(1)});
|
package/dist/install.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { type RuntimeInstallResult } from "./runtime.js";
|
|
2
|
-
import { type ServiceInstallResult } from "./service.js";
|
|
1
|
+
import { rollbackRuntime, type RuntimeInstallResult } from "./runtime.js";
|
|
2
|
+
import { startLegacyService, uninstallService, type ServiceInstallResult } from "./service.js";
|
|
3
3
|
import { type InstallArgs } from "./args.js";
|
|
4
|
+
import { runCommand } from "./exec.js";
|
|
5
|
+
import { type ClientMigrationResult } from "./migration.js";
|
|
4
6
|
export type InstallResult = {
|
|
5
7
|
configPath: string;
|
|
6
8
|
dataDir: string;
|
|
@@ -8,6 +10,28 @@ export type InstallResult = {
|
|
|
8
10
|
runtime: RuntimeInstallResult;
|
|
9
11
|
service: ServiceInstallResult;
|
|
10
12
|
};
|
|
13
|
+
export declare function activateMigratedService(migration: ClientMigrationResult, runtime: RuntimeInstallResult, configPath: string, path?: string): Promise<boolean>;
|
|
14
|
+
declare function activateMigratedServiceInline(migration: ClientMigrationResult, runtime: RuntimeInstallResult, configPath: string, path?: string): Promise<void>;
|
|
15
|
+
export declare function scheduleDarwinMigrationHandoff(migration: ClientMigrationResult, runtime: RuntimeInstallResult, configPath: string, path?: string, dependencies?: {
|
|
16
|
+
run?: typeof runCommand;
|
|
17
|
+
wait?: (milliseconds: number) => Promise<unknown>;
|
|
18
|
+
attempts?: number;
|
|
19
|
+
}): Promise<boolean>;
|
|
20
|
+
export declare function scheduleMigrationHandoff(migration: ClientMigrationResult, runtime: RuntimeInstallResult, configPath: string, path?: string, dependencies?: {
|
|
21
|
+
run?: typeof runCommand;
|
|
22
|
+
wait?: (milliseconds: number) => Promise<unknown>;
|
|
23
|
+
attempts?: number;
|
|
24
|
+
platform?: NodeJS.Platform;
|
|
25
|
+
}): Promise<boolean>;
|
|
26
|
+
export declare function shouldAttemptAutomaticMigration(rootDir: string, version: string): Promise<boolean>;
|
|
27
|
+
export declare function completeMigrationHandoff(handoffPath: string, dependencies?: {
|
|
28
|
+
activate?: typeof activateMigratedServiceInline;
|
|
29
|
+
rollback?: typeof rollbackRuntime;
|
|
30
|
+
uninstall?: typeof uninstallService;
|
|
31
|
+
startLegacy?: typeof startLegacyService;
|
|
32
|
+
run?: typeof runCommand;
|
|
33
|
+
activeHelperLabel?: string;
|
|
34
|
+
}): Promise<void>;
|
|
11
35
|
type ResolvedInstallArgs = Omit<InstallArgs, "tunnelId" | "token" | "workspace" | "workspaceId" | "workspaceName"> & {
|
|
12
36
|
tunnelId: string;
|
|
13
37
|
token: string;
|
package/dist/install.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{randomUUID as
|
|
1
|
+
import{randomUUID as _}from"node:crypto";import{mkdir as C,readFile as L,realpath as H,rename as j,stat as R,writeFile as W}from"node:fs/promises";import{join as P}from"node:path";import{setTimeout as U}from"node:timers/promises";import{normalizeAgentServer as z}from"@messenger-agent/shared/agent-config";import{readConfigYaml as S,updateClientConfig as F,writeUpgradeChannel as G}from"./config-file.js";import{installRuntime as V,rollbackRuntime as g}from"./runtime.js";import{installService as A,startLegacyService as D,stopLegacyService as E,uninstallLegacyService as b,uninstallService as M}from"./service.js";import{UsageError as p}from"./args.js";import{defaultWorkspacePath as I,legacyCodingAgentPaths as q,messengerAgentPaths as B}from"./paths.js";import{runCommand as y}from"./exec.js";import{completeLegacyMigration as N,migrateLegacyClient as J,rollbackLegacyMigration as Z}from"./migration.js";const x="vip.elevo.messenger.agent.migration";async function gt(t,a,e,o){if(!t.migrated)return!1;if(process.platform==="darwin")return X(t,a,e,o);try{return await T(t,a,e,o),!0}catch(n){throw await g(a).catch(()=>{}),await O(t),n}}async function T(t,a,e,o){const n=await S(e),i=m(n,"data_dir")??t.paths.dataDir,s=Array.isArray(n.workspaces)?n.workspaces.find(c=>!!c&&typeof c=="object"&&!Array.isArray(c)&&typeof c.path=="string"):void 0,r=m(s,"path");if(!r)throw new Error("Migrated config does not contain a workspace path");await E(),await A({configPath:e,dataDir:i,workspacePath:r,serviceCommandPath:a.wrapperPath,path:o}),await b(),await N(t)}async function X(t,a,e,o,n={}){return Y(t,a,e,o,{...n,platform:"darwin"})}async function Y(t,a,e,o,n={}){const i=n.run??y,s=n.wait??U,r=n.attempts??1200,c=n.platform??process.platform;if(c!=="darwin"&&c!=="linux")throw new Error("Only Linux and macOS are supported");const f=P(t.paths.rootDir,"migration-handoff.json"),l=c==="darwin"?`${x}.${process.pid}`:`messenger-agent-migration-${process.pid}`;c==="darwin"&&await $(i,[],void 0,!0),await u(f,{schemaVersion:1,status:"scheduled",helperLabel:l,migration:t,runtime:a,configPath:e,...o?{path:o}:{},updatedAt:new Date().toISOString()});try{c==="darwin"?await i("launchctl",["submit","-l",l,"--",a.cliWrapperPath,"complete-migration","--handoff",f]):await i("systemd-run",["--user","--quiet","--collect","--unit",l,"--",a.cliWrapperPath,"complete-migration","--handoff",f])}catch(d){throw await u(f,{...await w(f),status:"failed",message:d instanceof Error?d.message:String(d),updatedAt:new Date().toISOString()}),d}for(let d=0;d<r;d+=1){const h=await w(f);if(h.status==="completed")return c==="darwin"&&await i("launchctl",["remove",l],{allowFailure:!0}),!0;if(h.status==="failed")throw new Error(h.message??"Service migration failed");await s(100)}throw new Error(`Timed out waiting for service migration; inspect ${f}`)}async function yt(t,a){try{const e=await w(P(t,"migration-handoff.json"));return e.status!=="completed"&&e.runtime.version!==a}catch(e){if(e.code==="ENOENT")return!0;throw e}}async function vt(t,a={}){const e=await w(t),o=a.run??y;if(e.status==="completed"||e.status==="failed"){await v(e,o,a.activeHelperLabel);return}await u(t,{...e,status:"running",updatedAt:new Date().toISOString()});try{await(a.activate??T)(e.migration,e.runtime,e.configPath,e.path),await u(t,{...e,status:"completed",updatedAt:new Date().toISOString()}),await v(e,o,a.activeHelperLabel)}catch(n){const i=[];await(a.rollback??g)(e.runtime).catch(r=>{i.push(`runtime rollback failed: ${String(r)}`)}),await(a.uninstall??M)().catch(r=>{i.push(`new service cleanup failed: ${String(r)}`)}),await(a.startLegacy??D)().catch(r=>{i.push(`legacy service restart failed: ${String(r)}`)});const s=[n instanceof Error?n.message:String(n),...i].join("; ");throw await u(t,{...e,status:"failed",message:s,updatedAt:new Date().toISOString()}),await v(e,o,a.activeHelperLabel),n}}async function v(t,a=y,e=process.env.XPC_SERVICE_NAME){await $(a,[t.helperLabel],e)}async function $(t,a=[],e,o=!1){const n=new Set(a.filter(k));if(e&&k(e)&&n.add(e),n.size===0&&!o)return;if(o||n.size>0){const s=await t("launchctl",["list"],{allowFailure:!0,logCommand:!1}).catch(()=>{});for(const r of s?.stdout.split(`
|
|
2
|
+
`)??[]){const c=r.trim().split(/\s+/).at(-1);c&&k(c)&&n.add(c)}}const i=[...n].filter(s=>s!==e);e&&n.has(e)&&i.push(e);for(const s of i)await t("launchctl",["remove",s],{allowFailure:!0}).catch(()=>{})}function k(t){return t.startsWith(`${x}.`)}async function w(t){const a=JSON.parse(await L(t,"utf8"));if(a.schemaVersion!==1||!a.migration||!a.runtime||typeof a.configPath!="string"||typeof a.helperLabel!="string"||a.status!=="scheduled"&&a.status!=="running"&&a.status!=="completed"&&a.status!=="failed")throw new Error(`Invalid Messenger Agent migration handoff: ${t}`);return a}async function u(t,a){const e=`${t}.${process.pid}.tmp`;await W(e,`${JSON.stringify(a,null,2)}
|
|
3
|
+
`,{mode:384}),await j(e,t)}function K(t=process.platform){if(t!=="linux"&&t!=="darwin")throw new Error("Only Linux and macOS are supported")}function Q(t=process.versions.node){const a=/^(\d+)\.(\d+)\.(\d+)(?:[.-]|$)/.exec(t),e=Number(a?.[1]),o=Number(a?.[2]);if(!(e>22||e===22&&o>=19))throw new Error("Node.js 22.19.0 or newer is required")}function tt(t){if(t.server)try{z(t.server)}catch{throw new Error("--server must be a valid HTTP or HTTPS server address")}if(t.tunnelId&&!/^[A-Za-z0-9._:-]+$/.test(t.tunnelId))throw new Error("--tunnel-id may only contain letters, numbers, '.', '_', ':', and '-'");if(t.workspaceId&&!/^[A-Za-z0-9._:-]+$/.test(t.workspaceId))throw new Error("--workspace-id may only contain letters, numbers, '.', '_', ':', and '-'");if(t.workspaceName&&(t.workspaceName.trim().length===0||t.workspaceName.trim().length>128))throw new Error("--workspace-name must be between 1 and 128 characters")}async function et(t,a=!1){a&&await C(t,{recursive:!0});const e=await H(t);if(!(await R(e)).isDirectory())throw new Error("--workspace must point to an existing directory");return e}async function kt(t){K(),Q();const a=B(),e=q(),n=t.configPath===a.configPath||t.configPath===e.configPath?await J():void 0;let i;try{const s=n?{...t,configPath:t.configPath===n.legacyPaths.configPath?n.paths.configPath:t.configPath,dataDir:t.dataDir===n.legacyPaths.dataDir?n.paths.dataDir:t.dataDir}:t,r=await at(s);tt(r);const c=await et(r.workspace,r.createWorkspace);await F({configPath:r.configPath,dataDir:r.dataDir,workspacePath:c,workspaceId:r.workspaceId,workspaceName:r.workspaceName,tunnelId:r.tunnelId,token:r.token,server:r.server,serverUrl:r.serverUrl,preserveWorkspaces:r.preserveWorkspaces,path:process.env.PATH}),t.channel&&await G(r.configPath,t.channel),i=await V({version:"current",configPath:r.configPath,runtimeDir:n?.paths.runtimeDir,binDir:n?.paths.binDir,path:process.env.PATH,hostArtifactDirectory:process.env.MESSENGER_AGENT_BOOTSTRAP_HOST_DIR,clientDirectory:process.env.MESSENGER_AGENT_BOOTSTRAP_CLIENT_DIR}),n?.migrated&&await E();const f=await A({configPath:r.configPath,dataDir:r.dataDir,workspacePath:c,serviceCommandPath:i.wrapperPath,path:process.env.PATH});return n?.migrated&&(await b(),await N(n)),{configPath:r.configPath,dataDir:r.dataDir,workspacePath:c,runtime:i,service:f}}catch(s){throw i&&await g(i).catch(()=>{}),n?.migrated&&await O(n),s}}async function O(t){await M().catch(()=>{}),await Z(t),await D().catch(()=>{})}async function at(t){const a=await S(t.configPath),e=nt(a,"tunnel"),o=t.tunnelId??m(e,"tunnel_id"),n=t.token??m(e,"token"),i=rt(a,t.workspaceId,o),s=t.workspace??i?.path??I,r=t.workspaceId??i?.id??_(),c=t.workspaceName??i?.name??(o?`${o} Default`:void 0),f=s===I;if(!o)throw new p("Missing required option: --tunnel-id");if(!n)throw new p("Missing required option: --token");if(!r)throw new p("Missing required option: --workspace-id");if(!c)throw new p("Missing required option: --workspace-name");return{...t,tunnelId:o,token:n,workspace:s,workspaceId:r,workspaceName:c,preserveWorkspaces:!t.workspace&&!!i,createWorkspace:f}}function rt(t,a,e){const o=t.workspaces;if(!Array.isArray(o))return;const n=o.filter(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&typeof r.path=="string");if(a){const r=n.find(c=>c.id===a);return!r||typeof r.path!="string"?void 0:{id:a,name:typeof r.name=="string"&&r.name?r.name:`${e??a} Default`,path:r.path}}const i=a??(e?`${e}--default`:void 0),s=(i?n.find(r=>r.id===i):void 0)??n.find(r=>r.id==="default")??n[0];if(!(!s||typeof s.path!="string"))return{id:typeof s.id=="string"&&s.id?s.id:i??"default",name:typeof s.name=="string"&&s.name?s.name:`${e??i??"default"} Default`,path:s.path}}function nt(t,a){const e=t[a];if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function m(t,a){const e=t?.[a];return typeof e=="string"&&e?e:void 0}export{gt as activateMigratedService,Q as assertNodeVersion,K as assertSupportedPlatform,vt as completeMigrationHandoff,kt as installClient,at as resolveInstallArgs,et as resolveWorkspacePath,X as scheduleDarwinMigrationHandoff,Y as scheduleMigrationHandoff,yt as shouldAttemptAutomaticMigration,tt as validateInstallArgs};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ClientPaths } from "./paths.js";
|
|
2
|
+
export type ClientMigrationResult = {
|
|
3
|
+
paths: ClientPaths;
|
|
4
|
+
migrated: boolean;
|
|
5
|
+
legacyPaths: ClientPaths;
|
|
6
|
+
statePath?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function migrateLegacyClient(home?: string): Promise<ClientMigrationResult>;
|
|
9
|
+
export declare function completeLegacyMigration(result: ClientMigrationResult): Promise<void>;
|
|
10
|
+
export declare function rollbackLegacyMigration(result: ClientMigrationResult): Promise<void>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{constants as O}from"node:fs";import{access as $,chmod as u,lstat as m,mkdir as M,readFile as y,readlink as D,rename as s,symlink as N,unlink as _,writeFile as l}from"node:fs/promises";import{dirname as f,isAbsolute as P,join as w,relative as k,resolve as e}from"node:path";import{parse as x,stringify as C}from"yaml";import{legacyCodingAgentPaths as v,messengerAgentPaths as j}from"./paths.js";async function K(t){const r=j(t),a=v(t);if(await d(r.configPath)){const i=w(r.rootDir,"migration.json"),n=await F(i);return n?.status==="prepared"&&e(n.sourceRoot)===e(a.rootDir)&&e(n.targetRoot)===e(r.rootDir)?(await A(a.rootDir,r.rootDir),{paths:r,migrated:!0,legacyPaths:a,statePath:i}):{paths:r,migrated:!1,legacyPaths:a}}if(!await d(a.configPath))return{paths:r,migrated:!1,legacyPaths:a};if(await d(r.rootDir))throw new Error(`Messenger Agent migration target already exists without a config file: ${r.rootDir}`);await s(a.rootDir,r.rootDir);const o=w(r.rootDir,"migration.json");try{return await A(a.rootDir,r.rootDir),await E(r.configPath,a,r),await h(o,{schemaVersion:1,status:"prepared",sourceRoot:a.rootDir,targetRoot:r.rootDir,updatedAt:new Date().toISOString()}),{paths:r,migrated:!0,legacyPaths:a,statePath:o}}catch(i){throw await b(a.rootDir,r.rootDir).catch(()=>{}),await s(r.rootDir,a.rootDir).catch(()=>{}),i}}async function Y(t){!t.migrated||!t.statePath||await h(t.statePath,{schemaVersion:1,status:"completed",sourceRoot:t.legacyPaths.rootDir,targetRoot:t.paths.rootDir,updatedAt:new Date().toISOString()})}async function q(t){if(t.migrated){if(await b(t.legacyPaths.rootDir,t.paths.rootDir),await d(t.legacyPaths.rootDir))throw new Error(`Cannot roll back Messenger Agent migration because the legacy directory exists: ${t.legacyPaths.rootDir}`);t.statePath&&await h(t.statePath,{schemaVersion:1,status:"rolled-back",sourceRoot:t.legacyPaths.rootDir,targetRoot:t.paths.rootDir,updatedAt:new Date().toISOString()}),await E(t.paths.configPath,t.paths,t.legacyPaths),await s(t.paths.rootDir,t.legacyPaths.rootDir)}}async function F(t){try{const r=JSON.parse(await y(t,"utf8"));if(r.schemaVersion!==1||r.status!=="prepared"&&r.status!=="completed"&&r.status!=="rolled-back"||typeof r.sourceRoot!="string"||typeof r.targetRoot!="string"||typeof r.updatedAt!="string")throw new Error(`Invalid Messenger Agent migration state: ${t}`);return r}catch(r){if(r.code==="ENOENT")return;throw r}}async function A(t,r){try{if((await m(t)).isSymbolicLink()&&e(f(t),await D(t))===e(r))return;throw new Error(`Legacy migration path is occupied: ${t}`)}catch(a){if(a.code!=="ENOENT")throw a}await N(r,t,"dir")}async function b(t,r){try{if(!(await m(t)).isSymbolicLink()||e(f(t),await D(t))!==e(r))return;await _(t)}catch(a){if(a.code!=="ENOENT")throw a}}async function E(t,r,a){const o=x(await y(t,"utf8"));if(!S(o))throw new Error(`Config file must contain a YAML object: ${t}`);c(o,["data_dir"],r.rootDir,a.rootDir),c(o,["file_uploads","temp_dir"],r.rootDir,a.rootDir);for(const n of["codex","claude","workspace"])c(o,[n,"data_dir"],r.rootDir,a.rootDir),c(o,[n,"log_file"],r.rootDir,a.rootDir),c(o,[n,"file_uploads","temp_dir"],r.rootDir,a.rootDir);const i=`${t}.${process.pid}.tmp`;await l(i,C(o),{mode:384}),await u(i,384),await s(i,t),await u(t,384)}function c(t,r,a,o){let i=t;for(const L of r.slice(0,-1)){const p=i[L];if(!S(p))return;i=p}const n=r.at(-1);if(!n)return;const g=i[n];typeof g!="string"||!I(g,a)||(i[n]=w(o,k(e(a),e(g))))}function I(t,r){if(!P(t))return!1;const a=k(e(r),e(t));return a===""||!a.startsWith("..")&&!P(a)}async function h(t,r){await M(f(t),{recursive:!0,mode:448});const a=`${t}.${process.pid}.tmp`;await l(a,`${JSON.stringify(r,null,2)}
|
|
2
|
+
`,{mode:384}),await s(a,t)}async function d(t){try{return await $(t,O.F_OK),!0}catch{return!1}}function S(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}export{Y as completeLegacyMigration,K as migrateLegacyClient,q as rollbackLegacyMigration};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertPlatformNativeDependencies(platform?: NodeJS.Platform, arch?: string, resolvePackage?: (request: string) => string, isFile?: (path: string) => boolean): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{statSync as l}from"node:fs";import{createRequire as p}from"node:module";import{dirname as s,join as x}from"node:path";const m=p(import.meta.url),g={"linux-x64":[{packageName:"@openai/codex-linux-x64",executable:"vendor/x86_64-unknown-linux-musl/bin/codex"},{packageName:"@anthropic-ai/claude-agent-sdk-linux-x64",executable:"claude"}],"linux-arm64":[{packageName:"@openai/codex-linux-arm64",executable:"vendor/aarch64-unknown-linux-musl/bin/codex"},{packageName:"@anthropic-ai/claude-agent-sdk-linux-arm64",executable:"claude"}],"darwin-x64":[{packageName:"@openai/codex-darwin-x64",executable:"vendor/x86_64-apple-darwin/bin/codex"},{packageName:"@anthropic-ai/claude-agent-sdk-darwin-x64",executable:"claude"}],"darwin-arm64":[{packageName:"@openai/codex-darwin-arm64",executable:"vendor/aarch64-apple-darwin/bin/codex"},{packageName:"@anthropic-ai/claude-agent-sdk-darwin-arm64",executable:"claude"}]};function h(e=process.platform,t=process.arch,i=m.resolve,o=k){const a=`${e}-${t}`,r=g[a];if(!r)throw new Error(`Unsupported native dependency target: ${a}`);const c=r.filter(({packageName:n,executable:d})=>{try{const u=i(`${n}/package.json`);return!o(x(s(u),d))}catch{return!0}});if(c.length>0)throw new Error(`Missing native Agent dependencies for ${a}: ${c.map(({packageName:n})=>n).join(", ")}`)}function k(e){try{return l(e).isFile()}catch{return!1}}export{h as assertPlatformNativeDependencies};
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
export type ClientPaths = {
|
|
2
|
+
rootDir: string;
|
|
3
|
+
configPath: string;
|
|
4
|
+
dataDir: string;
|
|
5
|
+
runtimeDir: string;
|
|
6
|
+
binDir: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function messengerAgentPaths(home?: string): ClientPaths;
|
|
9
|
+
export declare function legacyCodingAgentPaths(home?: string): ClientPaths;
|
|
10
|
+
export declare function preferredClientPaths(home?: string): ClientPaths;
|
|
11
|
+
export declare const defaultRootDir: string;
|
|
1
12
|
export declare const defaultConfigPath: string;
|
|
2
13
|
export declare const defaultDataDir: string;
|
|
3
14
|
export declare const defaultRuntimeDir: string;
|
package/dist/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{homedir as
|
|
1
|
+
import{existsSync as a}from"node:fs";import{homedir as n}from"node:os";import{dirname as u,join as e,resolve as f}from"node:path";function c(t=n()){return s(e(t,".messenger-agent"))}function g(t=n()){return s(e(t,".coding-agent"))}function x(t=n()){const i=c(t),o=g(t);return a(i.configPath)||!a(o.configPath)?i:o}const r=c(),P=r.rootDir,h=r.configPath,D=r.dataDir,y=r.runtimeDir,b=r.binDir,C=e(n(),"messenger-workspace");function s(t){return{rootDir:t,configPath:e(t,"config.yaml"),dataDir:e(t,"data"),runtimeDir:e(t,"runtime"),binDir:e(t,"bin")}}function d(t){return t==="~"?n():t.startsWith("~/")?e(n(),t.slice(2)):t}function k(t){return f(d(t))}function v(t){return u(t)}export{v as configBaseDir,b as defaultBinDir,h as defaultConfigPath,D as defaultDataDir,P as defaultRootDir,y as defaultRuntimeDir,C as defaultWorkspacePath,d as expandHome,g as legacyCodingAgentPaths,c as messengerAgentPaths,x as preferredClientPaths,k as resolvePath};
|
package/dist/runtime.d.ts
CHANGED
|
@@ -7,13 +7,39 @@ export type RuntimeInstallOptions = {
|
|
|
7
7
|
codexHome?: string;
|
|
8
8
|
claudeHome?: string;
|
|
9
9
|
path?: string;
|
|
10
|
+
platform?: NodeJS.Platform;
|
|
11
|
+
arch?: NodeJS.Architecture;
|
|
12
|
+
registryUrl?: string;
|
|
13
|
+
hostArtifactDirectory?: string;
|
|
14
|
+
clientDirectory?: string;
|
|
10
15
|
};
|
|
11
16
|
export type RuntimeInstallResult = {
|
|
12
17
|
releaseDir: string;
|
|
13
18
|
currentLink: string;
|
|
14
19
|
wrapperPath: string;
|
|
20
|
+
legacyServiceWrapperPath: string;
|
|
15
21
|
cliWrapperPath: string;
|
|
22
|
+
legacyCliWrapperPath: string;
|
|
16
23
|
version: string;
|
|
24
|
+
previousReleaseDir?: string;
|
|
25
|
+
hostCurrentLink: string;
|
|
26
|
+
previousHostReleaseDir?: string;
|
|
27
|
+
previousWrappers: PreviousWrapper[];
|
|
28
|
+
};
|
|
29
|
+
type PreviousWrapper = {
|
|
30
|
+
path: string;
|
|
31
|
+
content?: string;
|
|
32
|
+
};
|
|
33
|
+
export type NodeHostManifest = {
|
|
34
|
+
schemaVersion: 1;
|
|
35
|
+
product: "messenger-agent-node-host";
|
|
36
|
+
version: string;
|
|
37
|
+
nodeVersion: string;
|
|
38
|
+
platform: "linux" | "darwin";
|
|
39
|
+
arch: "x64" | "arm64";
|
|
40
|
+
node: string;
|
|
41
|
+
npm: string;
|
|
42
|
+
payload?: string;
|
|
17
43
|
};
|
|
18
44
|
export type ReleaseChannel = "latest" | "beta" | "alpha";
|
|
19
45
|
export declare const releaseChannels: ReleaseChannel[];
|
|
@@ -26,10 +52,11 @@ export declare function normalizeUpgradeVersion(version: string, explicitChannel
|
|
|
26
52
|
export declare function isPrereleaseVersion(version: string): boolean;
|
|
27
53
|
export declare function compareSemverVersions(left: string, right: string): number;
|
|
28
54
|
export declare function currentPackageVersion(): Promise<string>;
|
|
29
|
-
export declare function npmExecutablePath(nodeExecutable?: string): string;
|
|
30
|
-
export declare function npmProcessPath(nodeExecutable?: string, currentPath?: string | undefined): string;
|
|
31
55
|
export declare function currentBundledSkillsDir(moduleUrl?: string): string;
|
|
32
56
|
export declare function defaultAgentHomes(): [string, string];
|
|
33
57
|
export declare function installRuntime(options: RuntimeInstallOptions): Promise<RuntimeInstallResult>;
|
|
34
|
-
export declare function
|
|
58
|
+
export declare function rollbackRuntime(result: RuntimeInstallResult): Promise<void>;
|
|
59
|
+
export declare function nodeHostPackageName(platform: "linux" | "darwin", arch: "x64" | "arm64"): string;
|
|
60
|
+
export declare function resolveChannelPackageVersion(channel: ReleaseChannel, registryUrl?: string): Promise<string>;
|
|
35
61
|
export declare function syncBundledSkills(skillsSourceDir: string, agentHomes: string[]): Promise<void>;
|
|
62
|
+
export {};
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{access as
|
|
2
|
-
`),
|
|
3
|
-
`),{mode:448}),{
|
|
1
|
+
import{createHash as oe}from"node:crypto";import{createReadStream as se,createWriteStream as ce}from"node:fs";import{access as le,cp as j,lstat as Z,mkdir as k,readFile as S,readlink as ue,rename as E,rm as $,symlink as fe,writeFile as N}from"node:fs/promises";import{homedir as q}from"node:os";import{basename as de,delimiter as me,dirname as C,isAbsolute as G,join as a,relative as we,resolve as v}from"node:path";import{Readable as pe}from"node:stream";import{pipeline as he}from"node:stream/promises";import{fileURLToPath as Q}from"node:url";import{runCommand as P}from"./exec.js";import{cliName as ge,legacyCliName as ye,runtimePackageScope as $e}from"./identity.js";import{defaultBinDir as ve,defaultRuntimeDir as ke,legacyCodingAgentPaths as Ee,messengerAgentPaths as Ne}from"./paths.js";const O="https://registry.npmjs.org",I="@messenger-agent/client",Ke=["latest","beta","alpha"];function et(e){if(!(e==null||e==="")){if(e==="stable")return"latest";if(e==="latest"||e==="beta"||e==="alpha")return e;throw new Error(`Unknown release channel: ${String(e)} (expected latest, beta, or alpha)`)}}function W(e){return e==="stable"?"latest":e==="latest"||e==="beta"||e==="alpha"?e:void 0}function tt(e,t){const r=W(e),n=t??r;return{version:r?n??r:e,channel:n}}function rt(e){return/^\d+\.\d+\.\d+-/.test(e)}function at(e,t){const[r]=e.split("+",1),[n]=t.split("+",1),o=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(r??""),s=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(n??"");if(!o||!s)throw new Error(`Automatic upgrades require semantic versions, received: ${e} and ${t}`);for(let c=1;c<=3;c+=1){const l=Number(o[c])-Number(s[c]);if(l!==0)return Math.sign(l)}return Pe(o[4],s[4])}function Pe(e,t){if(!e&&!t)return 0;if(!e)return 1;if(!t)return-1;const r=e.split("."),n=t.split(".");for(let o=0;o<Math.max(r.length,n.length);o+=1){const s=r[o],c=n[o];if(s===void 0)return-1;if(c===void 0)return 1;const l=/^\d+$/.test(s),i=/^\d+$/.test(c);if(l&&i){const w=Number(s)-Number(c);if(w!==0)return Math.sign(w);continue}if(l)return-1;if(i)return 1;if(s!==c)return s<c?-1:1}return 0}async function xe(){const e=a(C(Q(import.meta.url)),"..","package.json");return JSON.parse(await S(e,"utf8")).version??"latest"}function nt(e=import.meta.url){const t=C(Q(e));return de(t)==="src"?a(t,"..","assets","skills"):a(t,"assets","skills")}function be(){return[process.env.CODEX_HOME??a(q(),".codex"),process.env.CLAUDE_CONFIG_DIR??a(q(),".claude")]}async function m(e){await $(e,{recursive:!0,force:!0})}async function V(e,t){const r=`${t}.tmp-${process.pid}`;await m(r),await fe(e,r,"dir"),await E(r,t)}async function F(e){try{return(await Z(e)).isSymbolicLink()}catch{return!1}}async function it(e){const t=De(e.configPath),r=e.runtimeDir??t?.runtimeDir??ke,n=e.binDir??t?.binDir??ve,o=Ue(e.platform??process.platform),s=je(e.arch??process.arch),c=W(e.version),l=e.version==="current"?await xe():c?await Ce(c,e.registryUrl):e.version,i=await He({runtimeDir:r,platform:o,arch:s,registryUrl:e.registryUrl,artifactDirectory:e.hostArtifactDirectory}),w=l.replaceAll("/","_").replaceAll(":","_"),p=a(r,"releases"),u=a(p,w),h=a(r,"current"),D=a(u,"node_modules","@messenger-agent","client","dist","index.js"),d=a(u,"node_modules","@messenger-agent","client","package.json"),_=e.skillsSourceDir??a(u,"node_modules","@messenger-agent","client","dist","assets","skills"),M=a(n,"messenger-agent-service"),T=a(n,"coding-agent-client-service"),L=a(n,ge),U=a(n,ye),ae=[M,T,L,U];if(await k(p,{recursive:!0,mode:448}),await k(n,{recursive:!0,mode:448}),!(await z(d,l)&&(await X(i.nodeExecutable,D)).status===0)){const f=`${u}.tmp-${process.pid}`,A=a(f,"node_modules","@messenger-agent","client","dist","index.js");await m(f),await k(f,{recursive:!0,mode:448});try{if(e.clientDirectory&&await z(a(e.clientDirectory,"node_modules","@messenger-agent","client","package.json"),l))await j(e.clientDirectory,f,{recursive:!0});else{const x=a(f,".npmrc");await N(x,""),await P(i.nodeExecutable,[i.npmCli,"install","--prefix",f,"--omit=dev","--include=optional","--ignore-scripts","--no-audit","--no-fund","--registry",e.registryUrl??process.env.MESSENGER_AGENT_NPM_REGISTRY??O,"--userconfig",x,`${I}@${l}`],{env:{PATH:_e(i.nodeExecutable,e.path)},cwd:f})}if(!await z(a(f,"node_modules","@messenger-agent","client","package.json"),l))throw new Error(`Installed Messenger Agent Client does not match ${l}`);const g=await X(i.nodeExecutable,A);if(g.status!==0)throw new Error(`Messenger Agent Client self-check failed: ${g.stderr||g.stdout}`);await m(u),await E(f,u)}catch(g){throw await m(f),g}}const[ne,ie]=be();await Ge(_,[e.codexHome??ne,e.claudeHome??ie]);const J=await re(h),B=await re(i.currentLink),Y=await Promise.all(ae.map(async f=>({path:f,content:await Ae(f)})));await F(h)||await m(h),await F(i.currentLink)||await m(i.currentLink);try{await V(i.releaseDir,i.currentLink),await V(u,h);const f=b(i.currentLink,i.manifest.node),A=a(h,"node_modules","@messenger-agent","client","dist","index.js"),g=["#!/bin/sh","set -eu",...e.path?[`export PATH=${y(e.path)}`]:[],`export AGENT_CONFIG_PATH=${y(e.configPath)}`,`exec ${y(f)} ${y(A)} run-service --config ${y(e.configPath)}`,""].join(`
|
|
2
|
+
`),x=["#!/bin/sh","set -eu",`export AGENT_CONFIG_PATH=${y(e.configPath)}`,`exec ${y(f)} ${y(A)} "$@"`,""].join(`
|
|
3
|
+
`);await N(M,g,{mode:448}),await N(T,g,{mode:448}),await N(L,x,{mode:448}),await N(U,x,{mode:448})}catch(f){throw await H(J,h),await H(B,i.currentLink),await K(Y),f}return{releaseDir:u,currentLink:h,wrapperPath:M,legacyServiceWrapperPath:T,cliWrapperPath:L,legacyCliWrapperPath:U,version:l,previousReleaseDir:J,hostCurrentLink:i.currentLink,previousHostReleaseDir:B,previousWrappers:Y}}async function X(e,t){return P(e,[t,"self-check"],{allowFailure:!0})}function De(e){const t=Ne();if(v(e)===v(t.configPath))return t;const r=Ee();return v(e)===v(r.configPath)?r:void 0}async function ot(e){await H(e.previousReleaseDir,e.currentLink),await H(e.previousHostReleaseDir,e.hostCurrentLink),await K(e.previousWrappers)}async function H(e,t){e?await V(e,t):await m(t)}async function Ae(e){try{return await S(e,"utf8")}catch(t){if(t.code==="ENOENT")return;throw t}}async function K(e){await Promise.all(e.map(({path:t,content:r})=>r===void 0?m(t):N(t,r,{mode:448})))}function Se(e,t){return`${$e}/node-host-${e}-${t}`}async function Ce(e,t){return(await ee(I,e,t)).version}async function He(e){const t=Se(e.platform,e.arch),r=e.artifactDirectory?void 0:await Me(t,"latest",e.registryUrl),o=(e.artifactDirectory?await te(a(e.artifactDirectory,"manifest.json"),{platform:e.platform,arch:e.arch}):void 0)?.version??r?.version;if(!o)throw new Error(`Unable to resolve ${t}`);const s=a(e.runtimeDir,"host"),c=a(s,"releases"),l=`${o}-${e.platform}-${e.arch}`.replaceAll("/","_").replaceAll(":","_"),i=a(c,l),w=a(s,"current"),p=a(i,"manifest.json");if(await k(c,{recursive:!0,mode:448}),!await R(p)){const d=`${i}.tmp-${process.pid}`;await m(d),await k(d,{recursive:!0,mode:448});try{e.artifactDirectory?await j(e.artifactDirectory,d,{recursive:!0}):r&&await Re(r,d),await m(i),await E(d,i)}catch(_){throw await m(d),_}}const u=await te(p,{version:o,platform:e.platform,arch:e.arch});await Le(i,u);const h=b(i,u.node),D=b(i,u.npm);if(!await R(h)||!await R(D))throw new Error(`Node Host ${t}@${o} is incomplete`);if(u.platform==="darwin"){const d=a(i,"Messenger Agent.app");await P("codesign",["--verify","--deep","--strict",d]),await P("spctl",["--assess","--type","execute",d])}return{releaseDir:i,currentLink:w,nodeExecutable:h,npmCli:D,manifest:u}}async function Re(e,t){const r=`${t}.tgz`;try{const n=await fetch(e.tarball);if(!n.ok||!n.body)throw new Error(`Unable to download ${e.packageName}@${e.version}: HTTP ${n.status}`);await he(pe.fromWeb(n.body),ce(r,{mode:384})),await Te(r,e.integrity),await P("tar",["-xzf",r,"-C",t,"--strip-components=2","package/host"])}finally{await $(r,{force:!0})}}async function z(e,t){try{const r=JSON.parse(await S(e,"utf8"));return r.name===I&&r.version===t}catch{return!1}}function _e(e,t=process.env.PATH){const r=C(e);return t?`${r}${me}${t}`:r}async function Me(e,t,r=process.env.MESSENGER_AGENT_NPM_REGISTRY??O){const{metadata:n,version:o}=await ee(e,t,r),s=n.versions?.[o]?.dist;if(!s?.tarball||!s.integrity)throw new Error(`Registry returned incomplete artifact metadata for ${e}@${o}`);return{packageName:e,version:o,tarball:s.tarball,integrity:s.integrity}}async function ee(e,t,r=process.env.MESSENGER_AGENT_NPM_REGISTRY??O){const n=`${r.replace(/\/$/,"")}/${encodeURIComponent(e)}`,o=await fetch(n,{headers:{accept:"application/json"}});if(!o.ok)throw new Error(`Unable to resolve ${e}: HTTP ${o.status}`);const s=await o.json(),c=W(t)?s["dist-tags"]?.[t]:t;if(!c)throw new Error(`Registry has no ${t} release for ${e}`);return{metadata:s,version:c}}async function Te(e,t){const r=t.indexOf("-");if(r<=0)throw new Error("Node Host has an invalid integrity value");const n=t.slice(0,r),o=t.slice(r+1),s=oe(n);for await(const c of se(e))s.update(c);if(s.digest("base64")!==o)throw new Error("Node Host integrity verification failed")}async function te(e,t){const r=JSON.parse(await S(e,"utf8"));if(r.schemaVersion!==1||r.product!=="messenger-agent-node-host"||t.version!==void 0&&r.version!==t.version||typeof r.version!="string"||typeof r.nodeVersion!="string"||r.platform!==t.platform||r.arch!==t.arch||typeof r.node!="string"||typeof r.npm!="string"||r.payload!==void 0&&typeof r.payload!="string")throw new Error(`Node Host manifest does not match ${t.platform}-${t.arch}${t.version?`@${t.version}`:""}`);return r}async function Le(e,t){if(!t.payload)return;const r=b(e,t.node);if(await R(r))return;if(t.platform!=="darwin")throw new Error("Only macOS Node Hosts may contain a zip payload");const n=b(e,t.payload);await P("ditto",["-x","-k",n,e])}function b(e,t){if(!t||G(t))throw new Error(`Node Host contains an unsafe path: ${t}`);const r=v(e),n=v(e,t),o=we(r,n);if(o.startsWith("..")||G(o))throw new Error(`Node Host contains an unsafe path: ${t}`);return n}function Ue(e){if(e==="linux"||e==="darwin")return e;throw new Error(`No Messenger Agent runtime is available for platform: ${e}`)}function je(e){if(e==="x64"||e==="arm64")return e;throw new Error(`No Messenger Agent runtime is available for architecture: ${e}`)}async function re(e){if(!await F(e))return;const t=await ue(e);return G(t)?t:v(C(e),t)}async function R(e){try{return await le(e),!0}catch{return!1}}async function Ge(e,t){const r="manage-messenger-agent",n="manage-coding-agent-client",o=a(e,r),s=await Oe(o);for(const c of new Set(t)){const l=a(c,"skills"),i=a(l,r),w=a(l,`.${r}.tmp-${process.pid}`),p=a(l,`.${r}.old-${process.pid}`);if(await $(w,{recursive:!0,force:!0}),await $(p,{recursive:!0,force:!0}),await $(a(l,n),{recursive:!0,force:!0}),!s){await $(i,{recursive:!0,force:!0});continue}await k(l,{recursive:!0,mode:448}),await j(o,w,{recursive:!0}),await E(i,p).catch(u=>{if(u.code!=="ENOENT")throw u});try{await E(w,i),await $(p,{recursive:!0,force:!0})}catch(u){throw await E(p,i).catch(()=>{}),u}}}async function Oe(e){try{return(await Z(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}}function y(e){return`'${e.replaceAll("'","'\\''")}'`}export{at as compareSemverVersions,nt as currentBundledSkillsDir,xe as currentPackageVersion,be as defaultAgentHomes,it as installRuntime,rt as isPrereleaseVersion,Se as nodeHostPackageName,et as normalizeReleaseChannel,tt as normalizeUpgradeVersion,W as parseReleaseChannel,Ke as releaseChannels,Ce as resolveChannelPackageVersion,ot as rollbackRuntime,Ge as syncBundledSkills};
|
package/dist/service.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type CommandResult } from "./exec.js";
|
|
2
|
-
export
|
|
3
|
-
export declare const launchdLabel = "vip.elevo.coding-agent.client";
|
|
1
|
+
import { runCommand, type CommandResult } from "./exec.js";
|
|
2
|
+
export { launchdLabel, serviceName } from "./identity.js";
|
|
4
3
|
export type ServiceInstallOptions = {
|
|
5
4
|
configPath: string;
|
|
6
5
|
dataDir: string;
|
|
@@ -36,7 +35,20 @@ type LingerDependencies = {
|
|
|
36
35
|
};
|
|
37
36
|
export declare function ensureSystemdUserLinger(user: string, dependencies?: LingerDependencies): Promise<void>;
|
|
38
37
|
export declare function installService(options: ServiceInstallOptions): Promise<ServiceInstallResult>;
|
|
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
|
-
export declare function
|
|
47
|
+
export declare function legacyLinuxCommands(): ServiceCommands;
|
|
48
|
+
export declare function darwinCommands(dataDir?: string): ServiceCommands;
|
|
49
|
+
export declare function legacyDarwinCommands(): ServiceCommands;
|
|
50
|
+
export declare function serviceCommandsForConfig(configPath: string): ServiceCommands;
|
|
51
|
+
export declare function uninstallLegacyService(platform?: NodeJS.Platform): Promise<void>;
|
|
52
|
+
export declare function stopLegacyService(platform?: NodeJS.Platform): Promise<void>;
|
|
53
|
+
export declare function startLegacyService(platform?: NodeJS.Platform): Promise<void>;
|
|
41
54
|
export declare function uninstallService(platform?: NodeJS.Platform): Promise<void>;
|
|
42
|
-
export {};
|
package/dist/service.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import{access as
|
|
2
|
-
`)}function
|
|
3
|
-
`)}async function
|
|
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("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}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/dist/supervisor.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { readClientPath } from "./config-file.js";
|
|
3
|
+
import { currentPackageVersion, installRuntime, rollbackRuntime } from "./runtime.js";
|
|
4
|
+
import { migrateLegacyClient } from "./migration.js";
|
|
5
|
+
import { scheduleMigrationHandoff, shouldAttemptAutomaticMigration } from "./install.js";
|
|
2
6
|
import { type AgentActivitySnapshot, type ManagedAgentName } from "@messenger-agent/shared/agent-activity";
|
|
3
7
|
export type { ManagedAgentName } from "@messenger-agent/shared/agent-activity";
|
|
4
8
|
export type AgentActivityStatus = ({
|
|
@@ -43,3 +47,12 @@ export declare class AgentSupervisor {
|
|
|
43
47
|
private startAgent;
|
|
44
48
|
}
|
|
45
49
|
export declare function runSupervisor(configPath: string): Promise<void>;
|
|
50
|
+
export declare function migrateLegacyServiceAtStartup(configPath: string, dependencies?: {
|
|
51
|
+
currentVersion?: typeof currentPackageVersion;
|
|
52
|
+
shouldAttempt?: typeof shouldAttemptAutomaticMigration;
|
|
53
|
+
migrate?: typeof migrateLegacyClient;
|
|
54
|
+
install?: typeof installRuntime;
|
|
55
|
+
handoff?: typeof scheduleMigrationHandoff;
|
|
56
|
+
rollback?: typeof rollbackRuntime;
|
|
57
|
+
readPath?: typeof readClientPath;
|
|
58
|
+
}): Promise<boolean>;
|
package/dist/supervisor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{spawn as
|
|
1
|
+
import{spawn as x}from"node:child_process";import{randomUUID as b}from"node:crypto";import{createRequire as M}from"node:module";import{dirname as h,join as f,resolve as w}from"node:path";import{parse as k}from"yaml";import{readFile as C,unlink as y}from"node:fs/promises";import{readClientPath as v,readUpgradeChannel as E,writeClientPath as I}from"./config-file.js";import{readControlSocketPath as $,startControlServer as L}from"./control.js";import{MaintenanceScheduler as N}from"./maintenance.js";import{currentBundledSkillsDir as F,currentPackageVersion as O,defaultAgentHomes as R,installRuntime as A,rollbackRuntime as P,syncBundledSkills as D}from"./runtime.js";import{launchdLabel as G,serviceCommandsForConfig as _,serviceName as j}from"./service.js";import{legacyLaunchdLabel as B,legacyServiceName as q}from"./identity.js";import{legacyCodingAgentPaths as S}from"./paths.js";import{runCommand as u}from"./exec.js";import{AutoUpgradeScheduler as U}from"./auto-upgrade.js";import{migrateLegacyClient as H}from"./migration.js";import{scheduleMigrationHandoff as K,shouldAttemptAutomaticMigration as Y}from"./install.js";import{isAgentActivityResponse as V}from"@messenger-agent/shared/agent-activity";const g=M(import.meta.url);function W(){return[{name:"codex",entry:g.resolve("@messenger-agent/codex-agent")},{name:"claude",entry:g.resolve("@messenger-agent/claude-agent")},{name:"workspace",entry:g.resolve("@messenger-agent/messenger-agent")}]}function X(a,t){let e=a;for(const r of t){if(!e||typeof e!="object"||Array.isArray(e))return;e=e[r]}return e}async function z(a){const t=k(await C(a,"utf8")),e=X(t,["workspaces"]);if(Array.isArray(e)){const r=e.find(s=>!!s&&typeof s=="object"&&!Array.isArray(s)&&typeof s.path=="string");if(typeof r?.path=="string"&&r.path.trim())return r.path}return h(a)}class J{options;stopping=!1;running;restartBaseMs;restartMaxMs;constructor(t){this.options=t,this.running=(t.agents??W()).map(e=>({definition:e,restartAttempts:0})),this.restartBaseMs=t.restartBaseMs??1e3,this.restartMaxMs=t.restartMaxMs??3e4}start(){for(const t of this.running)this.startAgent(t)}async stop(){this.stopping=!0;for(const t of this.running)t.restartTimer&&clearTimeout(t.restartTimer),t.process?.kill("SIGTERM");await Promise.all(this.running.map(t=>t.process).filter(t=>!!t&&t.exitCode===null&&!t.killed).map(t=>new Promise(e=>{const r=setTimeout(()=>{t.kill("SIGKILL"),e()},8e3);t.once("exit",()=>{clearTimeout(r),e()})})))}restartAgent(t){const e=this.running.find(({definition:r})=>r.name===t);return e?(e.restartPromise||(e.restartPromise=this.restartAgentProcess(e).finally(()=>{e.restartPromise=void 0})),e.restartPromise):Promise.reject(new Error(`Agent is not managed by this client: ${t}`))}async activityStatus(t=1e3){const[e,r]=await Promise.all([this.agentActivityStatus("codex",t),this.agentActivityStatus("claude",t)]),s=[e,r].filter(i=>i.available);return{active:s.reduce((i,n)=>i+n.active,0),waiting:s.reduce((i,n)=>i+n.waiting,0),agents:{codex:e,claude:r}}}agentActivityStatus(t,e){const r=this.running.find(({definition:s})=>s.name===t)?.process;return!r||!r.connected||!r.send?Promise.resolve({available:!1,error:`${t} agent is not connected`}):new Promise(s=>{const i=b(),n={type:"client.activity.request",requestId:i};let c=!1;const l=o=>{c||(c=!0,clearTimeout(T),r.off("message",m),s(o))},m=o=>{!V(o)||o.requestId!==i||o.agent!==t||l({available:!0,...o.snapshot})},T=setTimeout(()=>l({available:!1,error:`${t} agent did not respond`}),e);r.on("message",m),r.send(n,o=>{o&&l({available:!1,error:o.message})})})}async restartAgentProcess(t){t.restartTimer&&(clearTimeout(t.restartTimer),t.restartTimer=void 0);const e=t.process;if(e&&e.exitCode===null&&!e.killed&&(e.kill("SIGTERM"),await et(e)),this.stopping)throw new Error("Client service is stopping");t.restartAttempts=0,this.startAgent(t)}startAgent(t){const e={...process.env,AGENT_CONFIG_PATH:this.options.configPath};t.definition.name==="workspace"&&(delete e.OPENAI_API_KEY,delete e.CODEX_API_KEY,delete e.ANTHROPIC_API_KEY);const r=(this.options.spawnProcess??x)(process.execPath,[t.definition.entry],{cwd:this.options.workspacePath,env:e,stdio:["inherit","inherit","inherit","ipc"]});t.process=r,t.definition.name==="workspace"&&r.on("message",s=>{s&&typeof s=="object"&&"type"in s&&s.type==="client.workspaces.changed"&&Promise.all([this.restartAgent("codex"),this.restartAgent("claude")]).catch(i=>{console.error("[client] failed to reload agents after workspace configuration changed",i)})}),console.log(`[client] started ${t.definition.name}-agent pid=${r.pid}`),r.once("exit",(s,i)=>{if(t.process=void 0,this.stopping||t.restartPromise)return;const n=Math.min(this.restartBaseMs*2**t.restartAttempts,this.restartMaxMs);t.restartAttempts+=1,console.error(`[client] ${t.definition.name}-agent exited with code=${s??"null"} signal=${i??"null"}; restarting in ${n}ms`),t.restartTimer=setTimeout(()=>{t.restartTimer=void 0,this.startAgent(t)},n)})}}async function At(a){if(await Q(a))return;await D(F(),R());const t=await z(a),e=new J({configPath:a,workspacePath:t}),r=await $(a),s=new N({statePath:f(h(r),"maintenance.json"),getActivity:()=>e.activityStatus(),execute:(l,m)=>Z(l,a,e,m)});await s.start();const i=new U({statePath:f(h(r),"auto-upgrade.json"),maintenance:s,getChannel:()=>E(a)});await i.start();const n=await L(r,{restartAgent:l=>e.restartAgent(l),getActivity:()=>e.activityStatus(),maintenance:s});e.start();const c=async()=>{i.stop(),s.stop(),await n.close(),await e.stop(),process.exit(0)};process.once("SIGINT",()=>{c()}),process.once("SIGTERM",()=>{c()})}async function Q(a,t={}){const e=S();if(w(a)!==w(e.configPath))return!1;const r=await(t.currentVersion??O)();if(!await(t.shouldAttempt??Y)(e.rootDir,r))return!1;let s;try{const i=await(t.migrate??H)();if(!i.migrated)return!1;const n=await(t.readPath??v)(i.paths.configPath);return s=await(t.install??A)({version:r,configPath:i.paths.configPath,runtimeDir:i.paths.runtimeDir,binDir:i.paths.binDir,path:n}),await(t.handoff??K)(i,s,i.paths.configPath,n),!0}catch(i){return s&&await(t.rollback??P)(s).catch(()=>{}),console.error(`[client] automatic legacy migration failed: ${i instanceof Error?i.message:String(i)}`),!1}}async function Z(a,t,e,r){if(a.type==="upgrade"){a.path&&await I(t,a.path);const s=await A({version:a.version,configPath:t,path:a.path??await v(t)});await r("restarting");try{await d(p(t).restart)}catch(i){throw await P(s),await d(p(t).restart).catch(()=>{}),i}return}if(a.type==="restart"&&a.agent){await e.restartAgent(a.agent);return}if(a.type==="restart"){await r("restarting"),await d(p(t).restart);return}if(a.type==="stop"){await r("stopping"),await d(p(t).stop);return}await r("stopping"),await tt(t)}function p(a){return _(a)}async function d(a){const t=await u("/bin/sh",["-lc",a],{allowFailure:!0});if(t.status!==0)throw new Error(t.stderr||t.stdout||`Service command failed: ${a}`)}async function tt(a){const t=process.env.HOME??"",e=a===S().configPath,r=e?q:j,s=e?B:G;if(process.platform==="linux"){await u("systemctl",["--user","disable",`${r}.service`],{allowFailure:!0}),await y(f(t,".config","systemd","user",`${r}.service`)).catch(i=>{if(i.code!=="ENOENT")throw i}),await u("systemctl",["--user","daemon-reload"],{allowFailure:!0}),await u("systemctl",["--user","stop",`${r}.service`],{allowFailure:!0});return}if(process.platform==="darwin"){const i=process.getuid?.();if(i===void 0)throw new Error("Unable to determine current uid for launchctl");const n=f(t,"Library","LaunchAgents",`${s}.plist`);await y(n).catch(c=>{if(c.code!=="ENOENT")throw c}),await u("launchctl",["bootout",`gui/${i}/${s}`],{allowFailure:!0});return}throw new Error("Only Linux and macOS are supported")}function et(a){return new Promise(t=>{const e=setTimeout(()=>{a.kill("SIGKILL")},8e3);a.once("exit",()=>{clearTimeout(e),t()})})}export{J as AgentSupervisor,Q as migrateLegacyServiceAtStartup,z as readWorkspacePathFromConfig,W as resolveAgentEntries,At as runSupervisor};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@messenger-agent/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
+
"messenger-agent": "./dist/index.js",
|
|
8
9
|
"coding-agent": "./dist/index.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
@@ -20,10 +21,10 @@
|
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"cac": "^7.0.0",
|
|
22
23
|
"yaml": "^2.9.0",
|
|
23
|
-
"@messenger-agent/
|
|
24
|
-
"@messenger-agent/
|
|
25
|
-
"@messenger-agent/
|
|
26
|
-
"@messenger-agent/
|
|
24
|
+
"@messenger-agent/claude-agent": "0.33.0-alpha.10",
|
|
25
|
+
"@messenger-agent/messenger-agent": "0.33.0-alpha.10",
|
|
26
|
+
"@messenger-agent/shared": "0.33.0-alpha.10",
|
|
27
|
+
"@messenger-agent/codex-agent": "0.33.0-alpha.10"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "rm -rf dist && tsc -p tsconfig.json && node ../../scripts/copy-client-assets.mjs && chmod +x dist/index.js",
|