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/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",
@@ -41473,8 +41497,10 @@ var init_router = __esm({
41473
41497
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
41474
41498
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
41475
41499
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
41476
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
41477
- 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}`);
41478
41504
  let currentInstalled = null;
41479
41505
  try {
41480
41506
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -41488,8 +41514,8 @@ var init_router = __esm({
41488
41514
  }
41489
41515
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
41490
41516
  if (currentInstalled === latest && runningVersion === latest) {
41491
- LOG.info("Upgrade", `Already on latest version v${latest}; skipping install`);
41492
- 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 };
41493
41519
  }
41494
41520
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
41495
41521
  LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -41502,12 +41528,12 @@ var init_router = __esm({
41502
41528
  cwd: process.cwd(),
41503
41529
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
41504
41530
  });
41505
- LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
41531
+ LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
41506
41532
  setTimeout(() => {
41507
41533
  LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
41508
41534
  process.exit(0);
41509
41535
  }, 3e3);
41510
- return { success: true, upgraded: true, version: latest, restarting: true };
41536
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
41511
41537
  } catch (e) {
41512
41538
  LOG.error("Upgrade", `Failed: ${e.message}`);
41513
41539
  return { success: false, error: e.message };
@@ -41671,14 +41697,20 @@ var init_router = __esm({
41671
41697
  } catch {
41672
41698
  }
41673
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
+ }
41674
41709
  const mcpConfig = {
41675
41710
  ...existingMcpConfig,
41676
41711
  mcpServers: {
41677
41712
  ...existingMcpConfig.mcpServers || {},
41678
- [coordinatorSetup.serverName]: {
41679
- command: coordinatorSetup.mcpServer.command,
41680
- args: coordinatorSetup.mcpServer.args
41681
- }
41713
+ [coordinatorSetup.serverName]: mcpServerEntry
41682
41714
  }
41683
41715
  };
41684
41716
  writeFileSync15(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
@@ -90258,7 +90290,7 @@ var init_adhdev_daemon = __esm({
90258
90290
  init_version();
90259
90291
  init_src();
90260
90292
  init_runtime_defaults();
90261
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.74" });
90293
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.75" });
90262
90294
  AdhdevDaemon = class _AdhdevDaemon {
90263
90295
  localHttpServer = null;
90264
90296
  localWss = null;
@@ -93896,6 +93928,33 @@ var DEFAULT_TRACE_FOLLOW_INTERVAL_MS = 1500;
93896
93928
  var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
93897
93929
  var DEV_SERVER_PORT2 = 19280;
93898
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
+ }
93899
93958
  function hideCommand(command) {
93900
93959
  command._hidden = true;
93901
93960
  return command;
@@ -94210,7 +94269,21 @@ async function runDaemonUpgrade(options, pkgVersion3) {
94210
94269
  const realPath = fsMod.realpathSync(adhdevPath);
94211
94270
  const isLinked = realPath.includes(".openclaw") || realPath.includes("/src/");
94212
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
+ }
94213
94285
  console.log(` ${source_default.bold("Current:")} v${currentVersion}`);
94286
+ console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(configuredChannel)}`);
94214
94287
  console.log(` ${source_default.bold("Install:")} ${isLinked ? "npm link (dev)" : "npm global"}`);
94215
94288
  if (isLinked) {
94216
94289
  const projectRoot = pathMod.resolve(pathMod.dirname(realPath), "..");
@@ -94239,7 +94312,7 @@ async function runDaemonUpgrade(options, pkgVersion3) {
94239
94312
  try {
94240
94313
  const { execNpmCommandSync: execNpmCommandSync2, resolveCurrentGlobalInstallSurface: resolveCurrentGlobalInstallSurface2 } = await Promise.resolve().then(() => (init_src(), src_exports));
94241
94314
  const npmSurface = resolveCurrentGlobalInstallSurface2({ packageName: "adhdev" });
94242
- latest = String(execNpmCommandSync2(["view", "adhdev", "version"], { encoding: "utf-8" }, npmSurface)).trim();
94315
+ latest = String(execNpmCommandSync2(["view", `adhdev@${npmTag}`, "version"], { encoding: "utf-8" }, npmSurface)).trim();
94243
94316
  } catch (e) {
94244
94317
  console.log(source_default.red(`
94245
94318
  \u2717 Failed to check latest version: ${e?.message}
@@ -94866,10 +94939,36 @@ function registerDaemonCommands(program2, pkgVersion3) {
94866
94939
  process.exit(1);
94867
94940
  }
94868
94941
  }));
94869
- 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) => {
94870
94943
  await runDaemonUpgrade(options, pkgVersion3);
94871
94944
  }));
94872
- 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) => {
94873
94972
  await runDaemonUpgrade(options, pkgVersion3);
94874
94973
  });
94875
94974
  }