@synkro-sh/cli 1.4.49 → 1.4.50

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/bootstrap.js CHANGED
@@ -4466,9 +4466,14 @@ function startTask(opts = {}) {
4466
4466
  const cwd = opts.cwd ?? ch.sessionDir;
4467
4467
  let existing = findTask(ch);
4468
4468
  while (existing) {
4469
- if (existing.status === "Running") {
4469
+ if (existing.status === "Running" || existing.status === "Queued") {
4470
4470
  spawnSync2("tmux", ["kill-session", "-t", ch.tmuxSession], { encoding: "utf-8" });
4471
4471
  spawnSync2("pueue", ["kill", String(existing.id)], { encoding: "utf-8" });
4472
+ for (let i = 0; i < 10; i++) {
4473
+ const check = findTask(ch);
4474
+ if (!check || check.id !== existing.id || check.status !== "Running" && check.status !== "Queued") break;
4475
+ spawnSync2("sleep", ["0.5"], { encoding: "utf-8" });
4476
+ }
4472
4477
  }
4473
4478
  spawnSync2("pueue", ["remove", String(existing.id)], { encoding: "utf-8" });
4474
4479
  existing = findTask(ch);
@@ -4496,10 +4501,19 @@ function startTask(opts = {}) {
4496
4501
  }
4497
4502
  function stopTask(channel = CHANNEL_PRIMARY) {
4498
4503
  spawnSync2("tmux", ["kill-session", "-t", channel.tmuxSession], { encoding: "utf-8" });
4499
- const t = findTask(channel);
4500
- if (!t) return;
4501
- spawnSync2("pueue", ["kill", String(t.id)], { encoding: "utf-8" });
4502
- spawnSync2("pueue", ["remove", String(t.id)], { encoding: "utf-8" });
4504
+ let t = findTask(channel);
4505
+ while (t) {
4506
+ if (t.status === "Running" || t.status === "Queued") {
4507
+ spawnSync2("pueue", ["kill", String(t.id)], { encoding: "utf-8" });
4508
+ for (let i = 0; i < 10; i++) {
4509
+ const check = findTask(channel);
4510
+ if (!check || check.id !== t.id || check.status !== "Running" && check.status !== "Queued") break;
4511
+ spawnSync2("sleep", ["0.5"], { encoding: "utf-8" });
4512
+ }
4513
+ }
4514
+ spawnSync2("pueue", ["remove", String(t.id)], { encoding: "utf-8" });
4515
+ t = findTask(channel);
4516
+ }
4503
4517
  }
4504
4518
  function tailLogs(lines = 80, channel = CHANNEL_PRIMARY) {
4505
4519
  const t = findTask(channel);
@@ -5035,7 +5049,7 @@ function writeConfigEnv(opts) {
5035
5049
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
5036
5050
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
5037
5051
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
5038
- `SYNKRO_VERSION=${shellQuoteSingle("1.4.49")}`
5052
+ `SYNKRO_VERSION=${shellQuoteSingle("1.4.50")}`
5039
5053
  ];
5040
5054
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
5041
5055
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -5252,9 +5266,11 @@ async function installCommand(opts = {}) {
5252
5266
  assertClaudeInstalled();
5253
5267
  assertPueueInstalled();
5254
5268
  assertTmuxInstalled();
5269
+ stopTask();
5270
+ stopTask(CHANNEL_SECONDARY);
5255
5271
  installLocalCC();
5256
- const t1 = ensureRunning();
5257
- const t2 = ensureRunning({ channel: CHANNEL_SECONDARY });
5272
+ const t1 = startTask();
5273
+ const t2 = startTask({ channel: CHANNEL_SECONDARY });
5258
5274
  console.log(` channel 1: pueue id=${t1.id} channel 2: pueue id=${t2.id}`);
5259
5275
  console.log(" Waiting for both channels...");
5260
5276
  const [ready1, ready2] = await Promise.all([