@mmmbuto/nexuscrew 0.9.60 → 0.9.62

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.
@@ -11,7 +11,7 @@
11
11
  <meta name="apple-mobile-web-app-title" content="NexusCrew" />
12
12
  <link rel="manifest" href="/manifest.json" />
13
13
  <title>NexusCrew</title>
14
- <script type="module" crossorigin src="/assets/index-D42BJVwr.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-Cq8wINIe.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-fCIoVxeq.css">
16
16
  </head>
17
17
  <body>
@@ -1 +1 @@
1
- {"version":"0.9.60"}
1
+ {"version":"0.9.62"}
@@ -30,7 +30,7 @@ const fs = require('node:fs');
30
30
  const os = require('node:os');
31
31
  const path = require('node:path');
32
32
  const {
33
- loadDefinitions, atomicWrite, CAPS, MAX_CELLS, validTmuxName, validateCommandTrust,
33
+ loadDefinitions, atomicWrite, CAPS, MAX_CELLS, validTmuxName, validateCommandTrust, defaultDefinitionsPath,
34
34
  aggiornaDefinizioni,
35
35
  cellIdFromTmuxSession,
36
36
  resolveCwd, normalizeCwdRel, deriveCwdRel,
@@ -611,7 +611,7 @@ async function createBuiltinFleet(cfg = {}) {
611
611
  if (cfg.builtinEnabled === false) return off;
612
612
 
613
613
  const home = cfg.home || os.homedir();
614
- const defsPath = cfg.fleetDefsPath || path.join(home, '.nexuscrew', 'fleet.json');
614
+ const defsPath = defaultDefinitionsPath(cfg);
615
615
  const tmuxBin = cfg.tmuxBin || process.env.TMUX_BIN || 'tmux';
616
616
  const readonly = () => (cfg.readonlyDefault === true || process.env.NEXUSCREW_READONLY === '1');
617
617
  // Lease opt-in: attivo solo quando cfg.cellLeaseEnabled === true. server.js lo
@@ -10,12 +10,21 @@
10
10
  // lib/fs/routes.js and lib/tmux/lifecycle.js.
11
11
  const fs = require('node:fs');
12
12
  const path = require('node:path');
13
+ const os = require('node:os');
13
14
  const crypto = require('node:crypto');
14
15
  const { normalizeManagedSpec } = require('./managed.js');
15
16
 
16
17
  // --- Cap + identita' (dichiarati; 100 regge una flotta reale con margine;
17
18
  // il limite resta deliberato contro un file patologico) ---
18
19
  const SCHEMA_VERSION = 1;
20
+
21
+ // Un cfg.home assente e' la NORMA delle installazioni reali (bin/nexuscrew
22
+ // serve non passa home): il default segue os.homedir(), esattamente come
23
+ // ogni altro path del server (server.js) e come il runtime Fleet.
24
+ function defaultDefinitionsPath(cfg = {}) {
25
+ const home = (cfg && cfg.home) || os.homedir();
26
+ return cfg.fleetDefsPath || path.join(home, '.nexuscrew', 'fleet.json');
27
+ }
19
28
  const MAX_ENGINES = 100;
20
29
  const MAX_CELLS = 32;
21
30
  const MAX_ARGS = 32; // argv: array, mai stringa spezzata (no shell)
@@ -1198,6 +1207,12 @@ const CAPS = {
1198
1207
  };
1199
1208
 
1200
1209
  module.exports = {
1210
+ // Il default canonico del path di fleet.json: UNA ricetta sola per il
1211
+ // runtime Fleet (builtin.js) e per ogni lettore delle definizioni (owner
1212
+ // ASK scope incluso). Come tutto il resto del server, un cfg.home assente
1213
+ // cade su os.homedir(): due ricette divergenti qui hanno prodotto il
1214
+ // crash all'avvio delle installazioni senza home esplicita.
1215
+ defaultDefinitionsPath,
1201
1216
  parseDefinitions,
1202
1217
  effectiveCapabilities,
1203
1218
  parseCapabilitySet,
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
- const path = require('node:path');
3
- const { loadDefinitions, cellIdFromTmuxSession } = require('../fleet/definitions.js');
2
+ const { loadDefinitions, cellIdFromTmuxSession, defaultDefinitionsPath } = require('../fleet/definitions.js');
4
3
 
5
4
  // The owner resolves local definitions, never a cell id supplied by a peer.
6
5
  // Activity and tmux polling do not participate in ASK authorization.
@@ -14,7 +13,7 @@ function resolveOwnerSession(session, cells) {
14
13
 
15
14
  function createOwnerAskScope(cfg) {
16
15
  const enabled = cfg.fleetEnabled !== false && cfg.builtinEnabled !== false;
17
- const definitionsPath = enabled ? (cfg.fleetDefsPath || path.join(cfg.home, '.nexuscrew', 'fleet.json')) : null;
16
+ const definitionsPath = enabled ? defaultDefinitionsPath(cfg) : null;
18
17
  function read() {
19
18
  if (!enabled) return { available: true, cells: [] };
20
19
  const definitions = loadDefinitions(definitionsPath);
package/lib/server.js CHANGED
@@ -1455,9 +1455,15 @@ function createServer(opts = {}) {
1455
1455
  return res.status(409).json({ error: 'answer requires reconciliation', reason: 'delivery-unknown-block' });
1456
1456
  }
1457
1457
  if (!ask && previous) return res.json({ dismissed: true, scope: 'local', ownerSync: previous.syncState === 'blocked' ? 'blocked' : 'pending' });
1458
- if (!unavailable) return res.status(409).json({ error: 'owner channel is not known unavailable', reason: 'owner-availability-unknown' });
1458
+ // Removing a card from THIS node's view is a local intent: it needs the
1459
+ // ask to be visible and quiet, not a permission from the owner. It is
1460
+ // persisted durably here (removing is not answering). Only the offline
1461
+ // path (owner channel unavailable AND the local reply grant present)
1462
+ // queues a sync for when the owner returns; a reachable owner is never
1463
+ // queued, whatever this node's own grants say — the owner's denial is
1464
+ // what governs the remote closure.
1459
1465
  const out = asksStore.dismissImported({ ownerId: b.ownerId, ownerAskId: b.askId, ask, cellId, retryBinding: dismissalBinding(b.ownerId),
1460
- syncState: grants.grants.askReplyAccess === true ? 'pending' : 'blocked' });
1466
+ syncState: unavailable && grants.grants.askReplyAccess === true ? 'pending' : 'blocked' });
1461
1467
  if (!out.ok) return res.status(out.reason === 'dismissal-cap' ? 429 : 503).json({ error: 'local dismissal refused', reason: out.reason });
1462
1468
  notifier.deliverOnlyRaw({ type: 'ask-dismissed', id: alias ? alias.id : b.askId, ownerId: b.ownerId, ownerAskId: b.askId, scope: 'local',
1463
1469
  // UI-only context also distinguishes changed content before the first snapshot.
@@ -1503,7 +1509,7 @@ function createServer(opts = {}) {
1503
1509
  let readable = false;
1504
1510
  try { readable = asksStore.health().readable; } catch (_) {}
1505
1511
  res.json({ ...remote, canDismissRemote: mutable && remote.canReply === true,
1506
- canDismissLocal: mutable && readable && local.visible && !local.blocked && (local.unavailable || !!local.previous) });
1512
+ canDismissLocal: mutable && readable && local.visible && !local.blocked });
1507
1513
  }
1508
1514
  catch (_) { res.json({ ownerId, askId, canReply: false, status: 'unreachable' }); }
1509
1515
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/nexuscrew",
3
- "version": "0.9.60",
3
+ "version": "0.9.62",
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": {