@adhdev/daemon-core 0.6.49 → 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 +5 -1
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/providers/_builtin/registry.json +1 -1
- package/src/commands/cli-manager.ts +2 -2
- package/src/commands/router.ts +12 -0
- package/src/config/config.ts +27 -4
package/package.json
CHANGED
|
@@ -165,7 +165,7 @@ export class DaemonCliManager {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
try { addCliHistory({ cliType: normalizedType, dir: resolvedDir, cliArgs }); } catch (e) { LOG.warn('CLI', `ACP history save failed: ${(e as Error)?.message}`); }
|
|
168
|
+
try { addCliHistory({ category: 'acp', cliType: normalizedType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel }); } catch (e) { LOG.warn('CLI', `ACP history save failed: ${(e as Error)?.message}`); }
|
|
169
169
|
this.deps.onStatusChange();
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
@@ -261,7 +261,7 @@ export class DaemonCliManager {
|
|
|
261
261
|
console.log(chalk.green(` ✓ CLI started: ${cliInfo.displayName} v${cliInfo.version || 'unknown'} in ${resolvedDir}`));
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
try { addCliHistory({ cliType, dir: resolvedDir, cliArgs }); } catch (e) { LOG.warn('CLI', `CLI history save failed: ${(e as Error)?.message}`); }
|
|
264
|
+
try { addCliHistory({ category: 'cli', cliType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel }); } catch (e) { LOG.warn('CLI', `CLI history save failed: ${(e as Error)?.message}`); }
|
|
265
265
|
|
|
266
266
|
this.deps.onStatusChange();
|
|
267
267
|
}
|
package/src/commands/router.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { launchWithCdp, killIdeProcess, isIdeRunning } from '../launch.js';
|
|
|
20
20
|
import { loadConfig, saveConfig, updateConfig } from '../config/config.js';
|
|
21
21
|
import { resolveIdeLaunchWorkspace } from '../config/workspaces.js';
|
|
22
22
|
import { appendWorkspaceActivity } from '../config/workspace-activity.js';
|
|
23
|
+
import { addCliHistory } from '../config/config.js';
|
|
23
24
|
import { detectIDEs } from '../detection/ide-detector.js';
|
|
24
25
|
import { LOG } from '../logging/logger.js';
|
|
25
26
|
import { logCommand } from '../logging/command-log.js';
|
|
@@ -207,6 +208,17 @@ export class DaemonCommandRouter {
|
|
|
207
208
|
};
|
|
208
209
|
LOG.info('LaunchIDE', `target=${ideKey || 'auto'}`);
|
|
209
210
|
const result = await launchWithCdp(launchArgs);
|
|
211
|
+
if (result.success && (result.ideId || ideKey)) {
|
|
212
|
+
try {
|
|
213
|
+
addCliHistory({
|
|
214
|
+
category: 'ide',
|
|
215
|
+
cliType: result.ideId || ideKey,
|
|
216
|
+
dir: resolvedWorkspace || '',
|
|
217
|
+
workspace: resolvedWorkspace || '',
|
|
218
|
+
newWindow: args?.newWindow === true,
|
|
219
|
+
});
|
|
220
|
+
} catch { /* ignore history failure */ }
|
|
221
|
+
}
|
|
210
222
|
|
|
211
223
|
if (result.success && result.port && result.ideId && !this.deps.cdpManagers.has(result.ideId)) {
|
|
212
224
|
const logFn = this.deps.getCdpLogFn
|
package/src/config/config.ts
CHANGED
|
@@ -87,9 +87,13 @@ export interface ADHDevConfig {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export interface CliHistoryEntry {
|
|
90
|
+
category?: 'ide' | 'cli' | 'acp';
|
|
90
91
|
cliType: string;
|
|
91
92
|
dir: string;
|
|
92
93
|
cliArgs?: string[];
|
|
94
|
+
workspace?: string;
|
|
95
|
+
newWindow?: boolean;
|
|
96
|
+
model?: string;
|
|
93
97
|
timestamp: number;
|
|
94
98
|
label?: string;
|
|
95
99
|
}
|
|
@@ -255,24 +259,43 @@ export function generateConnectionToken(): string {
|
|
|
255
259
|
return token;
|
|
256
260
|
}
|
|
257
261
|
/**
|
|
258
|
-
* Add
|
|
262
|
+
* Add launch to history (max 20, dedup by category+type+dir+args+workspace+model)
|
|
259
263
|
*/
|
|
260
264
|
export function addCliHistory(entry: Omit<CliHistoryEntry, 'timestamp'>): void {
|
|
261
265
|
const config = loadConfig();
|
|
262
266
|
const history = config.cliHistory || [];
|
|
263
267
|
const argsKey = (entry.cliArgs || []).join(' ');
|
|
268
|
+
const category = entry.category || 'cli';
|
|
269
|
+
const workspaceKey = entry.workspace || '';
|
|
270
|
+
const modelKey = entry.model || '';
|
|
264
271
|
|
|
265
|
-
// Remove duplicate (same
|
|
272
|
+
// Remove duplicate (same category + type + dir + args + workspace + model)
|
|
266
273
|
const filtered = history.filter(h => {
|
|
267
274
|
const hArgsKey = (h.cliArgs || []).join(' ');
|
|
268
|
-
return !(
|
|
275
|
+
return !(
|
|
276
|
+
(h.category || 'cli') === category &&
|
|
277
|
+
h.cliType === entry.cliType &&
|
|
278
|
+
h.dir === entry.dir &&
|
|
279
|
+
hArgsKey === argsKey &&
|
|
280
|
+
(h.workspace || '') === workspaceKey &&
|
|
281
|
+
(h.model || '') === modelKey
|
|
282
|
+
);
|
|
269
283
|
});
|
|
270
284
|
|
|
271
285
|
// Add to front
|
|
272
286
|
filtered.unshift({
|
|
273
287
|
...entry,
|
|
288
|
+
category,
|
|
274
289
|
timestamp: Date.now(),
|
|
275
|
-
label: entry.label ||
|
|
290
|
+
label: entry.label || (() => {
|
|
291
|
+
const base = `${entry.cliType} · ${entry.dir.split('/').filter(Boolean).pop() || 'root'}`;
|
|
292
|
+
const suffix: string[] = [];
|
|
293
|
+
if (entry.workspace && entry.workspace !== entry.dir) suffix.push(entry.workspace.split('/').filter(Boolean).pop() || entry.workspace);
|
|
294
|
+
if (entry.model) suffix.push(`model=${entry.model}`);
|
|
295
|
+
if (argsKey) suffix.push(argsKey);
|
|
296
|
+
if (entry.newWindow) suffix.push('new window');
|
|
297
|
+
return suffix.length > 0 ? `${base} (${suffix.join(' · ')})` : base;
|
|
298
|
+
})(),
|
|
276
299
|
});
|
|
277
300
|
|
|
278
301
|
// Keep max 20
|