@wolpertingerlabs/drawlatch 1.0.0-alpha.9.2 → 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 +27 -16
- 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
|
}
|
|
@@ -885,11 +891,16 @@ function cleanPidFile() {
|
|
|
885
891
|
|
|
886
892
|
// ── Health check utilities ────────────────────────────────────────
|
|
887
893
|
|
|
894
|
+
/** Resolve the host for client connections — 0.0.0.0 is a bind address, not connectable. */
|
|
895
|
+
function connectHost(host) {
|
|
896
|
+
return host === "0.0.0.0" ? "127.0.0.1" : host;
|
|
897
|
+
}
|
|
898
|
+
|
|
888
899
|
async function healthCheck(host, port) {
|
|
889
900
|
try {
|
|
890
901
|
const controller = new AbortController();
|
|
891
902
|
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
892
|
-
const res = await fetch(`http://${host}:${port}/health`, {
|
|
903
|
+
const res = await fetch(`http://${connectHost(host)}:${port}/health`, {
|
|
893
904
|
signal: controller.signal,
|
|
894
905
|
});
|
|
895
906
|
clearTimeout(timeout);
|
|
@@ -903,7 +914,7 @@ async function healthCheckFull(host, port) {
|
|
|
903
914
|
try {
|
|
904
915
|
const controller = new AbortController();
|
|
905
916
|
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
906
|
-
const res = await fetch(`http://${host}:${port}/health`, {
|
|
917
|
+
const res = await fetch(`http://${connectHost(host)}:${port}/health`, {
|
|
907
918
|
signal: controller.signal,
|
|
908
919
|
});
|
|
909
920
|
clearTimeout(timeout);
|
|
@@ -951,18 +962,18 @@ function ensureConfigDir() {
|
|
|
951
962
|
// ── Diagnostic utilities ──────────────────────────────────────────
|
|
952
963
|
|
|
953
964
|
async function diagnoseStartFailure() {
|
|
954
|
-
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
|
+
}
|
|
955
969
|
try {
|
|
956
970
|
const content = readFileSync(LOG_FILE, "utf-8");
|
|
957
|
-
const lines = content.split("\n").slice(-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
} else if (eacces) {
|
|
964
|
-
console.log("\n Error: Permission denied.");
|
|
965
|
-
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
|
+
}
|
|
966
977
|
}
|
|
967
978
|
} catch {
|
|
968
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",
|