@adhdev/daemon-core 0.6.48 → 0.6.50

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.d.ts CHANGED
@@ -179,9 +179,13 @@ interface ADHDevConfig {
179
179
  disableUpstream?: boolean;
180
180
  }
181
181
  interface CliHistoryEntry {
182
+ category?: 'ide' | 'cli' | 'acp';
182
183
  cliType: string;
183
184
  dir: string;
184
185
  cliArgs?: string[];
186
+ workspace?: string;
187
+ newWindow?: boolean;
188
+ model?: string;
185
189
  timestamp: number;
186
190
  label?: string;
187
191
  }
@@ -210,7 +214,7 @@ declare function isSetupComplete(): boolean;
210
214
  */
211
215
  declare function resetConfig(): void;
212
216
  /**
213
- * Add CLI launch to history (max 20, dedup by cliType+dir+args)
217
+ * Add launch to history (max 20, dedup by category+type+dir+args+workspace+model)
214
218
  */
215
219
  declare function addCliHistory(entry: Omit<CliHistoryEntry, 'timestamp'>): void;
216
220
 
package/dist/index.js CHANGED
@@ -320,14 +320,26 @@ function addCliHistory(entry) {
320
320
  const config = loadConfig();
321
321
  const history = config.cliHistory || [];
322
322
  const argsKey = (entry.cliArgs || []).join(" ");
323
+ const category = entry.category || "cli";
324
+ const workspaceKey = entry.workspace || "";
325
+ const modelKey = entry.model || "";
323
326
  const filtered = history.filter((h) => {
324
327
  const hArgsKey = (h.cliArgs || []).join(" ");
325
- return !(h.cliType === entry.cliType && h.dir === entry.dir && hArgsKey === argsKey);
328
+ return !((h.category || "cli") === category && h.cliType === entry.cliType && h.dir === entry.dir && hArgsKey === argsKey && (h.workspace || "") === workspaceKey && (h.model || "") === modelKey);
326
329
  });
327
330
  filtered.unshift({
328
331
  ...entry,
332
+ category,
329
333
  timestamp: Date.now(),
330
- label: entry.label || `${entry.cliType} \xB7 ${entry.dir.split("/").filter(Boolean).pop() || "root"}${argsKey ? ` (${argsKey})` : ""}`
334
+ label: entry.label || (() => {
335
+ const base = `${entry.cliType} \xB7 ${entry.dir.split("/").filter(Boolean).pop() || "root"}`;
336
+ const suffix = [];
337
+ if (entry.workspace && entry.workspace !== entry.dir) suffix.push(entry.workspace.split("/").filter(Boolean).pop() || entry.workspace);
338
+ if (entry.model) suffix.push(`model=${entry.model}`);
339
+ if (argsKey) suffix.push(argsKey);
340
+ if (entry.newWindow) suffix.push("new window");
341
+ return suffix.length > 0 ? `${base} (${suffix.join(" \xB7 ")})` : base;
342
+ })()
331
343
  });
332
344
  config.cliHistory = filtered.slice(0, 20);
333
345
  saveConfig(config);
@@ -7041,6 +7053,7 @@ function getAvailableIdeIds() {
7041
7053
  // src/commands/router.ts
7042
7054
  init_config();
7043
7055
  init_workspaces();
7056
+ init_config();
7044
7057
  init_logger();
7045
7058
 
7046
7059
  // src/logging/command-log.ts
@@ -7307,6 +7320,18 @@ var DaemonCommandRouter = class {
7307
7320
  };
7308
7321
  LOG.info("LaunchIDE", `target=${ideKey || "auto"}`);
7309
7322
  const result = await launchWithCdp(launchArgs);
7323
+ if (result.success && (result.ideId || ideKey)) {
7324
+ try {
7325
+ addCliHistory({
7326
+ category: "ide",
7327
+ cliType: result.ideId || ideKey,
7328
+ dir: resolvedWorkspace || "",
7329
+ workspace: resolvedWorkspace || "",
7330
+ newWindow: args?.newWindow === true
7331
+ });
7332
+ } catch {
7333
+ }
7334
+ }
7310
7335
  if (result.success && result.port && result.ideId && !this.deps.cdpManagers.has(result.ideId)) {
7311
7336
  const logFn = this.deps.getCdpLogFn ? this.deps.getCdpLogFn(result.ideId) : LOG.forComponent(`CDP:${result.ideId}`).asLogFn();
7312
7337
  const provider = this.deps.providerLoader.getMeta(result.ideId);
@@ -8924,7 +8949,7 @@ ${installInfo}`
8924
8949
  }
8925
8950
  }
8926
8951
  try {
8927
- addCliHistory({ cliType: normalizedType, dir: resolvedDir, cliArgs });
8952
+ addCliHistory({ category: "acp", cliType: normalizedType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel });
8928
8953
  } catch (e) {
8929
8954
  LOG.warn("CLI", `ACP history save failed: ${e?.message}`);
8930
8955
  }
@@ -9013,7 +9038,7 @@ ${installInfo}`
9013
9038
  console.log(import_chalk.default.green(` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
9014
9039
  }
9015
9040
  try {
9016
- addCliHistory({ cliType, dir: resolvedDir, cliArgs });
9041
+ addCliHistory({ category: "cli", cliType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel });
9017
9042
  } catch (e) {
9018
9043
  LOG.warn("CLI", `CLI history save failed: ${e?.message}`);
9019
9044
  }