@ssdavidai/zoclaw 1.1.2 → 1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssdavidai/zoclaw",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Set up OpenClaw on Zo with Tailscale access in one command",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -80,22 +80,55 @@ sleep 2
80
80
  openclaw gateway run --force > /dev/null 2>&1 &
81
81
  sleep 5
82
82
 
83
- # Verify
84
- if pgrep -f openclaw-gateway > /dev/null 2>&1; then
85
- TOKEN=$(node -pe "JSON.parse(require('fs').readFileSync('${CONFIG}','utf8')).gateway?.auth?.token ?? ''")
86
- TS_URL=$(tailscale serve status 2>/dev/null | grep -oP 'https://\S+' | head -1 || true)
87
-
88
- echo ""
89
- echo "Ready!"
90
- echo " TUI: openclaw tui"
91
- if [ -n "$TS_URL" ] && [ -n "$TOKEN" ]; then
92
- echo " Browser: ${TS_URL}?token=${TOKEN}"
93
- echo ""
94
- echo " On first browser load, the Control UI will request device pairing."
95
- echo " Approve it from the TUI or CLI:"
96
- echo " openclaw devices list"
97
- echo " openclaw devices approve <request-id>"
98
- fi
99
- else
83
+ # Verify gateway is running
84
+ if ! pgrep -f openclaw-gateway > /dev/null 2>&1; then
100
85
  echo "Warning: gateway did not start. Check 'openclaw gateway run --force' manually."
86
+ exit 1
87
+ fi
88
+
89
+ # Auto-pair: trigger a connection attempt to generate a pending request,
90
+ # then approve all pending devices so the TUI can connect immediately.
91
+ echo "Setting up device pairing..."
92
+ timeout 3 openclaw tui 2>/dev/null &
93
+ sleep 3
94
+
95
+ if [ -f "$PENDING" ]; then
96
+ node -e "
97
+ const fs = require('fs');
98
+ const pendingFile = process.argv[1];
99
+ const pairedFile = process.argv[2];
100
+ const pending = JSON.parse(fs.readFileSync(pendingFile, 'utf8'));
101
+ let paired = {};
102
+ try { paired = JSON.parse(fs.readFileSync(pairedFile, 'utf8')); } catch {}
103
+ const scopes = ['operator.read','operator.admin','operator.approvals','operator.pairing'];
104
+ let count = 0;
105
+ for (const [id, dev] of Object.entries(pending)) {
106
+ dev.scopes = scopes;
107
+ paired[id] = dev;
108
+ count++;
109
+ }
110
+ if (count > 0) {
111
+ fs.writeFileSync(pairedFile, JSON.stringify(paired, null, 2) + '\n');
112
+ fs.writeFileSync(pendingFile, '{}');
113
+ console.log(' ✓ Auto-approved ' + count + ' device(s)');
114
+ } else {
115
+ console.log(' No pending devices to approve');
116
+ }
117
+ " "$PENDING" "$PAIRED"
118
+ fi
119
+
120
+ # Restart gateway again to pick up new pairings
121
+ pkill -f openclaw-gateway 2>/dev/null || true
122
+ sleep 2
123
+ openclaw gateway run --force > /dev/null 2>&1 &
124
+ sleep 3
125
+
126
+ TOKEN=$(node -pe "JSON.parse(require('fs').readFileSync('${CONFIG}','utf8')).gateway?.auth?.token ?? ''")
127
+ TS_URL=$(tailscale serve status 2>/dev/null | grep -oP 'https://\S+' | head -1 || true)
128
+
129
+ echo ""
130
+ echo "Ready!"
131
+ echo " TUI: openclaw tui"
132
+ if [ -n "$TS_URL" ] && [ -n "$TOKEN" ]; then
133
+ echo " Browser: ${TS_URL}?token=${TOKEN}"
101
134
  fi