adhdev 0.9.76-rc.4 → 0.9.76-rc.6

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
@@ -39099,7 +39099,7 @@ function resolveAdhdevMcpServerLaunch(options) {
39099
39099
  if (!entryPath) return null;
39100
39100
  return {
39101
39101
  command: options.nodeExecutable?.trim() || process.execPath,
39102
- args: [entryPath, "--repo-mesh", options.meshId]
39102
+ args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
39103
39103
  };
39104
39104
  }
39105
39105
  function resolveAdhdevMcpEntryPath(explicitPath) {
@@ -40757,7 +40757,8 @@ var init_router = __esm({
40757
40757
  };
40758
40758
  if (args?.inlineMesh) {
40759
40759
  mcpServerEntry.env = {
40760
- ADHDEV_INLINE_MESH: JSON.stringify(mesh)
40760
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh),
40761
+ ADHDEV_MCP_TRANSPORT: "ipc"
40761
40762
  };
40762
40763
  }
40763
40764
  const mcpConfig = {
@@ -58870,7 +58871,9 @@ var init_daemon_mesh_manager = __esm({
58870
58871
  "read_chat",
58871
58872
  "git_status",
58872
58873
  "git_diff_summary",
58873
- "launch_cli"
58874
+ "launch_cli",
58875
+ "git_checkpoint",
58876
+ "resolve_action"
58874
58877
  ]);
58875
58878
  setRules(rules) {
58876
58879
  const valid = [];
@@ -59161,7 +59164,7 @@ var init_adhdev_daemon = __esm({
59161
59164
  init_version();
59162
59165
  init_src();
59163
59166
  init_runtime_defaults();
59164
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.4" });
59167
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.6" });
59165
59168
  AdhdevDaemon = class _AdhdevDaemon {
59166
59169
  localHttpServer = null;
59167
59170
  localWss = null;
@@ -60263,7 +60266,20 @@ ${err?.stack || ""}`);
60263
60266
  return;
60264
60267
  }
60265
60268
  try {
60266
- const result = await this.components.router.execute(command, normalizedArgs, "ipc");
60269
+ let result;
60270
+ if (command === "mesh_relay_command") {
60271
+ if (!this.meshManager) throw new Error("Mesh manager is not initialized");
60272
+ const targetDaemonId = typeof normalizedArgs.targetDaemonId === "string" ? normalizedArgs.targetDaemonId : "";
60273
+ const relayedCommand = typeof normalizedArgs.command === "string" ? normalizedArgs.command : "";
60274
+ const relayedArgs = normalizedArgs.args && typeof normalizedArgs.args === "object" ? normalizedArgs.args : {};
60275
+ if (!targetDaemonId || !relayedCommand) {
60276
+ throw new Error("mesh_relay_command requires targetDaemonId and command");
60277
+ }
60278
+ const relayResult = await this.meshManager.sendCommand(targetDaemonId, relayedCommand, relayedArgs);
60279
+ result = { success: true, result: relayResult };
60280
+ } else {
60281
+ result = await this.components.router.execute(command, normalizedArgs, "ipc");
60282
+ }
60267
60283
  ws.send(JSON.stringify({
60268
60284
  type: "ext:command_result",
60269
60285
  payload: {
@@ -90912,7 +90928,58 @@ init_lib();
90912
90928
  init_ora();
90913
90929
  init_src();
90914
90930
  init_version();
90915
- var SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
90931
+ var CHANNEL_NPM_TAG2 = {
90932
+ stable: "latest",
90933
+ preview: "next"
90934
+ };
90935
+ var CHANNEL_SERVER_URL2 = {
90936
+ stable: "https://api.adhf.dev",
90937
+ preview: "https://api-preview.adhf.dev"
90938
+ };
90939
+ function normalizeSetupReleaseChannel(value) {
90940
+ if (typeof value !== "string") return null;
90941
+ const normalized = value.trim().toLowerCase();
90942
+ if (normalized === "stable" || normalized === "latest") return "stable";
90943
+ if (normalized === "preview" || normalized === "next") return "preview";
90944
+ return null;
90945
+ }
90946
+ function inferReleaseChannelFromServerUrl(serverUrl) {
90947
+ if (typeof serverUrl !== "string") return null;
90948
+ const normalized = serverUrl.trim().toLowerCase();
90949
+ if (!normalized) return null;
90950
+ if (normalized.includes("api-preview.adhf.dev") || normalized.includes("dev.adhf.dev")) return "preview";
90951
+ if (normalized.includes("api.adhf.dev") || normalized.includes("adhf.dev")) return "stable";
90952
+ return null;
90953
+ }
90954
+ function buildDashboardUrl(serverUrl, channel) {
90955
+ try {
90956
+ const url2 = new URL(serverUrl);
90957
+ if (url2.hostname === "api-preview.adhf.dev") return "https://dev.adhf.dev/dashboard";
90958
+ if (url2.hostname === "api.adhf.dev") return "https://adhf.dev/dashboard";
90959
+ if (url2.hostname === "127.0.0.1" || url2.hostname === "localhost") {
90960
+ url2.port = url2.port === "3100" ? "3000" : url2.port;
90961
+ url2.pathname = "/dashboard";
90962
+ url2.search = "";
90963
+ url2.hash = "";
90964
+ return url2.toString();
90965
+ }
90966
+ } catch {
90967
+ }
90968
+ return channel === "preview" ? "https://dev.adhf.dev/dashboard" : "https://adhf.dev/dashboard";
90969
+ }
90970
+ function buildSetupReleaseContext(options = {}) {
90971
+ const env3 = options.env || process.env;
90972
+ const envServerUrl = typeof env3.ADHDEV_SERVER_URL === "string" && env3.ADHDEV_SERVER_URL.trim() ? env3.ADHDEV_SERVER_URL.trim() : null;
90973
+ const config2 = options.config || {};
90974
+ const channel = normalizeSetupReleaseChannel(config2.updateChannel) || inferReleaseChannelFromServerUrl(envServerUrl) || inferReleaseChannelFromServerUrl(config2.serverUrl) || "stable";
90975
+ const serverUrl = envServerUrl || CHANNEL_SERVER_URL2[channel];
90976
+ return {
90977
+ channel,
90978
+ npmTag: CHANNEL_NPM_TAG2[channel],
90979
+ serverUrl,
90980
+ dashboardUrl: buildDashboardUrl(serverUrl, channel)
90981
+ };
90982
+ }
90916
90983
  var LOGO = `
90917
90984
  ${source_default2.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}
90918
90985
  ${source_default2.cyan("\u2551")} ${source_default2.bold.white("\u{1F9A6} ADHDev Setup Wizard")} ${source_default2.cyan("\u2551")}
@@ -90928,10 +90995,10 @@ function hasCloudMachineAuth() {
90928
90995
  const config2 = loadConfig();
90929
90996
  return Boolean(config2.machineSecret && config2.machineSecret.trim());
90930
90997
  }
90931
- function readLatestPublishedCliVersion(execFileSyncLocal) {
90998
+ function readLatestPublishedCliVersion(execFileSyncLocal, npmTag = "latest") {
90932
90999
  const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
90933
91000
  try {
90934
- return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", "adhdev", "version"], {
91001
+ return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", `adhdev@${npmTag}`, "version"], {
90935
91002
  encoding: "utf-8",
90936
91003
  timeout: 5e3,
90937
91004
  stdio: ["pipe", "pipe", "pipe"],
@@ -90962,38 +91029,41 @@ function readInstalledGlobalCliVersion(execFileSyncLocal) {
90962
91029
  }
90963
91030
  async function runWizard(options = {}) {
90964
91031
  console.log(LOGO);
91032
+ const config2 = loadConfig();
91033
+ const releaseContext = buildSetupReleaseContext({ config: config2 });
90965
91034
  if (isSetupComplete() && hasCloudMachineAuth() && !options.force) {
90966
- const config2 = loadConfig();
90967
91035
  console.log(source_default2.green("\u2713") + " ADHDev is already configured.");
90968
91036
  console.log(source_default2.gray(` Account: ${config2.userEmail || "not logged in"}`));
91037
+ console.log(source_default2.gray(` Server: ${releaseContext.serverUrl}`));
90969
91038
  console.log();
90970
- await checkForUpdate();
90971
- await startDaemonFlow();
91039
+ await checkForUpdate(releaseContext);
91040
+ await startDaemonFlow(releaseContext);
90972
91041
  return;
90973
91042
  }
90974
- await quickSetup();
91043
+ await quickSetup(releaseContext);
90975
91044
  }
90976
- async function checkForUpdate() {
91045
+ async function checkForUpdate(releaseContext) {
90977
91046
  try {
90978
91047
  const { execFileSync: execFileSync5 } = await import("child_process");
90979
91048
  const currentVersion = resolvePackageVersion();
90980
- const latestVersion = readLatestPublishedCliVersion(execFileSync5);
91049
+ const latestVersion = readLatestPublishedCliVersion(execFileSync5, releaseContext.npmTag);
90981
91050
  if (!latestVersion) return;
90982
91051
  if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
90983
- console.log(source_default2.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
91052
+ console.log(source_default2.yellow(` Update available (${releaseContext.channel}/${releaseContext.npmTag}): ${currentVersion} \u2192 ${latestVersion}`));
90984
91053
  const { doUpdate } = await (await Promise.resolve().then(() => (init_lib(), lib_exports))).default.prompt([{
90985
91054
  type: "confirm",
90986
91055
  name: "doUpdate",
90987
- message: `Update adhdev CLI to v${latestVersion}?`,
91056
+ message: `Update adhdev CLI to v${latestVersion} from ${releaseContext.npmTag}?`,
90988
91057
  default: true
90989
91058
  }]);
90990
91059
  if (!doUpdate) {
90991
- console.log(source_default2.gray(" Skipping update. Run: npm install -g adhdev@latest\n"));
91060
+ console.log(source_default2.gray(` Skipping update. Run: npm install -g adhdev@${releaseContext.npmTag}
91061
+ `));
90992
91062
  return;
90993
91063
  }
90994
91064
  const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
90995
91065
  try {
90996
- const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
91066
+ const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
90997
91067
  execFileSync5(installCommand.command, installCommand.args, {
90998
91068
  encoding: "utf-8",
90999
91069
  timeout: 6e4,
@@ -91004,14 +91074,17 @@ async function checkForUpdate() {
91004
91074
  console.log();
91005
91075
  } catch (e) {
91006
91076
  spinner.fail("Update failed");
91007
- console.log(source_default2.gray(" Manual: npm install -g adhdev@latest\n"));
91077
+ console.log(source_default2.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}
91078
+ `));
91008
91079
  }
91009
91080
  } catch {
91010
91081
  }
91011
91082
  }
91012
- async function quickSetup() {
91083
+ async function quickSetup(releaseContext) {
91013
91084
  console.log(source_default2.bold("\n\u{1F680} Quick Setup\n"));
91014
- const loginResult = await loginFlow();
91085
+ console.log(source_default2.gray(` Channel: ${releaseContext.channel} (${releaseContext.npmTag})`));
91086
+ console.log(source_default2.gray(` Server: ${releaseContext.serverUrl}`));
91087
+ const loginResult = await loginFlow(releaseContext);
91015
91088
  const setupDate = (/* @__PURE__ */ new Date()).toISOString();
91016
91089
  if (!loginResult) {
91017
91090
  updateConfig({
@@ -91022,7 +91095,9 @@ async function quickSetup() {
91022
91095
  setupDate,
91023
91096
  userEmail: null,
91024
91097
  userName: null,
91025
- machineSecret: null
91098
+ machineSecret: null,
91099
+ updateChannel: releaseContext.channel,
91100
+ serverUrl: releaseContext.serverUrl
91026
91101
  });
91027
91102
  console.log(source_default2.yellow("\u26A0 Setup is not complete without login. Run `adhdev setup` after signing in."));
91028
91103
  }
@@ -91033,14 +91108,16 @@ async function quickSetup() {
91033
91108
  userEmail: loginResult.email,
91034
91109
  userName: loginResult.name,
91035
91110
  setupDate,
91111
+ updateChannel: releaseContext.channel,
91112
+ serverUrl: releaseContext.serverUrl,
91036
91113
  ...loginResult.registeredMachineId ? { registeredMachineId: loginResult.registeredMachineId } : {}
91037
91114
  };
91038
91115
  updateConfig(configUpdate);
91039
91116
  console.log(source_default2.green(` \u2713 Machine registered`));
91040
91117
  }
91041
- await installCliOnly();
91118
+ await installCliOnly(releaseContext);
91042
91119
  if (loginResult) {
91043
- await startDaemonFlow();
91120
+ await startDaemonFlow(releaseContext);
91044
91121
  } else {
91045
91122
  console.log(source_default2.gray(" Start daemon after login: adhdev setup"));
91046
91123
  console.log();
@@ -91049,6 +91126,7 @@ async function quickSetup() {
91049
91126
  console.log(source_default2.bold("\n\u{1F389} Setup Complete!\n"));
91050
91127
  console.log(` ${source_default2.bold("User:")} ${loginResult?.email || "not logged in"}`);
91051
91128
  console.log(` ${source_default2.bold("Status:")} ${loginResult ? source_default2.green("Ready to connect") : source_default2.yellow("Login required")}`);
91129
+ console.log(` ${source_default2.bold("Server:")} ${releaseContext.serverUrl}`);
91052
91130
  console.log();
91053
91131
  console.log(source_default2.gray(" Next steps:"));
91054
91132
  console.log(source_default2.gray(` ${loginResult ? "adhdev daemon \u2014 Start the main daemon (IDE / remote features)" : "adhdev setup \u2014 Sign in to finish setup and enable the daemon"}`));
@@ -91059,11 +91137,12 @@ async function quickSetup() {
91059
91137
  console.log(source_default2.gray(" adhdev launch claude \u2014 Start Claude Code agent"));
91060
91138
  console.log(source_default2.gray(" adhdev status \u2014 Check setup status"));
91061
91139
  console.log();
91062
- console.log(source_default2.cyan(" Dashboard: https://adhf.dev/dashboard"));
91140
+ console.log(source_default2.cyan(` Dashboard: ${releaseContext.dashboardUrl}`));
91063
91141
  console.log();
91064
91142
  }
91065
- async function loginFlow() {
91143
+ async function loginFlow(releaseContext) {
91066
91144
  console.log(source_default2.bold("\n\u{1F510} Login to ADHDev\n"));
91145
+ console.log(source_default2.gray(` Auth server: ${releaseContext.serverUrl}`));
91067
91146
  const { wantLogin } = await lib_default.prompt([
91068
91147
  {
91069
91148
  type: "confirm",
@@ -91080,7 +91159,7 @@ async function loginFlow() {
91080
91159
  try {
91081
91160
  const config2 = loadConfig();
91082
91161
  const os29 = await import("os");
91083
- const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
91162
+ const res = await fetch(`${releaseContext.serverUrl}/auth/cli/init`, {
91084
91163
  method: "POST",
91085
91164
  headers: { "Content-Type": "application/json" },
91086
91165
  body: JSON.stringify({
@@ -91122,7 +91201,7 @@ async function loginFlow() {
91122
91201
  while (Date.now() - startTime < timeout) {
91123
91202
  await new Promise((r) => setTimeout(r, 3e3));
91124
91203
  try {
91125
- const res = await fetch(`${SERVER_URL}/auth/cli/poll`, {
91204
+ const res = await fetch(`${releaseContext.serverUrl}/auth/cli/poll`, {
91126
91205
  method: "POST",
91127
91206
  headers: { "Content-Type": "application/json" },
91128
91207
  body: JSON.stringify({ deviceCode })
@@ -91152,9 +91231,9 @@ async function loginFlow() {
91152
91231
  console.log();
91153
91232
  console.log(source_default2.yellow(" To fix this, do one of the following:"));
91154
91233
  console.log(source_default2.gray(" 1. Remove an unused machine from the dashboard:"));
91155
- console.log(source_default2.gray(" https://adhf.dev/account \u2192 Registered Machines \u2192 \u2715 Remove"));
91234
+ console.log(source_default2.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account")} \u2192 Registered Machines \u2192 \u2715 Remove`));
91156
91235
  console.log(source_default2.gray(" 2. Upgrade your plan:"));
91157
- console.log(source_default2.gray(" https://adhf.dev/account?tab=billing"));
91236
+ console.log(source_default2.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account?tab=billing")}`));
91158
91237
  console.log();
91159
91238
  console.log(source_default2.gray(" Then run `adhdev setup` again."));
91160
91239
  console.log();
@@ -91166,11 +91245,12 @@ async function loginFlow() {
91166
91245
  pollSpinner.fail("Authentication timed out");
91167
91246
  return null;
91168
91247
  }
91169
- async function startDaemonFlow() {
91248
+ async function startDaemonFlow(releaseContext) {
91170
91249
  const { isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
91171
91250
  if (isDaemonRunning2()) {
91172
91251
  console.log(source_default2.green(" \u2713 Daemon is already running"));
91173
- console.log(source_default2.gray(" Dashboard: https://adhf.dev/dashboard\n"));
91252
+ console.log(source_default2.gray(` Dashboard: ${releaseContext.dashboardUrl}
91253
+ `));
91174
91254
  return;
91175
91255
  }
91176
91256
  const { startDaemon } = await lib_default.prompt([
@@ -91224,7 +91304,7 @@ async function startDaemonFlow() {
91224
91304
  } else {
91225
91305
  daemonSpinner.warn("Daemon starting in background (may take a few seconds)");
91226
91306
  }
91227
- console.log(source_default2.gray(" Dashboard: https://adhf.dev/dashboard"));
91307
+ console.log(source_default2.gray(` Dashboard: ${releaseContext.dashboardUrl}`));
91228
91308
  console.log(source_default2.gray(` Logs: ${logPath}`));
91229
91309
  console.log();
91230
91310
  } catch (e) {
@@ -91232,7 +91312,7 @@ async function startDaemonFlow() {
91232
91312
  console.log(source_default2.gray(" Manual: adhdev daemon\n"));
91233
91313
  }
91234
91314
  }
91235
- async function installCliOnly() {
91315
+ async function installCliOnly(releaseContext) {
91236
91316
  const { execFileSync: execFileSyncLocal } = await import("child_process");
91237
91317
  const currentVersion = readInstalledGlobalCliVersion(execFileSyncLocal);
91238
91318
  const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
@@ -91245,7 +91325,7 @@ async function installCliOnly() {
91245
91325
  console.log();
91246
91326
  if (currentVersion) {
91247
91327
  console.log(source_default2.green(` \u2713 Currently installed: v${currentVersion}`));
91248
- const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal);
91328
+ const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal, releaseContext.npmTag);
91249
91329
  if (latestVersion && currentVersion === latestVersion) {
91250
91330
  console.log(source_default2.gray(" (Already up to date)"));
91251
91331
  return;
@@ -91254,12 +91334,12 @@ async function installCliOnly() {
91254
91334
  const { doUpdate } = await lib_default.prompt([{
91255
91335
  type: "confirm",
91256
91336
  name: "doUpdate",
91257
- message: `Update to latest version${latestVersion ? ` (v${latestVersion})` : ""}?`,
91337
+ message: `Update to ${releaseContext.npmTag} version${latestVersion ? ` (v${latestVersion})` : ""}?`,
91258
91338
  default: true
91259
91339
  }]);
91260
91340
  if (!doUpdate) return;
91261
91341
  } else {
91262
- console.log(source_default2.gray(" Updating to latest..."));
91342
+ console.log(source_default2.gray(` Updating to ${releaseContext.npmTag}...`));
91263
91343
  }
91264
91344
  } else {
91265
91345
  console.log(source_default2.yellow(" \u2717 Not installed globally"));
@@ -91267,7 +91347,7 @@ async function installCliOnly() {
91267
91347
  const { doInstall } = await lib_default.prompt([{
91268
91348
  type: "confirm",
91269
91349
  name: "doInstall",
91270
- message: "Install adhdev CLI globally? (npm install -g adhdev)",
91350
+ message: `Install adhdev CLI globally? (npm install -g adhdev@${releaseContext.npmTag})`,
91271
91351
  default: true
91272
91352
  }]);
91273
91353
  if (!doInstall) {
@@ -91280,14 +91360,14 @@ async function installCliOnly() {
91280
91360
  }
91281
91361
  const installSpinner = ora2("Installing adhdev CLI...").start();
91282
91362
  try {
91283
- const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
91363
+ const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
91284
91364
  execFileSyncLocal(installCommand.command, installCommand.args, {
91285
91365
  encoding: "utf-8",
91286
91366
  timeout: 6e4,
91287
91367
  stdio: ["pipe", "pipe", "pipe"],
91288
91368
  ...installCommand.execOptions
91289
91369
  });
91290
- const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || "latest";
91370
+ const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || releaseContext.npmTag;
91291
91371
  installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
91292
91372
  console.log(source_default2.gray(" Try: adhdev daemon"));
91293
91373
  console.log();
@@ -91298,7 +91378,7 @@ async function installCliOnly() {
91298
91378
  if (osModule.platform() === "win32") {
91299
91379
  console.log(source_default2.gray(" On Windows, run PowerShell as Administrator"));
91300
91380
  }
91301
- console.log(source_default2.gray(" Manual: npm install -g adhdev@latest"));
91381
+ console.log(source_default2.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}`));
91302
91382
  console.log();
91303
91383
  }
91304
91384
  }