adhdev 0.9.74 → 0.9.76-rc.1

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_";
@@ -2905,7 +2907,7 @@ function buildNodeConfigSection(mesh) {
2905
2907
  for (const n of mesh.nodes) {
2906
2908
  const labels = [];
2907
2909
  if (n.isLocalWorktree) labels.push("worktree");
2908
- if (n.policy.readOnly) labels.push("read-only");
2910
+ if (n.policy?.readOnly) labels.push("read-only");
2909
2911
  const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
2910
2912
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
2911
2913
  }
@@ -2951,18 +2953,20 @@ var init_coordinator_prompt = __esm({
2951
2953
  3. **Delegate** \u2014 For each task:
2952
2954
  a. Pick the best node (consider: health, dirty state, current workload).
2953
2955
  b. If no session exists, call \`mesh_launch_session\` to start one.
2954
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
2956
+ c. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
2955
2957
  4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
2956
2958
  5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
2957
2959
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
2958
2960
  7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
2959
2961
  RULES_SECTION = `## Rules
2960
2962
 
2961
- - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
2962
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
2963
+ - **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly \u2014 delegate all of that to node agents. Your context should stay lean.
2964
+ - **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to a node. Do not do it yourself.
2965
+ - **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
2966
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
2963
2967
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
2964
2968
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
2965
- - **Keep the user informed.** Report progress after each delegation round.
2969
+ - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
2966
2970
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
2967
2971
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
2968
2972
  }
@@ -14627,6 +14631,17 @@ var init_provider_cli_adapter = __esm({
14627
14631
  this.lastScreenSnapshotReadAt = now;
14628
14632
  return screenText;
14629
14633
  }
14634
+ getParseScreenText(screenText) {
14635
+ const currentSnapshot = normalizeScreenSnapshot(screenText);
14636
+ const lastSnapshot = this.lastScreenSnapshot;
14637
+ if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
14638
+ const staleSnapshotLooksActive = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel/i.test(lastSnapshot);
14639
+ const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:\n|\r|$)/.test(screenText) && !/\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel/i.test(screenText);
14640
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
14641
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
14642
+ return `${screenText}
14643
+ ${lastSnapshot}`;
14644
+ }
14630
14645
  shouldReadTerminalScreenSnapshot(now) {
14631
14646
  if (!this.lastScreenText) return true;
14632
14647
  return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
@@ -15617,12 +15632,13 @@ var init_provider_cli_adapter = __esm({
15617
15632
  }
15618
15633
  try {
15619
15634
  const screenText = this.terminalScreen.getText();
15635
+ const parseScreenText = this.getParseScreenText(screenText);
15620
15636
  const tail = this.recentOutputBuffer.slice(-500);
15621
15637
  const input = buildCliParseInput({
15622
15638
  accumulatedBuffer: this.accumulatedBuffer,
15623
15639
  accumulatedRawBuffer: this.accumulatedRawBuffer,
15624
15640
  recentOutputBuffer: this.recentOutputBuffer,
15625
- terminalScreenText: screenText,
15641
+ terminalScreenText: parseScreenText,
15626
15642
  baseMessages: [],
15627
15643
  partialResponse: this.responseBuffer,
15628
15644
  isWaitingForResponse: this.isWaitingForResponse,
@@ -15716,8 +15732,9 @@ var init_provider_cli_adapter = __esm({
15716
15732
  */
15717
15733
  getScriptParsedStatus() {
15718
15734
  const screenText = this.readTerminalScreenText();
15735
+ const parseScreenText = this.getParseScreenText(screenText);
15719
15736
  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) {
15737
+ 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
15738
  return cached2.result;
15722
15739
  }
15723
15740
  const parsed = this.runParseSession();
@@ -15745,7 +15762,7 @@ var init_provider_cli_adapter = __esm({
15745
15762
  currentTurnScope: this.currentTurnScope,
15746
15763
  recentOutputBuffer: this.recentOutputBuffer,
15747
15764
  accumulatedBuffer: this.accumulatedBuffer,
15748
- screenText,
15765
+ screenText: parseScreenText,
15749
15766
  currentStatus: this.currentStatus,
15750
15767
  activeModal: this.activeModal,
15751
15768
  cliName: this.cliName,
@@ -15762,7 +15779,7 @@ var init_provider_cli_adapter = __esm({
15762
15779
  accumulatedBuffer: this.accumulatedBuffer,
15763
15780
  accumulatedRawBuffer: this.accumulatedRawBuffer,
15764
15781
  recentOutputBuffer: this.recentOutputBuffer,
15765
- terminalScreenText: this.terminalScreen.getText(),
15782
+ terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
15766
15783
  baseMessages: [],
15767
15784
  partialResponse: this.responseBuffer,
15768
15785
  isWaitingForResponse: this.isWaitingForResponse,
@@ -40058,6 +40075,8 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
40058
40075
  addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
40059
40076
  addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
40060
40077
  addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
40078
+ addCandidate((0, import_node_path2.resolve)(dir, "../../mcp-server/dist/index.js"));
40079
+ addCandidate((0, import_node_path2.resolve)(dir, "../../../mcp-server/dist/index.js"));
40061
40080
  };
40062
40081
  addPackagedCandidates(process.argv[1]);
40063
40082
  for (const candidate of candidates) {
@@ -40764,6 +40783,16 @@ var init_upgrade_helper = __esm({
40764
40783
  });
40765
40784
 
40766
40785
  // ../../oss/packages/daemon-core/src/commands/router.ts
40786
+ function normalizeReleaseChannel(value) {
40787
+ if (typeof value !== "string") return null;
40788
+ const normalized = value.trim().toLowerCase();
40789
+ if (normalized === "stable" || normalized === "latest") return "stable";
40790
+ if (normalized === "preview" || normalized === "next") return "preview";
40791
+ return null;
40792
+ }
40793
+ function resolveUpgradeChannel(args) {
40794
+ return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
40795
+ }
40767
40796
  function normalizeCommandSource(source) {
40768
40797
  switch (source) {
40769
40798
  case "ws":
@@ -40845,7 +40874,7 @@ function summarizeSessionHostPruneResult(result) {
40845
40874
  keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
40846
40875
  };
40847
40876
  }
40848
- var fs10, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
40877
+ var fs10, CHANNEL_NPM_TAG, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
40849
40878
  var init_router = __esm({
40850
40879
  "../../oss/packages/daemon-core/src/commands/router.ts"() {
40851
40880
  "use strict";
@@ -40872,6 +40901,7 @@ var init_router = __esm({
40872
40901
  init_snapshot();
40873
40902
  init_upgrade_helper();
40874
40903
  fs10 = __toESM(require("fs"));
40904
+ CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
40875
40905
  CHAT_COMMANDS = [
40876
40906
  "send_chat",
40877
40907
  "new_chat",
@@ -41473,8 +41503,10 @@ var init_router = __esm({
41473
41503
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
41474
41504
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
41475
41505
  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}`);
41506
+ const channel = resolveUpgradeChannel(args);
41507
+ const npmTag = CHANNEL_NPM_TAG[channel];
41508
+ const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
41509
+ LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
41478
41510
  let currentInstalled = null;
41479
41511
  try {
41480
41512
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -41488,8 +41520,8 @@ var init_router = __esm({
41488
41520
  }
41489
41521
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
41490
41522
  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 };
41523
+ LOG.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
41524
+ return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
41493
41525
  }
41494
41526
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
41495
41527
  LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -41502,12 +41534,12 @@ var init_router = __esm({
41502
41534
  cwd: process.cwd(),
41503
41535
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
41504
41536
  });
41505
- LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
41537
+ LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
41506
41538
  setTimeout(() => {
41507
41539
  LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
41508
41540
  process.exit(0);
41509
41541
  }, 3e3);
41510
- return { success: true, upgraded: true, version: latest, restarting: true };
41542
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
41511
41543
  } catch (e) {
41512
41544
  LOG.error("Upgrade", `Failed: ${e.message}`);
41513
41545
  return { success: false, error: e.message };
@@ -41671,14 +41703,20 @@ var init_router = __esm({
41671
41703
  } catch {
41672
41704
  }
41673
41705
  }
41706
+ const mcpServerEntry = {
41707
+ command: coordinatorSetup.mcpServer.command,
41708
+ args: coordinatorSetup.mcpServer.args
41709
+ };
41710
+ if (args?.inlineMesh) {
41711
+ mcpServerEntry.env = {
41712
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh)
41713
+ };
41714
+ }
41674
41715
  const mcpConfig = {
41675
41716
  ...existingMcpConfig,
41676
41717
  mcpServers: {
41677
41718
  ...existingMcpConfig.mcpServers || {},
41678
- [coordinatorSetup.serverName]: {
41679
- command: coordinatorSetup.mcpServer.command,
41680
- args: coordinatorSetup.mcpServer.args
41681
- }
41719
+ [coordinatorSetup.serverName]: mcpServerEntry
41682
41720
  }
41683
41721
  };
41684
41722
  writeFileSync15(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
@@ -90258,7 +90296,7 @@ var init_adhdev_daemon = __esm({
90258
90296
  init_version();
90259
90297
  init_src();
90260
90298
  init_runtime_defaults();
90261
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.74" });
90299
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.1" });
90262
90300
  AdhdevDaemon = class _AdhdevDaemon {
90263
90301
  localHttpServer = null;
90264
90302
  localWss = null;
@@ -93896,6 +93934,33 @@ var DEFAULT_TRACE_FOLLOW_INTERVAL_MS = 1500;
93896
93934
  var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
93897
93935
  var DEV_SERVER_PORT2 = 19280;
93898
93936
  var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
93937
+ var CHANNEL_NPM_TAG2 = { stable: "latest", preview: "next" };
93938
+ var CHANNEL_SERVER_URL = {
93939
+ stable: "https://api.adhf.dev",
93940
+ preview: "https://api-preview.adhf.dev"
93941
+ };
93942
+ function normalizeReleaseChannel2(value) {
93943
+ if (typeof value !== "string") return null;
93944
+ const normalized = value.trim().toLowerCase();
93945
+ if (normalized === "stable" || normalized === "latest") return "stable";
93946
+ if (normalized === "preview" || normalized === "next") return "preview";
93947
+ return null;
93948
+ }
93949
+ async function resolveConfiguredUpdateChannel() {
93950
+ try {
93951
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
93952
+ return normalizeReleaseChannel2(loadConfig2().updateChannel) || "stable";
93953
+ } catch {
93954
+ return "stable";
93955
+ }
93956
+ }
93957
+ function releaseChannelLabel(channel) {
93958
+ return `${channel} (${CHANNEL_NPM_TAG2[channel]})`;
93959
+ }
93960
+ async function persistReleaseChannel(channel) {
93961
+ const { updateConfig: updateConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
93962
+ updateConfig2({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
93963
+ }
93899
93964
  function hideCommand(command) {
93900
93965
  command._hidden = true;
93901
93966
  return command;
@@ -94210,7 +94275,21 @@ async function runDaemonUpgrade(options, pkgVersion3) {
94210
94275
  const realPath = fsMod.realpathSync(adhdevPath);
94211
94276
  const isLinked = realPath.includes(".openclaw") || realPath.includes("/src/");
94212
94277
  const currentVersion = pkgVersion3;
94278
+ const requestedChannel = options.channel === void 0 ? null : normalizeReleaseChannel2(options.channel);
94279
+ if (options.channel !== void 0 && !requestedChannel) {
94280
+ console.log(source_default.red(`
94281
+ \u2717 Invalid update channel: ${options.channel}. Use stable/latest or preview/next.
94282
+ `));
94283
+ process.exit(1);
94284
+ return;
94285
+ }
94286
+ const configuredChannel = requestedChannel || await resolveConfiguredUpdateChannel();
94287
+ const npmTag = CHANNEL_NPM_TAG2[configuredChannel];
94288
+ if (requestedChannel) {
94289
+ await persistReleaseChannel(configuredChannel);
94290
+ }
94213
94291
  console.log(` ${source_default.bold("Current:")} v${currentVersion}`);
94292
+ console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(configuredChannel)}`);
94214
94293
  console.log(` ${source_default.bold("Install:")} ${isLinked ? "npm link (dev)" : "npm global"}`);
94215
94294
  if (isLinked) {
94216
94295
  const projectRoot = pathMod.resolve(pathMod.dirname(realPath), "..");
@@ -94239,7 +94318,7 @@ async function runDaemonUpgrade(options, pkgVersion3) {
94239
94318
  try {
94240
94319
  const { execNpmCommandSync: execNpmCommandSync2, resolveCurrentGlobalInstallSurface: resolveCurrentGlobalInstallSurface2 } = await Promise.resolve().then(() => (init_src(), src_exports));
94241
94320
  const npmSurface = resolveCurrentGlobalInstallSurface2({ packageName: "adhdev" });
94242
- latest = String(execNpmCommandSync2(["view", "adhdev", "version"], { encoding: "utf-8" }, npmSurface)).trim();
94321
+ latest = String(execNpmCommandSync2(["view", `adhdev@${npmTag}`, "version"], { encoding: "utf-8" }, npmSurface)).trim();
94243
94322
  } catch (e) {
94244
94323
  console.log(source_default.red(`
94245
94324
  \u2717 Failed to check latest version: ${e?.message}
@@ -94866,10 +94945,36 @@ function registerDaemonCommands(program2, pkgVersion3) {
94866
94945
  process.exit(1);
94867
94946
  }
94868
94947
  }));
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) => {
94948
+ 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
94949
  await runDaemonUpgrade(options, pkgVersion3);
94871
94950
  }));
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) => {
94951
+ const channel = program2.command("channel").description("Manage ADHDev release/update channel");
94952
+ channel.command("get").description("Show the configured ADHDev channel").action(async () => {
94953
+ const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
94954
+ const config2 = loadConfig2();
94955
+ const current = normalizeReleaseChannel2(config2.updateChannel) || "stable";
94956
+ console.log(source_default.bold("\n ADHDev Channel\n"));
94957
+ console.log(` ${source_default.bold("Channel:")} ${releaseChannelLabel(current)}`);
94958
+ console.log(` ${source_default.bold("Server:")} ${config2.serverUrl || CHANNEL_SERVER_URL[current]}`);
94959
+ console.log();
94960
+ });
94961
+ channel.command("set <channel>").description("Set the ADHDev channel: stable/latest or preview/next").action(async (channelName) => {
94962
+ const selected = normalizeReleaseChannel2(channelName);
94963
+ if (!selected) {
94964
+ console.error(source_default.red(`
94965
+ \u2717 Unknown channel: ${channelName}. Use stable or preview.
94966
+ `));
94967
+ process.exit(1);
94968
+ return;
94969
+ }
94970
+ await persistReleaseChannel(selected);
94971
+ console.log(source_default.green(`
94972
+ \u2713 Channel set to ${releaseChannelLabel(selected)}`));
94973
+ console.log(source_default.gray(` Server: ${CHANNEL_SERVER_URL[selected]}`));
94974
+ console.log(source_default.gray(` Update: adhdev update --channel ${selected}
94975
+ `));
94976
+ });
94977
+ 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
94978
  await runDaemonUpgrade(options, pkgVersion3);
94874
94979
  });
94875
94980
  }