@tiflis-io/tiflis-code-workstation 0.3.22 → 0.3.24

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.
Files changed (2) hide show
  1. package/dist/main.js +22 -28
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -3057,8 +3057,11 @@ var HeadlessAgentExecutor = class extends EventEmitter {
3057
3057
  },
3058
3058
  stdio: ["ignore", "pipe", "pipe"],
3059
3059
  // stdin ignored, stdout/stderr piped
3060
- detached: true
3060
+ detached: true,
3061
3061
  // Create new process group for clean termination
3062
+ // Ensure child doesn't interfere with parent's signal handling
3063
+ // @ts-ignore - Node.js 16+ option
3064
+ ignoreParentSignals: true
3062
3065
  });
3063
3066
  this.subprocess.stdout?.on("data", (data) => {
3064
3067
  if (this.isKilled) return;
@@ -9189,19 +9192,6 @@ function handleAuthMessageViaTunnel(data, tunnelClient, authenticateClient, logg
9189
9192
  tunnelClient.send(JSON.stringify(errorResponse));
9190
9193
  }
9191
9194
  }
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
- });
9205
9195
  async function bootstrap() {
9206
9196
  const workstationVersion = getWorkstationVersion();
9207
9197
  const protocolVersion = getProtocolVersion();
@@ -9222,28 +9212,27 @@ async function bootstrap() {
9222
9212
  },
9223
9213
  "Starting workstation server"
9224
9214
  );
9215
+ let shutdownInProgress = false;
9216
+ let signalCount = 0;
9225
9217
  const registerSignalHandlers = (shutdown2) => {
9226
- let signalCount = 0;
9227
9218
  const handleSignal = (signal) => {
9228
9219
  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...");
9220
+ if (shutdownInProgress) {
9240
9221
  process.exit(1);
9241
9222
  }
9223
+ shutdownInProgress = true;
9224
+ logger.info({ signal, count: signalCount }, "Signal received");
9225
+ console.log("\nShutting down...");
9226
+ shutdown2(signal).catch((error) => {
9227
+ logger.error({ error }, "Shutdown error");
9228
+ }).finally(() => {
9229
+ process.exit(0);
9230
+ });
9242
9231
  };
9243
9232
  process.on("SIGTERM", () => handleSignal("SIGTERM"));
9244
9233
  process.on("SIGINT", () => handleSignal("SIGINT"));
9245
- process.on("unhandledRejection", (reason, promise) => {
9246
- logger.error({ reason, promise }, "Unhandled rejection");
9234
+ process.on("unhandledRejection", (reason) => {
9235
+ logger.error({ reason }, "Unhandled rejection");
9247
9236
  });
9248
9237
  process.on("uncaughtException", (error) => {
9249
9238
  logger.fatal({ error }, "Uncaught exception");
@@ -11384,6 +11373,11 @@ async function bootstrap() {
11384
11373
  };
11385
11374
  registerSignalHandlers(shutdown);
11386
11375
  }
11376
+ if (process.stdin && !process.stdin.destroyed) {
11377
+ if (process.stdin.isPaused?.()) {
11378
+ process.stdin.resume();
11379
+ }
11380
+ }
11387
11381
  bootstrap().catch((error) => {
11388
11382
  console.error("Failed to bootstrap:", error);
11389
11383
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiflis-io/tiflis-code-workstation",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
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",