adhdev 0.8.86 → 0.8.88

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/cli/index.js CHANGED
@@ -6367,6 +6367,25 @@ var init_setup = __esm({
6367
6367
  }
6368
6368
  });
6369
6369
 
6370
+ // ../../oss/packages/daemon-core/src/runtime-defaults.ts
6371
+ var 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;
6372
+ var init_runtime_defaults = __esm({
6373
+ "../../oss/packages/daemon-core/src/runtime-defaults.ts"() {
6374
+ "use strict";
6375
+ DEFAULT_CDP_SCAN_INTERVAL_MS = 3e4;
6376
+ DEFAULT_CDP_DISCOVERY_INTERVAL_MS = 3e4;
6377
+ DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS = 2e3;
6378
+ DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS = 3e4;
6379
+ DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS = 5e3;
6380
+ MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS = 5e3;
6381
+ DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS = 15e3;
6382
+ MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 5e3;
6383
+ DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS = 1e4;
6384
+ DEFAULT_SESSION_HOST_READY_TIMEOUT_MS = 15e3;
6385
+ STANDALONE_CDP_SCAN_INTERVAL_MS = 15e3;
6386
+ }
6387
+ });
6388
+
6370
6389
  // ../../oss/packages/daemon-core/src/cdp/scanner.ts
6371
6390
  var DaemonCdpScanner;
