@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.
@@ -22695,6 +22695,7 @@ function normalizeConfig(raw) {
22695
22695
  ideSettings: isPlainObject2(parsed.ideSettings) ? parsed.ideSettings : {},
22696
22696
  providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
22697
22697
  providerDir: asOptionalString(parsed.providerDir),
22698
+ updateChannel: parsed.updateChannel === "preview" ? "preview" : "stable",
22698
22699
  terminalSizingMode: parsed.terminalSizingMode === "fit" ? "fit" : "measured"
22699
22700
  };
22700
22701
  }
@@ -22991,7 +22992,7 @@ function buildNodeConfigSection(mesh) {
22991
22992
  for (const n of mesh.nodes) {
22992
22993
  const labels = [];
22993
22994
  if (n.isLocalWorktree) labels.push("worktree");
22994
- if (n.policy.readOnly) labels.push("read-only");
22995
+ if (n.policy?.readOnly) labels.push("read-only");
22995
22996
  const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
22996
22997
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
22997
22998
  }
@@ -31597,6 +31598,8 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
31597
31598
  addCandidate((0, import_path4.resolve)(dir, "../vendor/mcp-server/index.js"));
31598
31599
  addCandidate((0, import_path4.resolve)(dir, "../../vendor/mcp-server/index.js"));
31599
31600
  addCandidate((0, import_path4.resolve)(dir, "../../../vendor/mcp-server/index.js"));
31601
+ addCandidate((0, import_path4.resolve)(dir, "../../mcp-server/dist/index.js"));
31602
+ addCandidate((0, import_path4.resolve)(dir, "../../../mcp-server/dist/index.js"));
31600
31603
  };
31601
31604
  addPackagedCandidates(process.argv[1]);
31602
31605
  for (const candidate of candidates) {
@@ -32255,6 +32258,16 @@ async function maybeRunDaemonUpgradeHelperFromEnv() {
32255
32258
  process.exit(1);
32256
32259
  }
32257
32260
  }
