@balababa/codex-mesh 0.5.0 → 0.5.1

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/README.md CHANGED
@@ -35,7 +35,7 @@ Codex Mesh 不是一种新的 Agent,而是给原本独立的 Codex Agent 加
35
35
  docker compose up -d --build
36
36
 
37
37
  # 客户端:每台已装 Codex 的机器
38
- npm install -g @balababa/codex-mesh@0.5.0
38
+ npm install -g @balababa/codex-mesh@0.5.1
39
39
  codex-mesh setup
40
40
  codex-mesh doctor
41
41
  codex
@@ -56,7 +56,7 @@ codex
56
56
  ### 1. 安装
57
57
 
58
58
  ```sh
59
- npm install -g @balababa/codex-mesh@0.5.0
59
+ npm install -g @balababa/codex-mesh@0.5.1
60
60
  ```
61
61
 
62
62
  包内含预编译 Rust 二进制、启动器和 Skill。npm 包名是 `@balababa/codex-mesh`,命令是 `codex-mesh`。
@@ -78,6 +78,8 @@ codex-mesh setup
78
78
 
79
79
  管理 Token **不会**保存到本机,浏览器授权只是签发本机自己的节点凭据。授权链接 10 分钟有效;中断后重跑 setup 可续接。
80
80
 
81
+ 如果已有节点 Token 被当前 Hub 返回 401,setup 会询问是否重新授权;输入 `y` 或 `yes` 才继续,直接回车会保留旧 Token。显式指定 Token 文件、非交互模式、网络错误和版本不匹配不会触发该提示。
82
+
81
83
  ### 3. 自检
82
84
 
83
85
  ```sh
@@ -163,7 +165,7 @@ Hub 是**纯基础设施**:不需要安装 Codex、不需要登录模型、不
163
165
 
164
166
  ### 方式一:Docker Compose(推荐)
165
167
 
166
- Docker 配置随 GitHub 源码 Release 分发,不包含在 npm 运行包内。先下载或克隆与客户端相同的 `v0.5.0` 源码标签,再执行以下命令。
168
+ Docker 配置随 GitHub 源码 Release 分发,不包含在 npm 运行包内。先下载或克隆与客户端相同的 `v0.5.1` 源码标签,再执行以下命令。
167
169
 
168
170
  Hub 强制只监听 loopback。容器方案让 Hub 监听容器内 `127.0.0.1:9010`,由共享网络命名空间的 Caddy 终止 TLS 并对外提供 80/443。**Hub 的 9010 端口不发布到宿主机。**
169
171
 
package/docs/INSTALL.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # npm installation and ordinary Codex setup
2
2
 
3
- Source release version: **0.5.0** (npm, Rust binary and Skill metadata).
3
+ Source release version: **0.5.1** (npm, Rust binary and Skill metadata).
4
4
 
5
5
  The npm package name is **`@balababa/codex-mesh`**, using the maintainer's
6
6
  personal scope. The operator selected this name after the prior organization
7
7
  scope failed publication with `Scope not found`. The command remains `codex-mesh`.
8
- Version 0.5.0 is published to npm and the matching Linux x86_64 GNU Hub binary
9
- is attached to GitHub Release v0.5.0 (verified on 2026-12-05). Upgrade the Hub
10
- deliberately before connecting 0.5.0 nodes.
8
+ Version 0.5.1 is published to npm and the matching Linux x86_64 GNU Hub binary
9
+ is attached to GitHub Release v0.5.1 (verified on 2026-12-06). Upgrade the Hub
10
+ deliberately before connecting 0.5.1 nodes.
11
11
  The unrelated unscoped `codex-mesh` package is not this implementation.
12
12
 
13
13
  ## Supported runtime
@@ -23,12 +23,12 @@ acceptance target. The daemon must already be running and normally authenticated
23
23
  Install the published release:
24
24
 
25
25
  ```sh
26
- npm install -g @balababa/codex-mesh@0.5.0
26
+ npm install -g @balababa/codex-mesh@0.5.1
27
27
  codex-mesh setup
28
28
  codex-mesh doctor