6372
6391
  var init_scanner = __esm({
@@ -6375,6 +6394,7 @@ var init_scanner = __esm({
6375
6394
  init_manager();
6376
6395
  init_setup();
6377
6396
  init_logger();
6397
+ init_runtime_defaults();
6378
6398
  DaemonCdpScanner = class {
6379
6399
  ctx;
6380
6400
  opts;
@@ -6408,7 +6428,7 @@ var init_scanner = __esm({
6408
6428
  */
6409
6429
  startPeriodicScan() {
6410
6430
  if (this.scanTimer) return;
6411
- const interval = this.opts.scanIntervalMs || 3e4;
6431
+ const interval = this.opts.scanIntervalMs || DEFAULT_CDP_SCAN_INTERVAL_MS;
6412
6432
  this.scanTimer = setInterval(async () => {
6413
6433
  const portMap = this.ctx.providerLoader.getCdpPortMap();
6414
6434
  for (const [ide, ports] of Object.entries(portMap)) {
@@ -6428,7 +6448,7 @@ var init_scanner = __esm({
6428
6448
  /**
6429
6449
  * Start periodic agent webview discovery on all connected CDPs.
6430
6450
  */
6431
- startWebviewDiscovery(intervalMs = 3e4) {
6451
+ startWebviewDiscovery(intervalMs = DEFAULT_CDP_DISCOVERY_INTERVAL_MS) {
6432
6452
  if (this.discoveryTimer) return;
6433
6453
  this.discoveryTimer = setInterval(async () => {
6434
6454
  for (const m of this.ctx.cdpManagers.values()) {
@@ -6528,6 +6548,7 @@ var init_initializer = __esm({
6528
6548
  init_setup();
6529
6549
  init_setup();
6530
6550
  init_logger();
6551
+ init_runtime_defaults();
6531
6552
  DaemonCdpInitializer = class {
6532
6553
  config;
6533
6554
  scanTimer = null;
@@ -6659,7 +6680,7 @@ var init_initializer = __esm({
6659
6680
  * Start periodic scanning for newly opened IDEs.
6660
6681
  * Idempotent — ignored if already started.
6661
6682
  */
6662
- startPeriodicScan(intervalMs = 3e4) {
6683
+ startPeriodicScan(intervalMs = DEFAULT_CDP_SCAN_INTERVAL_MS) {
6663
6684
  if (this.scanTimer) return;
6664
6685
  this.scanTimer = setInterval(async () => {
6665
6686
  const { providerLoader, cdpManagers } = this.config;
@@ -6673,7 +6694,7 @@ var init_initializer = __esm({
6673
6694
  /**
6674
6695
  * Start periodic agent webview discovery.
6675
6696
  */
6676
- startDiscovery(intervalMs = 3e4) {
6697
+ startDiscovery(intervalMs = DEFAULT_CDP_DISCOVERY_INTERVAL_MS) {
6677
6698
  if (this.discoveryTimer) return;
6678
6699
  this.discoveryTimer = setInterval(async () => {
6679
6700
  for (const m of this.config.cdpManagers.values()) {
@@ -13391,8 +13412,25 @@ var init_provider_cli_adapter = __esm({
13391
13412
  index: typeof message.index === "number" ? message.index : index,
13392
13413
  receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
13393
13414
  }));
13394
- const shouldPreferCommittedHistoryReplay = !this.currentTurnScope && !this.activeModal && committedHydratedMessages.length > parsedHydratedMessages.length;
13395
- const hydratedMessages = shouldPreferCommittedMessages || shouldPreferCommittedHistoryReplay ? committedHydratedMessages : parsedHydratedMessages;
13415
+ const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
13416
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && this.currentStatus === "idle" && parsedHydratedMessages.length > committedHydratedMessages.length && !!parsedLastAssistant;
13417
+ if (shouldAdoptParsedIdleReplay) {
13418
+ this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
13419
+ committedMessages: this.committedMessages,
13420
+ scope: this.currentTurnScope,
13421
+ lastOutputAt: this.lastOutputAt
13422
+ });
13423
+ this.syncMessageViews();
13424
+ }
13425
+ const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
13426
+ ...message,
13427
+ id: message.id || `msg_${index}`,
13428
+ index: typeof message.index === "number" ? message.index : index,
13429
+ receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
13430
+ })) : committedHydratedMessages;
13431
+ const shouldPreferCommittedHistoryReplay = !this.currentTurnScope && !this.activeModal && effectiveCommittedHydratedMessages.length > parsedHydratedMessages.length;
13432
+ const shouldPreferCommittedIdleReplay = shouldPreferCommittedMessages && !shouldAdoptParsedIdleReplay;
13433
+ const hydratedMessages = shouldPreferCommittedIdleReplay || shouldPreferCommittedHistoryReplay ? effectiveCommittedHydratedMessages : parsedHydratedMessages;
13396
13434
  result = {
13397
13435
  id: parsed.id || "cli_session",
13398
13436
  status: parsed.status || this.currentStatus,
@@ -38134,6 +38172,7 @@ var init_reporter = __esm({
38134
38172
  "../../oss/packages/daemon-core/src/status/reporter.ts"() {
38135
38173
  "use strict";
38136
38174
  init_logger();
38175
+ init_runtime_defaults();
38137
38176
  init_builders();
38138
38177
  init_snapshot();
38139
38178
  DaemonStatusReporter = class {
@@ -38154,19 +38193,19 @@ var init_reporter = __esm({
38154
38193
  startReporting() {
38155
38194
  setTimeout(() => {
38156
38195
  this.sendUnifiedStatusReport({ forceServer: true, reason: "initial" }).catch((e) => LOG.warn("Status", `Initial report failed: ${e?.message}`));
38157
- }, 2e3);
38196
+ }, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS);
38158
38197
  const scheduleServerReport = () => {
38159
38198
  this.statusTimer = setTimeout(() => {
38160
38199
  this.sendUnifiedStatusReport({ forceServer: true, reason: "periodic" }).catch((e) => LOG.warn("Status", `Periodic report failed: ${e?.message}`));
38161
38200
  scheduleServerReport();
38162
- }, 3e4);
38201
+ }, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS);
38163
38202
  };
38164
38203
  scheduleServerReport();
38165
38204
  this.p2pTimer = setInterval(() => {
38166
38205
  if (this.deps.p2p?.isConnected) {
38167
38206
  this.sendUnifiedStatusReport({ p2pOnly: true }).catch((e) => LOG.warn("Status", `P2P status send failed: ${e?.message}`));
38168
38207
  }
38169
- }, 5e3);
38208
+ }, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS);
38170
38209
  }
38171
38210
  stopReporting() {
38172
38211
  if (this.statusTimer) {
@@ -38184,14 +38223,14 @@ var init_reporter = __esm({
38184
38223
  throttledReport() {
38185
38224
  const now = Date.now();
38186
38225
  const elapsed = now - this.lastStatusSentAt;
38187
- if (elapsed >= 5e3) {
38226
+ if (elapsed >= DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS) {
38188
38227
  this.sendUnifiedStatusReport().catch((e) => LOG.warn("Status", `Throttled report failed: ${e?.message}`));
38189
38228
  } else if (!this.statusPendingThrottle) {
38190
38229
  this.statusPendingThrottle = true;
38191
38230
  setTimeout(() => {
38192
38231
  this.statusPendingThrottle = false;
38193
38232
  this.sendUnifiedStatusReport().catch((e) => LOG.warn("Status", `Deferred report failed: ${e?.message}`));
38194
- }, 5e3 - elapsed);
38233
+ }, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS - elapsed);
38195
38234
  }
38196
38235
  }
38197
38236
  toDaemonStatusEventName(value) {
@@ -45617,7 +45656,8 @@ var init_runtime_support = __esm({
45617
45656
  "../../oss/packages/daemon-core/src/session-host/runtime-support.ts"() {
45618
45657
  "use strict";
45619
45658
  init_dist();
45620
- STARTUP_TIMEOUT_MS = 8e3;
45659
+ init_runtime_defaults();
45660
+ STARTUP_TIMEOUT_MS = DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
45621
45661
  STARTUP_POLL_MS = 200;
45622
45662
  }
45623
45663
  });
@@ -45997,8 +46037,8 @@ async function initDaemonComponents(config2) {
45997
46037
  }
45998
46038
  });
45999
46039
  await cdpInitializer.connectAll(detectedIdesRef.value);
46000
- cdpInitializer.startPeriodicScan(config2.cdpScanIntervalMs ?? 3e4);
46001
- cdpInitializer.startDiscovery(3e4);
46040
+ cdpInitializer.startPeriodicScan(config2.cdpScanIntervalMs ?? DEFAULT_CDP_SCAN_INTERVAL_MS);
46041
+ cdpInitializer.startDiscovery(DEFAULT_CDP_DISCOVERY_INTERVAL_MS);
46002
46042
  const commandHandler = new DaemonCommandHandler({
46003
46043
  cdpManagers,
46004
46044
  ideType: "unknown",
@@ -46137,6 +46177,7 @@ var init_daemon_lifecycle = __esm({
46137
46177
  init_cli_detector();
46138
46178
  init_registry();
46139
46179
  init_logger();
46180
+ init_runtime_defaults();
46140
46181
  init_config();
46141
46182
  }
46142
46183
  });
@@ -46151,10 +46192,19 @@ __export(src_exports, {
46151
46192
  CliProviderInstance: () => CliProviderInstance,
46152
46193
  DAEMON_WS_PATH: () => DAEMON_WS_PATH,
46153
46194
  DEFAULT_ACTIVE_CHAT_POLL_STATUSES: () => DEFAULT_ACTIVE_CHAT_POLL_STATUSES,
46195
+ DEFAULT_CDP_DISCOVERY_INTERVAL_MS: () => DEFAULT_CDP_DISCOVERY_INTERVAL_MS,
46196
+ DEFAULT_CDP_SCAN_INTERVAL_MS: () => DEFAULT_CDP_SCAN_INTERVAL_MS,
46154
46197
  DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS: () => DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS,
46155
46198
  DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
46199
+ DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
46156
46200
  DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
46201
+ DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
46202
+ DEFAULT_SESSION_HOST_READY_TIMEOUT_MS: () => DEFAULT_SESSION_HOST_READY_TIMEOUT_MS,
46157
46203
  DEFAULT_STANDALONE_SESSION_HOST_APP_NAME: () => DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
46204
+ DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS: () => DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
46205
+ DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
46206
+ DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
46207
+ DEV_SERVER_PORT: () => DEV_SERVER_PORT,
46158
46208
  DaemonAgentStreamManager: () => DaemonAgentStreamManager,
46159
46209
  DaemonCdpInitializer: () => DaemonCdpInitializer,
46160
46210
  DaemonCdpManager: () => DaemonCdpManager,
@@ -46166,10 +46216,13 @@ __export(src_exports, {
46166
46216
  DevServer: () => DevServer,
46167
46217
  IdeProviderInstance: () => IdeProviderInstance,
46168
46218
  LOG: () => LOG,
46219
+ MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
46220
+ MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
46169
46221
  NodePtyTransportFactory: () => NodePtyTransportFactory,
46170
46222
  ProviderCliAdapter: () => ProviderCliAdapter,
46171
46223
  ProviderInstanceManager: () => ProviderInstanceManager,
46172
46224
  ProviderLoader: () => ProviderLoader,
46225
+ STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS,
46173
46226
  SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
46174
46227
  VersionArchive: () => VersionArchive,
46175
46228
  appendRecentActivity: () => appendRecentActivity,
@@ -46308,6 +46361,7 @@ var init_src = __esm({
46308
46361
  init_cli_manager();
46309
46362
  init_launch();
46310
46363
  init_ipc_protocol();
46364
+ init_runtime_defaults();
46311
46365
  init_chat_history();
46312
46366
  init_chat_signatures();
46313
46367
  init_subscription_updates();
@@ -46350,7 +46404,7 @@ function resolveDaemonCommandPort(port, env3 = process.env) {
46350
46404
  return explicitPort;
46351
46405
  }
46352
46406
  const envPort = parseInt(env3.ADHDEV_DAEMON_PORT || "", 10);
46353
- return Number.isFinite(envPort) && envPort > 0 ? envPort : 19222;
46407
+ return Number.isFinite(envPort) && envPort > 0 ? envPort : DEFAULT_DAEMON_PORT;
46354
46408
  }
46355
46409
  async function sendDaemonCommand(cmd, args = {}, port) {
46356
46410
  const resolvedPort = resolveDaemonCommandPort(port);
@@ -46474,6 +46528,7 @@ async function directCdpEval(expression, port = 9222) {
46474
46528
  var init_cdp_utils = __esm({
46475
46529
  "src/cli/cdp-utils.ts"() {
46476
46530
  "use strict";
46531
+ init_src();
46477
46532
  }
46478
46533
  });
46479
46534
 
@@ -77797,6 +77852,10 @@ var init_server_connection = __esm({
77797
77852
  }
77798
77853
  }
77799
77854
  scheduleReconnect() {
77855
+ if (this.reconnectTimer) {
77856
+ clearTimeout(this.reconnectTimer);
77857
+ this.reconnectTimer = null;
77858
+ }
77800
77859
  const delay = Math.min(2e3 * Math.pow(1.5, this.reconnectAttempts), 6e4);
77801
77860
  this.reconnectAttempts++;
77802
77861
  LOG.info("Server", `[ServerConn] Reconnecting in ${(delay / 1e3).toFixed(1)}s (attempt ${this.reconnectAttempts})...`);
@@ -77824,6 +77883,8 @@ var init_server_connection = __esm({
77824
77883
  if (misses >= 3 && this.ws) {
77825
77884
  LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 closing stale WS`);
77826
77885
  this.ws.terminate();
77886
+ } else if (misses === 1) {
77887
+ LOG.info("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
77827
77888
  } else {
77828
77889
  LOG.warn("Server", `[ServerConn] Pong timeout (${misses}x) \u2014 keeping WS open and retrying`);
77829
77890
  }
@@ -78442,9 +78503,44 @@ async function initiateConnection(deps, peerId, sharePermission) {
78442
78503
  clearTimeout(peer.failedCleanupTimer);
78443
78504
  peer.failedCleanupTimer = void 0;
78444
78505
  }
78506
+ if (peer.disconnectTimer) {
78507
+ clearTimeout(peer.disconnectTimer);
78508
+ peer.disconnectTimer = void 0;
78509
+ }
78445
78510
  deps.notifyStateChange();
78511
+ } else if (pcState === "disconnected") {
78512
+ log(`Peer ${pid} ICE disconnected \u2014 waiting 3s for recovery`);
78513
+ if (peer.disconnectTimer) clearTimeout(peer.disconnectTimer);
78514
+ peer.disconnectTimer = setTimeout(() => {
78515
+ const p = deps.peers.get(pid);
78516
+ if (!p) return;
78517
+ p.disconnectTimer = void 0;
78518
+ let currentState;
78519
+ try {
78520
+ currentState = pc.state?.();
78521
+ } catch {
78522
+ }
78523
+ if (currentState !== "connected") {
78524
+ log(`Peer ${pid} ICE recovery timeout (state=${currentState ?? "unknown"}) \u2014 marking failed`);
78525
+ p.state = "failed";
78526
+ deps.notifyStateChange();
78527
+ if (!p.failedCleanupTimer) {
78528
+ p.failedCleanupTimer = setTimeout(() => {
78529
+ const pp = deps.peers.get(pid);
78530
+ if (pp?.state === "failed") {
78531
+ log(`Auto-cleanup stale failed peer ${pid}`);
78532
+ disconnectPeer(deps.peers, pid, deps.notifyStateChange);
78533
+ }
78534
+ }, 3e4);
78535
+ }
78536
+ }
78537
+ }, 3e3);
78446
78538
  } else if (pcState === "failed" || pcState === "closed") {
78447
78539
  peer.state = "failed";
78540
+ if (peer.disconnectTimer) {
78541
+ clearTimeout(peer.disconnectTimer);
78542
+ peer.disconnectTimer = void 0;
78543
+ }
78448
78544
  deps.notifyStateChange();
78449
78545
  if (!peer.failedCleanupTimer) {
78450
78546
  peer.failedCleanupTimer = setTimeout(() => {
@@ -78602,6 +78698,7 @@ function disconnectPeer(peers, peerId, notifyStateChange) {
78602
78698
  if (peer.failedCleanupTimer) clearTimeout(peer.failedCleanupTimer);
78603
78699
  if (peer.heartbeatTimer) clearInterval(peer.heartbeatTimer);
78604
78700
  if (peer.connectionTimeout) clearTimeout(peer.connectionTimeout);
78701
+ if (peer.disconnectTimer) clearTimeout(peer.disconnectTimer);
78605
78702
  if (peer.dataChannel) try {
78606
78703
  peer.dataChannel.close();
78607
78704
  } catch {
@@ -86056,8 +86153,9 @@ var init_session_host = __esm({
86056
86153
  init_src();
86057
86154
  init_dist();
86058
86155
  init_session_host_hygiene();
86156
+ init_runtime_defaults();
86059
86157
  SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || DEFAULT_SESSION_HOST_APP_NAME;
86060
- SESSION_HOST_START_TIMEOUT_MS = 15e3;
86158
+ SESSION_HOST_START_TIMEOUT_MS = DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
86061
86159
  }
86062
86160
  });
86063
86161
 
@@ -86379,7 +86477,8 @@ var init_adhdev_daemon = __esm({
86379
86477
  init_source();
86380
86478
  init_version();
86381
86479
  init_src();
86382
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.86" });
86480
+ init_runtime_defaults();
86481
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.88" });
86383
86482
  AdhdevDaemon = class _AdhdevDaemon {
86384
86483
  localHttpServer = null;
86385
86484
  localWss = null;
@@ -86411,7 +86510,7 @@ var init_adhdev_daemon = __esm({
86411
86510
  "session_host_restart_session"
86412
86511
  ]);
86413
86512
  constructor() {
86414
- this.localPort = 19222;
86513
+ this.localPort = DEFAULT_DAEMON_PORT;
86415
86514
  }
86416
86515
  applyDebugRuntime(options) {
86417
86516
  this.debugConfig = resolveDebugRuntimeConfig({
@@ -86602,7 +86701,10 @@ var init_adhdev_daemon = __esm({
86602
86701
  }
86603
86702
  }
86604
86703
  buildMachineRuntimeUpdateForSubscription(subscription) {
86605
- const intervalMs = Math.max(5e3, Number(subscription.params.intervalMs || 15e3));
86704
+ const intervalMs = Math.max(
86705
+ MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
86706
+ Number(subscription.params.intervalMs || DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS)
86707
+ );
86606
86708
  const now = Date.now();
86607
86709
  if (subscription.lastSentAt > 0 && now - subscription.lastSentAt < intervalMs) {
86608
86710
  return null;
@@ -86623,7 +86725,10 @@ var init_adhdev_daemon = __esm({
86623
86725
  }
86624
86726
  async buildSessionHostDiagnosticsUpdateForSubscription(subscription) {
86625
86727
  if (!this.sessionHostController) return null;
86626
- const intervalMs = Math.max(5e3, Number(subscription.params.intervalMs || 1e4));
86728
+ const intervalMs = Math.max(
86729
+ MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
86730
+ Number(subscription.params.intervalMs || DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS)
86731
+ );
86627
86732
  const now = Date.now();
86628
86733
  if (subscription.lastSentAt > 0 && now - subscription.lastSentAt < intervalMs) {
86629
86734
  return null;
@@ -87694,7 +87799,7 @@ async function startDaemonFlow() {
87694
87799
  });
87695
87800
  }
87696
87801
  } catch {
87697
- daemon.start({ localPort: 19222, foreground: false }).catch(() => {
87802
+ daemon.start({ localPort: DEFAULT_DAEMON_PORT, foreground: false }).catch(() => {
87698
87803
  });
87699
87804
  }
87700
87805
  let started = false;
@@ -88841,6 +88946,7 @@ init_src();
88841
88946
 
88842
88947
  // src/cli/setup-commands.ts
88843
88948
  init_source();
88949
+ init_src();
88844
88950
 
88845
88951
  // src/cli/provider-source-status.ts
88846
88952
  function buildProviderSourceStatusLines(config2) {
@@ -88855,6 +88961,7 @@ function buildProviderSourceStatusLines(config2) {
88855
88961
 
88856
88962
  // src/cli/setup-commands.ts
88857
88963
  init_cdp_utils();
88964
+ var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS = 1500;
88858
88965
  function resolveLaunchableProviderTarget(providerLoader, targetArg) {
88859
88966
  if (!targetArg) return null;
88860
88967
  const resolvedType = providerLoader.resolveAlias(targetArg.toLowerCase());
@@ -89091,7 +89198,7 @@ function registerSetupCommands(program2, providerLoader) {
89091
89198
  if (!isDaemonRunning2({ port: daemonPort })) {
89092
89199
  spinner2.stop();
89093
89200
  console.log(source_default.yellow(`
89094
- \u26A0 Daemon not running on port ${daemonPort}. Start with 'adhdev daemon${daemonPort === 19222 ? "" : ` -p ${daemonPort}`}' first.
89201
+ \u26A0 Daemon not running on port ${daemonPort}. Start with 'adhdev daemon${daemonPort === DEFAULT_DAEMON_PORT ? "" : ` -p ${daemonPort}`}' first.
89095
89202
  `));
89096
89203
  console.log(source_default.gray(" Then run: adhdev launch " + targetArg));
89097
89204
  process.exit(1);
@@ -89227,7 +89334,7 @@ function registerSetupCommands(program2, providerLoader) {
89227
89334
  const daemonPort = resolveDaemonCommandPort();
89228
89335
  if (!isDaemonRunning2({ port: daemonPort })) {
89229
89336
  console.log(source_default.yellow(`
89230
- \u26A0 Daemon not running on port ${daemonPort}. Start with 'adhdev daemon${daemonPort === 19222 ? "" : ` -p ${daemonPort}`}' first.
89337
+ \u26A0 Daemon not running on port ${daemonPort}. Start with 'adhdev daemon${daemonPort === DEFAULT_DAEMON_PORT ? "" : ` -p ${daemonPort}`}' first.
89231
89338
  `));
89232
89339
  console.log(source_default.gray(` Then run: adhdev history list ${providerArg}`));
89233
89340
  process.exit(1);
@@ -89299,7 +89406,7 @@ function registerSetupCommands(program2, providerLoader) {
89299
89406
  const daemonPort = resolveDaemonCommandPort();
89300
89407
  if (!isDaemonRunning2({ port: daemonPort })) {
89301
89408
  console.log(source_default.yellow(`
89302
- \u26A0 Daemon not running on port ${daemonPort}. Start with 'adhdev daemon${daemonPort === 19222 ? "" : ` -p ${daemonPort}`}' first.
89409
+ \u26A0 Daemon not running on port ${daemonPort}. Start with 'adhdev daemon${daemonPort === DEFAULT_DAEMON_PORT ? "" : ` -p ${daemonPort}`}' first.
89303
89410
  `));
89304
89411
  console.log(source_default.gray(` Then run: adhdev history resume ${providerArg} ${historySessionId}`));
89305
89412
  process.exit(1);
@@ -89434,8 +89541,8 @@ function registerSetupCommands(program2, providerLoader) {
89434
89541
  if (daemonRunning) {
89435
89542
  try {
89436
89543
  const controller = new AbortController();
89437
- const timer = setTimeout(() => controller.abort(), 1500);
89438
- const res = await fetch("http://127.0.0.1:19222/health", { signal: controller.signal });
89544
+ const timer = setTimeout(() => controller.abort(), DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS);
89545
+ const res = await fetch(`http://127.0.0.1:${DEFAULT_DAEMON_PORT}/health`, { signal: controller.signal });
89439
89546
  clearTimeout(timer);
89440
89547
  if (res.ok) {
89441
89548
  const data = await res.json();
@@ -89611,6 +89718,7 @@ function registerSetupCommands(program2, providerLoader) {
89611
89718
 
89612
89719
  // src/cli/daemon-commands.ts
89613
89720
  init_source();
89721
+ init_src();
89614
89722
 
89615
89723
  // src/cli/runtime-tools.ts
89616
89724
  var fs24 = __toESM(require("fs"));
@@ -89774,6 +89882,11 @@ function formatDebugTraceEntryLine(entry) {
89774
89882
  }
89775
89883
 
89776
89884
  // src/cli/daemon-commands.ts
89885
+ var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS2 = 1500;
89886
+ var DEFAULT_TRACE_FOLLOW_INTERVAL_MS = 1500;
89887
+ var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
89888
+ var DEV_SERVER_PORT2 = 19280;
89889
+ var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
89777
89890
  function hideCommand(command) {
89778
89891
  if (typeof command.hideHelp === "function") {
89779
89892
  command.hideHelp();
@@ -89783,7 +89896,7 @@ function hideCommand(command) {
89783
89896
  }
89784
89897
  async function fetchLocalDaemonHealth(port) {
89785
89898
  const controller = new AbortController();
89786
- const timer = setTimeout(() => controller.abort(), 1500);
89899
+ const timer = setTimeout(() => controller.abort(), DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS2);
89787
89900
  try {
89788
89901
  const res = await fetch(`http://127.0.0.1:${port}/health`, { signal: controller.signal });
89789
89902
  if (!res.ok) return null;
@@ -89975,9 +90088,9 @@ async function printRuntimeGroups(records, options) {
89975
90088
  }
89976
90089
  }
89977
90090
  async function handleTraceCommand(options) {
89978
- const port = parseInt(String(options.port ?? "19222"), 10) || 19222;
90091
+ const port = parseInt(String(options.port ?? DEFAULT_DAEMON_PORT_TEXT), 10) || DEFAULT_DAEMON_PORT;
89979
90092
  const count = Math.max(1, Math.min(500, parseInt(String(options.count ?? "40"), 10) || 40));
89980
- const intervalMs = Math.max(250, Math.min(3e4, parseInt(String(options.interval ?? "1500"), 10) || 1500));
90093
+ const intervalMs = Math.max(250, Math.min(3e4, parseInt(String(options.interval ?? String(DEFAULT_TRACE_FOLLOW_INTERVAL_MS)), 10) || DEFAULT_TRACE_FOLLOW_INTERVAL_MS));
89981
90094
  const baseArgs = {
89982
90095
  count,
89983
90096
  category: options.category,
@@ -90081,11 +90194,11 @@ async function handleTraceCommand(options) {
90081
90194
  }
90082
90195
  }
90083
90196
  function registerDaemonCommands(program2, pkgVersion3) {
90084
- program2.command("daemon").description("\u{1F680} Start ADHDev Daemon \u2014 unified hub for IDE monitoring, agent management, and remote control").option("-p, --port <port>", "Local WS server port", "19222").option("--server <url>", "Override server URL for testing").option("--dev", "Enable Dev Mode \u2014 HTTP API on :19280 for script debugging + structured trace collection").option("--log-level <level>", "Console log level (debug|info|warn|error)").option("--trace", "Enable structured debug trace collection").option("--trace-content", "Include richer content snapshots in debug traces").option("--trace-buffer-size <count>", "Structured trace ring buffer size").action(async (options) => {
90197
+ program2.command("daemon").description("\u{1F680} Start ADHDev Daemon \u2014 unified hub for IDE monitoring, agent management, and remote control").option("-p, --port <port>", "Local WS server port", DEFAULT_DAEMON_PORT_TEXT).option("--server <url>", "Override server URL for testing").option("--dev", "Enable Dev Mode \u2014 HTTP API on :19280 for script debugging + structured trace collection").option("--log-level <level>", "Console log level (debug|info|warn|error)").option("--trace", "Enable structured debug trace collection").option("--trace-content", "Include richer content snapshots in debug traces").option("--trace-buffer-size <count>", "Structured trace ring buffer size").action(async (options) => {
90085
90198
  const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
90086
90199
  const daemon = new AdhdevDaemon2();
90087
90200
  await daemon.start({
90088
- localPort: parseInt(options.port) || 19222,
90201
+ localPort: parseInt(options.port) || DEFAULT_DAEMON_PORT,
90089
90202
  serverUrl: options.server,
90090
90203
  foreground: true,
90091
90204
  dev: options.dev || false,
@@ -90095,7 +90208,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
90095
90208
  traceBufferSize: options.traceBufferSize ? parseInt(options.traceBufferSize, 10) || void 0 : void 0
90096
90209
  });
90097
90210
  });
90098
- program2.command("trace").description("Inspect structured daemon trace from the running local daemon (for example: --category session_host)").option("-p, --port <port>", "Local daemon IPC port", "19222").option("--category <category>", "Filter by trace category (for example: session_host)").option("--interaction <id>", "Filter by interaction id").option("--count <count>", "Maximum number of trace entries to fetch", "40").option("--follow", "Keep polling and print new trace entries as they arrive").option("--interval <ms>", "Polling interval for --follow mode", "1500").option("--json", "Print raw trace JSON output").action(async (options) => {
90211
+ program2.command("trace").description("Inspect structured daemon trace from the running local daemon (for example: --category session_host)").option("-p, --port <port>", "Local daemon IPC port", DEFAULT_DAEMON_PORT_TEXT).option("--category <category>", "Filter by trace category (for example: session_host)").option("--interaction <id>", "Filter by interaction id").option("--count <count>", "Maximum number of trace entries to fetch", "40").option("--follow", "Keep polling and print new trace entries as they arrive").option("--interval <ms>", "Polling interval for --follow mode", String(DEFAULT_TRACE_FOLLOW_INTERVAL_MS)).option("--json", "Print raw trace JSON output").action(async (options) => {
90099
90212
  try {
90100
90213
  await handleTraceCommand(options);
90101
90214
  } catch (error48) {
@@ -90175,11 +90288,11 @@ function registerDaemonCommands(program2, pkgVersion3) {
90175
90288
  console.log(source_default.gray(` Set with: adhdev daemon:api ${enabled ? "disable" : "enable"}
90176
90289
  `));
90177
90290
  }));
90178
- hideCommand(program2.command("daemon:status").description("Check ADHDev Daemon status").option("-p, --port <port>", "Local WS server port", "19222").action(async (options) => {
90291
+ hideCommand(program2.command("daemon:status").description("Check ADHDev Daemon status").option("-p, --port <port>", "Local WS server port", DEFAULT_DAEMON_PORT_TEXT).action(async (options) => {
90179
90292
  const { isDaemonRunning: isDaemonRunning2, getDaemonPid: getDaemonPid2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
90180
90293
  const { getCurrentDaemonLogPath: getCurrentDaemonLogPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
90181
90294
  const { probeSessionHostStatus: probeSessionHostStatus2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
90182
- const port = parseInt(options.port, 10) || 19222;
90295
+ const port = parseInt(options.port, 10) || DEFAULT_DAEMON_PORT;
90183
90296
  const { loadConfig: loadConfig2, ProviderLoader: ProviderLoader2 } = await Promise.resolve().then(() => (init_src(), src_exports));
90184
90297
  const config2 = loadConfig2();
90185
90298
  const providerLoader = new ProviderLoader2({
@@ -90252,8 +90365,8 @@ function registerDaemonCommands(program2, pkgVersion3) {
90252
90365
  }
90253
90366
  try {
90254
90367
  const controller = new AbortController();
90255
- const timer = setTimeout(() => controller.abort(), 1500);
90256
- const res = await fetch("http://127.0.0.1:19280/api/status", { signal: controller.signal });
90368
+ const timer = setTimeout(() => controller.abort(), DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS2);
90369
+ const res = await fetch(`${DEV_SERVER_BASE_URL}/api/status`, { signal: controller.signal });
90257
90370
  clearTimeout(timer);
90258
90371
  if (res.ok) {
90259
90372
  const data = await res.json();
@@ -90277,10 +90390,10 @@ function registerDaemonCommands(program2, pkgVersion3) {
90277
90390
  `));
90278
90391
  }
90279
90392
  }));
90280
- hideCommand(program2.command("daemon:session-host").description("Advanced operator diagnostics and control for the raw session-host surface").option("-p, --port <port>", "Local WS server port", "19222").option("--json", "Print raw JSON diagnostics/result").option("--limit <count>", "Number of diagnostics entries to include", "20").option("--session <sessionId>", "Target session ID").option("--restart", "Restart the target session").option("--resume", "Resume the target session").option("--stop", "Stop the target session").option("--signal <signal>", "Send a signal to the target session").option("--detach-client <clientId>", "Force-detach a client from the target session").option("--prune-duplicates", "Stop and remove duplicate hosted runtimes that share the same provider session binding").option("--acquire-write <clientId>", "Force-acquire write ownership for a client").option("--release-write <clientId>", "Release write ownership for a client").option("--owner-type <type>", "ownerType for --acquire-write (user|agent)", "user").action(async (options) => {
90393
+ hideCommand(program2.command("daemon:session-host").description("Advanced operator diagnostics and control for the raw session-host surface").option("-p, --port <port>", "Local WS server port", DEFAULT_DAEMON_PORT_TEXT).option("--json", "Print raw JSON diagnostics/result").option("--limit <count>", "Number of diagnostics entries to include", "20").option("--session <sessionId>", "Target session ID").option("--restart", "Restart the target session").option("--resume", "Resume the target session").option("--stop", "Stop the target session").option("--signal <signal>", "Send a signal to the target session").option("--detach-client <clientId>", "Force-detach a client from the target session").option("--prune-duplicates", "Stop and remove duplicate hosted runtimes that share the same provider session binding").option("--acquire-write <clientId>", "Force-acquire write ownership for a client").option("--release-write <clientId>", "Release write ownership for a client").option("--owner-type <type>", "ownerType for --acquire-write (user|agent)", "user").action(async (options) => {
90281
90394
  const sessionId = typeof options.session === "string" ? options.session.trim() : "";
90282
90395
  const limit = Math.max(1, Math.min(200, parseInt(options.limit, 10) || 20));
90283
- const port = parseInt(options.port, 10) || 19222;
90396
+ const port = parseInt(options.port, 10) || DEFAULT_DAEMON_PORT;
90284
90397
  const requireSessionId = () => {
90285
90398
  if (!sessionId) {
90286
90399
  throw new Error("--session is required for this action");
@@ -90599,9 +90712,9 @@ function registerDaemonCommands(program2, pkgVersion3) {
90599
90712
  process.exit(1);
90600
90713
  }
90601
90714
  });
90602
- hideCommand(program2.command("daemon:stop").description("Stop ADHDev Daemon").option("-p, --port <port>", "Local WS server port", "19222").action(async (options) => {
90715
+ hideCommand(program2.command("daemon:stop").description("Stop ADHDev Daemon").option("-p, --port <port>", "Local WS server port", DEFAULT_DAEMON_PORT_TEXT).action(async (options) => {
90603
90716
  const { stopDaemon: stopDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
90604
- const port = parseInt(options.port, 10) || 19222;
90717
+ const port = parseInt(options.port, 10) || DEFAULT_DAEMON_PORT;
90605
90718
  if (stopDaemon2({ port })) {
90606
90719
  console.log(source_default.green(`
90607
90720
  \u2713 ADHDev Daemon stopped.
@@ -90612,19 +90725,19 @@ function registerDaemonCommands(program2, pkgVersion3) {
90612
90725
  `));
90613
90726
  }
90614
90727
  }));
90615
- hideCommand(program2.command("daemon:restart").description("Restart ADHDev Daemon (stop \u2192 start)").option("-p, --port <port>", "Local WS server port", "19222").option("--server <url>", "Override server URL").option("--dev", "Enable Dev Mode").action(async (options) => {
90728
+ hideCommand(program2.command("daemon:restart").description("Restart ADHDev Daemon (stop \u2192 start)").option("-p, --port <port>", "Local WS server port", DEFAULT_DAEMON_PORT_TEXT).option("--server <url>", "Override server URL").option("--dev", "Enable Dev Mode").action(async (options) => {
90616
90729
  const { stopDaemon: stopDaemon2, isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
90617
90730
  const { stopManagedSessionHostProcess: stopManagedSessionHostProcess2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
90618
90731
  const { spawn: spawn6 } = await import("child_process");
90619
- if (isDaemonRunning2({ port: parseInt(options.port, 10) || 19222 })) {
90732
+ if (isDaemonRunning2({ port: parseInt(options.port, 10) || DEFAULT_DAEMON_PORT })) {
90620
90733
  console.log(source_default.yellow("\n Stopping existing daemon..."));
90621
- stopDaemon2({ port: parseInt(options.port, 10) || 19222 });
90734
+ stopDaemon2({ port: parseInt(options.port, 10) || DEFAULT_DAEMON_PORT });
90622
90735
  await new Promise((r) => setTimeout(r, 2e3));
90623
90736
  }
90624
90737
  stopManagedSessionHostProcess2();
90625
90738
  await new Promise((r) => setTimeout(r, 500));
90626
90739
  console.log(source_default.cyan(" Starting new daemon..."));
90627
- const args = ["daemon", "-p", options.port || "19222"];
90740
+ const args = ["daemon", "-p", options.port || DEFAULT_DAEMON_PORT_TEXT];
90628
90741
  if (options.server) args.push("--server", options.server);
90629
90742
  if (options.dev) args.push("--dev");
90630
90743
  const child = spawn6(process.execPath, [process.argv[1], ...args], {
@@ -90635,7 +90748,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
90635
90748
  });
90636
90749
  child.unref();
90637
90750
  await new Promise((r) => setTimeout(r, 3e3));
90638
- if (isDaemonRunning2({ port: parseInt(options.port, 10) || 19222 })) {
90751
+ if (isDaemonRunning2({ port: parseInt(options.port, 10) || DEFAULT_DAEMON_PORT })) {
90639
90752
  console.log(source_default.green(` \u2713 ADHDev Daemon restarted (PID: ${child.pid})
90640
90753
  `));
90641
90754
  } else {
@@ -90709,7 +90822,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
90709
90822
  packageName: "adhdev",
90710
90823
  targetVersion: latest,
90711
90824
  parentPid: process.pid,
90712
- restartArgv: daemonWasRunning ? [process.argv[1], "daemon", "-p", "19222"] : [],
90825
+ restartArgv: daemonWasRunning ? [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT] : [],
90713
90826
  cwd: process.cwd()
90714
90827
  });
90715
90828
  if (daemonWasRunning) {
@@ -90730,7 +90843,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
90730
90843
  await new Promise((r) => setTimeout(r, 2e3));
90731
90844
  stopManagedSessionHostProcess2();
90732
90845
  await new Promise((r) => setTimeout(r, 500));
90733
- const child = spawn6(process.execPath, [process.argv[1], "daemon", "-p", "19222"], {
90846
+ const child = spawn6(process.execPath, [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT], {
90734
90847
  detached: true,
90735
90848
  stdio: "ignore",
90736
90849
  windowsHide: true,
@@ -91270,6 +91383,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
91270
91383
  init_source();
91271
91384
  var path33 = __toESM(require("path"));
91272
91385
  init_cdp_utils();
91386
+ var DEV_SERVER_PORT3 = 19280;
91273
91387
  var IDE_AUTO_FIX_FUNCTIONS = [
91274
91388
  "openPanel",
91275
91389
  "sendMessage",
@@ -91502,7 +91616,7 @@ function registerProviderCommands(program2) {
91502
91616
  const result = await new Promise((resolve17, reject) => {
91503
91617
  const req = http3.request({
91504
91618
  hostname: "127.0.0.1",
91505
- port: 19280,
91619
+ port: DEV_SERVER_PORT3,
91506
91620
  path: "/api/providers/reload",
91507
91621
  method: "POST",
91508
91622
  headers: { "Content-Type": "application/json", "Content-Length": "2" }
@@ -91639,7 +91753,7 @@ function registerProviderCommands(program2) {
91639
91753
  const postData = JSON.stringify({ type, name, category, location, cdpPorts, osPaths, processNames });
91640
91754
  const req = http3.request({
91641
91755
  hostname: "127.0.0.1",
91642
- port: 19280,
91756
+ port: DEV_SERVER_PORT3,
91643
91757
  path: "/api/scaffold",
91644
91758
  method: "POST",
91645
91759
  headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
@@ -91847,7 +91961,7 @@ function registerProviderCommands(program2) {
91847
91961
  const startResult = await new Promise((resolve17, reject) => {
91848
91962
  const req = http3.request({
91849
91963
  hostname: "127.0.0.1",
91850
- port: 19280,
91964
+ port: DEV_SERVER_PORT3,
91851
91965
  path: `/api/providers/${type}/auto-implement`,
91852
91966
  method: "POST",
91853
91967
  headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
@@ -91893,7 +92007,7 @@ function registerProviderCommands(program2) {
91893
92007
  `);
91894
92008
  console.log(source_default.gray(` Agent logs: ${logFile}`));
91895
92009
  await new Promise((resolve17, reject) => {
91896
- http3.get(`http://127.0.0.1:19280${startResult.sseUrl}`, (res) => {
92010
+ http3.get(`http://127.0.0.1:${DEV_SERVER_PORT3}${startResult.sseUrl}`, (res) => {
91897
92011
  let buffer = "";
91898
92012
  res.on("data", (chunk) => {
91899
92013
  const rawStr = chunk.toString();
@@ -92002,7 +92116,7 @@ function registerProviderCommands(program2) {
92002
92116
  const result = await new Promise((resolve17, reject) => {
92003
92117
  const req = http3.request({
92004
92118
  hostname: "127.0.0.1",
92005
- port: 19280,
92119
+ port: DEV_SERVER_PORT3,
92006
92120
  path: `/api/providers/${type}/script`,
92007
92121
  method: "POST",
92008
92122
  headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
@@ -92050,7 +92164,7 @@ function registerProviderCommands(program2) {
92050
92164
  try {
92051
92165
  const http3 = await import("http");
92052
92166
  const result = await new Promise((resolve17, reject) => {
92053
- http3.get(`http://127.0.0.1:19280/api/providers/${type}/source`, (res) => {
92167
+ http3.get(`http://127.0.0.1:${DEV_SERVER_PORT3}/api/providers/${type}/source`, (res) => {
92054
92168
  let data = "";
92055
92169
  res.on("data", (c) => data += c);
92056
92170
  res.on("end", () => {
@@ -92108,7 +92222,7 @@ function registerProviderCommands(program2) {
92108
92222
  const result = await new Promise((resolve17, reject) => {
92109
92223
  const req = http3.request({
92110
92224
  hostname: "127.0.0.1",
92111
- port: 19280,
92225
+ port: DEV_SERVER_PORT3,
92112
92226
  path: `/api/providers/${type}/script`,
92113
92227
  method: "POST",
92114
92228
  headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
@@ -92414,6 +92528,7 @@ var import_node_os6 = __toESM(require("os"));
92414
92528
  var import_node_child_process6 = require("child_process");
92415
92529
  init_source();
92416
92530
  init_src();
92531
+ var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
92417
92532
  var LAUNCHD_LABEL = "dev.adhf.daemon";
92418
92533
  var ADHDEV_DIR = import_node_path4.default.join(import_node_os6.default.homedir(), ".adhdev");
92419
92534
  var LOG_OUT = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.out");
@@ -92437,7 +92552,7 @@ function ensureDir(dir) {
92437
92552
  }
92438
92553
  async function fetchHealth() {
92439
92554
  const controller = new AbortController();
92440
- const timer = setTimeout(() => controller.abort(), 1500);
92555
+ const timer = setTimeout(() => controller.abort(), DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3);
92441
92556
  try {
92442
92557
  const res = await fetch(`http://127.0.0.1:${DEFAULT_DAEMON_PORT}/health`, { signal: controller.signal });
92443
92558
  if (!res.ok) return null;