@wolpertingerlabs/drawlatch 1.0.0-alpha.9.3 → 1.0.0-alpha.9.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/bin/drawlatch.js +20 -14
- package/dist/remote/server.js +16 -2
- package/package.json +1 -1
package/bin/drawlatch.js
CHANGED
|
@@ -356,10 +356,16 @@ async function cmdStart() {
|
|
|
356
356
|
}
|
|
357
357
|
console.log(` Logs: drawlatch logs`);
|
|
358
358
|
} else {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
359
|
+
const stillAlive = isProcessAlive(child.pid);
|
|
360
|
+
if (stillAlive) {
|
|
361
|
+
console.log(
|
|
362
|
+
`\nServer started (PID ${child.pid}) but health check did not pass within 5s.`,
|
|
363
|
+
);
|
|
364
|
+
console.log(` The server process is still running — it may need more time.`);
|
|
365
|
+
} else {
|
|
366
|
+
console.log(`\nServer process (PID ${child.pid}) exited before becoming healthy.`);
|
|
367
|
+
cleanPidFile();
|
|
368
|
+
}
|
|
363
369
|
await diagnoseStartFailure();
|
|
364
370
|
}
|
|
365
371
|
}
|
|
@@ -956,18 +962,18 @@ function ensureConfigDir() {
|
|
|
956
962
|
// ── Diagnostic utilities ──────────────────────────────────────────
|
|
957
963
|
|
|
958
964
|
async function diagnoseStartFailure() {
|
|
959
|
-
if (!existsSync(LOG_FILE))
|
|
965
|
+
if (!existsSync(LOG_FILE)) {
|
|
966
|
+
console.log("\n No log file found. The server may not have started at all.");
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
960
969
|
try {
|
|
961
970
|
const content = readFileSync(LOG_FILE, "utf-8");
|
|
962
|
-
const lines = content.split("\n").slice(-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
} else if (eacces) {
|
|
969
|
-
console.log("\n Error: Permission denied.");
|
|
970
|
-
console.log(" Try using a port >= 1024.");
|
|
971
|
+
const lines = content.split("\n").filter(Boolean).slice(-15);
|
|
972
|
+
if (lines.length > 0) {
|
|
973
|
+
console.log("\n Recent logs:");
|
|
974
|
+
for (const line of lines) {
|
|
975
|
+
console.log(` ${line}`);
|
|
976
|
+
}
|
|
971
977
|
}
|
|
972
978
|
} catch {
|
|
973
979
|
// Best effort
|
package/dist/remote/server.js
CHANGED
|
@@ -30,11 +30,11 @@ import { isSecretSetForCaller, setCallerSecrets } from '../shared/env-utils.js';
|
|
|
30
30
|
function loadEnvFile() {
|
|
31
31
|
const configDirEnvPath = getEnvFilePath();
|
|
32
32
|
if (fs.existsSync(configDirEnvPath)) {
|
|
33
|
-
dotenv.config({ path: configDirEnvPath });
|
|
33
|
+
dotenv.config({ path: configDirEnvPath, quiet: true });
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
// Backward compat: fall back to cwd .env
|
|
37
|
-
const result = dotenv.config();
|
|
37
|
+
const result = dotenv.config({ quiet: true });
|
|
38
38
|
if (result.parsed) {
|
|
39
39
|
console.warn(`[remote] Loaded .env from working directory. ` +
|
|
40
40
|
`Move it to ${configDirEnvPath} for portable operation.`);
|
|
@@ -1407,6 +1407,7 @@ export function createApp(options = {}) {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
// ── Start ──────────────────────────────────────────────────────────────────
|
|
1409
1409
|
export function main() {
|
|
1410
|
+
console.log('[remote] Starting drawlatch server...');
|
|
1410
1411
|
// Pre-flight validation: check for common setup issues before starting
|
|
1411
1412
|
const remoteConfigPath = getRemoteConfigPath();
|
|
1412
1413
|
if (!fs.existsSync(remoteConfigPath)) {
|
|
@@ -1443,6 +1444,7 @@ export function main() {
|
|
|
1443
1444
|
let stopTunnel;
|
|
1444
1445
|
const server = app.listen(port, host, () => void (async () => {
|
|
1445
1446
|
console.log(`[remote] Secure remote server listening on ${host}:${port}`);
|
|
1447
|
+
console.log(`[remote] PID: ${process.pid}, Node: ${process.version}`);
|
|
1446
1448
|
// If a tunnel was requested, start it before ingestors so that
|
|
1447
1449
|
// process.env.DRAWLATCH_TUNNEL_URL is available during secret resolution.
|
|
1448
1450
|
if (useTunnel) {
|
|
@@ -1513,6 +1515,18 @@ export function main() {
|
|
|
1513
1515
|
process.exit(1);
|
|
1514
1516
|
}, 10_000).unref();
|
|
1515
1517
|
};
|
|
1518
|
+
server.on('error', (err) => {
|
|
1519
|
+
if (err.code === 'EADDRINUSE') {
|
|
1520
|
+
console.error(`[remote] Error: Port ${port} is already in use.`);
|
|
1521
|
+
}
|
|
1522
|
+
else if (err.code === 'EACCES') {
|
|
1523
|
+
console.error(`[remote] Error: Permission denied for ${host}:${port}. Try a port >= 1024.`);
|
|
1524
|
+
}
|
|
1525
|
+
else {
|
|
1526
|
+
console.error(`[remote] Server error:`, err);
|
|
1527
|
+
}
|
|
1528
|
+
process.exit(1);
|
|
1529
|
+
});
|
|
1516
1530
|
process.on('SIGTERM', shutdown);
|
|
1517
1531
|
process.on('SIGINT', shutdown);
|
|
1518
1532
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolpertingerlabs/drawlatch",
|
|
3
|
-
"version": "1.0.0-alpha.9.
|
|
3
|
+
"version": "1.0.0-alpha.9.4",
|
|
4
4
|
"description": "Encrypted MCP proxy with mutual authentication. Local MCP server forwards requests through an encrypted channel to a remote secrets-holding server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/mcp/server.js",
|