@ssdavidai/zoclaw 1.3.0 → 1.3.1
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 +1 -1
- package/scripts/bootstrap.sh +43 -0
package/package.json
CHANGED
package/scripts/bootstrap.sh
CHANGED
|
@@ -142,6 +142,39 @@ pkill -f "openclaw gateway run" 2>/dev/null || true
|
|
|
142
142
|
pkill -f "openclaw-gateway" 2>/dev/null || true
|
|
143
143
|
sleep 1
|
|
144
144
|
|
|
145
|
+
# Register in /substrate_runtime_info.json so the Zo UI shows the service.
|
|
146
|
+
RUNTIME_INFO="/substrate_runtime_info.json"
|
|
147
|
+
if [ -f "$RUNTIME_INFO" ]; then
|
|
148
|
+
node -e "
|
|
149
|
+
const fs = require('fs');
|
|
150
|
+
const ri = JSON.parse(fs.readFileSync(process.argv[1], 'utf8'));
|
|
151
|
+
ri.services ??= [];
|
|
152
|
+
if (!ri.services.some(s => s.name === 'openclaw-gateway')) {
|
|
153
|
+
ri.services.push({
|
|
154
|
+
name: 'openclaw-gateway',
|
|
155
|
+
entrypoint: 'openclaw gateway run',
|
|
156
|
+
port: 18789,
|
|
157
|
+
encrypted_port: false,
|
|
158
|
+
env_vars: {},
|
|
159
|
+
workdir: '/home/workspace',
|
|
160
|
+
is_user_defined: true,
|
|
161
|
+
supervisor_overrides: {
|
|
162
|
+
autorestart: 'true',
|
|
163
|
+
stdout_logfile_maxbytes: '10MB',
|
|
164
|
+
stopsignal: 'TERM',
|
|
165
|
+
stopasgroup: 'true',
|
|
166
|
+
killasgroup: 'true'
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
fs.writeFileSync(process.argv[1], JSON.stringify(ri, null, 2) + '\n');
|
|
170
|
+
console.log(' Added openclaw-gateway to runtime_info services');
|
|
171
|
+
} else {
|
|
172
|
+
console.log(' openclaw-gateway already in runtime_info services');
|
|
173
|
+
}
|
|
174
|
+
" "$RUNTIME_INFO"
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
# Add supervisor program config
|
|
145
178
|
if ! grep -q "\[program:openclaw-gateway\]" "$USER_SUPERVISOR" 2>/dev/null; then
|
|
146
179
|
cat >> "$USER_SUPERVISOR" << 'SUPERVISOR'
|
|
147
180
|
[program:openclaw-gateway]
|
|
@@ -166,6 +199,16 @@ else
|
|
|
166
199
|
echo " [program:openclaw-gateway] already in user supervisor"
|
|
167
200
|
fi
|
|
168
201
|
|
|
202
|
+
# Notify Zo API about the service change
|
|
203
|
+
HOST_KEY=$(node -pe "JSON.parse(require('fs').readFileSync('$RUNTIME_INFO','utf8')).tags?.host_key ?? ''" 2>/dev/null || true)
|
|
204
|
+
if [ -n "$HOST_KEY" ]; then
|
|
205
|
+
curl -s -X POST https://api.zo.computer/snapshot \
|
|
206
|
+
-H "Content-Type: application/json" \
|
|
207
|
+
-d "{\"host_key\": \"$HOST_KEY\", \"reason\": \"openclaw_gateway_registered\"}" \
|
|
208
|
+
> /dev/null 2>&1 || true
|
|
209
|
+
echo " Notified Zo API (snapshot)"
|
|
210
|
+
fi
|
|
211
|
+
|
|
169
212
|
# ─── 4. Phase 1: Start gateway, auto-pair local device ───────────────
|
|
170
213
|
|
|
171
214
|
echo ""
|