@agent-p2p/cli 0.0.3 → 0.0.5

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/dist/index.js CHANGED
@@ -1,6 +1,26 @@
1
1
  #!/usr/bin/env bun
2
- // No WebRTC polyfill needed trystero bundles its own via @thaunknown/simple-peer + webrtc-polyfill
3
- import { joinCommand, publishCommand, peersCommand, historyCommand, identityCommand } from "./commands/index.js";
2
+ // Ensure the node-datachannel native binary exists.
3
+ // bunx blocks install scripts, so prebuild-install never runs.
4
+ // We detect this and run it ourselves before importing trystero.
5
+ import { existsSync } from "node:fs";
6
+ import { dirname, join } from "node:path";
7
+ import { execSync } from "node:child_process";
8
+ import { createRequire } from "node:module";
9
+ const require = createRequire(import.meta.url);
10
+ try {
11
+ const ndcDir = dirname(require.resolve("node-datachannel/package.json"));
12
+ const binary = join(ndcDir, "build", "Release", "node_datachannel.node");
13
+ if (!existsSync(binary)) {
14
+ const prebuild = join(ndcDir, "..", "prebuild-install", "bin.js");
15
+ if (existsSync(prebuild)) {
16
+ execSync(`node ${prebuild} -r napi`, { cwd: ndcDir, stdio: "ignore" });
17
+ }
18
+ }
19
+ }
20
+ catch {
21
+ // Will fail later with a more descriptive error if WebRTC is needed
22
+ }
23
+ const { joinCommand, publishCommand, peersCommand, historyCommand, identityCommand } = await import("./commands/index.js");
4
24
  const USAGE = `agent-p2p — P2P signal streaming CLI
5
25
 
6
26
  Usage:
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,qGAAqG;AAErG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjH,MAAM,KAAK,GAAG;;;;;;;;CAQb,CAAC;AAEF,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI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"version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "CLI for agent-p2p — join stations, publish signals, and manage identity",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@agent-p2p/core": "^0.0.1",
23
- "@agent-p2p/peer": "^0.0.2"
23
+ "@agent-p2p/peer": "^0.0.3"
24
24
  },
25
25
  "license": "MIT",
26
26
  "repository": {
package/src/index.ts CHANGED
@@ -1,8 +1,28 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- // No WebRTC polyfill needed trystero bundles its own via @thaunknown/simple-peer + webrtc-polyfill
3
+ // Ensure the node-datachannel native binary exists.
4
+ // bunx blocks install scripts, so prebuild-install never runs.
5
+ // We detect this and run it ourselves before importing trystero.
6
+ import { existsSync } from "node:fs";
7
+ import { dirname, join } from "node:path";
8
+ import { execSync } from "node:child_process";
9
+ import { createRequire } from "node:module";
4
10
 
5
- import { joinCommand, publishCommand, peersCommand, historyCommand, identityCommand } from "./commands/index.js";
11
+ const require = createRequire(import.meta.url);
12
+ try {
13
+ const ndcDir = dirname(require.resolve("node-datachannel/package.json"));
14
+ const binary = join(ndcDir, "build", "Release", "node_datachannel.node");
15
+ if (!existsSync(binary)) {
16
+ const prebuild = join(ndcDir, "..", "prebuild-install", "bin.js");
17
+ if (existsSync(prebuild)) {
18
+ execSync(`node ${prebuild} -r napi`, { cwd: ndcDir, stdio: "ignore" });
19
+ }
20
+ }
21
+ } catch {
22
+ // Will fail later with a more descriptive error if WebRTC is needed
23
+ }
24
+
25
+ const { joinCommand, publishCommand, peersCommand, historyCommand, identityCommand } = await import("./commands/index.js");
6
26
 
7
27
  const USAGE = `agent-p2p — P2P signal streaming CLI
8
28