29
29
  ```
30
30
 
31
- The x86_64 Hub binary is available from GitHub Release `v0.5.0`; verify it with
31
+ The x86_64 Hub binary is available from GitHub Release `v0.5.1`; verify it with
32
32
  the attached `.sha256` file before installing it on the server.
33
33
 
34
34
  Installation itself has no lifecycle hook, never joins a session and never
@@ -105,10 +105,19 @@ local setup check fails. Timeout, denial or missing permission produces an error
105
105
  not a successful installation. Doctor points to incomplete onboarding. For a hard
106
106
  process termination, follow the stale setup-lock instructions below before retry.
107
107
 
108
- Existing saved node credentials are reused. Explicit `--node-token-file` uses the
109
- file workflow. Non-interactive setup without saved/file credentials fails with
110
- instructions rather than waiting for browser input. A Hub without browser
111
- authorization support must be upgraded, or use the file workflow.
108
+ Existing saved node credentials are reused and checked against the selected Hub.
109
+ If the default saved credential receives HTTP 401, interactive setup asks before
110
+ starting browser reauthorization (`y`/`yes`; the default is no). Declining keeps
111
+ the old Token unchanged. Explicit token files and non-interactive setup still fail
112
+ without prompting; network errors, unsafe files and Hub/package version mismatches
113
+ do not trigger reauthorization. A replacement Token is written atomically only
114
+ after its authenticated admission succeeds. Its authenticated Node UUID becomes
115
+ the saved identity; an explicit mismatched `--node-id` remains an error.
116
+
117
+ Explicit `--node-token-file` uses the file workflow. Non-interactive setup without
118
+ saved/file credentials fails with instructions rather than waiting for browser
119
+ input. A Hub without browser authorization support must be upgraded, or use the
120
+ file workflow.
112
121
 
113
122
  Setup uses the existing ordinary Codex and discovers its owning daemon; it does
114
123
  not start, replace or restart Codex. If another independently owned server is
@@ -160,7 +169,7 @@ replies use notify to avoid wake loops.
160
169
  The same package provides every Rust subcommand, including stdio MCP:
161
170
 
162
171
  ```sh
163
- npx --yes --package=/absolute/path/balababa-codex-mesh-0.5.0.tgz \
172
+ npx --yes --package=/absolute/path/balababa-codex-mesh-0.5.1.tgz \
164
173
  codex-mesh mcp --socket /absolute/private/mesh-runtime/mcp.sock
