@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.mjs CHANGED
@@ -487,7 +487,7 @@ function buildNodeConfigSection(mesh) {
487
487
  for (const n of mesh.nodes) {
488
488
  const labels = [];
489
489
  if (n.isLocalWorktree) labels.push("worktree");
490
- if (n.policy.readOnly) labels.push("read-only");
490
+ if (n.policy?.readOnly) labels.push("read-only");
491
491
  const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
492
492
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
493
493
  }
@@ -533,18 +533,20 @@ var init_coordinator_prompt = __esm({
533
533
  3. **Delegate** \u2014 For each task:
534
534
  a. Pick the best node (consider: health, dirty state, current workload).
535
535
  b. If no session exists, call \`mesh_launch_session\` to start one.
536
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
536
+ 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.
537
537
  4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
538
538
  5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
539
539
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
540
540
  7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
541
541
  RULES_SECTION = `## Rules
542
542
 
543
- - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
544
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
543
+ - **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.
544
+ - **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.
545
+ - **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.
546
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
545
547
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
546
548
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
547
- - **Keep the user informed.** Report progress after each delegation round.
549
+ - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
548
550
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
549
551
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
550
552
  }
@@ -1760,6 +1762,11 @@ var init_provider_cli_adapter = __esm({
1760
1762
  const currentSnapshot = normalizeScreenSnapshot(screenText);
1761
1763
  const lastSnapshot = this.lastScreenSnapshot;
1762
1764
  if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
1765
+ 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;
1766
+ const staleSnapshotLooksActive = activeScreenPattern.test(lastSnapshot);
1767
+ const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:Try\s+["“][^\n\r"”]+["”])?\s*(?:\n|\r|$)/.test(screenText) && !activeScreenPattern.test(screenText);
1768
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
1769
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
1763
1770
  return `${screenText}
1764
1771
  ${lastSnapshot}`;
1765
1772
  }
@@ -10993,6 +11000,14 @@ function getActiveChatOptions(profile) {
10993
11000
  if (profile === "full") return {};
10994
11001
  return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
10995
11002
  }
11003
+ function resolveSessionStatus(activeChat, providerStatus) {
11004
+ const chatStatus = normalizeManagedStatus(activeChat?.status, { activeModal: activeChat?.activeModal || null });
11005
+ const topLevelStatus = normalizeManagedStatus(providerStatus, { activeModal: activeChat?.activeModal || null });
11006
+ if (chatStatus === "waiting_approval" || topLevelStatus === "waiting_approval") return "waiting_approval";
11007
+ if (chatStatus === "generating" || topLevelStatus === "generating") return "generating";
11008
+ if (topLevelStatus !== "idle") return topLevelStatus;
11009
+ return chatStatus;
11010
+ }
10996
11011
  function shouldIncludeSessionControls(profile) {
10997
11012
  return profile !== "live";
10998
11013
  }
@@ -11071,9 +11086,7 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
11071
11086
  providerName: state.name,
11072
11087
  kind: "workspace",
11073
11088
  transport: "cdp-page",
11074
- status: normalizeManagedStatus(activeChat?.status || state.status, {
11075
- activeModal: activeChat?.activeModal || null
11076
- }),
11089
+ status: resolveSessionStatus(activeChat, state.status),
11077
11090
  title,
11078
11091
  workspace,
11079
11092
  ...git && { git },
@@ -11108,9 +11121,7 @@ function buildExtensionAgentSession(parent, ext, options) {
11108
11121
  providerSessionId: ext.providerSessionId,
11109
11122
  kind: "agent",
11110
11123
  transport: "cdp-webview",
11111
- status: normalizeManagedStatus(activeChat?.status || ext.status, {
11112
- activeModal: activeChat?.activeModal || null
11113
- }),
11124
+ status: resolveSessionStatus(activeChat, ext.status),
11114
11125
  title: activeChat?.title || ext.name,
11115
11126
  workspace,
11116
11127
  ...git && { git },
@@ -11160,9 +11171,7 @@ function buildCliSession(state, options) {
11160
11171
  providerSessionId: state.providerSessionId,
11161
11172
  kind: "agent",
11162
11173
  transport: "pty",
11163
- status: normalizeManagedStatus(activeChat?.status || state.status, {
11164
- activeModal: activeChat?.activeModal || null
11165
- }),
11174
+ status: resolveSessionStatus(activeChat, state.status),
11166
11175
  title: activeChat?.title || state.name,
11167
11176
  workspace,
11168
11177
  ...git && { git },
@@ -11210,9 +11219,7 @@ function buildAcpSession(state, options) {
11210
11219
  providerName: state.name,
11211
11220
  kind: "agent",
11212
11221
  transport: "acp",
11213
- status: normalizeManagedStatus(activeChat?.status || state.status, {
11214
- activeModal: activeChat?.activeModal || null
11215
- }),
11222
+ status: resolveSessionStatus(activeChat, state.status),
11216
11223
  title: activeChat?.title || state.name,
11217
11224
  workspace,
11218
11225
  ...git && { git },
@@ -19897,7 +19904,7 @@ function resolveAdhdevMcpServerLaunch(options) {
19897
19904
  if (!entryPath) return null;
19898
19905
  return {
19899
19906
  command: options.nodeExecutable?.trim() || process.execPath,
19900
- args: [entryPath, "--repo-mesh", options.meshId]
19907
+ args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
19901
19908
  };
19902
19909
  }
19903
19910
  function resolveAdhdevMcpEntryPath(explicitPath) {
@@ -20596,6 +20603,10 @@ async function maybeRunDaemonUpgradeHelperFromEnv() {
20596
20603
  // src/commands/router.ts
20597
20604
  import * as fs10 from "fs";
20598
20605
  var CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
20606
+ var CHANNEL_SERVER_URL = {
20607
+ stable: "https://api.adhf.dev",
20608
+ preview: "https://api-preview.adhf.dev"
20609
+ };
20599
20610
  function normalizeReleaseChannel(value) {
20600
20611
  if (typeof value !== "string") return null;
20601
20612
  const normalized = value.trim().toLowerCase();
@@ -21292,6 +21303,7 @@ var DaemonCommandRouter = class {
21292
21303
  const npmTag = CHANNEL_NPM_TAG[channel];
21293
21304
  const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
21294
21305
  LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
21306
+ updateConfig({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
21295
21307
  let currentInstalled = null;
21296
21308
  try {
21297
21309
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -21494,7 +21506,8 @@ var DaemonCommandRouter = class {
21494
21506
  };
21495
21507
  if (args?.inlineMesh) {
21496
21508
  mcpServerEntry.env = {
21497
- ADHDEV_INLINE_MESH: JSON.stringify(mesh)
21509
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh),
21510
+ ADHDEV_MCP_TRANSPORT: "ipc"
21498
21511
  };
21499
21512
  }
21500
21513
  const mcpConfig = {