adhdev 0.9.73 → 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",
@@ -39925,6 +39949,10 @@ var init_router = __esm({
39925
39949
  READ_DEBUG_ENABLED2 = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
39926
39950
  DaemonCommandRouter = class {
39927
39951
  deps;
39952
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
39953
+ * Allows the MCP server to query mesh data via get_mesh even when
39954
+ * the mesh doesn't exist in the local meshes.json file. */
39955
+ inlineMeshCache = /* @__PURE__ */ new Map();
39928
39956
  constructor(deps) {
39929
39957
  this.deps = deps;
39930
39958
  }
@@ -40512,8 +40540,10 @@ var init_router = __esm({
40512
40540
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
40513
40541
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
40514
40542
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
40515
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
40516
- 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}`);
40517
40547
  let currentInstalled = null;
40518
40548
  try {
40519
40549
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -40527,8 +40557,8 @@ var init_router = __esm({
40527
40557
  }
40528
40558
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
40529
40559
  if (currentInstalled === latest && runningVersion === latest) {
40530
- LOG.info("Upgrade", `Already on latest version v${latest}; skipping install`);
40531
- 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 };
40532
40562
  }
40533
40563
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
40534
40564
  LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -40541,12 +40571,12 @@ var init_router = __esm({
40541
40571
  cwd: process.cwd(),
40542
40572
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
40543
40573
  });
40544
- LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
40574
+ LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
40545
40575
  setTimeout(() => {
40546
40576
  LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
40547
40577
  process.exit(0);
40548
40578
  }, 3e3);
40549
- return { success: true, upgraded: true, version: latest, restarting: true };
40579
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
40550
40580
  } catch (e) {
40551
40581
  LOG.error("Upgrade", `Failed: ${e.message}`);
40552
40582
  return { success: false, error: e.message };
@@ -40573,11 +40603,12 @@ var init_router = __esm({
40573
40603
  try {
40574
40604
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40575
40605
  const mesh = getMesh3(meshId);
40576
- if (!mesh) return { success: false, error: "Mesh not found" };
40577
- return { success: true, mesh };
40578
- } catch (e) {
40579
- return { success: false, error: e.message };
40606
+ if (mesh) return { success: true, mesh };
40607
+ } catch {
40580
40608
  }
40609
+ const cached2 = this.inlineMeshCache.get(meshId);
40610
+ if (cached2) return { success: true, mesh: cached2 };
40611
+ return { success: false, error: "Mesh not found" };
40581
40612
  }
40582
40613
  case "create_mesh": {
40583
40614
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -40640,6 +40671,7 @@ var init_router = __esm({
40640
40671
  let mesh;
40641
40672
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
40642
40673
  mesh = args.inlineMesh;
40674
+ this.inlineMeshCache.set(meshId, mesh);
40643
40675
  } else {
40644
40676
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
40645
40677
  mesh = getMesh3(meshId);
@@ -40708,14 +40740,20 @@ var init_router = __esm({
40708
40740
  } catch {
40709
40741
  }
40710
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
+ }
40711
40752
  const mcpConfig = {
40712
40753
  ...existingMcpConfig,
40713
40754
  mcpServers: {
40714
40755
  ...existingMcpConfig.mcpServers || {},
40715
- [coordinatorSetup.serverName]: {
40716
- command: coordinatorSetup.mcpServer.command,
40717
- args: coordinatorSetup.mcpServer.args
40718
- }
40756
+ [coordinatorSetup.serverName]: mcpServerEntry
40719
40757
  }
40720
40758
  };
40721
40759
  writeFileSync14(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
@@ -59110,7 +59148,7 @@ var init_adhdev_daemon = __esm({
59110
59148
  init_version();
59111
59149
  init_src();
59112
59150
  init_runtime_defaults();
59113
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.73" });
59151
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.75" });
59114
59152
  AdhdevDaemon = class _AdhdevDaemon {
59115
59153
  localHttpServer = null;
59116
59154
  localWss = null;