@adhdev/daemon-core 0.9.75 → 0.9.76-rc.10

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
@@ -493,7 +493,7 @@ function buildNodeConfigSection(mesh) {
493
493
  for (const n of mesh.nodes) {
494
494
  const labels = [];
495
495
  if (n.isLocalWorktree) labels.push("worktree");
496
- if (n.policy.readOnly) labels.push("read-only");
496
+ if (n.policy?.readOnly) labels.push("read-only");
497
497
  const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
498
498
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
499
499
  }
@@ -539,18 +539,20 @@ var init_coordinator_prompt = __esm({
539
539
  3. **Delegate** \u2014 For each task:
540
540
  a. Pick the best node (consider: health, dirty state, current workload).
541
541
  b. If no session exists, call \`mesh_launch_session\` to start one.
542
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
542
+ 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.
543
543
  4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
544
544
  5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
545
545
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
546
546
  7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
547
547
  RULES_SECTION = `## Rules
548
548
 
549
- - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
550
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
549
+ - **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.
550
+ - **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.
551
+ - **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.
552
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
551
553
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
552
554
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
553
- - **Keep the user informed.** Report progress after each delegation round.
555
+ - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
554
556
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
555
557
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
556
558
  }
@@ -1764,6 +1766,11 @@ var init_provider_cli_adapter = __esm({
1764
1766
  const currentSnapshot = normalizeScreenSnapshot(screenText);
1765
1767
  const lastSnapshot = this.lastScreenSnapshot;
1766
1768
  if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
1769
+ const activeScreenPattern = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel|Enter to confirm\s*[·•-]\s*Esc to cancel|\b(?:MCP servers?|tool calls?)\b[^\n\r]{0,160}\brequire approval\b/i;
1770
+ const staleSnapshotLooksActive = activeScreenPattern.test(lastSnapshot);
1771
+ const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:Try\s+["“][^\n\r"”]+["”])?\s*(?:\n|\r|$)/.test(screenText) && !activeScreenPattern.test(screenText);
1772
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
1773
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
1767
1774
  return `${screenText}
1768
1775
  ${lastSnapshot}`;
1769
1776
  }
@@ -11185,6 +11192,14 @@ function getActiveChatOptions(profile) {
11185
11192
  if (profile === "full") return {};
11186
11193
  return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
11187
11194
  }
11195
+ function resolveSessionStatus(activeChat, providerStatus) {
11196
+ const chatStatus = normalizeManagedStatus(activeChat?.status, { activeModal: activeChat?.activeModal || null });
11197
+ const topLevelStatus = normalizeManagedStatus(providerStatus, { activeModal: activeChat?.activeModal || null });
11198
+ if (chatStatus === "waiting_approval" || topLevelStatus === "waiting_approval") return "waiting_approval";
11199
+ if (chatStatus === "generating" || topLevelStatus === "generating") return "generating";
11200
+ if (topLevelStatus !== "idle") return topLevelStatus;
11201
+ return chatStatus;
11202
+ }
11188
11203
  function shouldIncludeSessionControls(profile) {
11189
11204
  return profile !== "live";
11190
11205
  }
@@ -11263,9 +11278,7 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
11263
11278
  providerName: state.name,
11264
11279
  kind: "workspace",
11265
11280
  transport: "cdp-page",
11266
- status: normalizeManagedStatus(activeChat?.status || state.status, {
11267
- activeModal: activeChat?.activeModal || null
11268
- }),
11281
+ status: resolveSessionStatus(activeChat, state.status),
11269
11282
  title,
11270
11283
  workspace,
11271
11284
  ...git && { git },
@@ -11300,9 +11313,7 @@ function buildExtensionAgentSession(parent, ext, options) {
11300
11313
  providerSessionId: ext.providerSessionId,
11301
11314
  kind: "agent",
11302
11315
  transport: "cdp-webview",
11303
- status: normalizeManagedStatus(activeChat?.status || ext.status, {
11304
- activeModal: activeChat?.activeModal || null
11305
- }),
11316
+ status: resolveSessionStatus(activeChat, ext.status),
11306
11317
  title: activeChat?.title || ext.name,
11307
11318
  workspace,
11308
11319
  ...git && { git },
@@ -11352,9 +11363,7 @@ function buildCliSession(state, options) {
11352
11363
  providerSessionId: state.providerSessionId,
11353
11364
  kind: "agent",
11354
11365
  transport: "pty",
11355
- status: normalizeManagedStatus(activeChat?.status || state.status, {
11356
- activeModal: activeChat?.activeModal || null
11357
- }),
11366
+ status: resolveSessionStatus(activeChat, state.status),
11358
11367
  title: activeChat?.title || state.name,
11359
11368
  workspace,
11360
11369
  ...git && { git },
@@ -11402,9 +11411,7 @@ function buildAcpSession(state, options) {
11402
11411
  providerName: state.name,
11403
11412
  kind: "agent",
11404
11413
  transport: "acp",
11405
- status: normalizeManagedStatus(activeChat?.status || state.status, {
11406
- activeModal: activeChat?.activeModal || null
11407
- }),
11414
+ status: resolveSessionStatus(activeChat, state.status),
11408
11415
  title: activeChat?.title || state.name,
11409
11416
  workspace,
11410
11417
  ...git && { git },
@@ -20084,7 +20091,7 @@ function resolveAdhdevMcpServerLaunch(options) {
20084
20091
  if (!entryPath) return null;
20085
20092
  return {
20086
20093
  command: options.nodeExecutable?.trim() || process.execPath,
20087
- args: [entryPath, "--repo-mesh", options.meshId]
20094
+ args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
20088
20095
  };
20089
20096
  }
20090
20097
  function resolveAdhdevMcpEntryPath(explicitPath) {
@@ -20783,6 +20790,10 @@ async function maybeRunDaemonUpgradeHelperFromEnv() {
20783
20790
  // src/commands/router.ts
20784
20791
  var fs10 = __toESM(require("fs"));
20785
20792
  var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
20793
+ var CHANNEL_SERVER_URL = {
20794
+ stable: "https://api.adhf.dev",
20795
+ preview: "https://api-preview.adhf.dev"
20796
+ };
20786
20797
  function normalizeReleaseChannel(value) {
20787
20798
  if (typeof value !== "string") return null;
20788
20799
  const normalized = value.trim().toLowerCase();
@@ -21479,6 +21490,7 @@ var DaemonCommandRouter = class {
21479
21490
  const npmTag = CHANNEL_NPM_TAG[channel];
21480
21491
  const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
21481
21492
  LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
21493
+ updateConfig({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
21482
21494
  let currentInstalled = null;
21483
21495
  try {
21484
21496
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -21681,7 +21693,8 @@ var DaemonCommandRouter = class {
21681
21693
  };
21682
21694
  if (args?.inlineMesh) {
21683
21695
  mcpServerEntry.env = {
21684
- ADHDEV_INLINE_MESH: JSON.stringify(mesh)
21696
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh),
21697
+ ADHDEV_MCP_TRANSPORT: "ipc"
21685
21698
  };
21686
21699
  }
21687
21700
  const mcpConfig = {