@scalequality/cli 0.4.18 → 0.4.19

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "sdkVersion": "0.3.281",
3
- "sha256": "fe49d1a8b41bb6191aefbfeeb63afc6b3b10357776b9358f654a0882b22e4524",
4
- "sourceCommit": "31bb504c079043ba44af43413ef65d982bd111ed"
3
+ "sha256": "b2a5530d1c275c47eb296b65d8f7c42b9a7eeddd6394e62264e0aad6644b9f81",
4
+ "sourceCommit": "8c4feb2574f6847724a26ad6bc37d8d47fe59610"
5
5
  }
package/dist/connect.cjs CHANGED
@@ -2084,15 +2084,14 @@ var HttpSessionTransport = class {
2084
2084
  } catch (e) {
2085
2085
  throw new TransportError(`${method} ${routeLabel(path)} failed: ${e.name}`, null, true);
2086
2086
  }
2087
- if (this.gone.has(res.status)) {
2088
- await res.body?.cancel().catch(() => void 0);
2089
- throw new SessionGoneError(res.status);
2090
- }
2091
2087
  if (!res.ok) {
2092
- const code = await res.text().then((t) => JSON.parse(t)?.code, () => void 0).catch(() => void 0);
2093
- const retryable = res.status === 429 || res.status >= 500;
2088
+ const raw = await res.text().then((t) => JSON.parse(t)?.code, () => void 0).catch(() => void 0);
2089
+ const code = typeof raw === "string" && /^[A-Z_]{3,80}$/.test(raw) ? raw : void 0;
2090
+ const edge = (res.status === 401 || res.status === 403) && !code;
2091
+ if (this.gone.has(res.status) && !edge) throw new SessionGoneError(res.status);
2092
+ const retryable = edge || res.status === 429 || res.status >= 500;
2094
2093
  const error = new TransportError(`${method} ${routeLabel(path)} answered ${res.status}`, res.status, retryable);
2095
- if (typeof code === "string" && /^[A-Z_]{3,80}$/.test(code)) error.code = code;
2094
+ if (code) error.code = code;
2096
2095
  throw error;
2097
2096
  }
2098
2097
  if (res.status === 204) return void 0;
@@ -3411,7 +3410,8 @@ var MACHINE_USAGE = {
3411
3410
  "The background service that keeps this computer connected.",
3412
3411
  "",
3413
3412
  " install Install (or update) and start it for the connected computer.",
3414
- " start Start it again (the same as install).",
3413
+ " start Start it again (the same as install). On a computer that is not",
3414
+ " connected, it connects it first (the same as login).",
3415
3415
  ' uninstall Stop and remove it. The computer stays paired; "scalequality',
3416
3416
  ' logout" disconnects it.',
3417
3417
  " status Whether it is installed and running, and where it logs.",
@@ -4440,6 +4440,7 @@ var MachineClient = class {
4440
4440
  }
4441
4441
  if (!res.ok) {
4442
4442
  const code = typeof parsed?.code === "string" && /^[A-Z_]{3,80}$/.test(parsed.code) ? parsed.code : null;
4443
+ if ((res.status === 401 || res.status === 403) && !code) throw new MachineApiError(null, null);
4443
4444
  throw new MachineApiError(res.status, code, parsed);
4444
4445
  }
4445
4446
  return parsed;
@@ -11669,7 +11670,19 @@ ${String(item.content)}` : String(item.content);
11669
11670
  this.turnAbort?.abort();
11670
11671
  return;
11671
11672
  }
11672
- if (live.between || live.turnEnded) return;
11673
+ if (live.between || live.turnEnded) {
11674
+ if (!live.accepting) {
11675
+ this.deps.log.info("stopping background work after the turn");
11676
+ live.abort.abort();
11677
+ return;
11678
+ }
11679
+ try {
11680
+ await Promise.race([Promise.resolve(q.interrupt()), new Promise((_, reject) => setTimeout(() => reject(new Error("INTERRUPT_TIMEOUT")), INTERRUPT_TIMEOUT_MS))]);
11681
+ } catch (e) {
11682
+ this.deps.log.warn("interrupt between turns failed", { error: this.redactor.text(e.message) });
11683
+ }
11684
+ return;
11685
+ }
11673
11686
  live.interrupted = true;
11674
11687
  const ac = live.abort;
11675
11688
  if (!live.stopGuard) {
@@ -14324,6 +14337,11 @@ async function serviceMain(action, api, lines2, toggle = null) {
14324
14337
  say(toggle === "on" ? "Automatic updates are on: the service installs new versions by itself while no session runs." : "Automatic updates are off. Update by hand with: npx @scalequality/cli@latest login");
14325
14338
  return;
14326
14339
  }
14340
+ if (action === "start" && !credentials.get(api)) {
14341
+ say(`This computer is not connected to ${api}. Connecting it now.`);
14342
+ await loginMain(api, null, true, false);
14343
+ return;
14344
+ }
14327
14345
  if (action === "install" || action === "start") {
14328
14346
  if (!credentials.get(api)) {
14329
14347
  say(style.red(`This computer is not connected to ${api}. Run scalequality login${apiFlag(api)} first.`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalequality/cli",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "description": "ScaleQuality CLI. Connect your computer to the ScaleQuality AI Workspace (`scalequality login`), run its coding engine in any folder of your computer, and import your Claude Code and Codex conversations.",
5
5
  "type": "module",
6
6
  "bin": {