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/cli/index.js CHANGED
@@ -2061,6 +2061,7 @@ function normalizeConfig(raw) {
2061
2061
  ideSettings: isPlainObject(parsed.ideSettings) ? parsed.ideSettings : {},
2062
2062
  providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
2063
2063
  providerDir: asOptionalString(parsed.providerDir),
2064
+ updateChannel: parsed.updateChannel === "preview" ? "preview" : "stable",
2064
2065
  terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
2065
2066
  };
2066
2067
  }
@@ -2210,6 +2211,7 @@ var init_config = __esm({
2210
2211
  machineProviders: {},
2211
2212
  ideSettings: {},
2212
2213
  providerSourceMode: "normal",
2214
+ updateChannel: "stable",
2213
2215
  terminalSizingMode: "measured"
2214
2216
  };
2215
2217
  MACHINE_ID_PREFIX = "mach_";
@@ -14627,6 +14629,13 @@ var init_provider_cli_adapter = __esm({
14627
14629
  this.lastScreenSnapshotReadAt = now;
14628
14630
  return screenText;
14629
14631
  }
14632
+ getParseScreenText(screenText) {
14633
+ const currentSnapshot = normalizeScreenSnapshot(screenText);
14634
+ const lastSnapshot = this.lastScreenSnapshot;
14635
+ if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
14636
+ return `${screenText}
14637
+ ${lastSnapshot}`;
14638
+ }
14630
14639
  shouldReadTerminalScreenSnapshot(now) {
14631
14640
  if (!this.lastScreenText) return true;
14632
14641
  return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
@@ -15617,12 +15626,13 @@ var init_provider_cli_adapter = __esm({
15617
15626
  }
15618
15627
  try {
15619
15628
  const screenText = this.terminalScreen.getText();
15629
+ const parseScreenText = this.getParseScreenText(screenText);
15620
15630
  const tail = this.recentOutputBuffer.slice(-500);
15621
15631
  const input = buildCliParseInput({
15622
15632
  accumulatedBuffer: this.accumulatedBuffer,
15623
15633
  accumulatedRawBuffer: this.accumulatedRawBuffer,
15624
15634
  recentOutputBuffer: this.recentOutputBuffer,
15625
- terminalScreenText: screenText,
15635
+ terminalScreenText: parseScreenText,
15626
15636
  baseMessages: [],
15627
15637
  partialResponse: this.responseBuffer,
15628
15638
  isWaitingForResponse: this.isWaitingForResponse,
@@ -15716,8 +15726,9 @@ var init_provider_cli_adapter = __esm({
15716
15726
  */
15717
15727
  getScriptParsedStatus() {
15718
15728
  const screenText = this.readTerminalScreenText();
15729
+ const parseScreenText = this.getParseScreenText(screenText);
15719
15730
  const cached2 = this.parsedStatusCache;
15720
- 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) {
15731
+ 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) {
15721
15732
  return cached2.result;
15722
15733
  }
15723
15734
  const parsed = this.runParseSession();
@@ -15745,7 +15756,7 @@ var init_provider_cli_adapter = __esm({
15745
15756
  currentTurnScope: this.currentTurnScope,
15746
15757
  recentOutputBuffer: this.recentOutputBuffer,
15747
15758
  accumulatedBuffer: this.accumulatedBuffer,
15748
- screenText,
15759
+ screenText: parseScreenText,
15749
15760
  currentStatus: this.currentStatus,
15750
15761
  activeModal: this.activeModal,
15751
15762
  cliName: this.cliName,
@@ -15762,7 +15773,7 @@ var init_provider_cli_adapter = __esm({
15762
15773
  accumulatedBuffer: this.accumulatedBuffer,
15763
15774
  accumulatedRawBuffer: this.accumulatedRawBuffer,
15764
15775
  recentOutputBuffer: this.recentOutputBuffer,
15765
- terminalScreenText: this.terminalScreen.getText(),
15776
+ terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
15766
15777
  baseMessages: [],
15767
15778
  partialResponse: this.responseBuffer,
15768
15779
  isWaitingForResponse: this.isWaitingForResponse,
@@ -40058,6 +40069,8 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
40058
40069
  addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
40059
40070
  addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
40060
40071
  addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
40072
+ addCandidate((0, import_node_path2.resolve)(dir, "../../mcp-server/dist/index.js"));
40073
+ addCandidate((0, import_node_path2.resolve)(dir, "../../../mcp-server/dist/index.js"));
40061
40074
  };
40062
40075
  addPackagedCandidates(process.argv[1]);
40063
40076
  for (const candidate of candidates) {
@@ -40764,6 +40777,16 @@ var init_upgrade_helper = __esm({
40764
40777
  });
40765
40778
 
40766
40779
  // ../../oss/packages/daemon-core/src/commands/router.ts
40780
+ function normalizeReleaseChannel(value) {
40781
+ if (typeof value !== "string") return null;
40782
+ const normalized = value.trim().toLowerCase();
40783
+ if (normalized === "stable" || normalized === "latest") return "stable";
40784
+ if (normalized === "preview" || normalized === "next") return "preview";
40785
+ return null;
40786
+ }
40787
+ function resolveUpgradeChannel(args) {
40788
+ return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
40789
+ }
40767
40790
  function normalizeCommandSource(source) {
40768
40791
  switch (source) {
40769
40792
  case "ws":
@@ -40845,7 +40868,7 @@ function summarizeSessionHostPruneResult(result) {
40845
40868
  keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
40846
40869
  };
40847
40870
  }
40848
- var fs10, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
40871
+ var fs10, CHANNEL_NPM_TAG, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
40849
40872
  var init_router = __esm({
40850
40873
  "../../oss/packages/daemon-core/src/commands/router.ts"() {
40851
40874
  "use strict";
@@ -40872,6 +40895,7 @@ var init_router = __esm({
40872
40895
  init_snapshot();
40873
40896
  init_upgrade_helper();
40874
40897
  fs10 = __toESM(require("fs"));
40898
+ CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
40875
40899
  CHAT_COMMANDS = [
40876
40900
  "send_chat",
40877
40901
  "new_chat",
@@ -40882,6 +40906,10 @@ var init_router = __esm({
40882
40906
  READ_DEBUG_ENABLED2 = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
40883
40907
  DaemonCommandRouter = class {
40884
40908
  deps;
40909
+ /** In-memory cache for cloud-originating meshes passed via inlineMesh.
40910
+ * Allows the MCP server to query mesh data via get_mesh even when
40911
+ * the mesh doesn't exist in the local meshes.json file. */
40912
+ inlineMeshCache = /* @__PURE__ */ new Map();
40885
40913
  constructor(deps) {
40886
40914
  this.deps = deps;
40887
40915
  }
@@ -41469,8 +41497,10 @@ var init_router = __esm({
41469
41497
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
41470
41498
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
41471
41499
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
41472
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
41473
- LOG.info("Upgrade", `Latest ${pkgName}: v${latest}`);
41500
+ const channel = resolveUpgradeChannel(args);
41501
+ const npmTag = CHANNEL_NPM_TAG[channel];
41502
+ const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
41503
+ LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
41474
41504
  let currentInstalled = null;
41475
41505
  try {
41476
41506
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -41484,8 +41514,8 @@ var init_router = __esm({
41484
41514
  }
41485
41515
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
41486
41516
  if (currentInstalled === latest && runningVersion === latest) {
41487
- LOG.info("Upgrade", `Already on latest version v${latest}; skipping install`);
41488
- return { success: true, upgraded: false, alreadyLatest: true, version: latest };
41517
+ LOG.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
41518
+ return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
41489
41519
  }
41490
41520
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
41491
41521
  LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -41498,12 +41528,12 @@ var init_router = __esm({
41498
41528
  cwd: process.cwd(),
41499
41529
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
41500
41530
  });
41501
- LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
41531
+ LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
41502
41532
  setTimeout(() => {
41503
41533
  LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
41504
41534
  process.exit(0);
41505
41535
  }, 3e3);
41506
- return { success: true, upgraded: true, version: latest, restarting: true };
41536
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
41507
41537
  } catch (e) {
41508
41538
  LOG.error("Upgrade", `Failed: ${e.message}`);
41509
41539
  return { success: false, error: e.message };
@@ -41530,11 +41560,12 @@ var init_router = __esm({
41530
41560
  try {
41531
41561
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
41532
41562
  const mesh = getMesh3(meshId);
41533
- if (!mesh) return { success: false, error: "Mesh not found" };
41534
- return { success: true, mesh };
41535
- } catch (e) {
41536
- return { success: false, error: e.message };
41563
+ if (mesh) return { success: true, mesh };
41564
+ } catch {
41537
41565
  }
41566
+ const cached2 = this.inlineMeshCache.get(meshId);
41567
+ if (cached2) return { success: true, mesh: cached2 };
41568
+ return { success: false, error: "Mesh not found" };
41538
41569
  }
41539
41570
  case "create_mesh": {
41540
41571
  const name = typeof args?.name === "string" ? args.name.trim() : "";
@@ -41597,6 +41628,7 @@ var init_router = __esm({
41597
41628
  let mesh;
41598
41629
  if (args?.inlineMesh && typeof args.inlineMesh === "object") {
41599
41630
  mesh = args.inlineMesh;
41631
+ this.inlineMeshCache.set(meshId, mesh);
41600
41632
  } else {
41601
41633
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
41602
41634
  mesh = getMesh3(meshId);
@@ -41665,14 +41697,20 @@ var init_router = __esm({
41665
41697
  } catch {
41666
41698
  }
41667
41699
  }
41700
+ const mcpServerEntry = {
41701
+ command: coordinatorSetup.mcpServer.command,
41702
+ args: coordinatorSetup.mcpServer.args
41703
+ };
41704
+ if (args?.inlineMesh) {
41705
+ mcpServerEntry.env = {
41706
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh)
41707
+ };
41708
+ }
41668
41709
  const mcpConfig = {
41669
41710
  ...existingMcpConfig,
41670
41711
  mcpServers: {
41671
41712
  ...existingMcpConfig.mcpServers || {},
41672
- [coordinatorSetup.serverName]: {
41673
- command: coordinatorSetup.mcpServer.command,
41674
- args: coordinatorSetup.mcpServer.args
41675
- }
41713
+ [coordinatorSetup.serverName]: mcpServerEntry
41676
41714
  }
41677
41715
  };
41678
41716
  writeFileSync15(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
@@ -90252,7 +90290,7 @@ var init_adhdev_daemon = __esm({
90252
90290
  init_version();
90253
90291
  init_src();
90254
90292
  init_runtime_defaults();
90255
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.73" });
90293
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.75" });
90256
90294
  AdhdevDaemon = class _AdhdevDaemon {
90257
90295
  localHttpServer = null;
90258
90296
  localWss = null;
@@ -93890,6 +93928,33 @@ var DEFAULT_TRACE_FOLLOW_INTERVAL_MS = 1500;
93890
93928
  var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
93891
93929
  var DEV_SERVER_PORT2 = 19280;
93892
93930
  var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
93931
+ var CHANNEL_NPM_TAG2 = { stable: "latest", preview: "next" };
93932
+ var CHANNEL_SERVER_URL = {
93933
+ stable: "https://api.adhf.dev",
93934
+ preview: "https://api-preview.adhf.dev"
93935
+ };
93936
+ function normalizeReleaseChannel2(value) {
93937
+ if (typeof value !== "string") return null;
93938
+ const normalized = value.trim().toLowerCase();
93939
+ if (normalized === "stable" || normalized === "latest") return "stable";
93940
+ if (normalized === "preview" || normalized === "next") return "preview";
93941
+ return null;
93942
+ }
93943
+ async function resolveConfiguredUpdateChannel() {
93944
+ try {
93945
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
93946
+ return normalizeReleaseChannel2(loadConfig2().updateChannel) || "stable";
93947
+ } catch {
93948
+ return "stable";
93949
+ }
93950
+ }
93951
+ function releaseChannelLabel(channel) {
93952
+ return `${channel} (${CHANNEL_NPM_TAG2[channel]})`;
93953
+ }
93954
+ async function persistReleaseChannel(channel) {
93955
+ const { updateConfig: updateConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
93956
+ updateConfig2({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
93957
+ }
93893
93958
  function hideCommand(command) {
93894
93959
  command._hidden = true;
93895
93960
  return command;
@@ -94204,7 +94269,21 @@ async function runDaemonUpgrade(options, pkgVersion3) {
94204
94269
  const realPath = fsMod.realpathSync(adhdevPath);
94205
94270
  const isLinked = realPath.includes(".openclaw") || realPath.includes("/src/");
94206
94271
  const currentVersion = pkgVersion3;
94272
+ const requestedChannel = options.channel === void 0 ? null : normalizeReleaseChannel2(options.channel);
94273
+ if (options.channel !== void 0 && !requestedChannel) {
94274
+ console.log(source_default.red(`
94275
+ \u2717 Invalid update channel: ${options.channel}. Use stable/latest or preview/next.
94276
+ `));
94277
+ process.exit(1);
94278
+ return;
94279
+ }
94280
+ const configuredChannel = requestedChannel || await resolveConfiguredUpdateChannel();
94281
+ const npmTag = CHANNEL_NPM_TAG2[configuredChannel];
94282
+ if (requestedChannel) {
94283
+ await persistReleaseChannel(configuredChannel);
94284
+ }
94207
94285
  console.log(` ${source_default.bold("Current:")} v${currentVersion}`);
94286
+ console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(configuredChannel)}`);
94208
94287
  console.log(` ${source_default.bold("Install:")} ${isLinked ? "npm link (dev)" : "npm global"}`);
94209
94288
  if (isLinked) {
94210
94289
  const projectRoot = pathMod.resolve(pathMod.dirname(realPath), "..");
@@ -94233,7 +94312,7 @@ async function runDaemonUpgrade(options, pkgVersion3) {
94233
94312
  try {
94234
94313
  const { execNpmCommandSync: execNpmCommandSync2, resolveCurrentGlobalInstallSurface: resolveCurrentGlobalInstallSurface2 } = await Promise.resolve().then(() => (init_src(), src_exports));
94235
94314
  const npmSurface = resolveCurrentGlobalInstallSurface2({ packageName: "adhdev" });
94236
- latest = String(execNpmCommandSync2(["view", "adhdev", "version"], { encoding: "utf-8" }, npmSurface)).trim();
94315
+ latest = String(execNpmCommandSync2(["view", `adhdev@${npmTag}`, "version"], { encoding: "utf-8" }, npmSurface)).trim();
94237
94316
  } catch (e) {
94238
94317
  console.log(source_default.red(`
94239
94318
  \u2717 Failed to check latest version: ${e?.message}
@@ -94860,10 +94939,36 @@ function registerDaemonCommands(program2, pkgVersion3) {
94860
94939
  process.exit(1);
94861
94940
  }
94862
94941
  }));
94863
- hideCommand(program2.command("daemon:upgrade").description("Upgrade ADHDev to latest version and restart daemon").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
94942
+ hideCommand(program2.command("daemon:upgrade").description("Upgrade ADHDev to the selected channel and restart daemon").option("--channel <channel>", "Update channel: stable/latest or preview/next").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
94864
94943
  await runDaemonUpgrade(options, pkgVersion3);
94865
94944
  }));
94866
- program2.command("update").description("\u{1F504} Update ADHDev to latest version and restart daemon (alias for daemon:upgrade)").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
94945
+ const channel = program2.command("channel").description("Manage ADHDev release/update channel");
94946
+ channel.command("get").description("Show the configured ADHDev channel").action(async () => {
94947
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
94948
+ const config2 = loadConfig2();
94949
+ const current = normalizeReleaseChannel2(config2.updateChannel) || "stable";
94950
+ console.log(source_default.bold("\n ADHDev Channel\n"));
94951
+ console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(current)}`);
94952
+ console.log(` ${source_default.bold("Server:")} ${config2.serverUrl || CHANNEL_SERVER_URL[current]}`);
94953
+ console.log();
94954
+ });
94955
+ channel.command("set <channel>").description("Set the ADHDev channel: stable/latest or preview/next").action(async (channelName) => {
94956
+ const selected = normalizeReleaseChannel2(channelName);
94957
+ if (!selected) {
94958
+ console.error(source_default.red(`
94959
+ \u2717 Unknown channel: ${channelName}. Use stable or preview.
94960
+ `));
94961
+ process.exit(1);
94962
+ return;
94963
+ }
94964
+ await persistReleaseChannel(selected);
94965
+ console.log(source_default.green(`
94966
+ \u2713 Channel set to ${releaseChannelLabel(selected)}`));
94967
+ console.log(source_default.gray(` Server: ${CHANNEL_SERVER_URL[selected]}`));
94968
+ console.log(source_default.gray(` Update: adhdev update --channel ${selected}
94969
+ `));
94970
+ });
94971
+ program2.command("update").description("\u{1F504} Update ADHDev to selected channel and restart daemon").option("--channel <channel>", "Update channel: stable/latest or preview/next").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
94867
94972
  await runDaemonUpgrade(options, pkgVersion3);
94868
94973
  });
94869
94974
  }