@adhdev/daemon-standalone 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/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_";
@@ -28345,7 +28347,7 @@ ${userInstruction}`);
28345
28347
  for (const n of mesh.nodes) {
28346
28348
  const labels = [];
28347
28349
  if (n.isLocalWorktree) labels.push("worktree");
28348
- if (n.policy.readOnly) labels.push("read-only");
28350
+ if (n.policy?.readOnly) labels.push("read-only");
28349
28351
  const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
28350
28352
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
28351
28353
  }
@@ -28393,18 +28395,20 @@ ${rules.join("\n")}`;
28393
28395
  3. **Delegate** \u2014 For each task:
28394
28396
  a. Pick the best node (consider: health, dirty state, current workload).
28395
28397
  b. If no session exists, call \`mesh_launch_session\` to start one.
28396
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
28398
+ 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.
28397
28399
  4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
28398
28400
  5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
28399
28401
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
28400
28402
  7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
28401
28403
  RULES_SECTION = `## Rules
28402
28404
 
28403
- - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
28404
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
28405
+ - **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.
28406
+ - **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.
28407
+ - **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.
28408
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
28405
28409
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
28406
28410
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
28407
- - **Keep the user informed.** Report progress after each delegation round.
28411
+ - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
28408
28412
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
28409
28413
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
28410
28414
  }
@@ -29627,6 +29631,17 @@ ${rules.join("\n")}`;
29627
29631
  this.lastScreenSnapshotReadAt = now;
29628
29632
  return screenText;
29629
29633
  }
29634
+ getParseScreenText(screenText) {
29635
+ const currentSnapshot = normalizeScreenSnapshot(screenText);
29636
+ const lastSnapshot = this.lastScreenSnapshot;
29637
+ if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
29638
+ const staleSnapshotLooksActive = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel/i.test(lastSnapshot);
29639
+ 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);
29640
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
29641
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
29642
+ return `${screenText}
29643
+ ${lastSnapshot}`;
29644
+ }
29630
29645
  shouldReadTerminalScreenSnapshot(now) {
29631
29646
  if (!this.lastScreenText) return true;
29632
29647
  return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
@@ -30617,12 +30632,13 @@ ${rules.join("\n")}`;
30617
30632
  }
