palmier 0.2.2 → 0.2.3

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.
@@ -2,6 +2,7 @@ import * as http from "node:http";
2
2
  import { StringCodec } from "nats";
3
3
  import { loadConfig } from "../config.js";
4
4
  import { connectNats } from "../nats-client.js";
5
+ import { detectLanIp } from "../transports/http-transport.js";
5
6
  import { addSession } from "../session-store.js";
6
7
  const CODE_CHARS = "ABCDEFGHJKMNPQRSTUVWXYZ23456789"; // no O/0/I/1/L
7
8
  const CODE_LENGTH = 6;
@@ -78,6 +79,12 @@ export async function pairCommand() {
78
79
  console.log("");
79
80
  console.log(` ${code}`);
80
81
  console.log("");
82
+ if (mode === "lan" || mode === "auto") {
83
+ const ip = detectLanIp();
84
+ const port = config.directPort ?? 7400;
85
+ console.log(` LAN Address: ${ip}:${port}`);
86
+ console.log("");
87
+ }
81
88
  console.log("Code expires in 5 minutes.");
82
89
  // NATS pairing (nats or auto mode)
83
90
  if (mode === "nats" || mode === "auto") {
@@ -1,4 +1,5 @@
1
1
  import type { HostConfig, RpcMessage } from "../types.js";
2
+ export declare function detectLanIp(): string;
2
3
  /**
3
4
  * Start the HTTP transport: Express-like server with RPC, SSE, and health endpoints.
4
5
  */
@@ -2,7 +2,7 @@ import * as http from "node:http";
2
2
  import * as os from "os";
3
3
  import { validateSession, hasSessions, addSession } from "../session-store.js";
4
4
  const pendingPairs = new Map();
5
- function detectLanIp() {
5
+ export function detectLanIp() {
6
6
  const interfaces = os.networkInterfaces();
7
7
  for (const name of Object.keys(interfaces)) {
8
8
  for (const iface of interfaces[name] ?? []) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palmier",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Palmier host CLI - provisions, executes tasks, and serves NATS RPC",
5
5
  "license": "ISC",
6
6
  "author": "Hongxu Cai",
@@ -2,6 +2,7 @@ import * as http from "node:http";
2
2
  import { StringCodec } from "nats";
3
3
  import { loadConfig } from "../config.js";
4
4
  import { connectNats } from "../nats-client.js";
5
+ import { detectLanIp } from "../transports/http-transport.js";
5
6
  import { addSession } from "../session-store.js";
6
7
  import type { HostConfig } from "../types.js";
7
8
 
@@ -97,6 +98,14 @@ export async function pairCommand(): Promise<void> {
97
98
  console.log("");
98
99
  console.log(` ${code}`);
99
100
  console.log("");
101
+
102
+ if (mode === "lan" || mode === "auto") {
103
+ const ip = detectLanIp();
104
+ const port = config.directPort ?? 7400;
105
+ console.log(` LAN Address: ${ip}:${port}`);
106
+ console.log("");
107
+ }
108
+
100
109
  console.log("Code expires in 5 minutes.");
101
110
 
102
111
  // NATS pairing (nats or auto mode)
@@ -12,7 +12,7 @@ interface PendingPair {
12
12
 
13
13
  const pendingPairs = new Map<string, PendingPair>();
14
14
 
15
- function detectLanIp(): string {
15
+ export function detectLanIp(): string {
16
16
  const interfaces = os.networkInterfaces();
17
17
  for (const name of Object.keys(interfaces)) {
18
18
  for (const iface of interfaces[name] ?? []) {