@cello-protocol/cli 0.0.285 → 0.0.287

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,5 +11,5 @@
11
11
  * to stderr VERBATIM, and the exit code branches on it — so any bash-capable agent can drive a
12
12
  * CELLO node with `cello <cmd> | jq` and `$?`, with no MCP dependency.
13
13
  */
14
- export {};
14
+ import "../node-runtime-guard-init.js";
15
15
  //# sourceMappingURL=cello.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cello.d.ts","sourceRoot":"","sources":["../../src/bin/cello.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG"}
1
+ {"version":3,"file":"cello.d.ts","sourceRoot":"","sources":["../../src/bin/cello.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AAEH,OAAO,+BAA+B,CAAC"}
package/dist/bin/cello.js CHANGED
@@ -11,6 +11,7 @@
11
11
  * to stderr VERBATIM, and the exit code branches on it — so any bash-capable agent can drive a
12
12
  * CELLO node with `cello <cmd> | jq` and `$?`, with no MCP dependency.
13
13
  */
14
+ import "../node-runtime-guard-init.js";
14
15
  import { homedir } from "node:os";
15
16
  import { join, dirname } from "node:path";
16
17
  import { createRequire } from "node:module";
@@ -1 +1 @@
1
- {"version":3,"file":"cello.js","sourceRoot":"","sources":["../../src/bin/cello.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAuB,MAAM,gBAAgB,CAAC;AAGlE,kGAAkG;AAClG,qGAAqG;AACrG,mGA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ts","sourceRoot":"","sources":["../../src/hermes/assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,8/DAkC9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,QAg5DjC,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,eAAe,62JAqF3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,g/EAoDjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,kwFAUV,CAAC"}
@@ -255,8 +255,42 @@ _SAFE_SCALAR_RE = re.compile(r"^[A-Za-z0-9+/=_.:@-]{1,120}$")
255
255
  _MONIKER_RE = re.compile(r"^[A-Za-z0-9_-]{1,64}$")
256
256
 
257
257
 
258
- def _cello_socket_path() -> Path:
259
- cello_dir = os.environ.get("CELLO_DIR") or str(Path.home() / ".cello")
258
+ def _get_cello_env(name: str, default: str = "") -> str:
259
+ """Scope-aware env reader for multiplexed Hermes profiles (#72348 / #86905).
260
+
261
+ Under gateway.multiplex_profiles, os.environ holds only the DEFAULT profile's .env values;
262
+ secondary profiles' .env values live in agent.secret_scope and are read via
263
+ gateway.platforms._shared.get_scoped_secret. Reading os.environ directly leaks the default
264
+ profile's CELLO_AGENT_NAME into every secondary profile. Falls back to os.environ.get only
265
+ when gateway.platforms._shared is unavailable (e.g. standalone test harnesses).
266
+ """
267
+ try:
268
+ from gateway.platforms._shared import get_scoped_secret as _get_scoped_secret
269
+ except ImportError:
270
+ val = os.environ.get(name, default)
271
+ else:
272
+ val = _get_scoped_secret(name, default)
273
+ return str(val if val is not None else default).strip()
274
+
275
+
276
+ def _default_bindings_path() -> Path:
277
+ """Resolve the per-profile session-bindings path via hermes_constants.get_hermes_home().
278
+
279
+ Under gateway.multiplex_profiles, each profile has its own HERMES_HOME (bound per profile via
280
+ _profile_runtime_scope). Using a single hardcoded ~/.hermes/cello/session-bindings.json caused
281
+ secondary profiles to overwrite and prune the default profile's open session bindings on connect.
282
+ """
283
+ try:
284
+ from hermes_constants import get_hermes_home
285
+ base = Path(get_hermes_home())
286
+ except ImportError:
287
+ base = Path.home() / ".hermes"
288
+ return base / "cello" / "session-bindings.json"
289
+
290
+
291
+ def _cello_socket_path(explicit_dir: Optional[Any] = None) -> Path:
292
+ raw = str(explicit_dir).strip() if explicit_dir is not None else ""
293
+ cello_dir = raw or _get_cello_env("CELLO_DIR") or str(Path.home() / ".cello")
260
294
  return Path(cello_dir) / "daemon.sock"
261
295
 
262
296
 
@@ -337,7 +371,7 @@ class CelloAdapter(BasePlatformAdapter):
337
371
  super().__init__(config, Platform("cello"))
338
372
  extra = config.extra or {}
339
373
  self._agent_name: str = str(
340
- extra.get("agent_name") or os.environ.get("CELLO_AGENT_NAME", "")
374
+ extra.get("agent_name") or _get_cello_env("CELLO_AGENT_NAME")
341
375
  ).strip()
342
376
  self._runtime_session: str = str(
343
377
  extra.get("runtime_session", DEFAULT_RUNTIME_SESSION)
@@ -347,19 +381,22 @@ class CelloAdapter(BasePlatformAdapter):
347
381
  # takes down more than this platform. connect() is the loud gate - see _invalid_settings.
348
382
  self._delivery_mode: str = str(
349
383
  extra.get("delivery_mode")
350
- or os.environ.get("CELLO_DELIVERY_MODE")
384
+ or _get_cello_env("CELLO_DELIVERY_MODE")
351
385
  or DEFAULT_DELIVERY_MODE
352
386
  ).strip().lower()
353
387
  self._session_scope: str = str(
354
388
  extra.get("session_scope")
355
- or os.environ.get("CELLO_SESSION_SCOPE")
389
+ or _get_cello_env("CELLO_SESSION_SCOPE")
356
390
  or DEFAULT_SESSION_SCOPE
357
391
  ).strip().lower()
358
392
  self._channel_notifications: str = str(
359
393
  extra.get("channel_notifications")
360
- or os.environ.get("CELLO_CHANNEL_NOTIFICATIONS")
394
+ or _get_cello_env("CELLO_CHANNEL_NOTIFICATIONS")
361
395
  or DEFAULT_CHANNEL_NOTIFICATIONS
362
396
  ).strip().lower()
397
+ # Pin the socket path while _profile_runtime_scope is active so background reconnects
398
+ # (_reconnect_forever) never re-query an unscoped ContextVar after connect() returns.
399
+ self._socket_path: Path = _cello_socket_path(extra.get("cello_dir"))
363
400
  self._writer: Optional[asyncio.StreamWriter] = None
364
401
  self._read_task: Optional[asyncio.Task] = None
365
402
  self._reconnect_task: Optional[asyncio.Task] = None
@@ -375,7 +412,7 @@ class CelloAdapter(BasePlatformAdapter):
375
412
  self._closing = False
376
413
  # 049-BRIDGEREPLY Part B: CELLO-session -> Hermes-chat bindings, recovered from disk so an
377
414
  # escalation opened before a restart still has its answer routed home.
378
- self._bindings_path: Path = BINDINGS_PATH
415
+ self._bindings_path: Path = _default_bindings_path()
379
416
  self._bindings: Dict[str, str] = self._load_bindings()
380
417
  # Part C: chat_id -> {session_id: who} for replies the agent has not sent yet. The loop is
381
418
  # captured in connect(), because the reminder is scheduled from a hook that may run off it.
@@ -540,7 +577,7 @@ class CelloAdapter(BasePlatformAdapter):
540
577
  # cello_send" while send() is a no-op means replies stop dead, with no error anywhere.
541
578
  # Cannot be fixed from here (the hint is already registered), so say so loudly. A genuine
542
579
  # per-entry hint arrives with multi-agent binding (DOD-HERMES-5).
543
- hint_mode = (os.environ.get("CELLO_DELIVERY_MODE") or DEFAULT_DELIVERY_MODE).strip().lower()
580
+ hint_mode = (_get_cello_env("CELLO_DELIVERY_MODE") or DEFAULT_DELIVERY_MODE).strip().lower()
544
581
  if hint_mode != self._delivery_mode:
545
582
  # REFUSE rather than warn. Both directions are broken and one is silent: adapter
546
583
  # 'wake' with a 'channel' hint tells the agent not to call cello_send while send() is
@@ -584,7 +621,7 @@ class CelloAdapter(BasePlatformAdapter):
584
621
  logger.error(
585
622
  "[cello] Could not connect to the CELLO daemon at %s: %s. "
586
623
  "Is the daemon running? Start it with 'cello login'.",
587
- _cello_socket_path(),
624
+ getattr(self, "_socket_path", None) or _cello_socket_path(),
588
625
  exc,
589
626
  )
590
627
  # Suppress the read loop's auto-reconnect: a failed INITIAL connect must
@@ -622,8 +659,9 @@ class CelloAdapter(BasePlatformAdapter):
622
659
 
623
660
  async def _establish(self) -> None:
624
661
  """Open the socket, start the frame reader, and run the IPC handshake."""
662
+ sock_path = getattr(self, "_socket_path", None) or _cello_socket_path()
625
663
  reader, writer = await asyncio.open_unix_connection(
626
- str(_cello_socket_path()), limit=MAX_LINE_BYTES
664
+ str(sock_path), limit=MAX_LINE_BYTES
627
665
  )
628
666
  self._writer = writer
629
667
  self._start_wake_worker()
@@ -1666,9 +1704,20 @@ def _is_connected(config: PlatformConfig) -> bool:
1666
1704
 
1667
1705
  def _env_enablement() -> Optional[dict]:
1668
1706
  """Auto-enable the platform when CELLO_AGENT_NAME is set (Raft's RAFT_PROFILE pattern)."""
1669
- if not os.getenv("CELLO_AGENT_NAME"):
1707
+ agent_name = _get_cello_env("CELLO_AGENT_NAME")
1708
+ if not agent_name:
1670
1709
  return None
1671
- return {"enabled": True}
1710
+ seeded: Dict[str, Any] = {"enabled": True, "agent_name": agent_name}
1711
+ for extra_key, env_name in (
1712
+ ("delivery_mode", "CELLO_DELIVERY_MODE"),
1713
+ ("session_scope", "CELLO_SESSION_SCOPE"),
1714
+ ("channel_notifications", "CELLO_CHANNEL_NOTIFICATIONS"),
1715
+ ("cello_dir", "CELLO_DIR"),
1716
+ ):
1717
+ val = _get_cello_env(env_name)
1718
+ if val:
1719
+ seeded[extra_key] = val
1720
+ return seeded
1672
1721
 
1673
1722
 
1674
1723
  def _delivery_hint() -> str:
@@ -1679,7 +1728,7 @@ def _delivery_hint() -> str:
1679
1728
  send, producing duplicate sends and a read that consumes nothing. The two are mutually
1680
1729
  exclusive, so they are never concatenated.
1681
1730
  """
1682
- mode = (os.environ.get("CELLO_DELIVERY_MODE") or DEFAULT_DELIVERY_MODE).strip().lower()
1731
+ mode = (_get_cello_env("CELLO_DELIVERY_MODE") or DEFAULT_DELIVERY_MODE).strip().lower()
1683
1732
  if mode == "wake":
1684
1733
  return (
1685
1734
  "HOW MESSAGES REACH YOU: as content-free wake notices naming a session and a "
@@ -1939,7 +1988,7 @@ def register(ctx) -> None:
1939
1988
  "fix the cause, and retry the tool.\n"
1940
1989
  "\n"
1941
1990
  "Before any other cello_* call, select your agent with cello_use_agent "
1942
- "(name='" + os.environ.get("CELLO_AGENT_NAME", "your-agent") + "'). The cello MCP "
1991
+ "(name='" + (_get_cello_env("CELLO_AGENT_NAME") or "your-agent") + "'). The cello MCP "
1943
1992
  "server holds its own daemon connection with no agent selected, so other calls "
1944
1993
  "fail with no_current_agent until you do.\n"
1945
1994
  "\n"
@@ -1 +1 @@
1
- {"version":3,"file":"assets.js","sourceRoot":"","sources":["../../src/hermes/assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCjC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDpC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;EAUpC,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Side-effect entrypoint imported first by `bin/cello.ts` so `enforceNodeRuntime()` runs before
3
+ * any sibling module in the ESM static import graph is evaluated.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=node-runtime-guard-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-runtime-guard-init.d.ts","sourceRoot":"","sources":["../src/node-runtime-guard-init.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Side-effect entrypoint imported first by `bin/cello.ts` so `enforceNodeRuntime()` runs before
3
+ * any sibling module in the ESM static import graph is evaluated.
4
+ */
5
+ import { enforceNodeRuntime } from "./node-runtime-guard.js";
6
+ enforceNodeRuntime();
7
+ //# sourceMappingURL=node-runtime-guard-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-runtime-guard-init.js","sourceRoot":"","sources":["../src/node-runtime-guard-init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Node runtime version guard and PATH alignment for the `cello` CLI binary.
3
+ *
4
+ * When a host has multiple Node.js installations (for example, a system Node 18/20 in `/usr/bin`
5
+ * and a private Node 22/24 installation), two failure modes occur:
6
+ * 1. `#!/usr/bin/env node` resolves to the older Node earlier on `PATH`.
7
+ * 2. Even when `cello` is invoked explicitly via `/path/to/node24/bin/node /path/to/cello`,
8
+ * subsequent child spawns that resolve `npm`, `npx`, or `#!/usr/bin/env node` via `PATH`
9
+ * hit the older directory on `PATH` unless `dirname(process.execPath)` is first on `PATH`.
10
+ *
11
+ * `checkNodeRuntime` validates the running Node major version (default `>= 22`) and prepends
12
+ * `dirname(execPath)` to `env.PATH` when it is not already first.
13
+ */
14
+ export declare const DEFAULT_MIN_NODE_MAJOR = 22;
15
+ export interface CheckNodeRuntimeOptions {
16
+ version?: string;
17
+ execPath?: string;
18
+ env?: NodeJS.ProcessEnv;
19
+ minMajor?: number;
20
+ }
21
+ export type CheckNodeRuntimeResult = {
22
+ readonly ok: true;
23
+ } | {
24
+ readonly ok: false;
25
+ readonly message: string;
26
+ };
27
+ export declare function checkNodeRuntime(opts?: CheckNodeRuntimeOptions): CheckNodeRuntimeResult;
28
+ export interface SuppressLocalStorageWarningOptions {
29
+ target?: object;
30
+ execArgv?: readonly string[];
31
+ env?: NodeJS.ProcessEnv;
32
+ }
33
+ /**
34
+ * Node 25+ defines a lazy getter on `globalThis.localStorage` (`node:internal/webstorage`) that
35
+ * emits `ExperimentalWarning: localStorage is not available because --localstorage-file was not
36
+ * provided.` the first time any dependency (such as `lib0/storage.js` via `yjs`) evaluates
37
+ * `typeof localStorage !== "undefined"`.
38
+ *
39
+ * When `--localstorage-file` is not configured in `execArgv` or `NODE_OPTIONS`, replace the
40
+ * lazy getter on `globalThis` with `value: undefined` without invoking the getter.
41
+ */
42
+ export declare function suppressUnconfiguredLocalStorageWarning(opts?: SuppressLocalStorageWarningOptions): void;
43
+ export interface EnforceNodeRuntimeOptions extends CheckNodeRuntimeOptions, SuppressLocalStorageWarningOptions {
44
+ writeStderr?: (text: string) => void;
45
+ exit?: (code: number) => void;
46
+ }
47
+ export declare function enforceNodeRuntime(opts?: EnforceNodeRuntimeOptions): void;
48
+ //# sourceMappingURL=node-runtime-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-runtime-guard.d.ts","sourceRoot":"","sources":["../src/node-runtime-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,uBAAuB,GAAG,sBAAsB,CAyBvF;AAED,MAAM,WAAW,kCAAkC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uCAAuC,CACrD,IAAI,CAAC,EAAE,kCAAkC,GACxC,IAAI,CAoBN;AAED,MAAM,WAAW,yBACf,SAAQ,uBAAuB,EAC7B,kCAAkC;IACpC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAED,wBAAgB,kBAAkB,CAAC,IAAI,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAazE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Node runtime version guard and PATH alignment for the `cello` CLI binary.
3
+ *
4
+ * When a host has multiple Node.js installations (for example, a system Node 18/20 in `/usr/bin`
5
+ * and a private Node 22/24 installation), two failure modes occur:
6
+ * 1. `#!/usr/bin/env node` resolves to the older Node earlier on `PATH`.
7
+ * 2. Even when `cello` is invoked explicitly via `/path/to/node24/bin/node /path/to/cello`,
8
+ * subsequent child spawns that resolve `npm`, `npx`, or `#!/usr/bin/env node` via `PATH`
9
+ * hit the older directory on `PATH` unless `dirname(process.execPath)` is first on `PATH`.
10
+ *
11
+ * `checkNodeRuntime` validates the running Node major version (default `>= 22`) and prepends
12
+ * `dirname(execPath)` to `env.PATH` when it is not already first.
13
+ */
14
+ import { dirname, delimiter } from "node:path";
15
+ export const DEFAULT_MIN_NODE_MAJOR = 22;
16
+ export function checkNodeRuntime(opts) {
17
+ const rawVersion = (opts?.version ?? process.versions.node).replace(/^v/i, "");
18
+ const execPath = opts?.execPath ?? process.execPath;
19
+ const env = opts?.env ?? process.env;
20
+ const envMin = Number(env["CELLO_MIN_NODE_MAJOR"]);
21
+ const minMajor = opts?.minMajor ?? (Number.isInteger(envMin) && envMin > 0 ? envMin : DEFAULT_MIN_NODE_MAJOR);
22
+ const major = Number.parseInt(rawVersion.split(".")[0] ?? "", 10);
23
+ if (!Number.isFinite(major) || major < minMajor) {
24
+ const message = `Unsupported Node.js runtime v${rawVersion} at ${execPath} (CELLO requires Node.js >=${minMajor}).\n` +
25
+ `If you have a newer Node.js installed on this machine, place its bin directory first on PATH:\n` +
26
+ ` export PATH="<path-to-node-${minMajor}+-bin>:$PATH"`;
27
+ return { ok: false, message };
28
+ }
29
+ const execDir = dirname(execPath);
30
+ const currentPath = env["PATH"] ?? "";
31
+ const segments = currentPath.length > 0 ? currentPath.split(delimiter) : [];
32
+ if (segments[0] !== execDir) {
33
+ env["PATH"] = currentPath.length > 0 ? `${execDir}${delimiter}${currentPath}` : execDir;
34
+ }
35
+ return { ok: true };
36
+ }
37
+ /**
38
+ * Node 25+ defines a lazy getter on `globalThis.localStorage` (`node:internal/webstorage`) that
39
+ * emits `ExperimentalWarning: localStorage is not available because --localstorage-file was not
40
+ * provided.` the first time any dependency (such as `lib0/storage.js` via `yjs`) evaluates
41
+ * `typeof localStorage !== "undefined"`.
42
+ *
43
+ * When `--localstorage-file` is not configured in `execArgv` or `NODE_OPTIONS`, replace the
44
+ * lazy getter on `globalThis` with `value: undefined` without invoking the getter.
45
+ */
46
+ export function suppressUnconfiguredLocalStorageWarning(opts) {
47
+ const target = opts?.target ?? globalThis;
48
+ const execArgv = opts?.execArgv ?? process.execArgv;
49
+ const env = opts?.env ?? process.env;
50
+ const nodeOptions = env["NODE_OPTIONS"] ?? "";
51
+ const hasFlag = execArgv.some((arg) => arg === "--localstorage-file" || arg.startsWith("--localstorage-file=")) ||
52
+ /(?:^|\s)--localstorage-file(?:=|\s|$)/.test(nodeOptions);
53
+ if (hasFlag)
54
+ return;
55
+ const desc = Object.getOwnPropertyDescriptor(target, "localStorage");
56
+ if (desc && typeof desc.get === "function" && desc.configurable) {
57
+ Object.defineProperty(target, "localStorage", {
58
+ value: undefined,
59
+ writable: true,
60
+ enumerable: false,
61
+ configurable: true,
62
+ });
63
+ }
64
+ }
65
+ export function enforceNodeRuntime(opts) {
66
+ suppressUnconfiguredLocalStorageWarning({
67
+ target: opts?.target,
68
+ execArgv: opts?.execArgv,
69
+ env: opts?.env,
70
+ });
71
+ const res = checkNodeRuntime(opts);
72
+ if (!res.ok) {
73
+ const write = opts?.writeStderr ?? ((s) => process.stderr.write(s));
74
+ const exit = opts?.exit ?? ((c) => process.exit(c));
75
+ write(`${res.message}\n`);
76
+ exit(1);
77
+ }
78
+ }
79
+ //# sourceMappingURL=node-runtime-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-runtime-guard.js","sourceRoot":"","sources":["../src/node-runtime-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAazC,MAAM,UAAU,gBAAgB,CAAC,IAA8B;IAC7D,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAA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AQ;QACxB,GAAG,EAAE,IAAI,EAAE,GAAG;KACf,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,KAAK,GAAG,IAAI,EAAE,WAAW,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,MAAM,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cello-protocol/cli",
3
- "version": "0.0.285",
3
+ "version": "0.0.287",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -17,9 +17,9 @@
17
17
  "package.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@cello-protocol/daemon": "0.0.278",
21
- "@cello-protocol/protocol-types": "0.0.140",
22
- "@cello-protocol/gateway": "0.0.124"
20
+ "@cello-protocol/daemon": "0.0.280",
21
+ "@cello-protocol/gateway": "0.0.125",
22
+ "@cello-protocol/protocol-types": "0.0.140"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^25.6.2"