adhdev 0.5.8 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18655,8 +18655,7 @@ var require_dist = __commonJS({
18655
18655
  // IDE meta
18656
18656
  ideVersion = "";
18657
18657
  instanceId;
18658
- workspaceFolders = [];
18659
- activeFile = null;
18658
+ workspace = "";
18660
18659
  // ─── Child Extension Instances ────────────────────
18661
18660
  extensions = /* @__PURE__ */ new Map();
18662
18661
  constructor(provider, instanceKey) {
@@ -18717,8 +18716,7 @@ var require_dist = __commonJS({
18717
18716
  activeModal: this.cachedChat.activeModal || null,
18718
18717
  inputContent: this.cachedChat.inputContent || ""
18719
18718
  } : null,
18720
- workspaceFolders: this.workspaceFolders,
18721
- activeFile: this.activeFile,
18719
+ workspace: this.workspace || null,
18722
18720
  extensions: extensionStates,
18723
18721
  cdpConnected: cdp?.isConnected || false,
18724
18722
  currentModel: this.cachedChat?.model || void 0,
@@ -18735,11 +18733,6 @@ var require_dist = __commonJS({
18735
18733
  } else if (event === "cdp_disconnected") {
18736
18734
  this.cachedChat = null;
18737
18735
  this.currentStatus = "idle";
18738
- } else if (event === "extension_data") {
18739
- if (data?.workspaceFolders) this.workspaceFolders = data.workspaceFolders;
18740
- if (data?.activeFile) this.activeFile = data.activeFile;
18741
- if (data?.ideVersion) this.ideVersion = data.ideVersion;
18742
- if (data?.instanceId) this.instanceId = data.instanceId;
18743
18736
  } else if (event === "stream_update") {
18744
18737
  const extType = data?.extensionType;
18745
18738
  if (extType && this.extensions.has(extType)) {
@@ -18795,6 +18788,10 @@ var require_dist = __commonJS({
18795
18788
  getExtensionInstances() {
18796
18789
  return [...this.extensions.values()];
18797
18790
  }
18791
+ /** Set workspace from daemon launch context */
18792
+ setWorkspace(workspace) {
18793
+ this.workspace = workspace;
18794
+ }
18798
18795
  // ─── CDP readChat ───────────────────────────────
18799
18796
  async readChat() {
18800
18797
  const { cdp } = this.context;
@@ -22516,7 +22513,7 @@ var require_dist = __commonJS({
22516
22513
  const acpStates = allStates.filter((s) => s.category === "acp");
22517
22514
  const ideSummary = ideStates.map((s) => {
22518
22515
  const msgs = s.activeChat?.messages?.length || 0;
22519
- const exts = (s.extensions || []).length;
22516
+ const exts = s.extensions.length;
22520
22517
  return `${s.type}(${s.status},${msgs}msg,${exts}ext${s.currentModel ? ",model=" + s.currentModel : ""})`;
22521
22518
  }).join(", ");
22522
22519
  const cliSummary = cliStates.map((s) => `${s.type}(${s.status})`).join(", ");
@@ -22536,13 +22533,12 @@ var require_dist = __commonJS({
22536
22533
  ideType: s.type,
22537
22534
  ideVersion: "",
22538
22535
  instanceId: s.instanceId,
22539
- workspaceFolders: s.workspaceFolders || [],
22540
- activeFile: s.activeFile || null,
22536
+ workspace: s.workspace || null,
22541
22537
  terminals: 0,
22542
22538
  aiAgents: [],
22543
22539
  activeChat: s.activeChat,
22544
22540
  chats: [],
22545
- agentStreams: (s.extensions || []).map((ext) => ({
22541
+ agentStreams: s.extensions.map((ext) => ({
22546
22542
  agentType: ext.type,
22547
22543
  agentName: ext.name,
22548
22544
  extensionId: ext.type,
@@ -22551,7 +22547,7 @@ var require_dist = __commonJS({
22551
22547
  inputContent: ext.activeChat?.inputContent || "",
22552
22548
  activeModal: ext.activeChat?.activeModal || null
22553
22549
  })),
22554
- cdpConnected: s.cdpConnected || false,
22550
+ cdpConnected: s.cdpConnected,
22555
22551
  currentModel: s.currentModel,
22556
22552
  currentPlan: s.currentPlan,
22557
22553
  currentAutoApprove: s.currentAutoApprove
@@ -22562,8 +22558,8 @@ var require_dist = __commonJS({
22562
22558
  cliType: s.type,
22563
22559
  cliName: s.name,
22564
22560
  status: s.status,
22565
- mode: s.mode || "terminal",
22566
- workingDir: s.workingDir || "",
22561
+ mode: s.mode,
22562
+ workspace: s.workspace || "",
22567
22563
  activeChat: s.activeChat
22568
22564
  }));
22569
22565
  const managedAcps = acpStates.map((s) => ({
@@ -22571,19 +22567,22 @@ var require_dist = __commonJS({
22571
22567
  acpType: s.type,
22572
22568
  acpName: s.name,
22573
22569
  status: s.status,
22574
- mode: "chat",
22575
- workingDir: s.workingDir || "",
22570
+ mode: s.mode,
22571
+ workspace: s.workspace || "",
22576
22572
  activeChat: s.activeChat,
22577
22573
  currentModel: s.currentModel,
22578
22574
  currentPlan: s.currentPlan,
22579
22575
  acpConfigOptions: s.acpConfigOptions,
22580
- acpModes: s.acpModes
22576
+ acpModes: s.acpModes,
22577
+ errorMessage: s.errorMessage,
22578
+ errorReason: s.errorReason
22581
22579
  }));
22582
22580
  const cfg = loadConfig3();
22583
22581
  const wsState = getWorkspaceState(cfg);
22584
22582
  const memSnap = getHostMemorySnapshot();
22585
22583
  const payload = {
22586
22584
  daemonMode: true,
22585
+ version: this.deps.daemonVersion || "unknown",
22587
22586
  machineNickname: cfg.machineNickname || null,
22588
22587
  workspaces: wsState.workspaces,
22589
22588
  defaultWorkspaceId: wsState.defaultWorkspaceId,
@@ -22786,12 +22785,14 @@ var require_dist = __commonJS({
22786
22785
  /Type your message/i,
22787
22786
  /^>\s*$/m,
22788
22787
  // '>' alone on its own line
22789
- /[›➤]\s*$/,
22790
- /for shortcuts/i,
22791
- /\?\s*for help/i,
22788
+ /[›❯]\s*[\r\n]/,
22789
+ // prompt char followed by line ending (ANSI-stripped may not have $ at end)
22790
+ /[›❯]\s*$/m,
22791
+ // prompt char at end of line (multiline)
22792
+ /for\s*shortcuts/i,
22793
+ // Claude Code prompt (ANSI strip may remove spaces → 'forshortcuts')
22794
+ /\?\s*for\s*help/i,
22792
22795
  /Press enter/i
22793
- // NOTE: removed /^[\s\u2500-\u257f]*>\s*$/m — the box-drawing char range is too wide and
22794
- // can match dialog-clearing ANSI output, causing false prompt detection in approval state.
22795
22796
  ];
22796
22797
  var FALLBACK_GENERATING = [
22797
22798
  /[\u2800-\u28ff]/,
@@ -22803,13 +22804,18 @@ var require_dist = __commonJS({
22803
22804
  // Specific Claude Code status
22804
22805
  ];
22805
22806
  var FALLBACK_APPROVAL = [
22806
- /Allow\s+once/i,
22807
- /Always\s+allow/i,
22807
+ /Allow\s*once/i,
22808
+ // ANSI strip may remove spaces
22809
+ /Always\s*allow/i,
22808
22810
  /\(y\/n\)/i,
22809
22811
  /\[Y\/n\]/i,
22810
- /Run\s+this\s+command/i
22811
- // NOTE: removed /Do you want to (?:run|execute|allow)/i — too broad, matches AI explanation
22812
- // text like "Do you want to allow this feature?" causing false approval notifications.
22812
+ /Run\s*this\s*command/i,
22813
+ /Allow\s*tool/i,
22814
+ // Claude Code v2 approval
22815
+ /Yes,?\s*don'?t\s*ask/i,
22816
+ // "Yes, don't ask again" (Claude Code)
22817
+ /Deny/i
22818
+ // Deny button presence = approval dialog
22813
22819
  ];
22814
22820
  function defaultCleanOutput(raw, _lastUserInput) {
22815
22821
  return stripAnsi(raw).trim();
@@ -22844,6 +22850,8 @@ var require_dist = __commonJS({
22844
22850
  maxResponse: t.maxResponse ?? 3e5,
22845
22851
  shutdownGrace: t.shutdownGrace ?? 1e3
22846
22852
  };
22853
+ const rawKeys = provider.approvalKeys;
22854
+ this.approvalKeys = rawKeys && typeof rawKeys === "object" ? rawKeys : {};
22847
22855
  }
22848
22856
  cliType;
22849
22857
  cliName;
@@ -22875,8 +22883,20 @@ var require_dist = __commonJS({
22875
22883
  approvalExitTimeout = null;
22876
22884
  // Resize redraw suppression
22877
22885
  resizeSuppressUntil = 0;
22886
+ // Debug: status transition history
22887
+ statusHistory = [];
22888
+ setStatus(status, trigger) {
22889
+ const prev = this.currentStatus;
22890
+ if (prev === status) return;
22891
+ this.currentStatus = status;
22892
+ this.statusHistory.push({ status, at: Date.now(), trigger });
22893
+ if (this.statusHistory.length > 50) this.statusHistory.shift();
22894
+ LOG5.info("CLI", `[${this.cliType}] status: ${prev} \u2192 ${status}${trigger ? ` (${trigger})` : ""}`);
22895
+ }
22878
22896
  // Resolved timeouts (provider defaults + overrides)
22879
22897
  timeouts;
22898
+ // Provider approval key mapping (e.g. { 0: '1', 1: '2', 2: '3' }) — loaded from provider.json
22899
+ approvalKeys;
22880
22900
  // ─── Lifecycle ─────────────────────────────────
22881
22901
  setServerConn(serverConn) {
22882
22902
  this.serverConn = serverConn;
@@ -22956,11 +22976,11 @@ var require_dist = __commonJS({
22956
22976
  this.ptyProcess.onExit(({ exitCode }) => {
22957
22977
  LOG5.info("CLI", `[${this.cliType}] Exit code ${exitCode}`);
22958
22978
  this.ptyProcess = null;
22959
- this.currentStatus = "stopped";
22979
+ this.setStatus("stopped", "pty_exit");
22960
22980
  this.ready = false;
22961
22981
  this.onStatusChange?.();
22962
22982
  });
22963
- this.currentStatus = "starting";
22983
+ this.setStatus("starting", "spawn");
22964
22984
  this.onStatusChange?.();
22965
22985
  }
22966
22986
  // ─── Output state machine ────────────────────────────
@@ -22978,9 +22998,13 @@ var require_dist = __commonJS({
22978
22998
  this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
22979
22999
  if (!this.ready) {
22980
23000
  this.startupBuffer += cleanData;
23001
+ LOG5.info("CLI", `[${this.cliType}] startup chunk (${cleanData.length} chars): ${cleanData.slice(0, 200).replace(/\n/g, "\\n")}`);
22981
23002
  const dialogPatterns = [
22982
23003
  /Do you want to connect/i,
22983
- /Do you trust the files/i
23004
+ /Do you trust the files/i,
23005
+ /Quick safety check/i,
23006
+ /Is this a project/i,
23007
+ /Enter to confirm/i
22984
23008
  ];
22985
23009
  if (dialogPatterns.some((p) => p.test(this.startupBuffer))) {
22986
23010
  setTimeout(() => this.ptyProcess?.write("\r"), this.timeouts.dialogAccept);
@@ -22989,7 +23013,7 @@ var require_dist = __commonJS({
22989
23013
  }
22990
23014
  if (patterns.prompt.some((p) => p.test(this.startupBuffer))) {
22991
23015
  this.ready = true;
22992
- this.currentStatus = "idle";
23016
+ this.setStatus("idle", "prompt_matched");
22993
23017
  LOG5.info("CLI", `[${this.cliType}] \u2713 Ready`);
22994
23018
  this.onStatusChange?.();
22995
23019
  }
@@ -23000,12 +23024,12 @@ var require_dist = __commonJS({
23000
23024
  if (this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown) return;
23001
23025
  const ctxLines = this.recentOutputBuffer.split("\n").map((l) => l.trim()).filter((l) => l && !/^[─═╭╮╰╯│]+$/.test(l));
23002
23026
  this.isWaitingForResponse = true;
23003
- this.currentStatus = "waiting_approval";
23027
+ this.setStatus("waiting_approval", "approval_pattern");
23004
23028
  this.recentOutputBuffer = "";
23005
23029
  this.approvalTransitionBuffer = "";
23006
23030
  this.activeModal = {
23007
23031
  message: ctxLines.slice(-5).join(" ").slice(0, 200) || "Approval required",
23008
- buttons: ["Allow once", "Always allow", "Deny"]
23032
+ buttons: this.cliType === "claude-cli" ? ["Yes (y)", "Always allow (a)", "Deny (Esc)"] : ["Allow once", "Always allow", "Deny"]
23009
23033
  };
23010
23034
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
23011
23035
  if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
@@ -23017,7 +23041,7 @@ var require_dist = __commonJS({
23017
23041
  this.recentOutputBuffer = "";
23018
23042
  this.approvalTransitionBuffer = "";
23019
23043
  this.approvalExitTimeout = null;
23020
- this.currentStatus = this.isWaitingForResponse ? "generating" : "idle";
23044
+ this.setStatus(this.isWaitingForResponse ? "generating" : "idle", "approval_cleared");
23021
23045
  this.onStatusChange?.();
23022
23046
  }
23023
23047
  }, 6e4);
@@ -23033,7 +23057,7 @@ var require_dist = __commonJS({
23033
23057
  clearTimeout(this.approvalExitTimeout);
23034
23058
  this.approvalExitTimeout = null;
23035
23059
  }
23036
- this.currentStatus = "generating";
23060
+ this.setStatus("generating", "approval_gen_resume");
23037
23061
  this.activeModal = null;
23038
23062
  this.recentOutputBuffer = "";
23039
23063
  this.approvalTransitionBuffer = "";
@@ -23056,7 +23080,7 @@ var require_dist = __commonJS({
23056
23080
  if (patterns.generating.some((p) => p.test(cleanData))) {
23057
23081
  this.isWaitingForResponse = true;
23058
23082
  this.responseBuffer = "";
23059
- this.currentStatus = "generating";
23083
+ this.setStatus("generating", "autonomous_gen");
23060
23084
  this.onStatusChange?.();
23061
23085
  }
23062
23086
  }
@@ -23065,7 +23089,7 @@ var require_dist = __commonJS({
23065
23089
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
23066
23090
  const stillGenerating = patterns.generating.some((p) => p.test(cleanData));
23067
23091
  if (stillGenerating) {
23068
- this.currentStatus = "generating";
23092
+ this.setStatus("generating", "still_generating");
23069
23093
  this.idleTimeout = setTimeout(() => {
23070
23094
  if (this.isWaitingForResponse) this.finishResponse();
23071
23095
  }, this.timeouts.generatingIdle);
@@ -23112,7 +23136,7 @@ var require_dist = __commonJS({
23112
23136
  this.responseBuffer = "";
23113
23137
  this.isWaitingForResponse = false;
23114
23138
  this.activeModal = null;
23115
- this.currentStatus = "idle";
23139
+ this.setStatus("idle", "response_finished");
23116
23140
  this.onStatusChange?.();
23117
23141
  }
23118
23142
  // ─── Public API (CliAdapter interface) ──────────
@@ -23131,7 +23155,7 @@ var require_dist = __commonJS({
23131
23155
  this.messages.push({ role: "user", content: text, timestamp: Date.now() });
23132
23156
  this.isWaitingForResponse = true;
23133
23157
  this.responseBuffer = "";
23134
- this.currentStatus = "generating";
23158
+ this.setStatus("generating", "sendMessage");
23135
23159
  this.onStatusChange?.();
23136
23160
  this.ptyProcess.write(text + "\r");
23137
23161
  this.responseTimeout = setTimeout(() => {
@@ -23159,7 +23183,7 @@ var require_dist = __commonJS({
23159
23183
  } catch {
23160
23184
  }
23161
23185
  this.ptyProcess = null;
23162
- this.currentStatus = "stopped";
23186
+ this.setStatus("stopped", "stop_cmd");
23163
23187
  this.ready = false;
23164
23188
  this.onStatusChange?.();
23165
23189
  }, this.timeouts.shutdownGrace);
@@ -23185,9 +23209,13 @@ var require_dist = __commonJS({
23185
23209
  */
23186
23210
  resolveModal(buttonIndex) {
23187
23211
  if (!this.ptyProcess || this.currentStatus !== "waiting_approval") return;
23188
- const DOWN = "\x1B[B";
23189
- const keys = DOWN.repeat(Math.max(0, buttonIndex)) + "\r";
23190
- this.ptyProcess.write(keys);
23212
+ if (buttonIndex in this.approvalKeys) {
23213
+ this.ptyProcess.write(this.approvalKeys[buttonIndex]);
23214
+ } else {
23215
+ const DOWN = "\x1B[B";
23216
+ const keys = DOWN.repeat(Math.max(0, buttonIndex)) + "\r";
23217
+ this.ptyProcess.write(keys);
23218
+ }
23191
23219
  }
23192
23220
  resize(cols, rows) {
23193
23221
  if (this.ptyProcess) {
@@ -23198,6 +23226,44 @@ var require_dist = __commonJS({
23198
23226
  }
23199
23227
  }
23200
23228
  }
23229
+ /**
23230
+ * Full debug state — exposes all internal buffers, status, and patterns for debugging.
23231
+ * Used by DevServer /api/cli/debug endpoint.
23232
+ */
23233
+ getDebugState() {
23234
+ return {
23235
+ type: this.cliType,
23236
+ name: this.cliName,
23237
+ status: this.currentStatus,
23238
+ ready: this.ready,
23239
+ workingDir: this.workingDir,
23240
+ messages: this.messages.slice(-20),
23241
+ messageCount: this.messages.length,
23242
+ // Buffers
23243
+ startupBuffer: this.startupBuffer.slice(-500),
23244
+ recentOutputBuffer: this.recentOutputBuffer.slice(-500),
23245
+ responseBuffer: this.responseBuffer.slice(-500),
23246
+ approvalTransitionBuffer: this.approvalTransitionBuffer.slice(-500),
23247
+ // State
23248
+ isWaitingForResponse: this.isWaitingForResponse,
23249
+ activeModal: this.activeModal,
23250
+ lastApprovalResolvedAt: this.lastApprovalResolvedAt,
23251
+ resizeSuppressUntil: this.resizeSuppressUntil,
23252
+ // Provider patterns (serialized)
23253
+ patterns: {
23254
+ prompt: this.provider.patterns.prompt.map((p) => p.toString()),
23255
+ generating: this.provider.patterns.generating.map((p) => p.toString()),
23256
+ approval: this.provider.patterns.approval.map((p) => p.toString()),
23257
+ ready: this.provider.patterns.ready.map((p) => p.toString())
23258
+ },
23259
+ // Status history
23260
+ statusHistory: this.statusHistory.slice(-30),
23261
+ // Timeouts config
23262
+ timeouts: this.timeouts,
23263
+ // PTY alive
23264
+ ptyAlive: !!this.ptyProcess
23265
+ };
23266
+ }
23201
23267
  };
23202
23268
  init_config();
23203
23269
  init_workspaces();
@@ -23222,6 +23288,8 @@ var require_dist = __commonJS({
23222
23288
  generatingStartedAt = 0;
23223
23289
  settings = {};
23224
23290
  monitor;
23291
+ generatingDebounceTimer = null;
23292
+ generatingDebouncePending = null;
23225
23293
  historyWriter;
23226
23294
  instanceId;
23227
23295
  // ─── Lifecycle ─────────────────────────────────
@@ -23288,7 +23356,7 @@ var require_dist = __commonJS({
23288
23356
  activeModal: adapterStatus.activeModal,
23289
23357
  inputContent: ""
23290
23358
  },
23291
- workingDir: this.workingDir,
23359
+ workspace: this.workingDir,
23292
23360
  instanceId: this.instanceId,
23293
23361
  lastUpdated: Date.now(),
23294
23362
  settings: this.settings,
@@ -23317,8 +23385,24 @@ var require_dist = __commonJS({
23317
23385
  LOG5.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
23318
23386
  if (this.lastStatus === "idle" && newStatus === "generating") {
23319
23387
  this.generatingStartedAt = now;
23320
- this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now });
23388
+ if (this.generatingDebounceTimer) clearTimeout(this.generatingDebounceTimer);
23389
+ this.generatingDebouncePending = { chatTitle, timestamp: now };
23390
+ this.generatingDebounceTimer = setTimeout(() => {
23391
+ if (this.generatingDebouncePending) {
23392
+ this.pushEvent({ event: "agent:generating_started", ...this.generatingDebouncePending });
23393
+ this.generatingDebouncePending = null;
23394
+ }
23395
+ this.generatingDebounceTimer = null;
23396
+ }, 1e3);
23321
23397
  } else if (newStatus === "waiting_approval") {
23398
+ if (this.generatingDebouncePending) {
23399
+ if (this.generatingDebounceTimer) {
23400
+ clearTimeout(this.generatingDebounceTimer);
23401
+ this.generatingDebounceTimer = null;
23402
+ }
23403
+ this.pushEvent({ event: "agent:generating_started", ...this.generatingDebouncePending });
23404
+ this.generatingDebouncePending = null;
23405
+ }
23322
23406
  if (!this.generatingStartedAt) this.generatingStartedAt = now;
23323
23407
  const modal = adapterStatus.activeModal;
23324
23408
  LOG5.info("CLI", `[${this.type}] approval modal: "${modal?.message?.slice(0, 80) ?? "none"}"`);
@@ -23331,10 +23415,24 @@ var require_dist = __commonJS({
23331
23415
  });
23332
23416
  } else if (newStatus === "idle" && (this.lastStatus === "generating" || this.lastStatus === "waiting_approval")) {
23333
23417
  const duration3 = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : 0;
23334
- LOG5.info("CLI", `[${this.type}] completed in ${duration3}s`);
23335
- this.pushEvent({ event: "agent:generating_completed", chatTitle, duration: duration3, timestamp: now });
23418
+ if (this.generatingDebouncePending) {
23419
+ LOG5.info("CLI", `[${this.type}] suppressed short generating (${now - this.generatingStartedAt}ms)`);
23420
+ if (this.generatingDebounceTimer) {
23421
+ clearTimeout(this.generatingDebounceTimer);
23422
+ this.generatingDebounceTimer = null;
23423
+ }
23424
+ this.generatingDebouncePending = null;
23425
+ } else {
23426
+ LOG5.info("CLI", `[${this.type}] completed in ${duration3}s`);
23427
+ this.pushEvent({ event: "agent:generating_completed", chatTitle, duration: duration3, timestamp: now });
23428
+ }
23336
23429
  this.generatingStartedAt = 0;
23337
23430
  } else if (newStatus === "stopped") {
23431
+ if (this.generatingDebounceTimer) {
23432
+ clearTimeout(this.generatingDebounceTimer);
23433
+ this.generatingDebounceTimer = null;
23434
+ }
23435
+ this.generatingDebouncePending = null;
23338
23436
  this.pushEvent({ event: "agent:stopped", chatTitle, timestamp: now });
23339
23437
  }
23340
23438
  this.lastStatus = newStatus;
@@ -23479,7 +23577,7 @@ var require_dist = __commonJS({
23479
23577
  } : null,
23480
23578
  inputContent: ""
23481
23579
  },
23482
- workingDir: this.workingDir,
23580
+ workspace: this.workingDir,
23483
23581
  currentModel: this.currentModel,
23484
23582
  currentPlan: this.currentMode,
23485
23583
  instanceId: this.instanceId,
@@ -23490,8 +23588,8 @@ var require_dist = __commonJS({
23490
23588
  acpConfigOptions: this.configOptions,
23491
23589
  acpModes: this.availableModes,
23492
23590
  // Error details for dashboard display
23493
- errorMessage: this.errorMessage,
23494
- errorReason: this.errorReason
23591
+ errorMessage: this.errorMessage || void 0,
23592
+ errorReason: this.errorReason || void 0
23495
23593
  };
23496
23594
  }
23497
23595
  onEvent(event, data) {
@@ -23974,29 +24072,27 @@ var require_dist = __commonJS({
23974
24072
  handleSessionUpdate(params) {
23975
24073
  if (!params) return;
23976
24074
  const update = params.update;
23977
- this.log.debug(`[${this.type}] sessionUpdate: ${update.sessionUpdate} | keys=${Object.keys(update).join(",")}`);
24075
+ this.log.debug(`[${this.type}] sessionUpdate: ${update.sessionUpdate}`);
23978
24076
  switch (update.sessionUpdate) {
23979
24077
  case "agent_message_chunk": {
23980
24078
  const content = update.content;
23981
- if (content?.type === "text" && content.text) {
24079
+ if (content.type === "text") {
23982
24080
  this.partialContent += content.text;
23983
- } else if (content?.type === "image") {
24081
+ } else if (content.type === "image") {
23984
24082
  this.partialBlocks.push({
23985
24083
  type: "image",
23986
- data: content.data || "",
23987
- mimeType: content.mimeType || "image/png",
23988
- uri: content.uri
24084
+ data: content.data,
24085
+ mimeType: content.mimeType
23989
24086
  });
23990
- } else if (content?.type === "resource_link") {
24087
+ } else if (content.type === "resource_link") {
23991
24088
  this.partialBlocks.push({
23992
24089
  type: "resource_link",
23993
- uri: content.uri || "",
24090
+ uri: content.uri,
23994
24091
  name: content.name || "resource",
23995
- title: content.title,
23996
- mimeType: content.mimeType,
23997
- size: content.size
24092
+ title: content.title ?? void 0,
24093
+ mimeType: content.mimeType ?? void 0
23998
24094
  });
23999
- } else if (content?.type === "resource") {
24095
+ } else if (content.type === "resource") {
24000
24096
  this.partialBlocks.push({
24001
24097
  type: "resource",
24002
24098
  resource: content.resource
@@ -25709,6 +25805,8 @@ async (params) => {
25709
25805
  server = null;
25710
25806
  providerLoader;
25711
25807
  cdpManagers;
25808
+ instanceManager;
25809
+ cliManager;
25712
25810
  logFn;
25713
25811
  sseClients = [];
25714
25812
  watchScriptPath = null;
@@ -25718,9 +25816,13 @@ async (params) => {
25718
25816
  autoImplProcess = null;
25719
25817
  autoImplSSEClients = [];
25720
25818
  autoImplStatus = { running: false, type: null, progress: [] };
25819
+ // CLI debug SSE
25820
+ cliSSEClients = [];
25721
25821
  constructor(options) {
25722
25822
  this.providerLoader = options.providerLoader;
25723
25823
  this.cdpManagers = options.cdpManagers;
25824
+ this.instanceManager = options.instanceManager || null;
25825
+ this.cliManager = options.cliManager || null;
25724
25826
  this.logFn = options.logFn || LOG5.forComponent("DevServer").asLogFn();
25725
25827
  }
25726
25828
  log(msg) {
@@ -25747,6 +25849,15 @@ async (params) => {
25747
25849
  { method: "POST", pattern: "/api/watch/stop", handler: (q, s) => this.handleWatchStop(q, s) },
25748
25850
  { method: "GET", pattern: "/api/watch/events", handler: (q, s) => this.handleSSE(q, s) },
25749
25851
  { method: "POST", pattern: "/api/scaffold", handler: (q, s) => this.handleScaffold(q, s) },
25852
+ // CLI Debug routes
25853
+ { method: "GET", pattern: "/api/cli/status", handler: (q, s) => this.handleCliStatus(q, s) },
25854
+ { method: "POST", pattern: "/api/cli/launch", handler: (q, s) => this.handleCliLaunch(q, s) },
25855
+ { method: "POST", pattern: "/api/cli/send", handler: (q, s) => this.handleCliSend(q, s) },
25856
+ { method: "POST", pattern: "/api/cli/resolve", handler: (q, s) => this.handleCliResolve(q, s) },
25857
+ { method: "POST", pattern: "/api/cli/raw", handler: (q, s) => this.handleCliRaw(q, s) },
25858
+ { method: "POST", pattern: "/api/cli/stop", handler: (q, s) => this.handleCliStop(q, s) },
25859
+ { method: "GET", pattern: "/api/cli/events", handler: (q, s) => this.handleCliSSE(q, s) },
25860
+ { method: "GET", pattern: /^\/api\/cli\/debug\/([^/]+)$/, handler: (q, s, p) => this.handleCliDebug(p[0], q, s) },
25750
25861
  // Dynamic routes (provider :type param)
25751
25862
  { method: "POST", pattern: /^\/api\/providers\/([^/]+)\/script$/, handler: (q, s, p) => this.handleRunScript(p[0], q, s) },
25752
25863
  { method: "GET", pattern: /^\/api\/providers\/([^/]+)\/files$/, handler: (q, s, p) => this.handleListFiles(p[0], q, s) },
@@ -28013,6 +28124,251 @@ data: ${JSON.stringify(msg.data)}
28013
28124
  });
28014
28125
  });
28015
28126
  }
28127
+ // ─── CLI Debug Handlers ──────────────────────────────
28128
+ /** GET /api/cli/status — list all running CLI/ACP instances with state */
28129
+ async handleCliStatus(_req, res) {
28130
+ if (!this.instanceManager) {
28131
+ this.json(res, 503, { error: "InstanceManager not available (daemon not fully initialized)" });
28132
+ return;
28133
+ }
28134
+ const allStates = this.instanceManager.collectAllStates();
28135
+ const cliStates = allStates.filter((s) => s.category === "cli" || s.category === "acp");
28136
+ const result = cliStates.map((s) => ({
28137
+ instanceId: s.instanceId,
28138
+ type: s.type,
28139
+ name: s.name,
28140
+ category: s.category,
28141
+ status: s.status,
28142
+ mode: s.mode,
28143
+ workspace: s.workspace,
28144
+ messageCount: s.activeChat?.messages?.length || 0,
28145
+ lastMessage: s.activeChat?.messages?.slice(-1)[0] || null,
28146
+ activeModal: s.activeChat?.activeModal || null,
28147
+ pendingEvents: s.pendingEvents || [],
28148
+ currentModel: s.currentModel,
28149
+ settings: s.settings
28150
+ }));
28151
+ this.json(res, 200, { instances: result, count: result.length });
28152
+ }
28153
+ /** POST /api/cli/launch — launch a CLI agent { type, workingDir?, args? } */
28154
+ async handleCliLaunch(req, res) {
28155
+ if (!this.cliManager) {
28156
+ this.json(res, 503, { error: "CliManager not available" });
28157
+ return;
28158
+ }
28159
+ const body = await this.readBody(req);
28160
+ const { type, workingDir, args } = body;
28161
+ if (!type) {
28162
+ this.json(res, 400, { error: "type required (e.g. claude-cli, gemini-cli)" });
28163
+ return;
28164
+ }
28165
+ try {
28166
+ await this.cliManager.startSession(type, workingDir || process.cwd(), args || []);
28167
+ this.json(res, 200, { launched: true, type, workspace: workingDir || process.cwd() });
28168
+ } catch (e) {
28169
+ this.json(res, 500, { error: `Launch failed: ${e.message}` });
28170
+ }
28171
+ }
28172
+ /** POST /api/cli/send — send message to a running CLI { type, text } */
28173
+ async handleCliSend(req, res) {
28174
+ if (!this.instanceManager) {
28175
+ this.json(res, 503, { error: "InstanceManager not available" });
28176
+ return;
28177
+ }
28178
+ const body = await this.readBody(req);
28179
+ const { type, text, instanceId } = body;
28180
+ if (!text) {
28181
+ this.json(res, 400, { error: "text required" });
28182
+ return;
28183
+ }
28184
+ const allStates = this.instanceManager.collectAllStates();
28185
+ const target = allStates.find(
28186
+ (s) => (s.category === "cli" || s.category === "acp") && (instanceId ? s.instanceId === instanceId : s.type === type)
28187
+ );
28188
+ if (!target) {
28189
+ this.json(res, 404, { error: `No running instance found for: ${type || instanceId}` });
28190
+ return;
28191
+ }
28192
+ try {
28193
+ this.instanceManager.sendEvent(target.instanceId, "send_message", { text });
28194
+ this.json(res, 200, { sent: true, type: target.type, instanceId: target.instanceId });
28195
+ } catch (e) {
28196
+ this.json(res, 500, { error: `Send failed: ${e.message}` });
28197
+ }
28198
+ }
28199
+ /** POST /api/cli/stop — stop a running CLI { type } */
28200
+ async handleCliStop(req, res) {
28201
+ if (!this.instanceManager) {
28202
+ this.json(res, 503, { error: "InstanceManager not available" });
28203
+ return;
28204
+ }
28205
+ const body = await this.readBody(req);
28206
+ const { type, instanceId } = body;
28207
+ const allStates = this.instanceManager.collectAllStates();
28208
+ const target = allStates.find(
28209
+ (s) => (s.category === "cli" || s.category === "acp") && (instanceId ? s.instanceId === instanceId : s.type === type)
28210
+ );
28211
+ if (!target) {
28212
+ this.json(res, 404, { error: `No running instance found for: ${type || instanceId}` });
28213
+ return;
28214
+ }
28215
+ try {
28216
+ this.instanceManager.removeInstance(target.instanceId);
28217
+ this.json(res, 200, { stopped: true, type: target.type, instanceId: target.instanceId });
28218
+ } catch (e) {
28219
+ this.json(res, 500, { error: `Stop failed: ${e.message}` });
28220
+ }
28221
+ }
28222
+ /** GET /api/cli/events — SSE stream of CLI status events */
28223
+ handleCliSSE(_req, res) {
28224
+ res.writeHead(200, {
28225
+ "Content-Type": "text/event-stream",
28226
+ "Cache-Control": "no-cache",
28227
+ "Connection": "keep-alive",
28228
+ "Access-Control-Allow-Origin": "*"
28229
+ });
28230
+ res.write('data: {"type":"connected"}\n\n');
28231
+ this.cliSSEClients.push(res);
28232
+ if (this.cliSSEClients.length === 1 && this.instanceManager) {
28233
+ this.instanceManager.onEvent((event) => {
28234
+ this.sendCliSSE(event);
28235
+ });
28236
+ }
28237
+ if (this.instanceManager) {
28238
+ const allStates = this.instanceManager.collectAllStates();
28239
+ const cliStates = allStates.filter((s) => s.category === "cli" || s.category === "acp");
28240
+ for (const s of cliStates) {
28241
+ this.sendCliSSE({ event: "snapshot", providerType: s.type, status: s.status, instanceId: s.instanceId });
28242
+ }
28243
+ }
28244
+ _req.on("close", () => {
28245
+ this.cliSSEClients = this.cliSSEClients.filter((c) => c !== res);
28246
+ });
28247
+ }
28248
+ sendCliSSE(data) {
28249
+ const msg = `data: ${JSON.stringify({ ...data, timestamp: Date.now() })}
28250
+
28251
+ `;
28252
+ for (const client of this.cliSSEClients) {
28253
+ try {
28254
+ client.write(msg);
28255
+ } catch {
28256
+ }
28257
+ }
28258
+ }
28259
+ /** GET /api/cli/debug/:type — full internal debug state of a CLI adapter */
28260
+ async handleCliDebug(type, _req, res) {
28261
+ if (!this.instanceManager) {
28262
+ this.json(res, 503, { error: "InstanceManager not available" });
28263
+ return;
28264
+ }
28265
+ const allStates = this.instanceManager.collectAllStates();
28266
+ const target = allStates.find(
28267
+ (s) => (s.category === "cli" || s.category === "acp") && s.type === type
28268
+ );
28269
+ if (!target) {
28270
+ this.json(res, 404, { error: `No running instance for: ${type}`, available: allStates.filter((s) => s.category === "cli" || s.category === "acp").map((s) => s.type) });
28271
+ return;
28272
+ }
28273
+ const instance = this.instanceManager.getInstance(target.instanceId);
28274
+ if (!instance) {
28275
+ this.json(res, 404, { error: `Instance not found: ${target.instanceId}` });
28276
+ return;
28277
+ }
28278
+ try {
28279
+ const adapter = instance.getAdapter?.() || instance.adapter;
28280
+ if (adapter && typeof adapter.getDebugState === "function") {
28281
+ const debugState = adapter.getDebugState();
28282
+ this.json(res, 200, {
28283
+ instanceId: target.instanceId,
28284
+ providerState: {
28285
+ type: target.type,
28286
+ name: target.name,
28287
+ status: target.status,
28288
+ mode: "mode" in target ? target.mode : void 0
28289
+ },
28290
+ debug: debugState
28291
+ });
28292
+ } else {
28293
+ this.json(res, 200, {
28294
+ instanceId: target.instanceId,
28295
+ providerState: target,
28296
+ debug: null,
28297
+ message: "No debug state available (adapter.getDebugState not found)"
28298
+ });
28299
+ }
28300
+ } catch (e) {
28301
+ this.json(res, 500, { error: `Debug state failed: ${e.message}` });
28302
+ }
28303
+ }
28304
+ /** POST /api/cli/resolve — resolve an approval modal { type, buttonIndex } */
28305
+ async handleCliResolve(req, res) {
28306
+ const body = await this.readBody(req);
28307
+ const { type, buttonIndex, instanceId } = body;
28308
+ if (buttonIndex === void 0 || buttonIndex === null) {
28309
+ this.json(res, 400, { error: "buttonIndex required (0=Yes, 1=Always, 2=Deny)" });
28310
+ return;
28311
+ }
28312
+ if (!this.cliManager) {
28313
+ this.json(res, 503, { error: "CliManager not available" });
28314
+ return;
28315
+ }
28316
+ let adapter = null;
28317
+ for (const [, a] of this.cliManager.adapters) {
28318
+ if (type && a.cliType === type) {
28319
+ adapter = a;
28320
+ break;
28321
+ }
28322
+ }
28323
+ if (!adapter) {
28324
+ this.json(res, 404, { error: `No running adapter for: ${type || instanceId}` });
28325
+ return;
28326
+ }
28327
+ try {
28328
+ if (typeof adapter.resolveModal === "function") {
28329
+ adapter.resolveModal(buttonIndex);
28330
+ this.json(res, 200, { resolved: true, type, buttonIndex });
28331
+ } else {
28332
+ this.json(res, 400, { error: "resolveModal not available on this adapter" });
28333
+ }
28334
+ } catch (e) {
28335
+ this.json(res, 500, { error: `Resolve failed: ${e.message}` });
28336
+ }
28337
+ }
28338
+ /** POST /api/cli/raw — send raw keystrokes to PTY { type, keys } */
28339
+ async handleCliRaw(req, res) {
28340
+ const body = await this.readBody(req);
28341
+ const { type, keys, instanceId } = body;
28342
+ if (!keys) {
28343
+ this.json(res, 400, { error: "keys required (raw string to send to PTY)" });
28344
+ return;
28345
+ }
28346
+ if (!this.cliManager) {
28347
+ this.json(res, 503, { error: "CliManager not available" });
28348
+ return;
28349
+ }
28350
+ let adapter = null;
28351
+ for (const [, a] of this.cliManager.adapters) {
28352
+ if (type && a.cliType === type) {
28353
+ adapter = a;
28354
+ break;
28355
+ }
28356
+ }
28357
+ if (!adapter) {
28358
+ this.json(res, 404, { error: `No running adapter for: ${type || instanceId}` });
28359
+ return;
28360
+ }
28361
+ try {
28362
+ if (typeof adapter.writeRaw === "function") {
28363
+ adapter.writeRaw(keys);
28364
+ this.json(res, 200, { sent: true, type, keysLength: keys.length });
28365
+ } else {
28366
+ this.json(res, 400, { error: "writeRaw not available on this adapter" });
28367
+ }
28368
+ } catch (e) {
28369
+ this.json(res, 500, { error: `Raw send failed: ${e.message}` });
28370
+ }
28371
+ }
28016
28372
  };
28017
28373
  var import_child_process8 = require("child_process");
28018
28374
  var EXTENSION_CATALOG = [
@@ -28357,7 +28713,8 @@ var init_server_connection = __esm({
28357
28713
  this.ws = new import_ws.default(fullUrl, {
28358
28714
  headers: {
28359
28715
  "X-ADHDev-Token": this.options.token,
28360
- "X-ADHDev-IDE": JSON.stringify(this.options.cliInfo)
28716
+ "X-ADHDev-IDE": JSON.stringify(this.options.cliInfo),
28717
+ "X-ADHDev-Version": this.options.daemonVersion || "unknown"
28361
28718
  }
28362
28719
  });
28363
28720
  this.ws.on("open", () => this.onOpen());
@@ -28455,6 +28812,19 @@ var init_server_connection = __esm({
28455
28812
  import_daemon_core.LOG.error("Server", `Auth failed: ${message.payload.reason}`);
28456
28813
  this.setState("error");
28457
28814
  return;
28815
+ } else if (message.type === "version_mismatch") {
28816
+ const p = message.payload;
28817
+ import_daemon_core.LOG.info("Server", `
28818
+ \u{1F504} Update available: v${p.current} \u2192 v${p.latest}`);
28819
+ import_daemon_core.LOG.info("Server", ` Run: adhdev daemon:upgrade
28820
+ `);
28821
+ } else if (message.type === "force_update_required") {
28822
+ const p = message.payload;
28823
+ import_daemon_core.LOG.error("Server", `
28824
+ \u26D4 Daemon v${this.options.daemonVersion} is no longer compatible.`);
28825
+ import_daemon_core.LOG.error("Server", ` Minimum required: v${p.minVersion}`);
28826
+ import_daemon_core.LOG.error("Server", ` Run: adhdev daemon:upgrade
28827
+ `);
28458
28828
  }
28459
28829
  const handlers = this.messageHandlers.get(message.type);
28460
28830
  if (handlers) {
@@ -29631,6 +30001,7 @@ var init_adhdev_daemon = __esm({
29631
30001
  this.serverConn = new ServerConnection({
29632
30002
  serverUrl: options.serverUrl || config2.serverUrl,
29633
30003
  token: config2.connectionToken,
30004
+ daemonVersion: pkgVersion,
29634
30005
  cliInfo: {
29635
30006
  type: "adhdev-daemon",
29636
30007
  version: pkgVersion,
@@ -29716,6 +30087,7 @@ var init_adhdev_daemon = __esm({
29716
30087
  adapters: this.components.cliManager.adapters,
29717
30088
  detectedIdes: this.components.detectedIdes.value,
29718
30089
  ideType: this.ideType,
30090
+ daemonVersion: pkgVersion,
29719
30091
  instanceManager: this.components.instanceManager
29720
30092
  });
29721
30093
  this.statusReporter.startReporting();
@@ -29726,7 +30098,12 @@ var init_adhdev_daemon = __esm({
29726
30098
  process.on("SIGINT", () => this.stop());
29727
30099
  process.on("SIGTERM", () => this.stop());
29728
30100
  if (options.dev) {
29729
- const devServer = new import_daemon_core4.DevServer({ providerLoader: this.components.providerLoader, cdpManagers: this.components.cdpManagers });
30101
+ const devServer = new import_daemon_core4.DevServer({
30102
+ providerLoader: this.components.providerLoader,
30103
+ cdpManagers: this.components.cdpManagers,
30104
+ instanceManager: this.components.instanceManager,
30105
+ cliManager: this.components.cliManager
30106
+ });
29730
30107
  await devServer.start();
29731
30108
  }
29732
30109
  this.printBanner(options, config2.serverUrl);
@@ -30081,54 +30458,56 @@ async function quickSetup() {
30081
30458
  console.log(import_chalk2.default.bold("\n\u{1F680} Quick Setup\n"));
30082
30459
  const spinner = (0, import_ora.default)("Detecting installed IDEs...").start();
30083
30460
  const ides = await (0, import_daemon_core5.detectIDEs)();
30084
- const installedIDEs = ides.filter((i) => i.installed && i.cliCommand);
30461
+ const installedIDEs = ides.filter((i) => i.installed);
30085
30462
  spinner.stop();
30463
+ let selectedIDEs = [];
30086
30464
  if (installedIDEs.length === 0) {
30087
- console.log(import_chalk2.default.red("\u2717 No supported IDE with CLI found."));
30465
+ console.log(import_chalk2.default.yellow("\u26A0 No supported IDEs auto-detected."));
30466
+ console.log(import_chalk2.default.gray(" This is fine \u2014 the daemon will detect IDEs at runtime via CDP."));
30088
30467
  console.log(import_chalk2.default.gray(" Supported: VS Code, Cursor, Antigravity, Windsurf, VSCodium"));
30089
- return;
30090
- }
30091
- console.log(import_chalk2.default.green(`Found ${installedIDEs.length} IDE(s):
30468
+ console.log();
30469
+ } else {
30470
+ console.log(import_chalk2.default.green(`Found ${installedIDEs.length} IDE(s):
30092
30471
  `));
30093
- installedIDEs.forEach((ide) => {
30094
- const version2 = ide.version ? import_chalk2.default.gray(` v${ide.version}`) : "";
30095
- console.log(` ${import_chalk2.default.green("\u2713")} ${ide.icon} ${import_chalk2.default.bold(ide.displayName)}${version2}`);
30096
- });
30097
- console.log();
30098
- let selectedIDEs;
30099
- if (installedIDEs.length === 1) {
30100
- selectedIDEs = installedIDEs;
30101
- console.log(import_chalk2.default.gray(` Auto-selected: ${installedIDEs[0].displayName}
30472
+ installedIDEs.forEach((ide) => {
30473
+ const version2 = ide.version ? import_chalk2.default.gray(` v${ide.version}`) : "";
30474
+ console.log(` ${import_chalk2.default.green("\u2713")} ${ide.icon} ${import_chalk2.default.bold(ide.displayName)}${version2}`);
30475
+ });
30476
+ console.log();
30477
+ if (installedIDEs.length === 1) {
30478
+ selectedIDEs = installedIDEs;
30479
+ console.log(import_chalk2.default.gray(` Auto-selected: ${installedIDEs[0].displayName}
30102
30480
  `));
30103
- } else {
30104
- const { selectedIdeIds } = await import_inquirer.default.prompt([
30105
- {
30106
- type: "checkbox",
30107
- name: "selectedIdeIds",
30108
- message: "Select IDEs to set up (Space to toggle, Enter to confirm):",
30109
- choices: installedIDEs.map((ide) => ({
30110
- name: `${ide.icon} ${ide.displayName}${ide.version ? import_chalk2.default.gray(` v${ide.version}`) : ""}`,
30111
- value: ide.id,
30112
- checked: true
30113
- // All selected by default
30114
- })),
30115
- validate: (input) => input.length > 0 ? true : "Select at least one IDE"
30116
- }
30117
- ]);
30118
- selectedIDEs = installedIDEs.filter((i) => selectedIdeIds.includes(i.id));
30481
+ } else {
30482
+ const { selectedIdeIds } = await import_inquirer.default.prompt([
30483
+ {
30484
+ type: "checkbox",
30485
+ name: "selectedIdeIds",
30486
+ message: "Select IDEs to set up (Space to toggle, Enter to confirm):",
30487
+ choices: installedIDEs.map((ide) => ({
30488
+ name: `${ide.icon} ${ide.displayName}${ide.version ? import_chalk2.default.gray(` v${ide.version}`) : ""}`,
30489
+ value: ide.id,
30490
+ checked: true
30491
+ // All selected by default
30492
+ })),
30493
+ validate: (input) => input.length > 0 ? true : "Select at least one IDE"
30494
+ }
30495
+ ]);
30496
+ selectedIDEs = installedIDEs.filter((i) => selectedIdeIds.includes(i.id));
30497
+ }
30119
30498
  }
30120
30499
  console.log(DIVIDER);
30121
30500
  const loginResult = await loginFlow();
30122
30501
  if (!loginResult) {
30123
30502
  console.log(import_chalk2.default.yellow("\u26A0 Setup completed without login. You can login later with `adhdev setup`."));
30124
30503
  }
30125
- if (loginResult?.connectionToken) {
30504
+ if (loginResult?.connectionToken && selectedIDEs.length > 0) {
30126
30505
  for (const ide of selectedIDEs) {
30127
30506
  await injectTokenToIDE(ide, loginResult.connectionToken);
30128
30507
  }
30129
30508
  }
30130
30509
  const ideIds = selectedIDEs.map((i) => i.id);
30131
- (0, import_daemon_core5.markSetupComplete)(ideIds, ["adhdev"]);
30510
+ (0, import_daemon_core5.markSetupComplete)(ideIds.length > 0 ? ideIds : ["daemon-only"], ["adhdev"]);
30132
30511
  if (loginResult) {
30133
30512
  (0, import_daemon_core5.updateConfig)({
30134
30513
  connectionToken: loginResult.connectionToken,
@@ -30138,10 +30517,14 @@ async function quickSetup() {
30138
30517
  }
30139
30518
  console.log(DIVIDER);
30140
30519
  console.log(import_chalk2.default.bold("\n\u{1F389} Setup Complete!\n"));
30141
- if (selectedIDEs.length === 1) {
30142
- console.log(` ${import_chalk2.default.bold("IDE:")} ${selectedIDEs[0].icon} ${selectedIDEs[0].displayName}`);
30520
+ if (selectedIDEs.length > 0) {
30521
+ if (selectedIDEs.length === 1) {
30522
+ console.log(` ${import_chalk2.default.bold("IDE:")} ${selectedIDEs[0].icon} ${selectedIDEs[0].displayName}`);
30523
+ } else {
30524
+ console.log(` ${import_chalk2.default.bold("IDEs:")} ${selectedIDEs.map((i) => `${i.icon} ${i.displayName}`).join(", ")}`);
30525
+ }
30143
30526
  } else {
30144
- console.log(` ${import_chalk2.default.bold("IDEs:")} ${selectedIDEs.map((i) => `${i.icon} ${i.displayName}`).join(", ")}`);
30527
+ console.log(` ${import_chalk2.default.bold("IDEs:")} ${import_chalk2.default.gray("None detected (daemon will auto-detect at runtime)")}`);
30145
30528
  }
30146
30529
  console.log(` ${import_chalk2.default.bold("User:")} ${loginResult?.email || "not logged in"}`);
30147
30530
  console.log(` ${import_chalk2.default.bold("Status:")} ${import_chalk2.default.green("Ready to connect")}`);
@@ -30164,7 +30547,26 @@ async function customSetup() {
30164
30547
  const installedIDEs = ides.filter((i) => i.installed);
30165
30548
  spinner.stop();
30166
30549
  if (installedIDEs.length === 0) {
30167
- console.log(import_chalk2.default.yellow("\u26A0 No supported IDEs found."));
30550
+ console.log(import_chalk2.default.yellow("\u26A0 No supported IDEs auto-detected."));
30551
+ console.log(import_chalk2.default.gray(" The daemon will detect IDEs at runtime via CDP."));
30552
+ console.log();
30553
+ console.log(DIVIDER);
30554
+ const loginResult2 = await loginFlow();
30555
+ (0, import_daemon_core5.markSetupComplete)(["daemon-only"], ["adhdev"]);
30556
+ if (loginResult2) {
30557
+ (0, import_daemon_core5.updateConfig)({
30558
+ connectionToken: loginResult2.connectionToken,
30559
+ userEmail: loginResult2.email,
30560
+ userName: loginResult2.name
30561
+ });
30562
+ }
30563
+ console.log(DIVIDER);
30564
+ console.log(import_chalk2.default.bold("\n\u{1F389} Setup Complete!\n"));
30565
+ console.log(` ${import_chalk2.default.bold("IDEs:")} ${import_chalk2.default.gray("None detected (daemon will auto-detect at runtime)")}`);
30566
+ console.log(` ${import_chalk2.default.bold("User:")} ${loginResult2?.email || "not logged in"}`);
30567
+ console.log(` ${import_chalk2.default.bold("Status:")} ${import_chalk2.default.green("Ready to connect")}`);
30568
+ console.log();
30569
+ await startDaemonFlow();
30168
30570
  return;
30169
30571
  }
30170
30572
  console.log(import_chalk2.default.green(`Found ${installedIDEs.length} IDE(s):