@tiflis-io/tiflis-code-workstation 0.3.20 → 0.3.22
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/dist/main.js +45 -19
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2965,6 +2965,9 @@ var TerminalOutputBatcher = class {
|
|
|
2965
2965
|
if (this.timeout === null) {
|
|
2966
2966
|
const adaptiveInterval = this.outputRate > 1e3 ? this.batchIntervalMs : Math.min(8, this.batchIntervalMs);
|
|
2967
2967
|
this.timeout = setTimeout(() => this.flush(), adaptiveInterval);
|
|
2968
|
+
if (this.timeout.unref) {
|
|
2969
|
+
this.timeout.unref();
|
|
2970
|
+
}
|
|
2968
2971
|
}
|
|
2969
2972
|
}
|
|
2970
2973
|
/**
|
|
@@ -9186,6 +9189,19 @@ function handleAuthMessageViaTunnel(data, tunnelClient, authenticateClient, logg
|
|
|
9186
9189
|
tunnelClient.send(JSON.stringify(errorResponse));
|
|
9187
9190
|
}
|
|
9188
9191
|
}
|
|
9192
|
+
var emergencySignalCount = 0;
|
|
9193
|
+
process.on("SIGINT", () => {
|
|
9194
|
+
emergencySignalCount++;
|
|
9195
|
+
console.log("\n[SIGINT received]");
|
|
9196
|
+
if (emergencySignalCount >= 2) {
|
|
9197
|
+
console.log("[Force exit on repeated Ctrl+C]");
|
|
9198
|
+
process.exit(1);
|
|
9199
|
+
}
|
|
9200
|
+
});
|
|
9201
|
+
process.on("SIGTERM", () => {
|
|
9202
|
+
console.log("\n[SIGTERM received]");
|
|
9203
|
+
process.exit(1);
|
|
9204
|
+
});
|
|
9189
9205
|
async function bootstrap() {
|
|
9190
9206
|
const workstationVersion = getWorkstationVersion();
|
|
9191
9207
|
const protocolVersion = getProtocolVersion();
|
|
@@ -9206,6 +9222,34 @@ async function bootstrap() {
|
|
|
9206
9222
|
},
|
|
9207
9223
|
"Starting workstation server"
|
|
9208
9224
|
);
|
|
9225
|
+
const registerSignalHandlers = (shutdown2) => {
|
|
9226
|
+
let signalCount = 0;
|
|
9227
|
+
const handleSignal = (signal) => {
|
|
9228
|
+
signalCount++;
|
|
9229
|
+
logger.info({ signal, count: signalCount }, "Signal received, initiating shutdown");
|
|
9230
|
+
if (signalCount === 1) {
|
|
9231
|
+
console.log("\nShutting down gracefully...");
|
|
9232
|
+
shutdown2(signal).then(() => {
|
|
9233
|
+
process.exit(0);
|
|
9234
|
+
}).catch((error) => {
|
|
9235
|
+
logger.error({ error }, "Error during shutdown");
|
|
9236
|
+
process.exit(1);
|
|
9237
|
+
});
|
|
9238
|
+
} else {
|
|
9239
|
+
console.log("\nForce exiting...");
|
|
9240
|
+
process.exit(1);
|
|
9241
|
+
}
|
|
9242
|
+
};
|
|
9243
|
+
process.on("SIGTERM", () => handleSignal("SIGTERM"));
|
|
9244
|
+
process.on("SIGINT", () => handleSignal("SIGINT"));
|
|
9245
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
9246
|
+
logger.error({ reason, promise }, "Unhandled rejection");
|
|
9247
|
+
});
|
|
9248
|
+
process.on("uncaughtException", (error) => {
|
|
9249
|
+
logger.fatal({ error }, "Uncaught exception");
|
|
9250
|
+
process.exit(1);
|
|
9251
|
+
});
|
|
9252
|
+
};
|
|
9209
9253
|
const dataDir = env.DATA_DIR;
|
|
9210
9254
|
initDatabase(dataDir);
|
|
9211
9255
|
logger.info({ dataDir }, "Database initialized");
|
|
@@ -11338,25 +11382,7 @@ async function bootstrap() {
|
|
|
11338
11382
|
process.exit(1);
|
|
11339
11383
|
}
|
|
11340
11384
|
};
|
|
11341
|
-
|
|
11342
|
-
const handleSignal = (signal) => {
|
|
11343
|
-
signalCount++;
|
|
11344
|
-
if (signalCount === 1) {
|
|
11345
|
-
void shutdown(signal);
|
|
11346
|
-
} else {
|
|
11347
|
-
logger.warn({ signal, count: signalCount }, "Force exit on repeated signal");
|
|
11348
|
-
process.exit(1);
|
|
11349
|
-
}
|
|
11350
|
-
};
|
|
11351
|
-
process.on("SIGTERM", () => handleSignal("SIGTERM"));
|
|
11352
|
-
process.on("SIGINT", () => handleSignal("SIGINT"));
|
|
11353
|
-
process.on("unhandledRejection", (reason, promise) => {
|
|
11354
|
-
logger.error({ reason, promise }, "Unhandled rejection");
|
|
11355
|
-
});
|
|
11356
|
-
process.on("uncaughtException", (error) => {
|
|
11357
|
-
logger.fatal({ error }, "Uncaught exception");
|
|
11358
|
-
process.exit(1);
|
|
11359
|
-
});
|
|
11385
|
+
registerSignalHandlers(shutdown);
|
|
11360
11386
|
}
|
|
11361
11387
|
bootstrap().catch((error) => {
|
|
11362
11388
|
console.error("Failed to bootstrap:", error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiflis-io/tiflis-code-workstation",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22",
|
|
4
4
|
"description": "Workstation server for tiflis-code - manages agent sessions and terminal access",
|
|
5
5
|
"author": "Roman Barinov <rbarinov@gmail.com>",
|
|
6
6
|
"license": "FSL-1.1-NC",
|