staklink 0.4.11 → 0.4.13

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.
@@ -53243,16 +53243,26 @@ var Runner = class {
53243
53243
  /**
53244
53244
  * Execute a command with proper logging
53245
53245
  */
53246
- async executeCommand(command, cwd = this.cwd, description = "Command") {
53246
+ async executeCommand(command, cwd = this.cwd, description = "Command", timeoutMs = 20 * 60 * 1e3) {
53247
53247
  this.log_cb(`\u26A1 ${description}: ${command}`);
53248
53248
  this.log_cb(`\u{1F4C1} Working directory: ${cwd}`);
53249
53249
  return new Promise((resolve4, reject) => {
53250
53250
  const child = proc2.spawn("sh", ["-c", command], {
53251
53251
  cwd,
53252
- stdio: ["pipe", "pipe", "pipe"]
53252
+ stdio: ["pipe", "pipe", "pipe"],
53253
+ env: { ...process.env, CI: "1", DEBIAN_FRONTEND: "noninteractive" }
53253
53254
  });
53255
+ child.stdin?.end();
53254
53256
  let stdout = "";
53255
53257
  let stderr = "";
53258
+ let timedOut = false;
53259
+ const timer = setTimeout(() => {
53260
+ timedOut = true;
53261
+ this.log_cb(
53262
+ `\u23F0 Timeout: ${description} exceeded ${timeoutMs / 1e3}s, killing process`
53263
+ );
53264
+ child.kill("SIGKILL");
53265
+ }, timeoutMs);
53256
53266
  child.stdout?.on("data", (data) => {
53257
53267
  const output = data.toString();
53258
53268
  stdout += output;
@@ -53272,7 +53282,13 @@ var Runner = class {
53272
53282
  });
53273
53283
  });
53274
53284
  child.on("close", (code) => {
53275
- if (code === 0) {
53285
+ clearTimeout(timer);
53286
+ if (timedOut) {
53287
+ reject(
53288
+ `${description} timed out after ${timeoutMs / 1e3}s
53289
+ ${stderr}`
53290
+ );
53291
+ } else if (code === 0) {
53276
53292
  resolve4({ stdout, stderr });
53277
53293
  } else {
53278
53294
  const error88 = new Error(`Command failed with exit code ${code}`);
@@ -53282,6 +53298,7 @@ ${stderr}`);
53282
53298
  }
53283
53299
  });
53284
53300
  child.on("error", (error88) => {
53301
+ clearTimeout(timer);
53285
53302
  const errorMsg = error88.message || String(error88);
53286
53303
  this.log_cb(`\u274C Error: ${errorMsg}`);
53287
53304
  reject(`${errorMsg}
@@ -60910,7 +60927,7 @@ var SSEManager = class {
60910
60927
  var sseManager = new SSEManager();
60911
60928
 
60912
60929
  // src/proxy/version.ts
60913
- var VERSION = "0.4.11";
60930
+ var VERSION = "0.4.13";
60914
60931
 
60915
60932
  // node_modules/uuid/dist/esm/stringify.js
60916
60933
  var byteToHex = [];
@@ -141132,16 +141149,23 @@ async function handleBranchDiff(req, res) {
141132
141149
  action = "modify";
141133
141150
  }
141134
141151
  let content = "";
141135
- const binaryContent = await binaryDiffContent(repo, filePath, action);
141136
- if (binaryContent !== null) {
141137
- content = binaryContent;
141152
+ if (action === "delete") {
141138
141153
  } else {
141139
- try {
141140
- content = await repo.execCommand(
141141
- `git diff ${diffBase} -- "${filePath}"`
141142
- );
141143
- } catch (error88) {
141144
- warn(`Error getting branch diff for ${filePath}:`, error88);
141154
+ const binaryContent = await binaryDiffContent(
141155
+ repo,
141156
+ filePath,
141157
+ action
141158
+ );
141159
+ if (binaryContent !== null) {
141160
+ content = binaryContent;
141161
+ } else {
141162
+ try {
141163
+ content = await repo.execCommand(
141164
+ `git diff ${diffBase} -- "${filePath}"`
141165
+ );
141166
+ } catch (error88) {
141167
+ warn(`Error getting branch diff for ${filePath}:`, error88);
141168
+ }
141145
141169
  }
141146
141170
  }
141147
141171
  results.push({
@@ -4512,16 +4512,26 @@ var Runner = class {
4512
4512
  /**
4513
4513
  * Execute a command with proper logging
4514
4514
  */
4515
- async executeCommand(command, cwd = this.cwd, description = "Command") {
4515
+ async executeCommand(command, cwd = this.cwd, description = "Command", timeoutMs = 20 * 60 * 1e3) {
4516
4516
  this.log_cb(`\u26A1 ${description}: ${command}`);
4517
4517
  this.log_cb(`\u{1F4C1} Working directory: ${cwd}`);
4518
4518
  return new Promise((resolve, reject) => {
4519
4519
  const child = proc2.spawn("sh", ["-c", command], {
4520
4520
  cwd,
4521
- stdio: ["pipe", "pipe", "pipe"]
4521
+ stdio: ["pipe", "pipe", "pipe"],
4522
+ env: { ...process.env, CI: "1", DEBIAN_FRONTEND: "noninteractive" }
4522
4523
  });
4524
+ child.stdin?.end();
4523
4525
  let stdout = "";
4524
4526
  let stderr = "";
4527
+ let timedOut = false;
4528
+ const timer = setTimeout(() => {
4529
+ timedOut = true;
4530
+ this.log_cb(
4531
+ `\u23F0 Timeout: ${description} exceeded ${timeoutMs / 1e3}s, killing process`
4532
+ );
4533
+ child.kill("SIGKILL");
4534
+ }, timeoutMs);
4525
4535
  child.stdout?.on("data", (data) => {
4526
4536
  const output = data.toString();
4527
4537
  stdout += output;
@@ -4541,7 +4551,13 @@ var Runner = class {
4541
4551
  });
4542
4552
  });
4543
4553
  child.on("close", (code) => {
4544
- if (code === 0) {
4554
+ clearTimeout(timer);
4555
+ if (timedOut) {
4556
+ reject(
4557
+ `${description} timed out after ${timeoutMs / 1e3}s
4558
+ ${stderr}`
4559
+ );
4560
+ } else if (code === 0) {
4545
4561
  resolve({ stdout, stderr });
4546
4562
  } else {
4547
4563
  const error2 = new Error(`Command failed with exit code ${code}`);
@@ -4551,6 +4567,7 @@ ${stderr}`);
4551
4567
  }
4552
4568
  });
4553
4569
  child.on("error", (error2) => {
4570
+ clearTimeout(timer);
4554
4571
  const errorMsg = error2.message || String(error2);
4555
4572
  this.log_cb(`\u274C Error: ${errorMsg}`);
4556
4573
  reject(`${errorMsg}
@@ -10987,7 +11004,7 @@ var glob = Object.assign(glob_, {
10987
11004
  glob.glob = glob;
10988
11005
 
10989
11006
  // src/proxy/version.ts
10990
- var VERSION = "0.4.11";
11007
+ var VERSION = "0.4.13";
10991
11008
 
10992
11009
  // src/deps.ts
10993
11010
  var import_child_process = require("child_process");
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "staklink",
3
3
  "displayName": "staklink",
4
4
  "description": "staklink process manager",
5
- "version": "0.4.11",
5
+ "version": "0.4.13",
6
6
  "type": "module",
7
7
  "publisher": "stakwork",
8
8
  "engines": {