165
174
  ```
166
175
 
@@ -56,6 +56,9 @@ async function request(hub,endpoint,token,body) {
56
56
  if(response.status<200||response.status>=300) {const error=new Error(`Hub authentication/connectivity failed (HTTP ${response.status}); check tunnel, Hub and credential role`);error.status=response.status;throw error;}
57
57
  const result=JSON.parse(response.text);if(result.error) throw new Error('Hub rejected operation; check credential role/grants');return result;
58
58
  }
59
+ export function shouldOfferReauthorization(error,o) {
60
+ return error.status===401&&!o.nonInteractive&&!o.tokenFile;
61
+ }
59
62
  function command(program,args,options={}) {
60
63
  const r=spawnSync(program,args,{encoding:'utf8',timeout:15000,...options});
61
64
  if(r.error || r.status!==0) throw new Error(`Command failed: ${path.basename(program)} ${args.slice(0,2).join(' ')}; check program/service configuration`);
@@ -193,17 +196,30 @@ async function setup(o,context) {
193
196
  const tokenFile=path.resolve(o.tokenFile||path.join(root,'node.token'));
194
197
  const validateGrant=grant=>{if(grant.protocol_version!==1 || grant.version!==context.version)throw new Error(`Hub ${grant.version} is not compatible with package ${context.version}; upgrade the Hub deliberately first`);};
195
198
  let token,grant;
196
- if(!o.tokenFile&&((!o.nonInteractive&&pendingEnrollment(root))||!fs.existsSync(tokenFile))) {
199
+ const authorize=async()=>{
197
200
  if(o.nonInteractive)throw new Error('Non-interactive setup requires --node-token-file FILE or a saved credential. Run interactive setup to authorize this machine in a browser.');
198
201
  const controller=new AbortController();const interrupt=()=>controller.abort();process.on('SIGINT',interrupt);
199
202
  try {({token,grant}=await browserEnrollment({root,hub,nodeName:o.nodeName,version:context.version,request,validateGrant,signal:controller.signal}));}
200
203
  finally {process.removeListener('SIGINT',interrupt);}
201
- } else {token=readToken(tokenFile);grant=await request(hub,'/v1/node/check',token);validateGrant(grant);}
204
+ };
205
+ if(!o.tokenFile&&((!o.nonInteractive&&pendingEnrollment(root))||!fs.existsSync(tokenFile))) await authorize();
206
+ else {
207
+ token=readToken(tokenFile);
208
+ try {grant=await request(hub,'/v1/node/check',token);validateGrant(grant);}
209
+ catch(error) {
210
+ if(!shouldOfferReauthorization(error,o))throw error;
211
+ const rl=createInterface({input:process.stdin,output:process.stdout});
212
+ let answer;
213
+ try{answer=await rl.question('Saved node token was rejected by this Hub (HTTP 401). Reauthorize this machine in the browser? [y/N]: ');}finally{rl.close();}
214
+ if(!/^y(es)?$/i.test(answer.trim()))throw new Error('Saved node token was left unchanged; rerun setup and accept browser reauthorization, or explicitly use --node-token-file FILE.');
215
+ await authorize();
216
+ }
217
+ }
202
218
  if(!o.nonInteractive&&!o.allowDirs.length) {
203
219
  const rl=createInterface({input:process.stdin,output:process.stdout});
204
220
  try {const dir=await rl.question(`Allowed project directory [${old?.allowed?.join(', ')||os.homedir()}]: `);o.allowDirs=dir?[dir]:(old?.allowed||[os.homedir()]);}finally{rl.close();}
205
221
  }
206
- const nodeId=o.nodeId||old?.nodeId||grant.node_id;
222
+ const nodeId=o.nodeId||grant.node_id;
207
223
  if(nodeId!==grant.node_id)throw new Error('Node UUID does not match this node credential (management tokens cannot join)');
208
224
  const codex=absoluteProgram(o.codex||old?.codex||'codex');
209
225
  const skipDaemonVersionCheck=daemonVersionPolicy(o,old||{});
@@ -274,7 +290,7 @@ export function savedAgentArgs(args) {
274
290
  }
275
291
  export async function main(args,context) {
276
292
  const [action,...rest]=args;const o=options(rest);
277
- if(o.help){console.log(`codex-mesh ${action}\nsetup [--non-interactive] --hub URL [--node-token-file FILE] [--node-id UUID] [--allow-dir DIR...]\n [--node-name NAME] [--codex PATH] [--daemon-socket PATH] [--service systemd|process]\n [--skills-dir DIR] [--admin-token-file FILE]\n [--skip-daemon-version-check | --check-daemon-version]\nsetup --manager [--non-interactive] --hub URL --admin-token-file FILE\ndoctor [--json]\nFirst interactive setup asks for a node display name (default: hostname), then prints a browser authorization link; use your existing authorized management token in the browser.\nScripted setup requires a saved credential or --node-token-file FILE; --node-name defaults to the hostname; never pass token values. CODEX_MESH_HOME isolates Mesh state.\nAllowed directories default to your home directory on first setup; saved directories and explicit --allow-dir take precedence.\nDefault systemd user service survives terminals; process backend is explicitly opt-in and needs setup after reboot.\nDaemon version policy is saved; skip only bypasses version gating, never socket security or runtime checks.\nUpgrade: install new npm version, leave Mesh sessions, rerun setup; no install hooks restart services.`);return;}
293
+ if(o.help){console.log(`codex-mesh ${action}\nsetup [--non-interactive] --hub URL [--node-token-file FILE] [--node-id UUID] [--allow-dir DIR...]\n [--node-name NAME] [--codex PATH] [--daemon-socket PATH] [--service systemd|process]\n [--skills-dir DIR] [--admin-token-file FILE]\n [--skip-daemon-version-check | --check-daemon-version]\nsetup --manager [--non-interactive] --hub URL --admin-token-file FILE\ndoctor [--json]\nFirst interactive setup asks for a node display name (default: hostname), then prints a browser authorization link; use your existing authorized management token in the browser. If the saved node token receives HTTP 401, interactive setup offers browser reauthorization; declining preserves the old token.\nScripted setup requires a saved credential or --node-token-file FILE; --node-name defaults to the hostname; never pass token values. CODEX_MESH_HOME isolates Mesh state.\nAllowed directories default to your home directory on first setup; saved directories and explicit --allow-dir take precedence.\nDefault systemd user service survives terminals; process backend is explicitly opt-in and needs setup after reboot.\nDaemon version policy is saved; skip only bypasses version gating, never socket security or runtime checks.\nUpgrade: install new npm version, leave Mesh sessions, rerun setup; no install hooks restart services.`);return;}
278
294
  if(action==='setup')return setup(o,context);
279
295
  const root=home();const file=path.join(root,'installation.json');let checks;
280
296
  if(fs.existsSync(file)){try{checks=await inspect(json(file),context);}catch{checks=[{name:'configuration',ok:false,fix:'Saved installation configuration is incomplete/invalid; rerun setup with explicit options after preserving its private runtime state.'}];}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balababa/codex-mesh",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Session-native Mesh Hub, ordinary Codex MCP/Skill and Agent management",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
Binary file
package/release.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.5.0",
2
+ "version": "0.5.1",
3
3
  "protocolVersion": 1,
4
4
  "platforms": {
5
5
  "linux-x64-gnu": {
6
6
  "path": "platforms/linux-x64-gnu/codex-mesh",
7
- "sha256": "0489134f5f8f9b21875a35c635564a303ca5c70c1a84077d14a856febdde0431",
7
+ "sha256": "4cb6a9456342720ef4200a06a20ed2525ee5eeab996797e85de643d7ee01cb28",
8
8
  "nodeMinimum": "24.19.0",
9
9
  "glibcMinimum": "2.35"
10
10
  }
@@ -2,7 +2,7 @@
2
2
  name: codex-mesh
3
3
  description: Connect ordinary Codex to Codex Mesh (集群/机器/Agent 通信). Use when the user wants to join or leave Mesh, discover enrolled agents or machines, send a peer message, or read Mesh replies. Mesh MCP supplies the actions; this skill explains the workflow.
4
4
  metadata:
5
- version: "0.5.0"
5
+ version: "0.5.1"
6
6
  ---
7
7
 
8
8
  # Codex Mesh
@@ -1,4 +1,4 @@
1
- # Host setup for packaged Mesh 0.5.0
1
+ # Host setup for packaged Mesh 0.5.1
2
2
 
3
3
  The Skill supplies instructions; MCP performs actions; a persistent local Node
4
4
  receives messages and wakes explicitly enrolled native sessions. Installing or
@@ -11,7 +11,9 @@ provided per-node token file for scripts), and allowed project directories.
11
11
  The CLI prints a link and confirmation code; the human approves on a trusted
12
12
  browser and the CLI saves independent node credentials automatically. Never ask
13
13
  for a management Token through model tools or store it in a project.
14
- Machine authorization does not enroll this Codex session.
14
+ Machine authorization does not enroll this Codex session. If an existing saved
15
+ Node Token receives HTTP 401, interactive setup asks before browser reauthorization;
16
+ declining preserves it. Explicit/non-interactive credential failures never prompt.
15
17
 
16
18
  ```sh
17
19
  codex-mesh setup --non-interactive --hub http://127.0.0.1:19010 \
@@ -30,7 +32,7 @@ supported reload or a new session. Do not call mesh_join merely to diagnose an
30
32
  installation. Doctor checks readiness without inference or enrollment.
31
33
 
32
34
  For an npm/npx MCP entry, first complete host setup, then use the exact authorized
33
- package version with `npx --yes --package=<package>@0.5.0 codex-mesh mcp --socket
35
+ package version with `npx --yes --package=<package>@0.5.1 codex-mesh mcp --socket
34
36
  /private/mesh/mcp.sock`. The Node remains in stable managed storage. The package
35
37
  name is `@balababa/codex-mesh` under the maintainer personal scope; registry
36
38
  installation requires publication of that version. Do not install the unrelated unscoped `codex-mesh` package.