@clawlabz/clawnetwork 0.1.21 → 0.1.22
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/index.ts +7 -5
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare function setInterval(fn: () => void, ms: number): unknown
|
|
|
7
7
|
declare function clearInterval(id: unknown): void
|
|
8
8
|
declare function fetch(url: string, init?: Record<string, unknown>): Promise<{ status: number; ok: boolean; text: () => Promise<string>; json: () => Promise<unknown> }>
|
|
9
9
|
|
|
10
|
-
const VERSION = '0.1.
|
|
10
|
+
const VERSION = '0.1.22'
|
|
11
11
|
const PLUGIN_ID = 'clawnetwork'
|
|
12
12
|
const GITHUB_REPO = 'clawlabz/claw-network'
|
|
13
13
|
const DEFAULT_RPC_PORT = 9710
|
|
@@ -505,12 +505,14 @@ function isNodeRunning(): { running: boolean; pid: number | null } {
|
|
|
505
505
|
return { running: false, pid: null }
|
|
506
506
|
}
|
|
507
507
|
|
|
508
|
-
/** Check if a TCP port is in use
|
|
508
|
+
/** Check if a TCP port is in use via nc -z (works across users, no bind needed) */
|
|
509
509
|
function isPortInUse(port: number): boolean {
|
|
510
510
|
try {
|
|
511
|
-
execFileSync('
|
|
512
|
-
return true
|
|
513
|
-
} catch {
|
|
511
|
+
execFileSync('nc', ['-z', '127.0.0.1', String(port)], { timeout: 2000, stdio: 'ignore' })
|
|
512
|
+
return true // connection succeeded → something is listening
|
|
513
|
+
} catch {
|
|
514
|
+
return false // connection refused → port is free
|
|
515
|
+
}
|
|
514
516
|
}
|
|
515
517
|
|
|
516
518
|
/** Find available ports starting from the configured ones, skipping occupied ports */
|
package/openclaw.plugin.json
CHANGED