@adhdev/daemon-standalone 0.9.46 → 0.9.48

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/index.js CHANGED
@@ -40111,7 +40111,8 @@ ${effect.notification.body || ""}`.trim();
40111
40111
  if (command.type !== "send_message" && command.type !== "pty_write") return null;
40112
40112
  const text = typeof command.text === "string" ? command.text.trim() : typeof command.message === "string" ? command.message.trim() : "";
40113
40113
  if (!text) return null;
40114
- return { type: command.type, text };
40114
+ const enterCount = Number.isInteger(command.enterCount) && command.enterCount > 0 && command.enterCount <= 5 ? command.enterCount : void 0;
40115
+ return { type: command.type, text, ...enterCount ? { enterCount } : {} };
40115
40116
  }
40116
40117
  init_logger();
40117
40118
  function normalizeOpenPanelCommandResult(result) {
@@ -40367,7 +40368,12 @@ ${effect.notification.body || ""}`.trim();
40367
40368
  if (cliCommand?.type === "send_message" && cliCommand.text) {
40368
40369
  await adapter.sendMessage(cliCommand.text);
40369
40370
  } else if (cliCommand?.type === "pty_write" && cliCommand.text && adapter.writeRaw) {
40371
+ const enterCount = cliCommand.enterCount || 1;
40370
40372
  await adapter.writeRaw(cliCommand.text + "\r");
40373
+ for (let i = 1; i < enterCount; i += 1) {
40374
+ await new Promise((resolve12) => setTimeout(resolve12, 50));
40375
+ await adapter.writeRaw("\r");
40376
+ }
40371
40377
  }
40372
40378
  applyProviderPatch(h, args, parsed.payload);
40373
40379
  return {
@@ -41562,7 +41568,12 @@ ${effect.notification.body || ""}`.trim();
41562
41568
  if (cliCommand?.type === "send_message" && cliCommand.text) {
41563
41569
  await this.adapter.sendMessage(cliCommand.text);
41564
41570
  } else if (cliCommand?.type === "pty_write" && cliCommand.text) {
41571
+ const enterCount = cliCommand.enterCount || 1;
41565
41572
  await this.adapter.writeRaw(cliCommand.text + "\r");
41573
+ for (let i = 1; i < enterCount; i += 1) {
41574
+ await new Promise((resolve12) => setTimeout(resolve12, 50));
41575
+ await this.adapter.writeRaw("\r");
41576
+ }
41566
41577
  }
41567
41578
  this.applyProviderResponse(parsed.payload, { phase: "immediate" });
41568
41579
  }
@@ -46683,16 +46694,28 @@ Run 'adhdev doctor' for detailed diagnostics.`
46683
46694
  } catch {
46684
46695
  }
46685
46696
  }
46686
- function resolveSiblingNpmExecutable(nodeExecutable) {
46697
+ function resolveSiblingNpmInvocation(nodeExecutable, platform10 = process.platform) {
46687
46698
  const binDir = path16.dirname(nodeExecutable);
46688
- const candidates = process.platform === "win32" ? ["npm.cmd", "npm.exe", "npm"] : ["npm"];
46689
- for (const candidate of candidates) {
46699
+ if (platform10 === "win32") {
46700
+ const npmCliPath = path16.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
46701
+ if (fs8.existsSync(npmCliPath)) {
46702
+ return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: { shell: false } };
46703
+ }
46704
+ for (const candidate of ["npm.exe", "npm"]) {
46705
+ const candidatePath = path16.join(binDir, candidate);
46706
+ if (fs8.existsSync(candidatePath)) {
46707
+ return { executable: candidatePath, argsPrefix: [], execOptions: { shell: false } };
46708
+ }
46709
+ }
46710
+ return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: { shell: false } };
46711
+ }
46712
+ for (const candidate of ["npm"]) {
46690
46713
  const candidatePath = path16.join(binDir, candidate);
46691
46714
  if (fs8.existsSync(candidatePath)) {
46692
- return candidatePath;
46715
+ return { executable: candidatePath, argsPrefix: [], execOptions: { shell: false } };
46693
46716
  }
46694
46717
  }
46695
- return "npm";
46718
+ return { executable: "npm", argsPrefix: [], execOptions: { shell: false } };
46696
46719
  }
