@omnixal/openclaw-nats-plugin 0.1.2 → 0.1.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.
@@ -24,7 +24,7 @@ export function detectPlatform(): { os: string; arch: string } {
24
24
  }
25
25
 
26
26
  export function getNatsDownloadUrl(version: string, os: string, arch: string): string {
27
- return `https://github.com/nats-io/nats-server/releases/download/v${version}/nats-server-v${version}-${os}-${arch}.zip`;
27
+ return `https://github.com/nats-io/nats-server/releases/download/v${version}/nats-server-v${version}-${os}-${arch}.tar.gz`;
28
28
  }
29
29
 
30
30
  export async function downloadNatsServer(): Promise<string> {
@@ -35,7 +35,7 @@ export async function downloadNatsServer(): Promise<string> {
35
35
 
36
36
  const { os, arch } = detectPlatform();
37
37
  const url = getNatsDownloadUrl(NATS_VERSION, os, arch);
38
- const zipPath = join(BIN_DIR, 'nats-server.zip');
38
+ const archivePath = join(BIN_DIR, 'nats-server.tar.gz');
39
39
  const extractDir = join(BIN_DIR, 'nats-extract');
40
40
 
41
41
  mkdirSync(BIN_DIR, { recursive: true });
@@ -45,7 +45,7 @@ export async function downloadNatsServer(): Promise<string> {
45
45
  let lastError: Error | null = null;
46
46
  for (let attempt = 1; attempt <= 3; attempt++) {
47
47
  try {
48
- execFileSync('curl', ['-fsSL', '-o', zipPath, url], { stdio: 'pipe', timeout: 120_000 });
48
+ execFileSync('curl', ['-fsSL', '-o', archivePath, url], { stdio: 'pipe', timeout: 120_000 });
49
49
  lastError = null;
50
50
  break;
51
51
  } catch (e) {
@@ -67,14 +67,14 @@ export async function downloadNatsServer(): Promise<string> {
67
67
  try {
68
68
  execFileSync('curl', ['-fsSL', '-o', join(BIN_DIR, 'SHA256SUMS'), checksumUrl], { stdio: 'pipe', timeout: 30_000 });
69
69
 
70
- const zipData = readFileSync(zipPath);
71
- const actualHash = createHash('sha256').update(zipData).digest('hex');
70
+ const archiveData = readFileSync(archivePath);
71
+ const actualHash = createHash('sha256').update(archiveData).digest('hex');
72
72
  const checksumContent = readFileSync(join(BIN_DIR, 'SHA256SUMS'), 'utf-8');
73
- const expectedLine = checksumContent.split('\n').find(line => line.includes(`nats-server-v${NATS_VERSION}-${os}-${arch}.zip`));
73
+ const expectedLine = checksumContent.split('\n').find(line => line.includes(`nats-server-v${NATS_VERSION}-${os}-${arch}.tar.gz`));
74
74
  if (expectedLine) {
75
75
  const expectedHash = expectedLine.split(/\s+/)[0];
76
76
  if (actualHash !== expectedHash) {
77
- rmSync(zipPath);
77
+ rmSync(archivePath);
78
78
  throw new Error(`Checksum mismatch for nats-server download.\nExpected: ${expectedHash}\nActual: ${actualHash}`);
79
79
  }
80
80
  console.log('Checksum verified');
@@ -91,7 +91,7 @@ export async function downloadNatsServer(): Promise<string> {
91
91
 
92
92
  try {
93
93
  mkdirSync(extractDir, { recursive: true });
94
- execFileSync('unzip', ['-o', zipPath, '-d', extractDir], { stdio: 'pipe' });
94
+ execFileSync('tar', ['xzf', archivePath, '-C', extractDir], { stdio: 'pipe' });
95
95
 
96
96
  const innerDir = `nats-server-v${NATS_VERSION}-${os}-${arch}`;
97
97
  const extractedBin = join(extractDir, innerDir, 'nats-server');
@@ -99,7 +99,7 @@ export async function downloadNatsServer(): Promise<string> {
99
99
  renameSync(extractedBin, NATS_SERVER_BIN);
100
100
  chmodSync(NATS_SERVER_BIN, 0o755);
101
101
  } finally {
102
- if (existsSync(zipPath)) rmSync(zipPath);
102
+ if (existsSync(archivePath)) rmSync(archivePath);
103
103
  if (existsSync(extractDir)) rmSync(extractDir, { recursive: true });
104
104
  }
105
105
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "nats-plugin",
2
+ "id": "openclaw-nats-plugin",
3
3
  "configSchema": {
4
4
  "type": "object",
5
5
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnixal/openclaw-nats-plugin",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "NATS JetStream event-driven plugin for OpenClaw",
5
5
  "license": "MIT",
6
6
  "type": "module",