@cello-protocol/cli 0.0.305 → 0.0.307

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.
Files changed (234) hide show
  1. package/.claude-plugin/marketplace.json +15 -0
  2. package/README.md +107 -0
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +564 -0
  5. package/dist/daemon/account-page-assets.d.ts +4 -0
  6. package/dist/daemon/account-page-assets.js +160 -0
  7. package/dist/daemon/account-page.d.ts +14 -0
  8. package/dist/daemon/account-page.js +104 -0
  9. package/dist/daemon/address.d.ts +10 -0
  10. package/dist/daemon/address.js +34 -0
  11. package/dist/daemon/away.d.ts +31 -0
  12. package/dist/daemon/away.js +65 -0
  13. package/dist/daemon/channel-store.d.ts +112 -0
  14. package/dist/daemon/channel-store.js +284 -0
  15. package/dist/daemon/channels.d.ts +46 -0
  16. package/dist/daemon/channels.js +1049 -0
  17. package/dist/daemon/contacts.d.ts +26 -0
  18. package/dist/daemon/contacts.js +74 -0
  19. package/dist/daemon/engine.d.ts +80 -0
  20. package/dist/daemon/engine.js +2882 -0
  21. package/dist/daemon/errors.d.ts +5 -0
  22. package/dist/daemon/errors.js +16 -0
  23. package/dist/daemon/governance.d.ts +66 -0
  24. package/dist/daemon/governance.js +514 -0
  25. package/dist/daemon/guards.d.ts +36 -0
  26. package/dist/daemon/guards.js +140 -0
  27. package/dist/daemon/issuer-client.d.ts +56 -0
  28. package/dist/daemon/issuer-client.js +143 -0
  29. package/dist/daemon/link.d.ts +30 -0
  30. package/dist/daemon/link.js +191 -0
  31. package/dist/daemon/log.d.ts +1 -0
  32. package/dist/daemon/log.js +4 -0
  33. package/dist/daemon/main.d.ts +1 -0
  34. package/dist/daemon/main.js +511 -0
  35. package/dist/daemon/paths.d.ts +6 -0
  36. package/dist/daemon/paths.js +21 -0
  37. package/dist/daemon/pii.d.ts +24 -0
  38. package/dist/daemon/pii.js +146 -0
  39. package/dist/daemon/policy-cadence.d.ts +33 -0
  40. package/dist/daemon/policy-cadence.js +59 -0
  41. package/dist/daemon/policy-proposals.d.ts +41 -0
  42. package/dist/daemon/policy-proposals.js +83 -0
  43. package/dist/daemon/policy-store.d.ts +47 -0
  44. package/dist/daemon/policy-store.js +144 -0
  45. package/dist/daemon/presented.d.ts +36 -0
  46. package/dist/daemon/presented.js +94 -0
  47. package/dist/daemon/rate-limit.d.ts +17 -0
  48. package/dist/daemon/rate-limit.js +44 -0
  49. package/dist/daemon/reach.d.ts +63 -0
  50. package/dist/daemon/reach.js +207 -0
  51. package/dist/daemon/screening.d.ts +97 -0
  52. package/dist/daemon/screening.js +362 -0
  53. package/dist/daemon/settings.d.ts +125 -0
  54. package/dist/daemon/settings.js +73 -0
  55. package/dist/daemon/signal-rules.d.ts +55 -0
  56. package/dist/daemon/signal-rules.js +127 -0
  57. package/dist/daemon/signal-store.d.ts +53 -0
  58. package/dist/daemon/signal-store.js +114 -0
  59. package/dist/daemon/store.d.ts +188 -0
  60. package/dist/daemon/store.js +474 -0
  61. package/dist/daemon/tiers.d.ts +14 -0
  62. package/dist/daemon/tiers.js +9 -0
  63. package/dist/daemon/wallet.d.ts +73 -0
  64. package/dist/daemon/wallet.js +428 -0
  65. package/dist/daemon/who-label.d.ts +3 -0
  66. package/dist/daemon/who-label.js +11 -0
  67. package/dist/guidance.d.ts +39 -0
  68. package/dist/guidance.js +98 -0
  69. package/dist/hermes-bridge.d.ts +26 -0
  70. package/dist/hermes-bridge.js +180 -0
  71. package/dist/install-mcp.d.ts +6 -0
  72. package/dist/install-mcp.js +77 -0
  73. package/dist/ipc/client.d.ts +18 -0
  74. package/dist/ipc/client.js +107 -0
  75. package/dist/ipc/operations.d.ts +30 -0
  76. package/dist/ipc/operations.js +835 -0
  77. package/dist/ipc/protocol.d.ts +21 -0
  78. package/dist/ipc/protocol.js +1 -0
  79. package/dist/issuer-list-sign.d.ts +12 -0
  80. package/dist/issuer-list-sign.js +43 -0
  81. package/dist/local-operations.d.ts +2 -0
  82. package/dist/local-operations.js +73 -0
  83. package/dist/mcp-tools.d.ts +14 -0
  84. package/dist/mcp-tools.js +45 -0
  85. package/dist/mcp.d.ts +2 -0
  86. package/dist/mcp.js +155 -0
  87. package/dist/protocol/aead.d.ts +4 -0
  88. package/dist/protocol/aead.js +35 -0
  89. package/dist/protocol/cbor.d.ts +40 -0
  90. package/dist/protocol/cbor.js +106 -0
  91. package/dist/protocol/chain.d.ts +44 -0
  92. package/dist/protocol/chain.js +126 -0
  93. package/dist/protocol/channel.d.ts +153 -0
  94. package/dist/protocol/channel.js +298 -0
  95. package/dist/protocol/encode.d.ts +6 -0
  96. package/dist/protocol/encode.js +21 -0
  97. package/dist/protocol/identity.d.ts +27 -0
  98. package/dist/protocol/identity.js +94 -0
  99. package/dist/protocol/issuer-list.d.ts +56 -0
  100. package/dist/protocol/issuer-list.js +193 -0
  101. package/dist/protocol/issuer-roots.d.ts +6 -0
  102. package/dist/protocol/issuer-roots.js +10 -0
  103. package/dist/protocol/key-agreement.d.ts +20 -0
  104. package/dist/protocol/key-agreement.js +88 -0
  105. package/dist/protocol/merkle.d.ts +16 -0
  106. package/dist/protocol/merkle.js +166 -0
  107. package/dist/protocol/ml-dsa.d.ts +28 -0
  108. package/dist/protocol/ml-dsa.js +58 -0
  109. package/dist/protocol/ml-kem.d.ts +14 -0
  110. package/dist/protocol/ml-kem.js +57 -0
  111. package/dist/protocol/pq-errors.d.ts +9 -0
  112. package/dist/protocol/pq-errors.js +23 -0
  113. package/dist/protocol/pq-warnings.d.ts +1 -0
  114. package/dist/protocol/pq-warnings.js +18 -0
  115. package/dist/protocol/presented-signals.d.ts +17 -0
  116. package/dist/protocol/presented-signals.js +92 -0
  117. package/dist/protocol/salt.d.ts +5 -0
  118. package/dist/protocol/salt.js +47 -0
  119. package/dist/protocol/seal.d.ts +58 -0
  120. package/dist/protocol/seal.js +220 -0
  121. package/dist/protocol/signal.d.ts +54 -0
  122. package/dist/protocol/signal.js +266 -0
  123. package/dist/protocol/status.d.ts +41 -0
  124. package/dist/protocol/status.js +64 -0
  125. package/dist/protocol/structures.d.ts +359 -0
  126. package/dist/protocol/structures.js +296 -0
  127. package/dist/protocol/transcript.d.ts +61 -0
  128. package/dist/protocol/transcript.js +319 -0
  129. package/dist/protocol/wire.d.ts +212 -0
  130. package/dist/protocol/wire.js +161 -0
  131. package/dist/require-node.d.ts +1 -0
  132. package/dist/require-node.js +10 -0
  133. package/dist/screener/affordance.d.ts +1 -0
  134. package/dist/screener/affordance.js +2 -0
  135. package/dist/screener/classifier-selfcheck.d.ts +29 -0
  136. package/dist/screener/classifier-selfcheck.js +56 -0
  137. package/dist/screener/exfil.d.ts +11 -0
  138. package/dist/screener/exfil.js +45 -0
  139. package/dist/screener/gitleaks-rules.d.ts +9 -0
  140. package/dist/screener/gitleaks-rules.js +226 -0
  141. package/dist/screener/inbound.d.ts +25 -0
  142. package/dist/screener/inbound.js +102 -0
  143. package/dist/screener/injection-classifier-onnx.d.ts +20 -0
  144. package/dist/screener/injection-classifier-onnx.js +89 -0
  145. package/dist/screener/injection-classifier-wasm.d.ts +2 -0
  146. package/dist/screener/injection-classifier-wasm.js +97 -0
  147. package/dist/screener/injection-patterns.d.ts +8 -0
  148. package/dist/screener/injection-patterns.js +48 -0
  149. package/dist/screener/injection-windows.d.ts +9 -0
  150. package/dist/screener/injection-windows.js +37 -0
  151. package/dist/screener/language.d.ts +15 -0
  152. package/dist/screener/language.js +71 -0
  153. package/dist/screener/linear-regex.d.ts +8 -0
  154. package/dist/screener/linear-regex.js +27 -0
  155. package/dist/screener/model-installer.d.ts +14 -0
  156. package/dist/screener/model-installer.js +61 -0
  157. package/dist/screener/outbound.d.ts +19 -0
  158. package/dist/screener/outbound.js +62 -0
  159. package/dist/screener/sanitize.d.ts +44 -0
  160. package/dist/screener/sanitize.js +361 -0
  161. package/dist/screener/scan-variants.d.ts +5 -0
  162. package/dist/screener/scan-variants.js +146 -0
  163. package/dist/screener/screener-model-manifest.d.ts +16 -0
  164. package/dist/screener/screener-model-manifest.js +20 -0
  165. package/dist/screener/screener-state.d.ts +29 -0
  166. package/dist/screener/screener-state.js +119 -0
  167. package/dist/screener/secrets.d.ts +18 -0
  168. package/dist/screener/secrets.js +84 -0
  169. package/dist/screener/worker.d.ts +6 -0
  170. package/dist/screener/worker.js +83 -0
  171. package/dist/setup.d.ts +9 -0
  172. package/dist/setup.js +252 -0
  173. package/dist/shipped-issuer-list.d.ts +1 -0
  174. package/dist/shipped-issuer-list.js +3 -0
  175. package/dist/signals-text.d.ts +46 -0
  176. package/dist/signals-text.js +81 -0
  177. package/dist/verify-seal.d.ts +9 -0
  178. package/dist/verify-seal.js +30 -0
  179. package/hermes/plugin/__init__.py +1040 -0
  180. package/hermes/plugin/plugin.yaml +30 -0
  181. package/hermes/skills/cello-bridge-setup/SKILL.md +38 -0
  182. package/hermes/skills/cello-policy/SKILL.md +44 -0
  183. package/package.json +48 -16
  184. package/plugins/cello/.claude-plugin/plugin.json +19 -0
  185. package/plugins/cello/.mcp.json +7 -0
  186. package/plugins/cello/skills/cello/SKILL.md +117 -0
  187. package/dist/arg-parse.d.ts +0 -19
  188. package/dist/arg-parse.d.ts.map +0 -1
  189. package/dist/arg-parse.js +0 -29
  190. package/dist/arg-parse.js.map +0 -1
  191. package/dist/bin/cello.d.ts +0 -15
  192. package/dist/bin/cello.d.ts.map +0 -1
  193. package/dist/bin/cello.js +0 -110
  194. package/dist/bin/cello.js.map +0 -1
  195. package/dist/cli-args.d.ts +0 -62
  196. package/dist/cli-args.d.ts.map +0 -1
  197. package/dist/cli-args.js +0 -129
  198. package/dist/cli-args.js.map +0 -1
  199. package/dist/commands.d.ts +0 -196
  200. package/dist/commands.d.ts.map +0 -1
  201. package/dist/commands.js +0 -1544
  202. package/dist/commands.js.map +0 -1
  203. package/dist/hermes/assets.d.ts +0 -41
  204. package/dist/hermes/assets.d.ts.map +0 -1
  205. package/dist/hermes/assets.js +0 -2281
  206. package/dist/hermes/assets.js.map +0 -1
  207. package/dist/hermes/install-hermes.d.ts +0 -50
  208. package/dist/hermes/install-hermes.d.ts.map +0 -1
  209. package/dist/hermes/install-hermes.js +0 -232
  210. package/dist/hermes/install-hermes.js.map +0 -1
  211. package/dist/json-out.d.ts +0 -41
  212. package/dist/json-out.d.ts.map +0 -1
  213. package/dist/json-out.js +0 -59
  214. package/dist/json-out.js.map +0 -1
  215. package/dist/node-runtime-guard-init.d.ts +0 -6
  216. package/dist/node-runtime-guard-init.d.ts.map +0 -1
  217. package/dist/node-runtime-guard-init.js +0 -7
  218. package/dist/node-runtime-guard-init.js.map +0 -1
  219. package/dist/node-runtime-guard.d.ts +0 -48
  220. package/dist/node-runtime-guard.d.ts.map +0 -1
  221. package/dist/node-runtime-guard.js +0 -79
  222. package/dist/node-runtime-guard.js.map +0 -1
  223. package/dist/parity-commands.d.ts +0 -427
  224. package/dist/parity-commands.d.ts.map +0 -1
  225. package/dist/parity-commands.js +0 -953
  226. package/dist/parity-commands.js.map +0 -1
  227. package/dist/registry.d.ts +0 -120
  228. package/dist/registry.d.ts.map +0 -1
  229. package/dist/registry.js +0 -2169
  230. package/dist/registry.js.map +0 -1
  231. package/dist/screener-commands.d.ts +0 -85
  232. package/dist/screener-commands.d.ts.map +0 -1
  233. package/dist/screener-commands.js +0 -313
  234. package/dist/screener-commands.js.map +0 -1
