@matelink/cli 2026.4.20 → 2026.4.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/README.md CHANGED
@@ -178,3 +178,31 @@ API:
178
178
  - `GET /v1/gateways/{gatewayId}/requests/next` gateway bridge polls pending chat requests
179
179
  - `POST /v1/gateways/{gatewayId}/requests/{requestId}/events` gateway bridge streams relay events
180
180
  - `POST /v1/openclaw/responses` app chat endpoint (supports `gatewayId + clientToken`)
181
+
182
+ ## 9) CLI Bridge Logging
183
+
184
+ Bridge runs as a systemd user service on server 80, logs are written to files.
185
+
186
+ ### Viewing logs (server 80)
187
+
188
+ ```bash
189
+ tail -f /root/.openclaw/matecli/logs/bridge.stdout.log # normal logs (requests, relay status)
190
+ tail -f /root/.openclaw/matecli/logs/bridge.stderr.log # error logs (poll failures, retries)
191
+
192
+ # last 100 lines
193
+ tail -100 /root/.openclaw/matecli/logs/bridge.stderr.log
194
+
195
+ # search for specific request
196
+ grep "Bridge request" /root/.openclaw/matecli/logs/bridge.stdout.log | tail -20
197
+ ```
198
+
199
+ ### Service management
200
+
201
+ ```bash
202
+ systemctl --user status matelink-matecli-bridge # check status
203
+ systemctl --user restart matelink-matecli-bridge # restart
204
+ systemctl --user stop matelink-matecli-bridge # stop
205
+ journalctl --user -u matelink-matecli-bridge -f # systemd journal (if enabled)
206
+ ```
207
+
208
+ Service config: `~/.config/systemd/user/matelink-matecli-bridge.service`
package/bin/matecli.mjs CHANGED
@@ -18,7 +18,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
18
18
 
19
19
  const NUMERIC_CODE_LENGTH = 4;
20
20
  const GROUP_SIZE = 4;
21
- const DEFAULT_RELAY_WORKER_WAIT_SECONDS = 600;
21
+ const DEFAULT_RELAY_WORKER_WAIT_SECONDS = 90;
22
22
  const DEFAULT_NETWORK_TIMEOUT_MS = 600000;
23
23
  const BRIDGE_RETRY_DELAY_MS = 2000;
24
24
  const DEFAULT_RELAY_URL = "https://test-mate.clipzap.ai";