46697
46720
  function findCurrentPackageRoot(currentCliPath, packageName) {
46698
46721
  if (!currentCliPath) return null;
@@ -46741,26 +46764,30 @@ Run 'adhdev doctor' for detailed diagnostics.`
46741
46764
  }
46742
46765
  function resolveCurrentGlobalInstallSurface(options) {
46743
46766
  const packageRoot = findCurrentPackageRoot(options.currentCliPath || process.argv[1], options.packageName);
46767
+ const npmInvocation = resolveSiblingNpmInvocation(options.nodeExecutable || process.execPath, options.platform);
46744
46768
  return {
46745
- npmExecutable: resolveSiblingNpmExecutable(options.nodeExecutable || process.execPath),
46769
+ npmExecutable: npmInvocation.executable,
46770
+ npmArgsPrefix: npmInvocation.argsPrefix,
46746
46771
  packageRoot,
46747
- installPrefix: packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null
46772
+ installPrefix: packageRoot ? resolveInstallPrefixFromPackageRoot(packageRoot, options.packageName) : null,
46773
+ execOptions: npmInvocation.execOptions
46748
46774
  };
46749
46775
  }
46750
46776
  function buildPinnedGlobalInstallCommand(options) {
46751
46777
  const surface = resolveCurrentGlobalInstallSurface(options);
46752
- const args = ["install", "-g", `${options.packageName}@${options.targetVersion || "latest"}`, "--force"];
46778
+ const args = [...surface.npmArgsPrefix || [], "install", "-g", `${options.packageName}@${options.targetVersion || "latest"}`, "--force"];
46753
46779
  if (surface.installPrefix) {
46754
46780
  args.push("--prefix", surface.installPrefix);
46755
46781
  }
46756
46782
  return {
46757
46783
  command: surface.npmExecutable,
46758
46784
  args,
46759
- surface
46785
+ surface,
46786
+ execOptions: surface.execOptions || getNpmExecOptions(options.platform)
46760
46787
  };
46761
46788
  }
46762
- function getNpmExecOptions() {
46763
- return { shell: process.platform === "win32" };
46789
+ function getNpmExecOptions(_platform = process.platform) {
46790
+ return { shell: false };
46764
46791
  }
46765
46792
  function killPid2(pid) {
46766
46793
  try {
@@ -46855,11 +46882,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
46855
46882
  }
46856
46883
  }
46857
46884
  function cleanupStaleGlobalInstallDirs(pkgName, surface) {
46858
- const npmExecOpts = getNpmExecOptions();
46859
46885
  const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
46860
- const npmRoot = (0, import_child_process8.execFileSync)(surface.npmExecutable, ["root", "-g", ...prefixArgs], { encoding: "utf8", ...npmExecOpts }).trim();
46886
+ const npmRoot = (0, import_child_process8.execFileSync)(surface.npmExecutable, [...surface.npmArgsPrefix || [], "root", "-g", ...prefixArgs], { encoding: "utf8", ...surface.execOptions }).trim();
46861
46887
  if (!npmRoot) return;
46862
- const npmPrefix = surface.installPrefix || (0, import_child_process8.execFileSync)(surface.npmExecutable, ["prefix", "-g", ...prefixArgs], { encoding: "utf8", ...npmExecOpts }).trim();
46888
+ const npmPrefix = surface.installPrefix || (0, import_child_process8.execFileSync)(surface.npmExecutable, [...surface.npmArgsPrefix || [], "prefix", "-g", ...prefixArgs], { encoding: "utf8", ...surface.execOptions }).trim();
46863
46889
  const binDir = process.platform === "win32" ? npmPrefix : path16.join(npmPrefix, "bin");
46864
46890
  const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
46865
46891
  const binNames = /* @__PURE__ */ new Set([packageBaseName]);
@@ -46929,7 +46955,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
46929
46955
  encoding: "utf8",
46930
46956
  stdio: "pipe",
46931
46957
  maxBuffer: 20 * 1024 * 1024,
46932
- ...getNpmExecOptions()
46958
+ ...installCommand.execOptions
46933
46959
  }
46934
46960
  );
46935
46961
  if (installOutput.trim()) {
@@ -47348,7 +47374,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
47348
47374
  const wantsAll = args?.all === true;
47349
47375
  const offset = wantsAll ? 0 : Math.max(0, Number(args?.offset) || 0);
47350
47376
  const limit = wantsAll ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.min(100, Number(args?.limit) || 30));
47351
- const providerMeta = this.deps.providerLoader.getMeta(providerType);
47377
+ const providerMeta = this.deps.providerLoader.resolve?.(providerType) || this.deps.providerLoader.getMeta(providerType);
47352
47378
  const { sessions: historySessions, hasMore, source } = listProviderHistorySessions(providerType, {
47353
47379
  canonicalHistory: providerMeta?.canonicalHistory,
47354
47380
  offset,