32261
+ function normalizeReleaseChannel(value) {
32262
+ if (typeof value !== "string") return null;
32263
+ const normalized = value.trim().toLowerCase();
32264
+ if (normalized === "stable" || normalized === "latest") return "stable";
32265
+ if (normalized === "preview" || normalized === "next") return "preview";
32266
+ return null;
32267
+ }
32268
+ function resolveUpgradeChannel(args) {
32269
+ return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
32270
+ }
32258
32271
  function normalizeCommandSource(source) {
32259
32272
  switch (source) {
32260
32273
  case "ws":
@@ -36743,7 +36756,7 @@ async function shutdownDaemonComponents(components) {
36743
36756
  }
36744
36757
  cdpManagers.clear();
36745
36758
  }
36746
- var import_os, import_path, import_fs, import_crypto2, import_fs2, import_path2, import_crypto3, fs2, path9, os4, os8, os9, path13, import_child_process, os10, path14, os11, import_child_process2, import_fs3, import_promises4, path, import_util3, import_promises5, path22, path32, fs, os5, path4, import_crypto4, path5, path6, import_fs4, import_path3, import_child_process3, import_fs5, import_os2, path7, import_child_process4, os22, path8, import_fs6, os32, import_child_process5, http, crypto2, fs3, path10, os52, fs4, os6, path11, import_crypto5, fs5, path12, os7, os13, path16, crypto4, import_fs7, import_child_process6, os12, path15, crypto3, fs6, import_module, import_stream2, import_child_process7, import_child_process8, net2, os15, path18, fs7, path17, os14, fs8, path19, os16, import_fs8, import_module2, import_path4, os17, import_child_process9, import_child_process10, fs9, os18, path20, fs10, fs11, path21, os19, import_child_process11, import_os3, http2, fs15, path25, fs12, path222, fs13, path23, fs14, path24, os20, import_child_process12, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __require2, __esm2, __export2, __copyProps2, __toCommonJS, DEFAULT_MESH_POLICY, init_repo_mesh_types, config_exports, DEFAULT_CONFIG, MACHINE_ID_PREFIX, init_config, mesh_config_exports, init_mesh_config, coordinator_prompt_exports, TOOLS_SECTION, WORKFLOW_SECTION, RULES_SECTION, init_coordinator_prompt, LEVEL_NUM, LEVEL_LABEL, currentLevel, LOG_DIR, MAX_LOG_SIZE, MAX_LOG_DAYS, currentDate, currentLogFile, writeCount, RING_BUFFER_SIZE, ringBuffer, origConsoleLog, origConsoleError, origConsoleWarn, LOG, interceptorInstalled, LOG_PATH, init_logger, NORMAL_TRACE_BUFFER_SIZE, DEV_TRACE_BUFFER_SIZE, DEFAULT_CONFIG2, currentConfig, init_debug_config, DEFAULT_BINDING_CANDIDATES, cachedBinding, cachedBindingError, GhosttyVtTerminalBackend, init_ghostty_vt_backend, TerminalCtor, XtermTerminalBackend, init_xterm_backend, DEFAULT_SCROLLBACK, loggedTerminalBackends, TerminalScreen, init_terminal_screen, init_spawn_env, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory, init_pty_transport, buildCliSpawnEnv, init_provider_cli_shared, init_provider_cli_parse, init_provider_cli_config, init_provider_cli_runtime, provider_cli_adapter_exports, ProviderCliAdapter, init_provider_cli_adapter, execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError, DEFAULT_MAX_FILES, DEFAULT_MAX_BYTES, summarizeGitStatus, InMemoryGitSnapshotStore, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices, BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker, MAX_WORKSPACES, MAX_ACTIVITY, MAX_SAVED_SESSIONS, DEFAULT_STATE, BUILTIN_IDE_DEFINITIONS, registeredIDEs, LIVE_LIFECYCLES, DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES, DaemonCdpManager, CdpDomHandlers, DEFAULT_MONITOR_CONFIG, StatusMonitor, BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter, IDE_PROVIDER_SESSION_CAPABILITIES_BASE, EXTENSION_PROVIDER_SESSION_CAPABILITIES_BASE, ExtensionProviderInstance, VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES, DEFAULT_APPROVAL_POSITIVE_HINTS, IdeProviderInstance, DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, DaemonCdpScanner, DaemonCdpInitializer, WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT, IDE_SESSION_CAPABILITIES, EXTENSION_SESSION_CAPABILITIES, PTY_SESSION_CAPABILITIES, CLI_CHAT_SESSION_CAPABILITIES, ACP_SESSION_CAPABILITIES, VALID_INPUT_MEDIA_TYPES, globalStore, RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, recentSendByTarget, DEFAULT_DEBUG_SANITIZE_OPTIONS, SECRET_KEY_PATTERN, KEY_TO_VK, COMMAND_DEBUG_LEVELS, DaemonCommandHandler, CachedDatabaseSync, CliProviderInstance, AcpProviderInstance, chalkModule, chalkApi, DaemonCliManager, VALID_CAPABILITY_MEDIA_TYPES, KNOWN_PROVIDER_FIELDS, VALUE_CONTROL_TYPES, ProviderLoader, _providerLoader, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession, UPGRADE_HELPER_ENV, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter, DaemonStatusReporter, DEFAULT_DAEMON_PORT, DAEMON_WS_PATH, ProviderStreamAdapter, DaemonAgentStreamManager, AgentStreamPoller, ProviderInstanceManager, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive, DEV_SERVER_PORT, DevServer, SessionHostRuntimeTransport, SessionHostPtyTransportFactory, DEFAULT_SESSION_HOST_APP_NAME, DEFAULT_STANDALONE_SESSION_HOST_APP_NAME, STARTUP_TIMEOUT_MS, STARTUP_POLL_MS, EXTENSION_CATALOG, SessionRegistry;
36759
+ var import_os, import_path, import_fs, import_crypto2, import_fs2, import_path2, import_crypto3, fs2, path9, os4, os8, os9, path13, import_child_process, os10, path14, os11, import_child_process2, import_fs3, import_promises4, path, import_util3, import_promises5, path22, path32, fs, os5, path4, import_crypto4, path5, path6, import_fs4, import_path3, import_child_process3, import_fs5, import_os2, path7, import_child_process4, os22, path8, import_fs6, os32, import_child_process5, http, crypto2, fs3, path10, os52, fs4, os6, path11, import_crypto5, fs5, path12, os7, os13, path16, crypto4, import_fs7, import_child_process6, os12, path15, crypto3, fs6, import_module, import_stream2, import_child_process7, import_child_process8, net2, os15, path18, fs7, path17, os14, fs8, path19, os16, import_fs8, import_module2, import_path4, os17, import_child_process9, import_child_process10, fs9, os18, path20, fs10, fs11, path21, os19, import_child_process11, import_os3, http2, fs15, path25, fs12, path222, fs13, path23, fs14, path24, os20, import_child_process12, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __require2, __esm2, __export2, __copyProps2, __toCommonJS, DEFAULT_MESH_POLICY, init_repo_mesh_types, config_exports, DEFAULT_CONFIG, MACHINE_ID_PREFIX, init_config, mesh_config_exports, init_mesh_config, coordinator_prompt_exports, TOOLS_SECTION, WORKFLOW_SECTION, RULES_SECTION, init_coordinator_prompt, LEVEL_NUM, LEVEL_LABEL, currentLevel, LOG_DIR, MAX_LOG_SIZE, MAX_LOG_DAYS, currentDate, currentLogFile, writeCount, RING_BUFFER_SIZE, ringBuffer, origConsoleLog, origConsoleError, origConsoleWarn, LOG, interceptorInstalled, LOG_PATH, init_logger, NORMAL_TRACE_BUFFER_SIZE, DEV_TRACE_BUFFER_SIZE, DEFAULT_CONFIG2, currentConfig, init_debug_config, DEFAULT_BINDING_CANDIDATES, cachedBinding, cachedBindingError, GhosttyVtTerminalBackend, init_ghostty_vt_backend, TerminalCtor, XtermTerminalBackend, init_xterm_backend, DEFAULT_SCROLLBACK, loggedTerminalBackends, TerminalScreen, init_terminal_screen, init_spawn_env, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory, init_pty_transport, buildCliSpawnEnv, init_provider_cli_shared, init_provider_cli_parse, init_provider_cli_config, init_provider_cli_runtime, provider_cli_adapter_exports, ProviderCliAdapter, init_provider_cli_adapter, execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError, DEFAULT_MAX_FILES, DEFAULT_MAX_BYTES, summarizeGitStatus, InMemoryGitSnapshotStore, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices, BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker, MAX_WORKSPACES, MAX_ACTIVITY, MAX_SAVED_SESSIONS, DEFAULT_STATE, BUILTIN_IDE_DEFINITIONS, registeredIDEs, LIVE_LIFECYCLES, DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES, DaemonCdpManager, CdpDomHandlers, DEFAULT_MONITOR_CONFIG, StatusMonitor, BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter, IDE_PROVIDER_SESSION_CAPABILITIES_BASE, EXTENSION_PROVIDER_SESSION_CAPABILITIES_BASE, ExtensionProviderInstance, VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES, DEFAULT_APPROVAL_POSITIVE_HINTS, IdeProviderInstance, DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, DaemonCdpScanner, DaemonCdpInitializer, WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT, IDE_SESSION_CAPABILITIES, EXTENSION_SESSION_CAPABILITIES, PTY_SESSION_CAPABILITIES, CLI_CHAT_SESSION_CAPABILITIES, ACP_SESSION_CAPABILITIES, VALID_INPUT_MEDIA_TYPES, globalStore, RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, recentSendByTarget, DEFAULT_DEBUG_SANITIZE_OPTIONS, SECRET_KEY_PATTERN, KEY_TO_VK, COMMAND_DEBUG_LEVELS, DaemonCommandHandler, CachedDatabaseSync, CliProviderInstance, AcpProviderInstance, chalkModule, chalkApi, DaemonCliManager, VALID_CAPABILITY_MEDIA_TYPES, KNOWN_PROVIDER_FIELDS, VALUE_CONTROL_TYPES, ProviderLoader, _providerLoader, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession, UPGRADE_HELPER_ENV, CHANNEL_NPM_TAG, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter, DaemonStatusReporter, DEFAULT_DAEMON_PORT, DAEMON_WS_PATH, ProviderStreamAdapter, DaemonAgentStreamManager, AgentStreamPoller, ProviderInstanceManager, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive, DEV_SERVER_PORT, DevServer, SessionHostRuntimeTransport, SessionHostPtyTransportFactory, DEFAULT_SESSION_HOST_APP_NAME, DEFAULT_STANDALONE_SESSION_HOST_APP_NAME, STARTUP_TIMEOUT_MS, STARTUP_POLL_MS, EXTENSION_CATALOG, SessionRegistry;
36747
36760
  var init_dist2 = __esm({
36748
36761
  "../daemon-core/dist/index.mjs"() {
36749
36762
  "use strict";
@@ -36934,6 +36947,7 @@ var init_dist2 = __esm({
36934
36947
  machineProviders: {},
36935
36948
  ideSettings: {},
36936
36949
  providerSourceMode: "normal",
36950
+ updateChannel: "stable",
36937
36951
  terminalSizingMode: "measured"
36938
36952
  };
36939
36953
  MACHINE_ID_PREFIX = "mach_";
@@ -36985,18 +36999,20 @@ var init_dist2 = __esm({
36985
36999
  3. **Delegate** \u2014 For each task:
36986
37000
  a. Pick the best node (consider: health, dirty state, current workload).
36987
37001
  b. If no session exists, call \`mesh_launch_session\` to start one.
36988
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
37002
+ 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.
36989
37003
  4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
36990
37004
  5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
36991
37005
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
36992
37006
  7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
36993
37007
  RULES_SECTION = `## Rules
36994
37008
 
36995
- - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
36996
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
37009
+ - **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.
37010
+ - **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.
37011
+ - **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.
37012
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
36997
37013
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
36998
37014
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
36999
- - **Keep the user informed.** Report progress after each delegation round.
37015
+ - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
37000
37016
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
37001
37017
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
37002
37018
  }
@@ -37481,6 +37497,17 @@ var init_dist2 = __esm({
37481
37497
  this.lastScreenSnapshotReadAt = now;
37482
37498
  return screenText;
37483
37499
  }
37500
+ getParseScreenText(screenText) {
37501
+ const currentSnapshot = normalizeScreenSnapshot(screenText);
37502
+ const lastSnapshot = this.lastScreenSnapshot;
37503
+ if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
37504
+ const staleSnapshotLooksActive = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel/i.test(lastSnapshot);
37505
+ 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);
37506
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
37507
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
37508
+ return `${screenText}
37509
+ ${lastSnapshot}`;
37510
+ }
37484
37511
  shouldReadTerminalScreenSnapshot(now) {
37485
37512
  if (!this.lastScreenText) return true;
37486
37513
  return now - this.lastScreenSnapshotReadAt >= _ProviderCliAdapter.SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
@@ -38471,12 +38498,13 @@ var init_dist2 = __esm({
38471
38498
  }
38472
38499
  try {
38473
38500
  const screenText = this.terminalScreen.getText();
38501
+ const parseScreenText = this.getParseScreenText(screenText);
38474
38502
  const tail = this.recentOutputBuffer.slice(-500);
38475
38503
  const input = buildCliParseInput({
38476
38504
  accumulatedBuffer: this.accumulatedBuffer,
38477
38505
  accumulatedRawBuffer: this.accumulatedRawBuffer,
38478
38506
  recentOutputBuffer: this.recentOutputBuffer,
38479
- terminalScreenText: screenText,
38507
+ terminalScreenText: parseScreenText,
38480
38508
  baseMessages: [],
38481
38509
  partialResponse: this.responseBuffer,
38482
38510
  isWaitingForResponse: this.isWaitingForResponse,
@@ -38570,8 +38598,9 @@ var init_dist2 = __esm({
38570
38598
  */
38571
38599
  getScriptParsedStatus() {
38572
38600
  const screenText = this.readTerminalScreenText();
38601
+ const parseScreenText = this.getParseScreenText(screenText);
38573
38602
  const cached2 = this.parsedStatusCache;
38574
- 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) {
38603
+ 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) {
38575
38604
  return cached2.result;
38576
38605
  }
38577
38606
  const parsed = this.runParseSession();
@@ -38599,7 +38628,7 @@ var init_dist2 = __esm({
38599
38628
  currentTurnScope: this.currentTurnScope,
38600
38629
  recentOutputBuffer: this.recentOutputBuffer,
38601
38630
  accumulatedBuffer: this.accumulatedBuffer,
38602
- screenText,
38631
+ screenText: parseScreenText,
38603
38632
  currentStatus: this.currentStatus,
38604
38633
  activeModal: this.activeModal,
38605
38634
  cliName: this.cliName,
@@ -38616,7 +38645,7 @@ var init_dist2 = __esm({
38616
38645
  accumulatedBuffer: this.accumulatedBuffer,
38617
38646
  accumulatedRawBuffer: this.accumulatedRawBuffer,
38618
38647
  recentOutputBuffer: this.recentOutputBuffer,
38619
- terminalScreenText: this.terminalScreen.getText(),
38648
+ terminalScreenText: this.getParseScreenText(this.terminalScreen.getText()),
38620
38649
  baseMessages: [],
38621
38650
  partialResponse: this.responseBuffer,
38622
38651
  isWaitingForResponse: this.isWaitingForResponse,
@@ -47502,6 +47531,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
47502
47531
  READ_DEBUG_ENABLED = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
47503
47532
  recentReadDebugSignatureBySession = /* @__PURE__ */ new Map();
47504
47533
  UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
47534
+ CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
47505
47535
  CHAT_COMMANDS = [
47506
47536
  "send_chat",
47507
47537
  "new_chat",
@@ -48103,8 +48133,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
48103
48133
  const isStandalone = this.deps.packageName === "@adhdev/daemon-standalone" || process.argv[1]?.includes("daemon-standalone");
48104
48134
  const pkgName = isStandalone ? "@adhdev/daemon-standalone" : "adhdev";
48105
48135
  const npmSurface = resolveCurrentGlobalInstallSurface({ packageName: pkgName });
48106
- const latest = String(execNpmCommandSync(["view", pkgName, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
48107
- LOG.info("Upgrade", `Latest ${pkgName}: v${latest}`);
48136
+ const channel = resolveUpgradeChannel(args);
48137
+ const npmTag = CHANNEL_NPM_TAG[channel];
48138
+ const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
48139
+ LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
48108
48140
  let currentInstalled = null;
48109
48141
  try {
48110
48142
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -48118,8 +48150,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
48118
48150
  }
48119
48151
  const runningVersion = typeof this.deps.statusVersion === "string" ? this.deps.statusVersion.trim().replace(/^v/, "") : null;
48120
48152
  if (currentInstalled === latest && runningVersion === latest) {
48121
- LOG.info("Upgrade", `Already on latest version v${latest}; skipping install`);
48122
- return { success: true, upgraded: false, alreadyLatest: true, version: latest };
48153
+ LOG.info("Upgrade", `Already on ${channel} channel version v${latest}; skipping install`);
48154
+ return { success: true, upgraded: false, alreadyLatest: true, version: latest, channel, npmTag };
48123
48155
  }
48124
48156
  if (currentInstalled === latest && runningVersion && runningVersion !== latest) {
48125
48157
  LOG.info("Upgrade", `Installed package is v${latest}, but running daemon is v${runningVersion}; scheduling restart`);
@@ -48132,12 +48164,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
48132
48164
  cwd: process.cwd(),
48133
48165
  sessionHostAppName: process.env.ADHDEV_SESSION_HOST_NAME || "adhdev"
48134
48166
  });
48135
- LOG.info("Upgrade", `Scheduled detached upgrade to v${latest}`);
48167
+ LOG.info("Upgrade", `Scheduled detached ${channel} upgrade to v${latest}`);
48136
48168
  setTimeout(() => {
48137
48169
  LOG.info("Upgrade", "Exiting daemon so detached upgrader can continue...");
48138
48170
  process.exit(0);
48139
48171
  }, 3e3);
48140
- return { success: true, upgraded: true, version: latest, restarting: true };
48172
+ return { success: true, upgraded: true, version: latest, restarting: true, channel, npmTag };
48141
48173
  } catch (e) {
48142
48174
  LOG.error("Upgrade", `Failed: ${e.message}`);
48143
48175
  return { success: false, error: e.message };
@@ -48301,14 +48333,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
48301
48333
  } catch {
48302
48334
  }
48303
48335
  }
48336
+ const mcpServerEntry = {
48337
+ command: coordinatorSetup.mcpServer.command,
48338
+ args: coordinatorSetup.mcpServer.args
48339
+ };
48340
+ if (args?.inlineMesh) {
48341
+ mcpServerEntry.env = {
48342
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh)
48343
+ };
48344
+ }
48304
48345
  const mcpConfig = {
48305
48346
  ...existingMcpConfig,
48306
48347
  mcpServers: {
48307
48348
  ...existingMcpConfig.mcpServers || {},
48308
- [coordinatorSetup.serverName]: {
48309
- command: coordinatorSetup.mcpServer.command,
48310
- args: coordinatorSetup.mcpServer.args
48311
- }
48349
+ [coordinatorSetup.serverName]: mcpServerEntry
48312
48350
  }
48313
48351
  };
48314
48352
  writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
@@ -53220,7 +53258,14 @@ async function meshStatus(ctx) {
53220
53258
  workspace: node.workspace
53221
53259
  };
53222
53260
  try {
53223
- if (isLocalTransport(transport)) {
53261
+ if (!isLocalTransport(transport) && node.daemonId) {
53262
+ const result = await transport.gitStatus(node.daemonId, node.workspace, false);
53263
+ const status = result?.status ?? result;
53264
+ entry.health = status?.isGitRepo ? status?.isDirty ? "dirty" : "online" : "degraded";
53265
+ entry.branch = status?.branch;
53266
+ entry.isDirty = status?.isDirty;
53267
+ entry.uncommittedChanges = status?.uncommittedChanges ?? 0;
53268
+ } else if (isLocalTransport(transport)) {
53224
53269
  const statusResult = await transport.command("git_status", { workspace: node.workspace });
53225
53270
  const status = statusResult?.status ?? statusResult;
53226
53271
  entry.health = status?.isGitRepo ? status?.isDirty ? "dirty" : "online" : "degraded";
@@ -53229,7 +53274,7 @@ async function meshStatus(ctx) {
53229
53274
  entry.uncommittedChanges = status?.uncommittedChanges ?? 0;
53230
53275
  } else {
53231
53276
  entry.health = "unknown";
53232
- entry.note = "Cloud status probe not yet implemented for mesh nodes";
53277
+ entry.note = "No daemonId available for cloud status probe";
53233
53278
  }
53234
53279
  } catch (e) {
53235
53280
  entry.health = "degraded";
@@ -53263,7 +53308,7 @@ async function meshListNodes(ctx) {
53263
53308
  }
53264
53309
  async function meshSendTask(ctx, args) {
53265
53310
  const node = findNode(ctx.mesh, args.node_id);
53266
- if (node.policy.readOnly) {
53311
+ if (node.policy?.readOnly) {
53267
53312
  return JSON.stringify({ error: `Node '${args.node_id}' is read-only` });
53268
53313
  }
53269
53314
  if (isLocalTransport(ctx.transport)) {
@@ -53306,7 +53351,15 @@ async function meshLaunchSession(ctx, args) {
53306
53351
  }
53307
53352
  async function meshGitStatus(ctx, args) {
53308
53353
  const node = findNode(ctx.mesh, args.node_id);
53309
- if (isLocalTransport(ctx.transport)) {
53354
+ if (!isLocalTransport(ctx.transport) && node.daemonId) {
53355
+ const result = await ctx.transport.gitStatus(node.daemonId, node.workspace, true);
53356
+ return JSON.stringify({
53357
+ nodeId: args.node_id,
53358
+ workspace: node.workspace,
53359
+ status: result?.status ?? result,
53360
+ diff: result?.diff ?? null
53361
+ }, null, 2);
53362
+ } else if (isLocalTransport(ctx.transport)) {
53310
53363
  const statusResult = await ctx.transport.command("git_status", {
53311
53364
  workspace: node.workspace
53312
53365
  });
@@ -53320,12 +53373,12 @@ async function meshGitStatus(ctx, args) {
53320
53373
  diff: diffResult?.diffSummary ?? diffResult
53321
53374
  }, null, 2);
53322
53375
  } else {
53323
- return JSON.stringify({ error: "Cloud mesh git_status not yet implemented" });
53376
+ return JSON.stringify({ error: "No daemonId available for cloud git_status probe" });
53324
53377
  }
53325
53378
  }
53326
53379
  async function meshCheckpoint(ctx, args) {
53327
53380
  const node = findNode(ctx.mesh, args.node_id);
53328
- if (node.policy.readOnly) {
53381
+ if (node.policy?.readOnly) {
53329
53382
  return JSON.stringify({ error: `Node '${args.node_id}' is read-only \u2014 cannot checkpoint` });
53330
53383
  }
53331
53384
  if (isLocalTransport(ctx.transport)) {
@@ -53364,7 +53417,17 @@ async function startMcpServer(opts) {
53364
53417
  const isLocal = opts.mode === "local";
53365
53418
  if (opts.meshId) {
53366
53419
  let mesh;
53367
- if (opts.mode === "cloud" && opts.apiKey) {
53420
+ if (!mesh && process.env.ADHDEV_INLINE_MESH) {
53421
+ try {
53422
+ mesh = JSON.parse(process.env.ADHDEV_INLINE_MESH);
53423
+ process.stderr.write(`[adhdev-mcp] Loaded mesh config from ADHDEV_INLINE_MESH env
53424
+ `);
53425
+ } catch (e) {
53426
+ process.stderr.write(`[adhdev-mcp] Failed to parse ADHDEV_INLINE_MESH: ${e.message}
53427
+ `);
53428
+ }
53429
+ }
53430
+ if (!mesh && opts.mode === "cloud" && opts.apiKey) {
53368
53431
  try {
53369
53432
  const base = opts.baseUrl || "https://api.adhf.dev";
53370
53433
  const res = await fetch(`${base}/api/v1/repo-meshes/${opts.meshId}`, {
@@ -53404,6 +53467,7 @@ async function startMcpServer(opts) {
53404
53467
  id: n.id,
53405
53468
  workspace: n.workspace,
53406
53469
  repoRoot: n.repo_root,
53470
+ daemonId: n.daemon_id,
53407
53471
  userOverrides: {},
53408
53472
  policy: {},
53409
53473
  isLocalWorktree: false
@@ -53455,7 +53519,7 @@ async function startMcpServer(opts) {
53455
53519
  coordinatorPrompt = `You are a Repo Mesh Coordinator for "${mesh.name}" (${mesh.repoIdentity}). Use mesh_* tools to orchestrate work.`;
53456
53520
  }
53457
53521
  const server2 = new import_server.Server(
53458
- { name: "adhdev-mcp-server", version: "0.9.74" },
53522
+ { name: "adhdev-mcp-server", version: "0.9.75" },
53459
53523
  { capabilities: { tools: {}, resources: {} } }
53460
53524
  );
53461
53525
  const { ListResourcesRequestSchema, ReadResourceRequestSchema } = await import("@modelcontextprotocol/sdk/types.js");