adhdev 0.9.74 → 0.9.75

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
@@ -1541,6 +1541,7 @@ function normalizeConfig(raw) {
1541
1541
  ideSettings: isPlainObject(parsed.ideSettings) ? parsed.ideSettings : {},
1542
1542
  providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
1543
1543
  providerDir: asOptionalString(parsed.providerDir),
1544
+ updateChannel: parsed.updateChannel === "preview" ? "preview" : "stable",
1544
1545
  terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
1545
1546
  };
1546
1547
  }
@@ -1690,6 +1691,7 @@ var init_config = __esm({
1690
1691
  machineProviders: {},
1691
1692
  ideSettings: {},
1692
1693
  providerSourceMode: "normal",
1694
+ updateChannel: "stable",
1693
1695
  terminalSizingMode: "measured"
1694
1696
  };
1695
1697
  MACHINE_ID_PREFIX = "mach_";
@@ -13670,6 +13672,13 @@ var init_provider_cli_adapter = __esm({
13670
13672
  this.lastScreenSnapshotReadAt = now;
13671
13673
  return screenText;
13672
13674
  }
13675
+ getParseScreenText(screenText) {
13676
+ const currentSnapshot = normalizeScreenSnapshot(screenText);
13677
+ const lastSnapshot = this.lastScreenSnapshot;
13678
+ if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
13679
+ return `${screenText}
13680
+ ${lastSnapshot}`;
13681
+ }
13673
13682
  shouldReadTerminalScreenSnapshot(now) {
13674
13683
  if (!this.lastScreenText) return true;
13675
13684
  return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
@@ -14660,12 +14669,13 @@ var init_provider_cli_adapter = __esm({
14660
14669
  }
14661
14670
  try {
14662
14671
  const screenText = this.terminalScreen.getText();
14672
+ const parseScreenText = this.getParseScreenText(screenText);
14663
14673
  const tail = this.recentOutputBuffer.slice(-500);
14664
14674
  const input = buildCliParseInput({
14665
14675
  accumulatedBuffer: this.accumulatedBuffer,
14666
14676
  accumulatedRawBuffer: this.accumulatedRawBuffer,
14667
14677
  recentOutputBuffer: this.recentOutputBuffer,
14668
- terminalScreenText: screenText,
14678
+ terminalScreenText: parseScreenText,
14669
14679
  baseMessages: [],
14670
14680
  partialResponse: this.responseBuffer,
14671
14681
  isWaitingForResponse: this.isWaitingForResponse,
@@ -14759,8 +14769,9 @@ var init_provider_cli_adapter = __esm({
14759
14769
  */
14760
14770
  getScriptParsedStatus() {
14761
14771
  const screenText = this.readTerminalScreenText();
14772
+ const parseScreenText = this.getParseScreenText(screenText);
14762
14773
  const cached2 = this.parsedStatusCache;
14763
- if (cached2 && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.screenText === screenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName) {
14774
+ if (cached2 && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.screenText === parseScreenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName) {
14764
14775
  return cached2.result;
14765
14776
  }
14766
14777
  const parsed = this.runParseSession();
@@ -14788,7 +14799,7 @@ var init_provider_cli_adapter = __esm({
14788
14799
  currentTurnScope: this.currentTurnScope,
14789
14800
  recentOutputBuffer: this.recentOutputBuffer,
14790
14801
  accumulatedBuffer: this.accumulatedBuffer,
14791
- screenText,
14802
+ screenText: parseScreenText,
14792
14803
  currentStatus: this.currentStatus,
14793
14804
  activeModal: this.activeModal,
14794
14805
  cliName: this.cliName,
@@ -14805,7 +14816,7 @@ var init_provider_cli_adapter = __esm({
14805
14816
  accumulatedBuffer: this.accumulatedBuffer,
14806
14817
  accumulatedRawBuffer: this.accumulatedRawBuffer,
14807
14818
  recentOutputBuffer: this.recentOutputBuffer,
14808
- terminalScreenText: this.terminalScreen.getText(),
14819
+ terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
14809
14820
  baseMessages: [],
14810
14821
  partialResponse: this.responseBuffer,
14811
14822
  isWaitingForResponse: this.isWaitingForResponse,
@@ -39101,6 +39112,8 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
39101
39112
  addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
39102
39113
  addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
39103
39114
  addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
39115
+ addCandidate((0, import_node_path2.resolve)(dir, "../../mcp-server/dist/index.js"));
39116
+ addCandidate((0, import_node_path2.resolve)(dir, "../../../mcp-server/dist/index.js"));
39104
39117
  };
39105
39118
  addPackagedCandidates(process.argv[1]);
39106
39119
  for (const candidate of candidates) {
@@ -39807,6 +39820,16 @@ var init_upgrade_helper = __esm({
39807
39820
  });
39808
39821
 
39809
39822
  // ../../oss/packages/daemon-core/src/commands/router.ts
39823
+ function normalizeReleaseChannel(value) {
39824
+ if (typeof value !== "string") return null;
39825
+ const normalized = value.trim().toLowerCase();
39826
+ if (normalized === "stable" || normalized === "latest") return "stable";
39827
+ if (normalized === "preview" || normalized === "next") return "preview";
39828
+ return null;
39829
+ }
39830
+ function resolveUpgradeChannel(args) {
39831
+ return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
39832
+ }
39810
39833
  function normalizeCommandSource(source) {
39811
39834
  switch (source) {
39812
39835
  case "ws":
@@ -39888,7 +39911,7 @@ function summarizeSessionHostPruneResult(result) {
39888
39911
  keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
39889
39912
  };
39890
39913
  }
39891
- var fs10, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
39914
+ var fs10, CHANNEL_NPM_TAG, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
39892
39915
  var init_router = __esm({
39893
39916
  "../../oss/packages/daemon-core/src/commands/router.ts"() {
39894
39917
  "use strict";
@@ -39915,6 +39938,7 @@ var init_router = __esm({
39915
39938
  init_snapshot();
39916
39939
  init_upgrade_helper();
39917
39940
  fs10 = __toESM(require("fs"));
39941
+ CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
39918
39942
  CHAT_COMMANDS = [
39919
39943
  "send_chat",
39920
39944
  "new_chat",
@@ -40516,8 +40540,10 @@ var init_router = __esm({
40516
40540
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
40517
40541
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
40518
40542
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
40519
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
40520
- LOG.info("Upgrade", `Latest ${pkgName}: v${latest}`);
40543
+ const channel = resolveUpgradeChannel(args);
40544
+ const npmTag = CHANNEL_NPM_TAG[channel];
40545
+ const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
40546
+ LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
40521
40547
  let currentInstalled = null;
40522
40548
  try {
40523
40549
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -40531,8 +40557,8 @@ var init_router = __esm({
40531
40557
  }
40532
40558
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
40533
40559
  if (currentInstalled === latest && runningVersion === latest) {
40534
- LOG.info("Upgrade", `Already on latest version v${latest}; skipping install`);
40535
- return { success: true, upgraded: false, alreadyLatest: true, version: latest };
40560
+ LOG.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
40561
+ return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
40536
40562
  }
40537
40563
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
40538
40564
  LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -40545,12 +40571,12 @@ var init_router = __esm({
40545
40571
  cwd: process.cwd(),
40546
40572
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
40547
40573
  });
40548
- LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
40574
+ LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
40549
40575
  setTimeout(() => {
40550
40576
  LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
40551
40577
  process.exit(0);
40552
40578
  }, 3e3);
40553
- return { success: true, upgraded: true, version: latest, restarting: true };
40579
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
40554
40580
  } catch (e) {
40555
40581
  LOG.error("Upgrade", `Failed: ${e.message}`);
40556
40582
  return { success: false, error: e.message };
@@ -40714,14 +40740,20 @@ var init_router = __esm({
40714
40740
  } catch {
40715
40741
  }
40716
40742
  }
40743
+ const mcpServerEntry = {
40744
+ command: coordinatorSetup.mcpServer.command,
40745
+ args: coordinatorSetup.mcpServer.args
40746
+ };
40747
+ if (args?.inlineMesh) {
40748
+ mcpServerEntry.env = {
40749
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh)
40750
+ };
40751
+ }
40717
40752
  const mcpConfig = {
40718
40753
  ...existingMcpConfig,
40719
40754
  mcpServers: {
40720
40755
  ...existingMcpConfig.mcpServers || {},
40721
- [coordinatorSetup.serverName]: {
40722
- command: coordinatorSetup.mcpServer.command,
40723
- args: coordinatorSetup.mcpServer.args
40724
- }
40756
+ [coordinatorSetup.serverName]: mcpServerEntry
40725
40757
  }
40726
40758
  };
40727
40759
  writeFileSync14(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
@@ -59116,7 +59148,7 @@ var init_adhdev_daemon = __esm({
59116
59148
  init_version();
59117
59149
  init_src();
59118
59150
  init_runtime_defaults();
59119
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.74" });
59151
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.75" });
59120
59152
  AdhdevDaemon = class _AdhdevDaemon {
59121
59153
  localHttpServer = null;
59122
59154
  localWss = null;