create-walle 0.4.3 → 0.4.4
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
|
@@ -123,6 +123,7 @@
|
|
|
123
123
|
<div class="done-section">
|
|
124
124
|
<a href="/index.html" id="done-link">Go to Dashboard →</a>
|
|
125
125
|
<div style="margin-top:8px;font-size:12px;color:var(--dim)">You can return to this page anytime from the settings icon in the nav bar.</div>
|
|
126
|
+
<div id="version-label" style="margin-top:16px;font-size:11px;color:#30363d"></div>
|
|
126
127
|
</div>
|
|
127
128
|
</div>
|
|
128
129
|
|
|
@@ -139,6 +140,9 @@
|
|
|
139
140
|
if (d.slack_connected) {
|
|
140
141
|
document.getElementById('slack-btn').outerHTML = '<span class="badge badge-connected">Connected</span>';
|
|
141
142
|
}
|
|
143
|
+
if (d.version) {
|
|
144
|
+
document.getElementById('version-label').textContent = 'Wall-E v' + d.version;
|
|
145
|
+
}
|
|
142
146
|
} catch {}
|
|
143
147
|
}
|
|
144
148
|
|
|
@@ -202,7 +202,9 @@ function handleApi(req, res, url) {
|
|
|
202
202
|
slackConnected = fs.existsSync(tokPath);
|
|
203
203
|
} catch {}
|
|
204
204
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
205
|
-
|
|
205
|
+
let version = '';
|
|
206
|
+
try { version = require('../package.json').version; } catch {}
|
|
207
|
+
res.end(JSON.stringify({ owner_name: ownerName, has_api_key: hasApiKey, slack_connected: slackConnected, needs_setup: setup.needsSetup(), version }));
|
|
206
208
|
return;
|
|
207
209
|
}
|
|
208
210
|
if (url.pathname === '/api/setup/detect-key' && req.method === 'GET') {
|
|
@@ -339,6 +341,10 @@ function handleApi(req, res, url) {
|
|
|
339
341
|
}
|
|
340
342
|
fs.writeFileSync(envPath, lines.join('\n') + '\n', { mode: 0o600 });
|
|
341
343
|
setup.clearSetupCache(); // so next / request goes to dashboard
|
|
344
|
+
// Restart Wall-E so it picks up the new env vars from .env
|
|
345
|
+
if (apiKey || gw) {
|
|
346
|
+
_restartWalleQuiet();
|
|
347
|
+
}
|
|
342
348
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
343
349
|
res.end(JSON.stringify({ ok: true }));
|
|
344
350
|
} catch (e) {
|
|
@@ -2181,6 +2187,24 @@ function apiStartWalle(req, res) {
|
|
|
2181
2187
|
});
|
|
2182
2188
|
}
|
|
2183
2189
|
|
|
2190
|
+
// Silent Wall-E restart (no HTTP response needed) — used after saving API key
|
|
2191
|
+
function _restartWalleQuiet() {
|
|
2192
|
+
const walleDir = path.join(__dirname, '..', 'wall-e');
|
|
2193
|
+
const agentScript = path.join(walleDir, 'agent.js');
|
|
2194
|
+
execFile('lsof', ['-ti', ':' + WALLE_PORT], (err, stdout) => {
|
|
2195
|
+
const pids = (stdout || '').trim().split('\n').filter(Boolean);
|
|
2196
|
+
for (const pid of pids) { try { process.kill(parseInt(pid), 'SIGTERM'); } catch {} }
|
|
2197
|
+
setTimeout(() => {
|
|
2198
|
+
const child = require('child_process').spawn(
|
|
2199
|
+
process.execPath, [agentScript],
|
|
2200
|
+
{ cwd: walleDir, detached: true, stdio: 'ignore', env: { ...process.env, WALL_E_PORT: String(WALLE_PORT) } }
|
|
2201
|
+
);
|
|
2202
|
+
child.unref();
|
|
2203
|
+
console.log('[setup] Restarted Wall-E (PID ' + child.pid + ') to pick up new API config');
|
|
2204
|
+
}, 1000);
|
|
2205
|
+
});
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2184
2208
|
function apiRestartCtm(req, res) {
|
|
2185
2209
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
2186
2210
|
res.end(JSON.stringify({ ok: true, message: 'CTM server restarting...' }));
|