@adhdev/daemon-core 0.9.76-rc.11 → 0.9.76-rc.12

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.
@@ -21,6 +21,7 @@ export { normalizeCliProviderForRuntime, type CliApprovalInput, type CliChatMess
21
21
  export declare function appendBoundedText(current: string, chunk: string, maxChars: number): string;
22
22
  export declare class ProviderCliAdapter implements CliAdapter {
23
23
  private extraArgs;
24
+ private extraEnv;
24
25
  readonly cliType: string;
25
26
  readonly cliName: string;
26
27
  workingDir: string;
@@ -126,7 +127,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
126
127
  private readonly submitStrategy;
127
128
  private readonly requirePromptEchoBeforeSubmit;
128
129
  private static readonly SCRIPT_STATUS_DEBOUNCE_MS;
129
- constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], transportFactory?: PtyTransportFactory);
130
+ constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], extraEnv?: Record<string, string>, transportFactory?: PtyTransportFactory);
130
131
  /** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
131
132
  setCliScripts(scripts: CliScripts): void;
132
133
  /** Refresh provider scripts/config used by this adapter without restarting the PTY runtime. */
@@ -15,6 +15,7 @@ export declare function resolveCliSpawnPlan(options: {
15
15
  runtimeSettings: Record<string, any>;
16
16
  workingDir: string;
17
17
  extraArgs: string[];
18
+ extraEnv?: Record<string, string>;
18
19
  }): CliSpawnPlan;