@@ -1 +0,0 @@
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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqF9B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDpC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;EAUpC,qBAAqB,EAAE,CAAC"}
@@ -1,50 +0,0 @@
1
- /**
2
- * HERMES-001 — `cello bridge hermes`: wire the local CELLO daemon into a Hermes
3
- * Agent installation.
4
- *
5
- * What it does (design: trustless-cello 2026-07-09_1915_hermes-agent-integration-plan.md §5):
6
- * 1. Scaffolds the platform-adapter plugin into $HERMES_HOME/plugins/cello/
7
- * (plugin.yaml + __init__.py — a pure-stdlib Python IPC client, no subprocess).
8
- * 2. Drops the cello-bridge-setup skill into $HERMES_HOME/skills/.
9
- * 3. Binds the agent: writes CELLO_AGENT_NAME=<agent> into $HERMES_HOME/.env
10
- * (replace-or-append; every other line preserved byte-for-byte).
11
- * 4. Registers through Hermes' OWN CLI surfaces — `hermes plugins enable cello` and
12
- * `hermes mcp add cello …` — never by hand-editing config.yaml, so Hermes owns
13
- * its config format.
14
- *
15
- * Never edits anything outside $HERMES_HOME. Idempotent: re-running upgrades the
16
- * scaffolded files in place and keeps exactly one CELLO_AGENT_NAME line.
17
- */
18
- export interface ExecResult {
19
- code: number;
20
- stdout: string;
21
- stderr: string;
22
- }
23
- export type ExecFn = (cmd: string, args: string[]) => Promise<ExecResult>;
24
- /** DOD-HERMES-4 — the two per-agent behaviour settings, and their defaults. */
25
- export declare const DELIVERY_MODES: readonly ["explicit", "channel", "wake"];
26
- export declare const SESSION_SCOPES: readonly ["agent", "peer"];
27
- export declare const DEFAULT_DELIVERY_MODE: (typeof DELIVERY_MODES)[number];
28
- export declare const DEFAULT_SESSION_SCOPE: (typeof SESSION_SCOPES)[number];
29
- export declare const CHANNEL_NOTIFICATIONS: readonly ["on", "off"];
30
- export declare const DEFAULT_CHANNEL_NOTIFICATIONS: (typeof CHANNEL_NOTIFICATIONS)[number];
31
- export interface InstallHermesOptions {
32
- agentName: string;
33
- /** Defaults to $HERMES_HOME, falling back to ~/.hermes. */
34
- hermesHome?: string;
35
- /** `channel` (default): CELLO behaves as a normal two-way channel. `wake`: notices only. */
36
- deliveryMode?: string;
37
- /** `agent` (default): one conversation per agent. `peer`: one per counterparty. */
38
- sessionScope?: string;
39
- /** `on` (default): a new post on a followed channel wakes the agent. `off`: channel doorbells are ignored. */
40
- channelNotifications?: string;
41
- /** Direct incoming messages to this Hermes session instead of the default landing session. */
42
- landingSession?: string;
43
- /** Injectable for tests; defaults to a spawn-based runner. */
44
- exec?: ExecFn;
45
- }
46
- export declare function installHermes(opts: InstallHermesOptions): Promise<{
47
- exitCode: number;
48
- output: string;
49
- }>;
50
- //# sourceMappingURL=install-hermes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-hermes.d.ts","sourceRoot":"","sources":["../../src/hermes/install-hermes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAE1E,+EAA+E;AAC/E,eAAO,MAAM,cAAc,0CAA2C,CAAC;AACvE,eAAO,MAAM,cAAc,4BAA6B,CAAC;AACzD,eAAO,MAAM,qBAAqB,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAc,CAAC;AACjF,eAAO,MAAM,qBAAqB,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAW,CAAC;AAC9E,eAAO,MAAM,qBAAqB,wBAAyB,CAAC;AAC5D,eAAO,MAAM,6BAA6B,EAAE,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAQ,CAAC;AAE1F,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8GAA8G;IAC9G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA8DD,wBAAsB,aAAa,CACjC,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAgL/C"}
@@ -1,232 +0,0 @@
1
- /**
2
- * HERMES-001 — `cello bridge hermes`: wire the local CELLO daemon into a Hermes
3
- * Agent installation.
4
- *
5
- * What it does (design: trustless-cello 2026-07-09_1915_hermes-agent-integration-plan.md §5):
6
- * 1. Scaffolds the platform-adapter plugin into $HERMES_HOME/plugins/cello/
7
- * (plugin.yaml + __init__.py — a pure-stdlib Python IPC client, no subprocess).
8
- * 2. Drops the cello-bridge-setup skill into $HERMES_HOME/skills/.
9
- * 3. Binds the agent: writes CELLO_AGENT_NAME=<agent> into $HERMES_HOME/.env
10
- * (replace-or-append; every other line preserved byte-for-byte).
11
- * 4. Registers through Hermes' OWN CLI surfaces — `hermes plugins enable cello` and
12
- * `hermes mcp add cello …` — never by hand-editing config.yaml, so Hermes owns
13
- * its config format.
14
- *
15
- * Never edits anything outside $HERMES_HOME. Idempotent: re-running upgrades the
16
- * scaffolded files in place and keeps exactly one CELLO_AGENT_NAME line.
17
- */
18
- import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
19
- import { homedir } from "node:os";
20
- import { join } from "node:path";
21
- import { spawn } from "node:child_process";
22
- import { HERMES_PLUGIN_YAML, HERMES_PLUGIN_INIT_PY, HERMES_SKILL_MD, HERMES_POLICY_SKILL_MD } from "./assets.js";
23
- /** DOD-HERMES-4 — the two per-agent behaviour settings, and their defaults. */
24
- export const DELIVERY_MODES = ["explicit", "channel", "wake"];
25
- export const SESSION_SCOPES = ["agent", "peer"];
26
- export const DEFAULT_DELIVERY_MODE = "explicit";
27
- export const DEFAULT_SESSION_SCOPE = "agent";
28
- export const CHANNEL_NOTIFICATIONS = ["on", "off"];
29
- export const DEFAULT_CHANNEL_NOTIFICATIONS = "on";
30
- /** The two Hermes CLI registrations the installer performs (also printed as the
31
- * manual fallback when the `hermes` binary cannot be run). */
32
- const HERMES_COMMANDS = [
33
- ["plugins", "enable", "cello"],
34
- ["mcp", "add", "cello", "--command", "npx", "--args", "--yes", "@cello-protocol/connect@latest"],
35
- ];
36
- const defaultExec = (cmd, args) => new Promise((resolve, reject) => {
37
- const child = spawn(cmd, args, { stdio: ["pipe", "pipe", "pipe"] });
38
- // `hermes mcp add` is interactive: on a re-run it first asks "... already exists.
39
- // Overwrite? [y/N]" (default NO), then "Enable all N tools? [Y/n/select]". Feed a
40
- // few "Y" lines so BOTH prompts are answered yes on the fresh AND the re-run path
41
- // (extra lines are harmless — the child stops reading once satisfied). A closed
42
- // stdin would read as EOF → "Cancelled." with exit 0, which is why installHermes
43
- // also VERIFIES the registration against `hermes mcp list` rather than trusting
44
- // the exit code.
45
- child.stdin.write("Y\nY\nY\n");
46
- child.stdin.end();
47
- let stdout = "";
48
- let stderr = "";
49
- child.stdout.on("data", (d) => (stdout += d.toString("utf-8")));
50
- child.stderr.on("data", (d) => (stderr += d.toString("utf-8")));
51
- child.on("error", reject); // e.g. ENOENT — hermes not on PATH
52
- child.on("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
53
- });
54
- /** Replace-or-append KEY=value in an env file, preserving every other line. */
55
- function upsertEnvLine(envPath, key, value) {
56
- const line = `${key}=${value}`;
57
- let lines = [];
58
- if (existsSync(envPath)) {
59
- lines = readFileSync(envPath, "utf-8").split("\n");
60
- }
61
- let replaced = false;
62
- lines = lines.map((l) => {
63
- if (l.startsWith(`${key}=`)) {
64
- replaced = true;
65
- return line;
66
- }
67
- return l;
68
- });
69
- if (!replaced) {
70
- // Drop a single trailing empty line before appending so we don't grow blank gaps.
71
- if (lines.length > 0 && lines[lines.length - 1] === "")
72
- lines.pop();
73
- lines.push(line);
74
- }
75
- writeFileSync(envPath, lines.join("\n") + (lines[lines.length - 1] === "" ? "" : "\n"));
76
- }
77
- /** Drop KEY=value lines from an env file if present. */
78
- function removeEnvLine(envPath, key) {
79
- if (!existsSync(envPath))
80
- return;
81
- const lines = readFileSync(envPath, "utf-8").split("\n").filter((l) => !l.startsWith(`${key}=`));
82
- while (lines.length > 0 && lines[lines.length - 1] === "")
83
- lines.pop();
84
- writeFileSync(envPath, lines.join("\n") + (lines.length > 0 ? "\n" : ""));
85
- }
86
- const SAFE_SESSION_ID_RE = /^[A-Za-z0-9+/=_.:@-]{1,120}$/;
87
- export async function installHermes(opts) {
88
- const agentName = (opts.agentName ?? "").trim();
89
- if (!agentName) {
90
- return {
91
- exitCode: 1,
92
- output: "Missing agent name. Usage: cello bridge hermes --agent <name> [--hermes-home <path>]\n" +
93
- "The agent must be a local CELLO agent (see 'cello status' for the list).",
94
- };
95
- }
96
- // Validate the modes BEFORE touching the filesystem. A typo must not be written into .env and
97
- // discovered later as a gateway that refuses to start — reject it here, where the operator is
98
- // still looking at the command they just typed.
99
- const deliveryMode = (opts.deliveryMode ?? DEFAULT_DELIVERY_MODE).trim().toLowerCase();
100
- const sessionScope = (opts.sessionScope ?? DEFAULT_SESSION_SCOPE).trim().toLowerCase();
101
- const channelNotifications = (opts.channelNotifications ?? DEFAULT_CHANNEL_NOTIFICATIONS).trim().toLowerCase();
102
- let landingSession = (opts.landingSession ?? "").trim();
103
- if (landingSession.toLowerCase() === "default") {
104
- landingSession = "";
105
- }
106
- else if (landingSession.toLowerCase() === "current") {
107
- const currentId = (process.env.HERMES_SESSION_ID ?? "").trim();
108
- if (!currentId) {
109
- return {
110
- exitCode: 1,
111
- output: "Unable to resolve --landing-session current: HERMES_SESSION_ID is not set in the environment.\n" +
112
- "Run from inside a Hermes session, or pass the explicit session ID: --landing-session <session-id>.",
113
- };
114
- }
115
- landingSession = currentId;
116
- }
117
- if (landingSession && !SAFE_SESSION_ID_RE.test(landingSession)) {
118
- return {
119
- exitCode: 1,
120
- output: `Invalid --landing-session '${landingSession}'. Session ID must match [A-Za-z0-9+/=_.:@-]{1,120}.`,
121
- };
122
- }
123
- for (const [flag, value, allowed] of [
124
- ["--delivery-mode", deliveryMode, DELIVERY_MODES],
125
- ["--session-scope", sessionScope, SESSION_SCOPES],
126
- ["--channel-notifications", channelNotifications, CHANNEL_NOTIFICATIONS],
127
- ]) {
128
- if (!allowed.includes(value)) {
129
- return {
130
- exitCode: 1,
131
- output: `Invalid ${flag} '${value}'. Expected one of: ${allowed.join(", ")}.\n` +
132
- (flag === "--delivery-mode"
133
- ? " explicit — inbound arrives as a message; nothing is sent unless the agent calls cello_send (default)\n" +
134
- " channel — CELLO behaves like a normal chat channel; the agent's reply is sent automatically\n" +
135
- " wake — content-free notices only; the agent reads and replies via cello_* tools"
136
- : flag === "--channel-notifications"
137
- ? " on — a new post on a followed channel wakes the agent with a notice to read it (default)\n" +
138
- " off — channel doorbells are ignored; the agent reads channels only when it looks"
139
- : " agent — one conversation per CELLO agent (default)\n" +
140
- " peer — one conversation per counterparty, for a support desk"),
141
- };
142
- }
143
- }
144
- const hermesHome = opts.hermesHome || process.env.HERMES_HOME || join(homedir(), ".hermes");
145
- if (!existsSync(hermesHome)) {
146
- return {
147
- exitCode: 1,
148
- output: `Hermes home not found at ${hermesHome}.\n` +
149
- "Install Hermes Agent first (https://hermes-agent.nousresearch.com), or pass --hermes-home <path> " +
150
- "if it lives elsewhere.",
151
- };
152
- }
153
- const exec = opts.exec ?? defaultExec;
154
- const out = [];
155
- // 1. Plugin package
156
- const pluginDir = join(hermesHome, "plugins", "cello");
157
- mkdirSync(pluginDir, { recursive: true });
158
- writeFileSync(join(pluginDir, "plugin.yaml"), HERMES_PLUGIN_YAML);
159
- writeFileSync(join(pluginDir, "__init__.py"), HERMES_PLUGIN_INIT_PY);
160
- out.push(`Wrote plugin: ${pluginDir}/{plugin.yaml,__init__.py}`);
161
- // 2. Skill
162
- const skillDir = join(hermesHome, "skills", "cello-bridge-setup");
163
- mkdirSync(skillDir, { recursive: true });
164
- writeFileSync(join(skillDir, "SKILL.md"), HERMES_SKILL_MD);
165
- out.push(`Wrote skill: ${skillDir}/SKILL.md`);
166
- // 008-POLICY Part G: the policy-writing step, as its own skill.
167
- const policySkillDir = join(hermesHome, "skills", "cello-policy");
168
- mkdirSync(policySkillDir, { recursive: true });
169
- writeFileSync(join(policySkillDir, "SKILL.md"), HERMES_POLICY_SKILL_MD);
170
- out.push(`Wrote skill: ${policySkillDir}/SKILL.md`);
171
- // 3. Agent binding + behaviour settings. All settings are written on every run, so re-running the
172
- // installer without a flag RESETS that flag to its default rather than silently inheriting
173
- // a value the operator can no longer see in the command they typed.
174
- const envPath = join(hermesHome, ".env");
175
- upsertEnvLine(envPath, "CELLO_AGENT_NAME", agentName);
176
- upsertEnvLine(envPath, "CELLO_DELIVERY_MODE", deliveryMode);
177
- upsertEnvLine(envPath, "CELLO_SESSION_SCOPE", sessionScope);
178
- upsertEnvLine(envPath, "CELLO_CHANNEL_NOTIFICATIONS", channelNotifications);
179
- out.push(`Bound agent: CELLO_AGENT_NAME=${agentName} (${envPath})`);
180
- out.push(`Delivery: CELLO_DELIVERY_MODE=${deliveryMode}`);
181
- out.push(`Scope: CELLO_SESSION_SCOPE=${sessionScope}`);
182
- out.push(`Channels: CELLO_CHANNEL_NOTIFICATIONS=${channelNotifications}`);
183
- const landingJsonPath = join(hermesHome, "cello", "landing-session.json");
184
- if (landingSession) {
185
- upsertEnvLine(envPath, "CELLO_LANDING_SESSION", landingSession);
186
- mkdirSync(join(hermesHome, "cello"), { recursive: true });
187
- writeFileSync(landingJsonPath, JSON.stringify({ session_id: landingSession }, null, 2) + "\n");
188
- out.push(`Landing: CELLO_LANDING_SESSION=${landingSession}`);
189
- }
190
- else {
191
- removeEnvLine(envPath, "CELLO_LANDING_SESSION");
192
- if (existsSync(landingJsonPath)) {
193
- rmSync(landingJsonPath, { force: true });
194
- }
195
- out.push("Landing: default (CELLO_LANDING_SESSION unset)");
196
- }
197
- // 4. Register through Hermes' own CLI. A failure here is loud: the files are in
198
- // place, so we print exactly what remains to be run by hand.
199
- for (const args of HERMES_COMMANDS) {
200
- let result;
201
- try {
202
- result = await exec("hermes", [...args]);
203
- }
204
- catch (err) {
205
- const msg = err instanceof Error ? err.message : String(err);
206
- out.push(`\nCould not run the 'hermes' CLI (${msg}).`, "The CELLO files are installed, but Hermes still needs these two commands run manually:", " hermes plugins enable cello", " hermes mcp add cello --command npx --args --yes @cello-protocol/connect@latest", "Then restart the gateway: hermes gateway restart");
207
- return { exitCode: 1, output: out.join("\n") };
208
- }
209
- if (result.code !== 0) {
210
- out.push(`\n'hermes ${args.join(" ")}' failed (exit ${result.code}):`, (result.stderr || result.stdout).trim(), "Fix the error above and re-run 'cello bridge hermes' (it is idempotent).");
211
- return { exitCode: 1, output: out.join("\n") };
212
- }
213
- out.push(`Ran: hermes ${args.join(" ")}`);
214
- }
215
- // Verify the MCP registration actually landed: `hermes mcp add` can print
216
- // "Cancelled." and still exit 0 (e.g. when its interactive prompt hits EOF),
217
- // so the exit code alone proves nothing.
218
- try {
219
- const list = await exec("hermes", ["mcp", "list"]);
220
- if (!list.stdout.includes("cello")) {
221
- out.push("", "'hermes mcp add' reported success but 'hermes mcp list' does not show a 'cello' server.", "Run this manually and answer Y at the tool prompt:", " hermes mcp add cello --command npx --args --yes @cello-protocol/connect@latest");
222
- return { exitCode: 1, output: out.join("\n") };
223
- }
224
- }
225
- catch {
226
- // hermes CLI vanished between calls — vanishingly unlikely; the add above succeeded.
227
- }
228
- out.push("Verified: 'cello' present in hermes mcp list");
229
- out.push("", "CELLO bridge installed. Next step: restart the gateway so Hermes loads the plugin:", " hermes gateway restart", "Then verify from a Hermes chat by calling the cello_status MCP tool.");
230
- return { exitCode: 0, output: out.join("\n") };
231
- }
232
- //# sourceMappingURL=install-hermes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install-hermes.js","sourceRoot":"","sources":["../../src/hermes/install-hermes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAUjH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,CAAU,CAAC;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAoC,UAAU,CAAC;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAoC,OAAO,CAAC;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;AAC5D,MAAM,CAAC,MAAM,6BAA6B,GAA2C,IAAI,CAAC;AAkB1F;8DAC8D;AAC9D,MAAM,eAAe,GAAyC;IAC5D,CAAC,SAAS,EAAE,QAAQ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This is what makes `cello` a real programmatic interface rather than a human-only UI: any
5
- * bash-capable agent can drive a CELLO node with `cello <cmd> | jq` + `$?`, with no MCP dependency.
6
- *
7
- * The contract, applied identically by every parity command:
8
- * - stdout = the daemon's IPC response as JSON, one object per invocation (compact by default —
9
- * scripts and agents are the first-class consumer; `--pretty` for humans).
10
- * - exit 0 when the response is ok:true; non-zero otherwise.
11
- * - a FAILED response goes to stderr, VERBATIM — every field the daemon sent (reason, guidance,
12
- * and extras like the read-before-write cursor) survives untouched, and stdout stays EMPTY so a
13
- * piping script can never mistake an error body for a result.
14
- *
15
- * The verbatim rule is the DOD-SENDRAW-1 / DOD-LOGOUT-WAIT-1 lesson at the CLI surface: report the
16
- * outcome, never the intent. A command that reports success for a failed IPC call is a lie, and
17
- * absence of ok:true is NOT evidence of success — an unrecognized shape fails loud rather than
18
- * being optimistically passed off as a result.
19
- */
20
- export interface EmittedOutput {
21
- stdout: string;
22
- stderr: string;
23
- exitCode: number;
24
- }
25
- export interface EmitOptions {
26
- /** Human-readable indented JSON. JSON stays the default so scripts come first. */
27
- pretty?: boolean;
28
- }
29
- /**
30
- * Turn a daemon IPC response into the (stdout, stderr, exitCode) triple the contract demands.
31
- * The response is passed through UNMODIFIED in both directions — this function decides the stream
32
- * and the exit code, and is never allowed to rewrite, summarize, or invent the body.
33
- */
34
- export declare function emitIpcResult(result: Record<string, unknown>, opts?: EmitOptions): EmittedOutput;
35
- /**
36
- * A transport/daemon-level failure (socket unreachable, daemon not running, thrown error) — still
37
- * a structured, machine-parseable JSON error on stderr, so a bash agent branches on the same shape
38
- * whether the daemon rejected the call or never received it.
39
- */
40
- export declare function emitTransportError(reason: string, guidance: string, opts?: EmitOptions): EmittedOutput;
41
- //# sourceMappingURL=json-out.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-out.d.ts","sourceRoot":"","sources":["../src/json-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,GAAE,WAAgB,GACrB,aAAa,CAkBf;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,aAAa,CAM1G"}
package/dist/json-out.js DELETED
@@ -1,59 +0,0 @@
1
- /**
2
- * DOD-CLI-PARITY-1 §3 — the bash-adapter contract.
3
- *
4
- * This is what makes `cello` a real programmatic interface rather than a human-only UI: any
5
- * bash-capable agent can drive a CELLO node with `cello <cmd> | jq` + `$?`, with no MCP dependency.
6
- *
7
- * The contract, applied identically by every parity command:
8
- * - stdout = the daemon's IPC response as JSON, one object per invocation (compact by default —
9
- * scripts and agents are the first-class consumer; `--pretty` for humans).
10
- * - exit 0 when the response is ok:true; non-zero otherwise.
11
- * - a FAILED response goes to stderr, VERBATIM — every field the daemon sent (reason, guidance,
12
- * and extras like the read-before-write cursor) survives untouched, and stdout stays EMPTY so a
13
- * piping script can never mistake an error body for a result.
14
- *
15
- * The verbatim rule is the DOD-SENDRAW-1 / DOD-LOGOUT-WAIT-1 lesson at the CLI surface: report the
16
- * outcome, never the intent. A command that reports success for a failed IPC call is a lie, and
17
- * absence of ok:true is NOT evidence of success — an unrecognized shape fails loud rather than
18
- * being optimistically passed off as a result.
19
- */
20
- function render(value, pretty) {
21
- return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);
22
- }
23
- /**
24
- * Turn a daemon IPC response into the (stdout, stderr, exitCode) triple the contract demands.
25
- * The response is passed through UNMODIFIED in both directions — this function decides the stream
26
- * and the exit code, and is never allowed to rewrite, summarize, or invent the body.
27
- */
28
- export function emitIpcResult(result, opts = {}) {
29
- // The exit code keys on `ok === false`, not on `ok === true`, because the daemon has TWO response
30
- // conventions and only one of them carries `ok`:
31
- // (a) ok-bearing — { ok: true, … } / { ok: false, reason, guidance }
32
- // (b) payload-only — a bare result with NO `ok` at all: cello_list_agents returns { agents: [] },
33
- // cello_await_session returns { type: "timeout" | … }.
34
- // `ok: false` is the daemon's ONE failure convention; a genuine transport/daemon failure THROWS
35
- // and is handled by the caller as a transport error. So a payload without `ok` is a result, and
36
- // routing it to stderr would report working commands as broken — `cello agents` would exit 1 on
37
- // success.
38
- //
39
- // This does NOT weaken the no-fabricated-success rule: we never synthesize an ok:true, never
40
- // rewrite a body, and never swallow an ok:false. We report exactly what the daemon said.
41
- const failed = result.ok === false;
42
- if (failed) {
43
- return { stdout: "", stderr: render(result, opts.pretty), exitCode: 1 };
44
- }
45
- return { stdout: render(result, opts.pretty), stderr: "", exitCode: 0 };
46
- }
47
- /**
48
- * A transport/daemon-level failure (socket unreachable, daemon not running, thrown error) — still
49
- * a structured, machine-parseable JSON error on stderr, so a bash agent branches on the same shape
50
- * whether the daemon rejected the call or never received it.
51
- */
52
- export function emitTransportError(reason, guidance, opts = {}) {
53
- return {
54
- stdout: "",
55
- stderr: render({ ok: false, reason, guidance }, opts.pretty),
56
- exitCode: 1,
57
- };
58
- }
59
- //# sourceMappingURL=json-out.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-out.js","sourceRoot":"","sources":["../src/json-out.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH,SAAS,MAAM,CAAC,KAAc,EAAE,MAA2B;IACzD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA+B,EAC/B,OAAoB,EAAE;IAEtB,kGAAkG;IAClG,iDAAiD;IACjD,wEAAwE;IACxE,oGAAoG;IACpG,6DAA6D;IAC7D,gGAAgG;IAChG,gGAAgG;IAChG,gGAAgG;IAChG,WAAW;IACX,EAAE;IACF,6FAA6F;IAC7F,yFAAyF;IACzF,MAAM,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC;IACnC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC1E,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,QAAgB,EAAE,OAAoB,EAAE;IACzF,OAAO;QACL,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;QAC5D,QAAQ,EAAE,CAAC;KACZ,CAAC;AACJ,CAAC"}
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-runtime-guard-init.d.ts","sourceRoot":"","sources":["../src/node-runtime-guard-init.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,48 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,79 +0,0 @@
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
@@ -1 +0,0 @@
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,EAAE,CAAC,CAAC;IAC/E,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACpD,MAAM,GAAG,GAAG,IAAI,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACnD,MAAM,QAAQ,GACZ,IAAI,EAAE,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC;IAE/F,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,I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