@scalequality/cli 0.4.9-rc.1 → 0.4.9-rc.2

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": "5ad74aa136be8c43759fe4a89f977345c3af7ba6fea4c85657bab56398b3da4f",
4
- "sourceCommit": "38ed6bf736d29da672865dfedeed01901e57b828"
3
+ "sha256": "f9a1832f530428fd24a48cc17074549aab70faa7ba2f419f3f372321fbe81b0a",
4
+ "sourceCommit": "59a3d8bb1500daa81edb1d977bccf6a459954c5f"
5
5
  }
package/dist/connect.cjs CHANGED
@@ -3065,18 +3065,29 @@ function writeFileSafely(file, content, mode = 420) {
3065
3065
  (0, import_fs5.renameSync)(tmp, file);
3066
3066
  }
3067
3067
  var failed = (r) => `${r.stderr || r.stdout}`.trim().split("\n").slice(-1)[0]?.slice(0, 200) || `exit ${r.code}`;
3068
+ var LAUNCHD_REPLACE_WAIT_MS = 3e4;
3069
+ var LAUNCHD_POLL_MS = 500;
3070
+ var LAUNCHD_BOOTSTRAP_ATTEMPTS = 6;
3068
3071
  async function installLaunchd(env, bin, api) {
3069
3072
  const names = serviceNames(api);
3070
3073
  const plist = launchAgentPath(env, api);
3071
3074
  (0, import_fs5.mkdirSync)(logDir(env), { recursive: true });
3072
3075
  writeFileSafely(plist, launchAgentPlist(env, bin, api));
3073
3076
  const domain = `gui/${env.uid}`;
3074
- await env.run("launchctl", ["bootout", `${domain}/${names.label}`]);
3075
- await env.run("launchctl", ["enable", `${domain}/${names.label}`]);
3076
- const boot = await env.run("launchctl", ["bootstrap", domain, plist]);
3077
+ const sleep2 = env.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
3078
+ const target = `${domain}/${names.label}`;
3079
+ const loaded = async () => (await env.run("launchctl", ["print", target])).code === 0;
3080
+ await env.run("launchctl", ["bootout", target]);
3081
+ for (let waited = 0; waited < LAUNCHD_REPLACE_WAIT_MS && await loaded(); waited += LAUNCHD_POLL_MS) await sleep2(LAUNCHD_POLL_MS);
3082
+ await env.run("launchctl", ["enable", target]);
3083
+ let boot = await env.run("launchctl", ["bootstrap", domain, plist]);
3084
+ for (let attempt = 1; boot.code !== 0 && attempt < LAUNCHD_BOOTSTRAP_ATTEMPTS; attempt++) {
3085
+ await sleep2(LAUNCHD_POLL_MS);
3086
+ boot = await env.run("launchctl", ["bootstrap", domain, plist]);
3087
+ }
3077
3088
  if (boot.code === 0) return { ok: true, manager: "launchd", hints: [] };
3078
3089
  const legacy = await env.run("launchctl", ["load", "-w", plist]);
3079
- if (legacy.code === 0) return { ok: true, manager: "launchd", hints: [] };
3090
+ if (legacy.code === 0 && await loaded()) return { ok: true, manager: "launchd", hints: [] };
3080
3091
  (0, import_fs5.rmSync)(plist, { force: true });
3081
3092
  return { ok: false, code: "LAUNCHD_REFUSED", message: `macOS did not accept the background service (${failed(boot)}). A device management profile may block login items.` };
3082
3093
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalequality/cli",
3
- "version": "0.4.9-rc.1",
3
+ "version": "0.4.9-rc.2",
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": {