@adhdev/daemon-standalone 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
@@ -27980,6 +27980,7 @@ var require_dist2 = __commonJS({
27980
27980
  ideSettings: isPlainObject2(parsed.ideSettings) ? parsed.ideSettings : {},
27981
27981
  providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
27982
27982
  providerDir: asOptionalString(parsed.providerDir),
27983
+ updateChannel: parsed.updateChannel === "preview" ? "preview" : "stable",
27983
27984
  terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
27984
27985
  };
27985
27986
  }
@@ -28134,6 +28135,7 @@ var require_dist2 = __commonJS({
28134
28135
  machineProviders: {},
28135
28136
  ideSettings: {},
28136
28137
  providerSourceMode: "normal",
28138
+ updateChannel: "stable",
28137
28139
  terminalSizingMode: "measured"
28138
28140
  };
28139
28141
  MACHINE_ID_PREFIX = "mach_";
@@ -29627,6 +29629,13 @@ ${rules.join("\n")}`;
29627
29629
  this.lastScreenSnapshotReadAt = now;
29628
29630
  return screenText;
29629
29631
  }
29632
+ getParseScreenText(screenText) {
29633
+ const currentSnapshot = normalizeScreenSnapshot(screenText);
29634
+ const lastSnapshot = this.lastScreenSnapshot;
29635
+ if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
29636
+ return `${screenText}
29637
+ ${lastSnapshot}`;
29638
+ }
29630
29639
  shouldReadTerminalScreenSnapshot(now) {
29631
29640
  if (!this.lastScreenText) return true;
29632
29641
  return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
@@ -30617,12 +30626,13 @@ ${rules.join("\n")}`;
30617
30626
  }