30618
30633
  try {
30619
30634
  const screenText = this.terminalScreen.getText();
30635
+ const parseScreenText = this.getParseScreenText(screenText);
30620
30636
  const tail = this.recentOutputBuffer.slice(-500);
30621
30637
  const input = buildCliParseInput({
30622
30638
  accumulatedBuffer: this.accumulatedBuffer,
30623
30639
  accumulatedRawBuffer: this.accumulatedRawBuffer,
30624
30640
  recentOutputBuffer: this.recentOutputBuffer,
30625
- terminalScreenText: screenText,
30641
+ terminalScreenText: parseScreenText,
30626
30642
  baseMessages: [],
30627
30643
  partialResponse: this.responseBuffer,
30628
30644
  isWaitingForResponse: this.isWaitingForResponse,
@@ -30716,8 +30732,9 @@ ${rules.join("\n")}`;
30716
30732
  */
30717
30733
  getScriptParsedStatus() {
30718
30734
  const screenText = this.readTerminalScreenText();
30735
+ const parseScreenText = this.getParseScreenText(screenText);
30719
30736
  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) {
30737
+ 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
30738
  return cached2.result;
30722
30739
  }
30723
30740
  const parsed = this.runParseSession();
@@ -30745,7 +30762,7 @@ ${rules.join("\n")}`;
30745
30762
  currentTurnScope: this.currentTurnScope,
30746
30763
  recentOutputBuffer: this.recentOutputBuffer,
30747
30764
  accumulatedBuffer: this.accumulatedBuffer,
30748
- screenText,
30765
+ screenText: parseScreenText,
30749
30766
  currentStatus: this.currentStatus,
30750
30767
  activeModal: this.activeModal,
30751
30768
  cliName: this.cliName,
@@ -30762,7 +30779,7 @@ ${rules.join("\n")}`;
30762
30779
  accumulatedBuffer: this.accumulatedBuffer,
30763
30780
  accumulatedRawBuffer: this.accumulatedRawBuffer,
30764
30781
  recentOutputBuffer: this.recentOutputBuffer,
30765
- terminalScreenText: this.terminalScreen.getText(),
30782
+ terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
30766
30783
  baseMessages: [],
30767
30784
  partialResponse: this.responseBuffer,
30768
30785
  isWaitingForResponse: this.isWaitingForResponse,
@@ -47801,6 +47818,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
47801
47818
  addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
47802
47819
  addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
47803
47820
  addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
47821
+ addCandidate((0, import_node_path2.resolve)(dir, "../../mcp-server/dist/index.js"));
47822
+ addCandidate((0, import_node_path2.resolve)(dir, "../../../mcp-server/dist/index.js"));
47804
47823
  };
47805
47824
  addPackagedCandidates(process.argv[1]);
47806
47825
  for (const candidate of candidates) {
@@ -48472,6 +48491,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
48472
48491
  }
48473
48492
  }
48474
48493
  var fs10 = __toESM2(require("fs"));
48494
+ var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
48495
+ function normalizeReleaseChannel(value) {
48496
+ if (typeof value !== "string") return null;
48497
+ const normalized = value.trim().toLowerCase();
48498
+ if (normalized === "stable" || normalized === "latest") return "stable";
48499
+ if (normalized === "preview" || normalized === "next") return "preview";
48500
+ return null;
48501
+ }
48502
+ function resolveUpgradeChannel(args) {
48503
+ return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig2().updateChannel) || "stable";
48504
+ }
48475
48505
  var CHAT_COMMANDS = [
48476
48506
  "send_chat",
48477
48507
  "new_chat",
@@ -49154,8 +49184,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
49154
49184
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
49155
49185
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
49156
49186
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
49157
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
49158
- LOG2.info("Upgrade", `Latest ${pkgName}: v${latest}`);
49187
+ const channel = resolveUpgradeChannel(args);
49188
+ const npmTag = CHANNEL_NPM_TAG[channel];
49189
+ const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
49190
+ LOG2.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
49159
49191
  let currentInstalled = null;
49160
49192
  try {
49161
49193
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -49169,8 +49201,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
49169
49201
  }
49170
49202
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
49171
49203
  if (currentInstalled === latest && runningVersion === latest) {
49172
- LOG2.info("Upgrade", `Already on latest version v${latest}; skipping install`);
49173
- return { success: true, upgraded: false, alreadyLatest: true, version: latest };
49204
+ LOG2.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
49205
+ return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
49174
49206
  }
49175
49207
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
49176
49208
  LOG2.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -49183,12 +49215,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
49183
49215
  cwd: process.cwd(),
49184
49216
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
49185
49217
  });
49186
- LOG2.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
49218
+ LOG2.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
49187
49219
  setTimeout(() => {
49188
49220
  LOG2.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
49189
49221
  process.exit(0);
49190
49222
  }, 3e3);
49191
- return { success: true, upgraded: true, version: latest, restarting: true };
49223
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
49192
49224
  } catch (e) {
49193
49225
  LOG2.error("Upgrade", `Failed: ${e.message}`);
49194
49226
  return { success: false, error: e.message };
@@ -49352,14 +49384,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
49352
49384
  } catch {
49353
49385
  }
49354
49386
  }
49387
+ const mcpServerEntry = {
49388
+ command: coordinatorSetup.mcpServer.command,
49389
+ args: coordinatorSetup.mcpServer.args
49390
+ };
49391
+ if (args?.inlineMesh) {
49392
+ mcpServerEntry.env = {
49393
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh)
49394
+ };
49395
+ }
49355
49396
  const mcpConfig = {
49356
49397
  ...existingMcpConfig,
49357
49398
  mcpServers: {
49358
49399
  ...existingMcpConfig.mcpServers || {},
49359
- [coordinatorSetup.serverName]: {
49360
- command: coordinatorSetup.mcpServer.command,
49361
- args: coordinatorSetup.mcpServer.args
49362
- }
49400
+ [coordinatorSetup.serverName]: mcpServerEntry
49363
49401
  }
49364
49402
  };
49365
49403
  writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");