19
20
  export declare function buildCliLoginShellRetry(plan: Pick<CliSpawnPlan, 'binaryPath' | 'allArgs'>): {
20
21
  shellCmd: string;
@@ -58,6 +58,11 @@ type CliSessionBinding = {
58
58
  providerSessionId?: string;
59
59
  launchMode: CliLaunchMode;
60
60
  };
61
+ type CliStartOptions = {
62
+ resumeSessionId?: string;
63
+ settingsOverride?: Record<string, any>;
64
+ extraEnv?: Record<string, string>;
65
+ };
61
66
  export declare function supportsExplicitSessionResume(resume?: ProviderResumeCapability): boolean;
62
67
  export declare function resolveCliSessionBinding(provider: ProviderModule | undefined, normalizedType: string, cliArgs?: string[], requestedResumeSessionId?: string): CliSessionBinding;
63
68
  export declare class DaemonCliManager {
@@ -73,10 +78,7 @@ export declare class DaemonCliManager {
73
78
  private createAdapter;
74
79
  private startCliExitMonitor;
75
80
  private registerCliInstance;
76
- startSession(cliType: string, workingDir: string, cliArgs?: string[], initialModel?: string, options?: {
77
- resumeSessionId?: string;
78
- settingsOverride?: Record<string, any>;
79
- }): Promise<{
81
+ startSession(cliType: string, workingDir: string, cliArgs?: string[], initialModel?: string, options?: CliStartOptions): Promise<{
80
82
  runtimeSessionId: string;
81
83
  providerSessionId?: string;
82
84
  }>;
package/dist/index.js CHANGED
@@ -1630,7 +1630,7 @@ var init_provider_cli_config = __esm({
1630
1630
 
1631
1631
  // src/cli-adapters/provider-cli-runtime.ts
1632
1632
  function resolveCliSpawnPlan(options) {
1633
- const { provider, runtimeSettings, workingDir, extraArgs } = options;
1633
+ const { provider, runtimeSettings, workingDir, extraArgs, extraEnv } = options;
1634
1634
  const { spawn: spawnConfig } = provider;
1635
1635
  const configuredCommand = typeof runtimeSettings.executablePath === "string" && runtimeSettings.executablePath.trim() ? runtimeSettings.executablePath.trim() : spawnConfig.command;
1636
1636
  const binaryPath = findBinary(configuredCommand);
@@ -1654,7 +1654,7 @@ function resolveCliSpawnPlan(options) {
1654
1654
  shellCmd = binaryPath;
1655
1655
  shellArgs = allArgs;
1656
1656
  }
1657
- const env = buildCliSpawnEnv(process.env, spawnConfig.env);
1657
+ const env = buildCliSpawnEnv(process.env, { ...spawnConfig.env || {}, ...extraEnv || {} });
1658
1658
  env.TERMINAL_CWD = workingDir;
1659
1659
  return {
1660
1660
  binaryPath,
@@ -1757,8 +1757,9 @@ var init_provider_cli_adapter = __esm({
1757
1757
  init_provider_cli_runtime();
1758
1758
  init_provider_cli_shared();
1759
1759
  ProviderCliAdapter = class _ProviderCliAdapter {
1760
- constructor(provider, workingDir, extraArgs = [], transportFactory = new NodePtyTransportFactory()) {
1760
+ constructor(provider, workingDir, extraArgs = [], extraEnv = {}, transportFactory = new NodePtyTransportFactory()) {
1761
1761
  this.extraArgs = extraArgs;
1762
+ this.extraEnv = extraEnv;
1762
1763
  this.provider = provider;
1763
1764
  this.transportFactory = transportFactory;
1764
1765
  this.cliType = provider.type;
@@ -2074,7 +2075,8 @@ ${lastSnapshot}`;
2074
2075
  provider: this.provider,
2075
2076
  runtimeSettings: this.runtimeSettings,
2076
2077
  workingDir: this.workingDir,
2077
- extraArgs: this.extraArgs
2078
+ extraArgs: this.extraArgs,
2079
+ extraEnv: this.extraEnv
2078
2080
  });
2079
2081
  LOG.info("CLI", `[${this.cliType}] Spawning in ${this.workingDir}`);
2080
2082
  this.resetTraceSession();
@@ -5983,17 +5985,17 @@ function checkPathExists(paths) {
5983
5985
  return null;
5984
5986
  }
5985
5987
  async function detectIDEs(providerLoader) {
5986
- const os21 = (0, import_os2.platform)();
5988
+ const os22 = (0, import_os2.platform)();
5987
5989
  const results = [];
5988
5990
  for (const def of getMergedDefinitions()) {
5989
5991
  const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
5990
- const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os21] || []) || []);
5992
+ const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os22] || []) || []);
5991
5993
  let resolvedCli = cliPath;
5992
- if (!resolvedCli && appPath && os21 === "darwin") {
5994
+ if (!resolvedCli && appPath && os22 === "darwin") {
5993
5995
  const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
5994
5996
  if ((0, import_fs4.existsSync)(bundledCli)) resolvedCli = bundledCli;
5995
5997
  }
5996
- if (!resolvedCli && appPath && os21 === "win32") {
5998
+ if (!resolvedCli && appPath && os22 === "win32") {
5997
5999
  const { dirname: dirname9 } = await import("path");
5998
6000
  const appDir = dirname9(appPath);
5999
6001
  const candidates = [
@@ -6010,7 +6012,7 @@ async function detectIDEs(providerLoader) {
6010
6012
  }
6011
6013
  }
6012
6014
  }
6013
- const installed = os21 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
6015
+ const installed = os22 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
6014
6016
  const version = resolvedCli ? getIdeVersion(resolvedCli) : null;
6015
6017
  results.push({
6016
6018
  id: def.id,
@@ -14943,7 +14945,7 @@ var CliProviderInstance = class {
14943
14945
  this.providerSessionId = options?.providerSessionId;
14944
14946
  this.launchMode = options?.launchMode || "new";
14945
14947
  this.onProviderSessionResolved = options?.onProviderSessionResolved;
14946
- this.adapter = new ProviderCliAdapter(provider, workingDir, cliArgs, transportFactory);
14948
+ this.adapter = new ProviderCliAdapter(provider, workingDir, cliArgs, options?.extraEnv || {}, transportFactory);
14947
14949
  this.monitor = new StatusMonitor();
14948
14950
  this.historyWriter = new ChatHistoryWriter();
14949
14951
  }
@@ -17154,7 +17156,7 @@ var DaemonCliManager = class {
17154
17156
  attachExisting
17155
17157
  }) || void 0;
17156
17158
  }
17157
- createAdapter(cliType, workingDir, cliArgs, runtimeId, providerSessionId, attachExisting = false) {
17159
+ createAdapter(cliType, workingDir, cliArgs, runtimeId, providerSessionId, attachExisting = false, extraEnv) {
17158
17160
  const normalizedType = this.providerLoader.resolveAlias(cliType);
17159
17161
  const provider = this.providerLoader.getMeta(normalizedType);
17160
17162
  if (provider && provider.category === "cli" && provider.patterns && provider.spawn) {
@@ -17168,7 +17170,7 @@ var DaemonCliManager = class {
17168
17170
  providerSessionId,
17169
17171
  attachExisting
17170
17172
  );
17171
- return new ProviderCliAdapter(resolvedProvider, workingDir, cliArgs, transportFactory);
17173
+ return new ProviderCliAdapter(resolvedProvider, workingDir, cliArgs, extraEnv || {}, transportFactory);
17172
17174
  }
17173
17175
  throw new Error(`No CLI provider found for '${cliType}'. Create a provider.js in providers/cli/${cliType}/`);
17174
17176
  }
@@ -17371,6 +17373,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
17371
17373
  {
17372
17374
  providerSessionId: sessionBinding.providerSessionId,
17373
17375
  launchMode: sessionBinding.launchMode,
17376
+ extraEnv: options?.extraEnv,
17374
17377
  onProviderSessionResolved: ({ providerSessionId, providerName, providerType, workspace }) => {
17375
17378
  this.persistRecentActivity({
17376
17379
  kind: "cli",
@@ -17391,7 +17394,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
17391
17394
  resolvedCliArgs,
17392
17395
  key,
17393
17396
  sessionBinding.providerSessionId,
17394
- false
17397
+ false,
17398
+ options?.extraEnv
17395
17399
  );
17396
17400
  try {
17397
17401
  await adapter.spawn();
@@ -17620,7 +17624,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
17620
17624
  dir,
17621
17625
  args?.cliArgs,
17622
17626
  args?.initialModel,
17623
- { resumeSessionId: args?.resumeSessionId, settingsOverride: args?.settings }
17627
+ { resumeSessionId: args?.resumeSessionId, settingsOverride: args?.settings, extraEnv: args?.env }
17624
17628
  );
17625
17629
  return {
17626
17630
  success: true,
@@ -20159,11 +20163,13 @@ function getRecentCommands(count = 50) {
20159
20163
  cleanOldFiles();
20160
20164
 
20161
20165
  // src/commands/router.ts
20166
+ var yaml = __toESM(require("js-yaml"));
20162
20167
  init_logger();
20163
20168
 
20164
20169
  // src/commands/mesh-coordinator.ts
20165
20170
  var import_node_fs3 = require("fs");
20166
20171
  var import_node_module2 = require("module");
20172
+ var os17 = __toESM(require("os"));
20167
20173
  var import_node_path = require("path");
20168
20174
  var DEFAULT_SERVER_NAME = "adhdev-mesh";
20169
20175
  var DEFAULT_ADHDEV_MCP_COMMAND = "adhdev-mcp";
@@ -20203,7 +20209,7 @@ function resolveMeshCoordinatorSetup(options) {
20203
20209
  return {
20204
20210
  kind: "auto_import",
20205
20211
  serverName,
20206
- configPath: (0, import_node_path.join)(workspace, path27),
20212
+ configPath: resolveMcpConfigPath(path27, workspace),
20207
20213
  configFormat: mcpConfig.format,
20208
20214
  mcpServer
20209
20215
  };
@@ -20237,6 +20243,13 @@ function resolveMeshCoordinatorSetup(options) {
20237
20243
  function renderMeshCoordinatorTemplate(template, values) {
20238
20244
  return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_, key) => values[key] || "");
20239
20245
  }
20246
+ function resolveMcpConfigPath(configPath, workspace) {
20247
+ const trimmed = configPath.trim();
20248
+ if (trimmed === "~") return os17.homedir();
20249
+ if (trimmed.startsWith("~/")) return (0, import_node_path.join)(os17.homedir(), trimmed.slice(2));
20250
+ if ((0, import_node_path.isAbsolute)(trimmed)) return trimmed;
20251
+ return (0, import_node_path.join)(workspace, trimmed);
20252
+ }
20240
20253
  function resolveAdhdevMcpServerLaunch(options) {
20241
20254
  const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath);
20242
20255
  if (!entryPath) return null;
@@ -20288,7 +20301,7 @@ function normalizeExistingPath(filePath) {
20288
20301
  }
20289
20302
 
20290
20303
  // src/status/snapshot.ts
20291
- var os17 = __toESM(require("os"));
20304
+ var os18 = __toESM(require("os"));
20292
20305
  init_config();
20293
20306
  init_terminal_screen();
20294
20307
  init_logger();
@@ -20344,8 +20357,8 @@ function buildAvailableProviders(providerLoader) {
20344
20357
  }
20345
20358
  function buildMachineInfo(profile = "full") {
20346
20359
  const base = {
20347
- hostname: os17.hostname(),
20348
- platform: os17.platform()
20360
+ hostname: os18.hostname(),
20361
+ platform: os18.platform()
20349
20362
  };
20350
20363
  if (profile === "live") {
20351
20364
  return base;
@@ -20354,23 +20367,23 @@ function buildMachineInfo(profile = "full") {
20354
20367
  const memSnap2 = getHostMemorySnapshot();
20355
20368
  return {
20356
20369
  ...base,
20357
- arch: os17.arch(),
20358
- cpus: os17.cpus().length,
20370
+ arch: os18.arch(),
20371
+ cpus: os18.cpus().length,
20359
20372
  totalMem: memSnap2.totalMem,
20360
- release: os17.release()
20373
+ release: os18.release()
20361
20374
  };
20362
20375
  }
20363
20376
  const memSnap = getHostMemorySnapshot();
20364
20377
  return {
20365
20378
  ...base,
20366
- arch: os17.arch(),
20367
- cpus: os17.cpus().length,
20379
+ arch: os18.arch(),
20380
+ cpus: os18.cpus().length,
20368
20381
  totalMem: memSnap.totalMem,
20369
20382
  freeMem: memSnap.freeMem,
20370
20383
  availableMem: memSnap.availableMem,
20371
- loadavg: os17.loadavg(),
20372
- uptime: os17.uptime(),
20373
- release: os17.release()
20384
+ loadavg: os18.loadavg(),
20385
+ uptime: os18.uptime(),
20386
+ release: os18.release()
20374
20387
  };
20375
20388
  }
20376
20389
  function parseMessageTime(value) {
@@ -20604,11 +20617,11 @@ function buildStatusSnapshot(options) {
20604
20617
  var import_child_process8 = require("child_process");
20605
20618
  var import_child_process9 = require("child_process");
20606
20619
  var fs9 = __toESM(require("fs"));
20607
- var os18 = __toESM(require("os"));
20620
+ var os19 = __toESM(require("os"));
20608
20621
  var path21 = __toESM(require("path"));
20609
20622
  var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
20610
20623
  function getUpgradeLogPath() {
20611
- const home = os18.homedir();
20624
+ const home = os19.homedir();
20612
20625
  const dir = path21.join(home, ".adhdev");
20613
20626
  fs9.mkdirSync(dir, { recursive: true });
20614
20627
  return path21.join(dir, "daemon-upgrade.log");
@@ -20800,7 +20813,7 @@ async function waitForPidExit(pid, timeoutMs) {
20800
20813
  }
20801
20814
  }
20802
20815
  function stopSessionHostProcesses(appName) {
20803
- const pidFile = path21.join(os18.homedir(), ".adhdev", `${appName}-session-host.pid`);
20816
+ const pidFile = path21.join(os19.homedir(), ".adhdev", `${appName}-session-host.pid`);
20804
20817
  try {
20805
20818
  if (fs9.existsSync(pidFile)) {
20806
20819
  const pid = Number.parseInt(fs9.readFileSync(pidFile, "utf8").trim(), 10);
@@ -20817,7 +20830,7 @@ function stopSessionHostProcesses(appName) {
20817
20830
  }
20818
20831
  }
20819
20832
  function removeDaemonPidFile() {
20820
- const pidFile = path21.join(os18.homedir(), ".adhdev", "daemon.pid");
20833
+ const pidFile = path21.join(os19.homedir(), ".adhdev", "daemon.pid");
20821
20834
  try {
20822
20835
  fs9.unlinkSync(pidFile);
20823
20836
  } catch {
@@ -20955,6 +20968,22 @@ function normalizeReleaseChannel(value) {
20955
20968
  function resolveUpgradeChannel(args) {
20956
20969
  return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
20957
20970
  }
20971
+ function loadYamlModule() {
20972
+ return yaml;
20973
+ }
20974
+ function getMcpServersKey(format) {
20975
+ return format === "hermes_config_yaml" ? "mcp_servers" : "mcpServers";
20976
+ }
20977
+ function parseMeshCoordinatorMcpConfig(text, format) {
20978
+ if (!text.trim()) return {};
20979
+ if (format === "claude_mcp_json") return JSON.parse(text);
20980
+ const parsed = loadYamlModule().load(text);
20981
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
20982
+ }
20983
+ function serializeMeshCoordinatorMcpConfig(config, format) {
20984
+ if (format === "claude_mcp_json") return JSON.stringify(config, null, 2);
20985
+ return loadYamlModule().dump(config, { noRefs: true, lineWidth: 120 });
20986
+ }
20958
20987
  var CHAT_COMMANDS = [
20959
20988
  "send_chat",
20960
20989
  "new_chat",
@@ -21932,7 +21961,8 @@ var DaemonCommandRouter = class {
21932
21961
  meshCoordinatorSetup: coordinatorSetup
21933
21962
  };
21934
21963
  }
21935
- if (coordinatorSetup.configFormat !== "claude_mcp_json") {
21964
+ const configFormat = coordinatorSetup.configFormat;
21965
+ if (configFormat !== "claude_mcp_json" && configFormat !== "hermes_config_yaml") {
21936
21966
  return {
21937
21967
  success: false,
21938
21968
  code: "mesh_coordinator_unsupported",
@@ -21957,15 +21987,23 @@ var DaemonCommandRouter = class {
21957
21987
  workspace
21958
21988
  };
21959
21989
  }
21960
- const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync12, copyFileSync: copyFileSync3 } = await import("fs");
21990
+ const { existsSync: existsSync23, readFileSync: readFileSync15, writeFileSync: writeFileSync12, copyFileSync: copyFileSync3, mkdirSync: mkdirSync14 } = await import("fs");
21991
+ const { dirname: dirname9 } = await import("path");
21961
21992
  const mcpConfigPath = coordinatorSetup.configPath;
21993
+ mkdirSync14(dirname9(mcpConfigPath), { recursive: true });
21962
21994
  const hadExistingMcpConfig = existsSync23(mcpConfigPath);
21963
21995
  let existingMcpConfig = {};
21964
21996
  if (hadExistingMcpConfig) {
21965
21997
  try {
21966
- existingMcpConfig = JSON.parse(readFileSync15(mcpConfigPath, "utf-8"));
21998
+ existingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync15(mcpConfigPath, "utf-8"), configFormat);
21967
21999
  copyFileSync3(mcpConfigPath, mcpConfigPath + ".backup");
21968
- } catch {
22000
+ } catch (error) {
22001
+ LOG.error("MeshCoordinator", `Failed to parse existing MCP config ${mcpConfigPath}: ${error?.message || error}`);
22002
+ return {
22003
+ success: false,
22004
+ code: "mesh_coordinator_config_parse_failed",
22005
+ error: `Failed to parse existing MCP config at ${mcpConfigPath}`
22006
+ };
21969
22007
  }
21970
22008
  }
21971
22009
  const mcpServerEntry = {
@@ -21978,18 +22016,25 @@ var DaemonCommandRouter = class {
21978
22016
  ADHDEV_MCP_TRANSPORT: "ipc"
21979
22017
  };
21980
22018
  }
22019
+ const mcpServersKey = getMcpServersKey(configFormat);
22020
+ const existingServers = existingMcpConfig[mcpServersKey];
21981
22021
  const mcpConfig = {
21982
22022
  ...existingMcpConfig,
21983
- mcpServers: {
21984
- ...existingMcpConfig.mcpServers || {},
22023
+ [mcpServersKey]: {
22024
+ ...existingServers && typeof existingServers === "object" && !Array.isArray(existingServers) ? existingServers : {},
21985
22025
  [coordinatorSetup.serverName]: mcpServerEntry
21986
22026
  }
21987
22027
  };
21988
- writeFileSync12(mcpConfigPath, JSON.stringify(mcpConfig, null, 2), "utf-8");
22028
+ writeFileSync12(mcpConfigPath, serializeMeshCoordinatorMcpConfig(mcpConfig, configFormat), "utf-8");
21989
22029
  LOG.info("MeshCoordinator", `Wrote ${mcpConfigPath} with ${coordinatorSetup.serverName} server`);
21990
22030
  const cliArgs = [];
22031
+ const launchEnv = {};
21991
22032
  if (systemPrompt) {
21992
- cliArgs.push("--append-system-prompt", systemPrompt);
22033
+ if (configFormat === "hermes_config_yaml") {
22034
+ launchEnv.HERMES_EPHEMERAL_SYSTEM_PROMPT = systemPrompt;
22035
+ } else {
22036
+ cliArgs.push("--append-system-prompt", systemPrompt);
22037
+ }
21993
22038
  }
21994
22039
  if (cliType === "claude-cli") {
21995
22040
  cliArgs.push("--mcp-config", coordinatorSetup.configPath);
@@ -21998,6 +22043,7 @@ var DaemonCommandRouter = class {
21998
22043
  cliType,
21999
22044
  dir: workspace,
22000
22045
  cliArgs: cliArgs.length > 0 ? cliArgs : void 0,
22046
+ env: Object.keys(launchEnv).length > 0 ? launchEnv : void 0,
22001
22047
  settings: {
22002
22048
  meshCoordinatorFor: meshId
22003
22049
  }
@@ -23659,10 +23705,10 @@ var ProviderInstanceManager = class {
23659
23705
  // src/providers/version-archive.ts
23660
23706
  var fs11 = __toESM(require("fs"));
23661
23707
  var path22 = __toESM(require("path"));
23662
- var os19 = __toESM(require("os"));
23708
+ var os20 = __toESM(require("os"));
23663
23709
  var import_child_process10 = require("child_process");
23664
23710
  var import_os3 = require("os");
23665
- var ARCHIVE_PATH = path22.join(os19.homedir(), ".adhdev", "version-history.json");
23711
+ var ARCHIVE_PATH = path22.join(os20.homedir(), ".adhdev", "version-history.json");
23666
23712
  var MAX_ENTRIES_PER_PROVIDER = 20;
23667
23713
  var VersionArchive = class {
23668
23714
  history = {};
@@ -23765,7 +23811,7 @@ function getVersion(binary, versionCommand) {
23765
23811
  function checkPathExists2(paths) {
23766
23812
  for (const p of paths) {
23767
23813
  if (p.includes("*")) {
23768
- const home = os19.homedir();
23814
+ const home = os20.homedir();
23769
23815
  const resolved = p.replace(/\*/g, home.split(path22.sep).pop() || "");
23770
23816
  if (fs11.existsSync(resolved)) return resolved;
23771
23817
  } else {
@@ -26154,7 +26200,7 @@ async function handleCliRaw(ctx, req, res) {
26154
26200
  // src/daemon/dev-auto-implement.ts
26155
26201
  var fs14 = __toESM(require("fs"));
26156
26202
  var path25 = __toESM(require("path"));
26157
- var os20 = __toESM(require("os"));
26203
+ var os21 = __toESM(require("os"));
26158
26204
  function getAutoImplPid(ctx) {
26159
26205
  const pid = ctx.autoImplProcess?.pid;
26160
26206
  return typeof pid === "number" && pid > 0 ? pid : null;
@@ -26355,7 +26401,7 @@ async function handleAutoImplement(ctx, type, req, res) {
26355
26401
  });
26356
26402
  const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
26357
26403
  const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
26358
- const tmpDir = path25.join(os20.tmpdir(), "adhdev-autoimpl");
26404
+ const tmpDir = path25.join(os21.tmpdir(), "adhdev-autoimpl");
26359
26405
  if (!fs14.existsSync(tmpDir)) fs14.mkdirSync(tmpDir, { recursive: true });
26360
26406
  const promptFile = path25.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
26361
26407
  fs14.writeFileSync(promptFile, prompt, "utf-8");
@@ -26510,7 +26556,7 @@ async function handleAutoImplement(ctx, type, req, res) {
26510
26556
  const interactiveFlags = ["--yolo", "--interactive", "-i"];
26511
26557
  const baseArgs = [...spawn4.args || []].filter((a) => !interactiveFlags.includes(a));
26512
26558
  let shellCmd;
26513
- const isWin = os20.platform() === "win32";
26559
+ const isWin = os21.platform() === "win32";
26514
26560
  const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
26515
26561
  const promptMode = autoImpl?.promptMode ?? "stdin";
26516
26562
  const extraArgs = autoImpl?.extraArgs ?? [];
@@ -26549,7 +26595,7 @@ async function handleAutoImplement(ctx, type, req, res) {
26549
26595
  try {
26550
26596
  const pty = require("node-pty");
26551
26597
  ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
26552
- const isWin2 = os20.platform() === "win32";
26598
+ const isWin2 = os21.platform() === "win32";
26553
26599
  child = pty.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
26554
26600
  name: "xterm-256color",
26555
26601
  cols: 120,