30618
30627
  try {
30619
30628
  const screenText = this.terminalScreen.getText();
30629
+ const parseScreenText = this.getParseScreenText(screenText);
30620
30630
  const tail = this.recentOutputBuffer.slice(-500);
30621
30631
  const input = buildCliParseInput({
30622
30632
  accumulatedBuffer: this.accumulatedBuffer,
30623
30633
  accumulatedRawBuffer: this.accumulatedRawBuffer,
30624
30634
  recentOutputBuffer: this.recentOutputBuffer,
30625
- terminalScreenText: screenText,
30635
+ terminalScreenText: parseScreenText,
30626
30636
  baseMessages: [],
30627
30637
  partialResponse: this.responseBuffer,
30628
30638
  isWaitingForResponse: this.isWaitingForResponse,
@@ -30716,8 +30726,9 @@ ${rules.join("\n")}`;
30716
30726
  */
30717
30727
  getScriptParsedStatus() {
30718
30728
  const screenText = this.readTerminalScreenText();
30729
+ const parseScreenText = this.getParseScreenText(screenText);
30719
30730
  const cached2 = this.parsedStatusCache;
30720
- 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) {
30731
+ 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) {
30721
30732
  return cached2.result;
30722
30733
  }
30723
30734
  const parsed = this.runParseSession();
@@ -30745,7 +30756,7 @@ ${rules.join("\n")}`;
30745
30756
  currentTurnScope: this.currentTurnScope,
30746
30757
  recentOutputBuffer: this.recentOutputBuffer,
30747
30758
  accumulatedBuffer: this.accumulatedBuffer,
30748
- screenText,
30759
+ screenText: parseScreenText,
30749
30760
  currentStatus: this.currentStatus,
30750
30761
  activeModal: this.activeModal,
30751
30762
  cliName: this.cliName,
@@ -30762,7 +30773,7 @@ ${rules.join("\n")}`;
30762
30773
  accumulatedBuffer: this.accumulatedBuffer,
30763
30774
  accumulatedRawBuffer: this.accumulatedRawBuffer,
30764
30775
  recentOutputBuffer: this.recentOutputBuffer,
30765
- terminalScreenText: this.terminalScreen.getText(),
30776
+ terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
30766
30777
  baseMessages: [],
30767
30778
  partialResponse: this.responseBuffer,
30768
30779
  isWaitingForResponse: this.isWaitingForResponse,
@@ -47801,6 +47812,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
47801
47812
  addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
47802
47813
  addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
47803
47814
  addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
47815
+ addCandidate((0, import_node_path2.resolve)(dir, "../../mcp-server/dist/index.js"));
47816
+ addCandidate((0, import_node_path2.resolve)(dir, "../../../mcp-server/dist/index.js"));
47804
47817
  };
47805
47818
  addPackagedCandidates(process.argv[1]);
47806
47819
  for (const candidate of candidates) {
@@ -48472,6 +48485,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
48472
48485
  }
48473
48486
  }
48474
48487
  var fs10 = __toESM2(require("fs"));
48488
+ var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
48489
+ function normalizeReleaseChannel(value) {
48490
+ if (typeof value !== "string") return null;
48491
+ const normalized = value.trim().toLowerCase();
48492
+ if (normalized === "stable" || normalized === "latest") return "stable";
48493
+ if (normalized === "preview" || normalized === "next") return "preview";
48494
+ return null;
48495
+ }
48496
+ function resolveUpgradeChannel(args) {
48497
+ return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig2().updateChannel) || "stable";
48498
+ }
48475
48499
  var CHAT_COMMANDS = [
48476
48500
  "send_chat",
48477
48501
  "new_chat",
@@ -48563,6 +48587,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
48563
48587
  }
48564
48588
  var DaemonCommandRouter = class {
48565
48589
  deps;
48590
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
48591
+ * Allows the MCP server to query mesh data via get_mesh even when
48592
+ * the mesh doesn't exist in the local meshes.json file. */
48593
+ inlineMeshCache = /* @__PURE__ */ new Map();
48566
48594
  constructor(deps) {
48567
48595
  this.deps = deps;
48568
48596
  }
@@ -49150,8 +49178,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
49150
49178
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
49151
49179
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
49152
49180
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
49153
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
49154
- LOG2.info("Upgrade", `Latest ${pkgName}: v${latest}`);
49181
+ const channel = resolveUpgradeChannel(args);
49182
+ const npmTag = CHANNEL_NPM_TAG[channel];
49183
+ const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
49184
+ LOG2.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
49155
49185
  let currentInstalled = null;
49156
49186
  try {
49157
49187
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -49165,8 +49195,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
49165
49195
  }
49166
49196
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
49167
49197
  if (currentInstalled === latest && runningVersion === latest) {
49168
- LOG2.info("Upgrade", `Already on latest version v${latest}; skipping install`);
49169
- return { success: true, upgraded: false, alreadyLatest: true, version: latest };
49198
+ LOG2.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
49199
+ return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
49170
49200
  }
49171
49201
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
49172
49202
  LOG2.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -49179,12 +49209,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
49179
49209
  cwd: process.cwd(),
49180
49210
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
49181
49211
  });
49182
- LOG2.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
49212
+ LOG2.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
49183
49213
  setTimeout(() => {
49184
49214
  LOG2.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
49185
49215
  process.exit(0);
49186
49216
  }, 3e3);
49187
- return { success: true, upgraded: true, version: latest, restarting: true };
49217
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
49188
49218
  } catch (e) {
49189
49219
  LOG2.error("Upgrade", `Failed: ${e.message}`);
49190
49220
  return { success: false, error: e.message };
@@ -49211,11 +49241,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
49211
49241
  try {
49212
49242
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
49213
49243
  const mesh = getMesh3(meshId);
49214
- if (!mesh) return { success: false, error: "Mesh not found" };
49215
- return { success: true, mesh };
49216
- } catch (e) {
49217
- return { success: false, error: e.message };
49244
+ if (mesh) return { success: true, mesh };
49245
+ } catch {
49218
49246
  }
49247
+ const cached2 = this.inlineMeshCache.get(meshId);
49248
+ if (cached2) return { success: true, mesh: cached2 };
49249
+ return { success: false, error: "Mesh not found" };
49219
49250
  }
49220
49251
  case "create_mesh": {
49221
49252
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -49278,6 +49309,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
49278
49309
  let mesh;
49279
49310
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
49280
49311
  mesh = args.inlineMesh;
49312
+ this.inlineMeshCache.set(meshId, mesh);
49281
49313
  } else {
49282
49314
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
49283
49315
  mesh = getMesh3(meshId);
@@ -49346,14 +49378,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
49346
49378
  } catch {
49347
49379
  }
49348
49380
  }
49381
+ const mcpServerEntry = {
49382
+ command: coordinatorSetup.mcpServer.command,
49383
+ args: coordinatorSetup.mcpServer.args
49384
+ };
49385
+ if (args?.inlineMesh) {
49386
+ mcpServerEntry.env = {
49387
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh)
49388
+ };
49389
+ }
49349
49390
  const mcpConfig = {
49350
49391
  ...existingMcpConfig,
49351
49392
  mcpServers: {
49352
49393
  ...existingMcpConfig.mcpServers || {},
49353
- [coordinatorSetup.serverName]: {
49354
- command: coordinatorSetup.mcpServer.command,
49355
- args: coordinatorSetup.mcpServer.args
49356
- }
49394
+ [coordinatorSetup.serverName]: mcpServerEntry
49357
49395
  }
49358
49396
  };
49359
49397
  writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");