@mmmbuto/nexuscrew 0.8.12 → 0.8.13

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.
@@ -7,6 +7,7 @@ const path = require('node:path');
7
7
  const { execFileSync } = require('node:child_process');
8
8
  const {
9
9
  PACKAGE_NAME, parseVersion, scrubError, pidAlive, adoptUpdateLock, releaseUpdateLock, readState, writeState,
10
+ stableRuntimeDir,
10
11
  } = require('./core.js');
11
12
 
12
13
  function args(argv) {
@@ -69,6 +70,7 @@ async function runUpdate(opts = {}) {
69
70
  if (!parseVersion(version)) throw new Error('versione update non valida');
70
71
  const home = opts.home || os.homedir();
71
72
  const statusPath = opts.statusPath || path.join(home, '.nexuscrew', 'npm-update.json');
73
+ const workDir = opts.cwd || stableRuntimeDir(home);
72
74
  const execImpl = opts.execImpl || execFileSync;
73
75
  const readInstalledVersion = opts.readInstalledVersion || (() => {
74
76
  const p = path.resolve(__dirname, '..', '..', 'package.json');
@@ -76,7 +78,9 @@ async function runUpdate(opts = {}) {
76
78
  });
77
79
  const preflightImpl = opts.preflightImpl || (({ version: expectedVersion = version } = {}) => {
78
80
  const bin = path.resolve(__dirname, '..', '..', 'bin', 'nexuscrew.js');
79
- const output = execFileSync(process.execPath, [bin, 'version'], { encoding: 'utf8', timeout: 20_000, stdio: ['ignore', 'pipe', 'pipe'] });
81
+ const output = execFileSync(process.execPath, [bin, 'version'], {
82
+ encoding: 'utf8', timeout: 20_000, stdio: ['ignore', 'pipe', 'pipe'], cwd: workDir,
83
+ });
80
84
  if (String(output || '').trim() !== expectedVersion) throw new Error(`preflight CLI fallito: attesa ${expectedVersion}`);
81
85
  return true;
82
86
  });
@@ -96,7 +100,7 @@ async function runUpdate(opts = {}) {
96
100
  try {
97
101
  writeState(statusPath, { ...previous, phase: 'installing', targetVersion: version, updaterPid: process.pid, lastError: '' });
98
102
  execImpl('npm', ['install', '--global', `${PACKAGE_NAME}@${version}`, '--no-audit', '--no-fund'], {
99
- stdio: 'inherit', timeout: 5 * 60 * 1000,
103
+ stdio: 'inherit', timeout: 5 * 60 * 1000, cwd: workDir,
100
104
  });
101
105
  const installed = String(readInstalledVersion() || '');
102
106
  if (installed !== version) throw new Error(`verifica installazione fallita: attesa ${version}, trovata ${installed || 'sconosciuta'}`);
@@ -114,7 +118,7 @@ async function runUpdate(opts = {}) {
114
118
  if (installedNew && parseVersion(previousVersion) && previousVersion !== version) {
115
119
  try {
116
120
  execImpl('npm', ['install', '--global', `${PACKAGE_NAME}@${previousVersion}`, '--no-audit', '--no-fund'], {
117
- stdio: 'inherit', timeout: 5 * 60 * 1000,
121
+ stdio: 'inherit', timeout: 5 * 60 * 1000, cwd: workDir,
118
122
  });
119
123
  if (String(readInstalledVersion() || '') !== previousVersion) throw new Error(`rollback verify: attesa ${previousVersion}`);
120
124
  await preflightImpl({ version: previousVersion, home, rollback: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/nexuscrew",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "description": "Faithful browser tmux client — attach to live sessions over a real PTY, localhost-only, mobile-easy",
5
5
  "main": "lib/server.js",
6
6
  "bin": {
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: nexuscrew-agent
3
- description: Use when an AI agent connected to NexusCrew must notify or ask the human, inspect NexusCrew session/fleet status or its own deck membership, read its inbox, deliver a file (report, screenshot, export), send text/input to a tmux session, or recover from tmux send-keys messages that remain unsubmitted or arrive garbled. Prefer the NexusCrew MCP tools nc_notify, nc_ask, nc_status, nc_deck, nc_inbox, and nc_send_file when exposed; use the bundled tmux/file helpers as fallback.
3
+ description: Use when an AI agent connected to NexusCrew must notify or ask the human, inspect runtime or deck context, list authorized Fleet cells, message an exact active cell, read its inbox, deliver a file, or recover from local tmux messages that remain unsubmitted or garbled. Prefer nc_notify, nc_ask, nc_status, nc_deck, nc_cells, nc_send_cell, nc_inbox, and nc_send_file; use bundled tmux/file helpers only as a declared compatibility fallback.
4
4
  ---
5
5
 
6
6
  # NexusCrew Agent I/O
7
7
 
8
- Use the [NexusCrew](https://github.com/DioNanos/nexuscrew) MCP bridge for communication with the human and read-only runtime status. Use the bundled helpers for direct tmux messaging or as a compatibility fallback.
8
+ Use the [NexusCrew](https://github.com/DioNanos/nexuscrew) MCP bridge for communication with the human, read-only runtime discovery, and authenticated delivery to active Fleet cells. Use the bundled helpers only for same-host tmux compatibility fallbacks.
9
9
 
10
10
  ## MCP bridge (preferred)
11
11
 
@@ -17,6 +17,8 @@ When the client exposes the NexusCrew MCP server, use these tools directly:
17
17
  | Ask for a decision without blocking the agent | `nc_ask` |
18
18
  | Inspect live tmux sessions and fleet cells | `nc_status` |
19
19
  | Read the caller's deck name(s) and member cells/tmux sessions | `nc_deck` |
20
+ | List every authorized owner-qualified Fleet cell | `nc_cells` |
21
+ | Submit a bounded message to an exact active Fleet cell | `nc_send_cell` |
20
22
  | List files received for the current session | `nc_inbox` |
21
23
  | Deliver an absolute file path under the user's home | `nc_send_file` |
22
24
 
@@ -26,7 +28,8 @@ Apply these rules:
26
28
  - Never include access tokens, credentials, private keys, push subscriptions, or other secrets in a notification, ask, file caption, or tool result.
27
29
  - Treat `nc_ask` as non-blocking: it returns an ask ID immediately. Continue safe independent work or wait normally; the human response arrives in the originating tmux session with a `[human reply · ask#<id>]` prefix by default.
28
30
  - Use `nc_status` instead of scraping NexusCrew state files. Use `nc_deck` instead of reading `decks.json`: it returns every local or authorized shared-owner deck containing the caller, preserves visual member order, identifies each deck and member by stable owner ID, includes viewer-valid Hydra routes, and reports `cell: null` when no managed Fleet match is available.
29
- - Treat `nc_deck` as discovery, not authorization to contact every member. Use the verified tmux-messaging flow below for actual delivery and confirm submission visually.
31
+ - Use `nc_cells` immediately before cross-cell delivery. Select its exact owner-qualified `id`; require `canReceive: true`; never guess a duplicate name or stale route.
32
+ - Use `nc_send_cell {target, message}` for actual Fleet-cell delivery. `submitted` confirms bracketed paste plus Enter only, never task acceptance or completion. Inactive targets are not queued.
30
33
  - Use `nc_inbox` instead of guessing an inbox path when the tool is available.
31
34
  - Pass `nc_send_file` an existing absolute regular-file path below the user's home. Let NexusCrew choose and sanitize the outbox name.
32
35
  - Do not treat an MCP notification as a substitute for the final response required by the active client.
@@ -50,6 +53,10 @@ Don't hand-craft the path from a guessed session name — use `nc-deliver`, or d
50
53
 
51
54
  ## Sending text to a tmux session
52
55
 
56
+ For an active managed Fleet cell, prefer `nc_cells` followed by `nc_send_cell`.
57
+ The helper below is a same-host fallback for older NexusCrew runtimes or
58
+ non-Fleet sessions; it must not bypass federation visibility or routing ACLs.
59
+
53
60
  `tmux send-keys 'msg' Enter` is **not** reliable: a TUI's paste-burst detector swallows the Enter and the message just sits in the composer, while exit code is still 0. Use the helper:
54
61
 
55
62
  ```bash
@@ -72,6 +79,8 @@ tmux capture-pane -t <session> -p | tail -8 # see the text / a running state
72
79
  | Ask the human without blocking | `nc_ask` |
73
80
  | Inspect NexusCrew runtime state | `nc_status` |
74
81
  | Discover this session's deck neighbours | `nc_deck` |
82
+ | Discover authorized cells across nodes | `nc_cells` |
83
+ | Submit to an exact active Fleet cell | `nc_send_cell` |
75
84
  | Give the human a file | `nc_send_file` or fallback `nc-deliver <file>...` |
76
85
  | Read a file the human sent | `nc_inbox` or fallback to the path in the prompt |
77
86
  | Send a prompt/command to a session | `nc-send <session> "text"` |
@@ -85,3 +94,5 @@ tmux capture-pane -t <session> -p | tail -8 # see the text / a running state
85
94
  - **`tmux` aliased/wrapped by the shell** (e.g. an oh-my-zsh plugin) → the nudge silently fails. Helpers resolve the real binary; in ad-hoc commands use `/usr/bin/tmux` or `command tmux`.
86
95
  - **Pasting onto a dirty composer** → text concatenates with whatever was there. Clear it first, or the previous line will merge with yours.
87
96
  - **Delivering to a guessed session name** → file lands in an orphan folder with no badge. Use `nc-deliver` (it reads the real session).
97
+ - **Sending to an ambiguous cell name** → call `nc_cells` and use the full owner-qualified ID.
98
+ - **Calling `submitted` a completed task** → it is only a transport receipt; require an explicit result callback.