@@ -1650,12 +1650,12 @@ async function readRelayGatewayBinding({
1650
1650
  gatewayToken,
1651
1651
  }) {
1652
1652
  const url = `${trimSlash(relayUrl)}/v1/gateways/${encodeURIComponent(gatewayId)}/binding`;
1653
- const response = await fetch(url, {
1653
+ const response = await fetchWithTimeout(url, {
1654
1654
  method: "GET",
1655
1655
  headers: {
1656
1656
  ...relayGatewayHeaders(gatewayToken),
1657
1657
  },
1658
- });
1658
+ }, 30000);
1659
1659
  const text = await response.text();
1660
1660
  const decoded = text ? safeJsonParse(text) : null;
1661
1661
  if (response.status === 404) {
@@ -1691,12 +1691,12 @@ async function resetRelayGatewayBinding({
1691
1691
  gatewayToken,
1692
1692
  }) {
1693
1693
  const url = `${trimSlash(relayUrl)}/v1/gateways/${encodeURIComponent(gatewayId)}/reset`;
1694
- const response = await fetch(url, {
1694
+ const response = await fetchWithTimeout(url, {
1695
1695
  method: "POST",
1696
1696
  headers: {
1697
1697
  ...relayGatewayHeaders(gatewayToken),
1698
1698
  },
1699
- });
1699
+ }, 30000);
1700
1700
  const text = await response.text();
1701
1701
  const decoded = text ? safeJsonParse(text) : null;
1702
1702
  if (response.status === 404) {
@@ -2375,11 +2375,11 @@ async function probeGatewayResponsesEndpoint({
2375
2375
  }
2376
2376
 
2377
2377
  try {
2378
- const response = await fetch(url, {
2378
+ const response = await fetchWithTimeout(url, {
2379
2379
  method: "POST",
2380
2380
  headers,
2381
2381
  body: JSON.stringify({}),
2382
- });
2382
+ }, 10000);
2383
2383
  return {
2384
2384
  ok: ![401, 403, 404].includes(response.status),
2385
2385
  status: response.status,
@@ -2483,7 +2483,7 @@ async function publishPairToRelay({
2483
2483
  "content-type": "application/json",
2484
2484
  ...relayAuthHeaders(),
2485
2485
  };
2486
- const response = await fetch(url, {
2486
+ const response = await fetchWithTimeout(url, {
2487
2487
  method: "POST",
2488
2488
  headers,
2489
2489
  body: JSON.stringify({
@@ -2513,7 +2513,7 @@ async function publishPairToRelay({
2513
2513
 
2514
2514
  async function readPairSessionFromRelay({ relayUrl, code }) {
2515
2515
  const url = `${relayUrl}/v1/pair-sessions/${encodeURIComponent(code)}`;
2516
- const response = await fetch(url, { method: "GET" });
2516
+ const response = await fetchWithTimeout(url, { method: "GET" }, 30000);
2517
2517
  const text = await response.text();
2518
2518
  const decoded = text ? safeJsonParse(text) : null;
2519
2519
  if (response.status === 404) {
@@ -2557,12 +2557,12 @@ async function readRelayNextBindRequest({ relayUrl, code, after, waitSeconds })
2557
2557
  }
2558
2558
  url.searchParams.set("waitSeconds", String(waitSeconds));
2559
2559
 
2560
- const response = await fetch(url, {
2560
+ const response = await fetchWithTimeout(url, {
2561
2561
  method: "GET",
2562
2562
  headers: {
2563
2563
  ...relayAuthHeaders(),
2564
2564
  },
2565
- });
2565
+ }, 95000);
2566
2566
 
2567
2567
  if (response.status === 204) {
2568
2568
  return null;
@@ -2601,14 +2601,14 @@ async function readRelayNextBindRequest({ relayUrl, code, after, waitSeconds })
2601
2601
 
2602
2602
  async function publishRelayBindResult({ relayUrl, code, payload }) {
2603
2603
  const url = `${relayUrl}/v1/pair-sessions/${encodeURIComponent(code)}/bind-results`;
2604
- const response = await fetch(url, {
2604
+ const response = await fetchWithTimeout(url, {
2605
2605
  method: "POST",
2606
2606
  headers: {
2607
2607
  "content-type": "application/json",
2608
2608
  ...relayAuthHeaders(),
2609
2609
  },
2610
2610
  body: JSON.stringify(payload),
2611
- });
2611
+ }, 30000);
2612
2612
 
2613
2613
  const text = await response.text();
2614
2614
  if (!response.ok) {
@@ -3543,11 +3543,11 @@ async function proxyGatewayRequestLocal({
3543
3543
 
3544
3544
  let response;
3545
3545
  try {
3546
- response = await fetch(localUrl, {
3546
+ response = await fetchWithTimeout(localUrl, {
3547
3547
  method: "POST",
3548
3548
  headers,
3549
3549
  body: JSON.stringify(payload),
3550
- });
3550
+ }, DEFAULT_NETWORK_TIMEOUT_MS);
3551
3551
  } catch (error) {
3552
3552
  await publishRelayGatewayEvent({
3553
3553
  relayUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matelink/cli",
3
- "version": "2026.4.20",
3
+ "version": "2026.4.22",
4
4
  "private": false,
5
5
  "description": "Relay-first CLI for pairing and bridging OpenClaw gateway traffic",
6
6
  "type": "module",