@adhdev/daemon-core 0.7.37 → 0.7.39

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.
Files changed (93) hide show
  1. package/dist/agent-stream/forward.d.ts +8 -0
  2. package/dist/agent-stream/index.d.ts +6 -0
  3. package/dist/agent-stream/manager.d.ts +59 -0
  4. package/dist/agent-stream/poller.d.ts +41 -0
  5. package/dist/agent-stream/provider-adapter.d.ts +29 -0
  6. package/dist/agent-stream/types.d.ts +62 -0
  7. package/dist/boot/daemon-lifecycle.d.ts +97 -0
  8. package/dist/cdp/devtools.d.ts +51 -0
  9. package/dist/cdp/initializer.d.ts +50 -0
  10. package/dist/cdp/manager.d.ts +145 -0
  11. package/dist/cdp/scanner.d.ts +58 -0
  12. package/dist/cdp/setup.d.ts +58 -0
  13. package/dist/cli-adapter-types.d.ts +25 -0
  14. package/dist/cli-adapters/provider-cli-adapter.d.ts +229 -0
  15. package/dist/cli-adapters/pty-transport.d.ts +43 -0
  16. package/dist/cli-adapters/session-host-transport.d.ts +19 -0
  17. package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +12 -0
  18. package/dist/cli-adapters/terminal-backends/types.d.ts +14 -0
  19. package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +13 -0
  20. package/dist/cli-adapters/terminal-screen.d.ts +27 -0
  21. package/dist/commands/cdp-commands.d.ts +15 -0
  22. package/dist/commands/chat-commands.d.ts +15 -0
  23. package/dist/commands/cli-manager.d.ts +82 -0
  24. package/dist/commands/handler.d.ts +101 -0
  25. package/dist/commands/router.d.ts +69 -0
  26. package/dist/commands/stream-commands.d.ts +13 -0
  27. package/dist/commands/workspace-commands.d.ts +11 -0
  28. package/dist/config/chat-history.d.ts +60 -0
  29. package/dist/config/config.d.ts +101 -0
  30. package/dist/config/recent-activity.d.ts +27 -0
  31. package/dist/config/workspaces.d.ts +82 -0
  32. package/dist/daemon/dev-auto-implement.d.ts +26 -0
  33. package/dist/daemon/dev-cdp-handlers.d.ts +22 -0
  34. package/dist/daemon/dev-cli-debug.d.ts +24 -0
  35. package/dist/daemon/dev-server-types.d.ts +43 -0
  36. package/dist/daemon/dev-server.d.ts +133 -0
  37. package/dist/daemon/scaffold-template.d.ts +32 -0
  38. package/dist/daemon-core.d.ts +36 -0
  39. package/dist/detection/cli-detector.d.ts +27 -0
  40. package/dist/detection/ide-detector.d.ts +34 -0
  41. package/dist/index.d.ts +72 -2499
  42. package/dist/index.js +458 -637
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.mjs +465 -642
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/installer.d.ts +50 -0
  47. package/dist/ipc-protocol.d.ts +111 -0
  48. package/dist/launch.d.ts +46 -0
  49. package/dist/logging/command-log.d.ts +31 -0
  50. package/dist/logging/logger.d.ts +87 -0
  51. package/dist/providers/acp-provider-instance.d.ts +101 -0
  52. package/dist/providers/cli-provider-instance.d.ts +43 -0
  53. package/dist/providers/contracts.d.ts +483 -0
  54. package/dist/providers/extension-provider-instance.d.ts +44 -0
  55. package/dist/providers/ide-provider-instance.d.ts +61 -0
  56. package/dist/providers/index.d.ts +5 -0
  57. package/dist/providers/provider-instance-manager.d.ts +84 -0
  58. package/dist/providers/provider-instance.d.ts +148 -0
  59. package/dist/providers/provider-loader.d.ts +270 -0
  60. package/dist/providers/status-monitor.d.ts +48 -0
  61. package/dist/providers/version-archive.d.ts +52 -0
  62. package/dist/session-host/runtime-support.d.ts +8 -0
  63. package/dist/sessions/registry.d.ts +24 -0
  64. package/dist/shared-types-extra.d.ts +29 -0
  65. package/dist/shared-types.d.ts +213 -0
  66. package/dist/status/builders.d.ts +33 -0
  67. package/dist/status/normalize.d.ts +14 -1
  68. package/dist/status/reporter.d.ts +69 -0
  69. package/dist/status/snapshot.d.ts +38 -0
  70. package/dist/system/host-memory.d.ts +19 -0
  71. package/dist/types.d.ts +123 -0
  72. package/node_modules/@adhdev/session-host-core/package.json +1 -1
  73. package/package.json +3 -2
  74. package/src/commands/cli-manager.ts +1 -26
  75. package/src/commands/handler.ts +0 -31
  76. package/src/commands/router.ts +1 -18
  77. package/src/commands/stream-commands.ts +2 -4
  78. package/src/commands/workspace-commands.ts +9 -23
  79. package/src/config/config.ts +1 -78
  80. package/src/config/workspaces.ts +0 -24
  81. package/src/index.ts +16 -15
  82. package/src/providers/provider-loader.ts +13 -5
  83. package/src/shared-types-extra.ts +34 -0
  84. package/src/shared-types.ts +14 -27
  85. package/src/status/builders.ts +12 -0
  86. package/src/status/reporter.ts +1 -0
  87. package/src/status/snapshot.ts +26 -13
  88. package/src/types.ts +3 -8
  89. package/dist/index.d.mts +0 -2504
  90. package/dist/normalize-DVI4Lo5I.d.mts +0 -947
  91. package/dist/normalize-DVI4Lo5I.d.ts +0 -947
  92. package/dist/status/normalize.d.mts +0 -1
  93. package/src/config/workspace-activity.ts +0 -65
@@ -18,8 +18,6 @@ import type { ProviderInstanceManager } from '../providers/provider-instance-man
18
18
  import { launchWithCdp, killIdeProcess, isIdeRunning } from '../launch.js';
19
19
  import { loadConfig, saveConfig, updateConfig } from '../config/config.js';
20
20
  import { resolveIdeLaunchWorkspace } from '../config/workspaces.js';
21
- import { appendWorkspaceActivity } from '../config/workspace-activity.js';
22
- import { addCliHistory } from '../config/config.js';
23
21
  import { appendRecentActivity, buildRecentActivityKey, markRecentSessionSeen } from '../config/recent-activity.js';
24
22
  import { detectIDEs } from '../detection/ide-detector.js';
25
23
  import { SessionRegistry } from '../sessions/registry.js';
@@ -208,17 +206,6 @@ export class DaemonCommandRouter {
208
206
  };
209
207
  LOG.info('LaunchIDE', `target=${ideKey || 'auto'}`);
210
208
  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
- }
222
209
 
223
210
  if (result.success && result.port && result.ideId && !this.deps.cdpManagers.has(result.ideId)) {
224
211
  const logFn = this.deps.getCdpLogFn
@@ -241,11 +228,7 @@ export class DaemonCommandRouter {
241
228
  this.deps.onIdeConnected?.();
242
229
  if (result.success && resolvedWorkspace) {
243
230
  try {
244
- let next = appendWorkspaceActivity(loadConfig(), resolvedWorkspace, {
245
- kind: 'ide',
246
- agentType: result.ideId,
247
- });
248
- next = appendRecentActivity(next, {
231
+ const next = appendRecentActivity(loadConfig(), {
249
232
  kind: 'ide',
250
233
  providerType: result.ideId || ideKey,
251
234
  providerName: result.ideId || ideKey,
@@ -5,7 +5,6 @@
5
5
 
6
6
  import type { CommandResult, CommandHelpers } from './handler.js';
7
7
  import type { ProviderLoader } from '../providers/provider-loader.js';
8
- import { loadConfig } from '../config/config.js';
9
8
  import { LOG } from '../logging/logger.js';
10
9
 
11
10
  export async function handleFocusSession(h: CommandHelpers, args: any): Promise<CommandResult> {
@@ -193,14 +192,13 @@ export function handleGetIdeExtensions(h: CommandHelpers, args: any): CommandRes
193
192
  if (!loader) return { success: false, error: 'ProviderLoader not initialized' };
194
193
 
195
194
  const allExtProviders = loader.getByCategory?.('extension') || [];
196
- const config = loadConfig();
197
195
 
198
196
  if (ideType) {
199
197
  const extensions = allExtProviders.map(p => ({
200
198
  type: p.type,
201
199
  name: p.name,
202
200
  extensionId: p.extensionId,
203
- enabled: config.ideSettings?.[ideType]?.extensions?.[p.type]?.enabled === true,
201
+ enabled: loader.getIdeExtensionEnabledState?.(ideType, p.type) === true,
204
202
  }));
205
203
  return { success: true, ideType, extensions };
206
204
  }
@@ -212,7 +210,7 @@ export function handleGetIdeExtensions(h: CommandHelpers, args: any): CommandRes
212
210
  type: p.type,
213
211
  name: p.name,
214
212
  extensionId: p.extensionId,
215
- enabled: config.ideSettings?.[ide]?.extensions?.[p.type]?.enabled === true,
213
+ enabled: loader.getIdeExtensionEnabledState?.(ide, p.type) === true,
216
214
  }));
217
215
  }
218
216
  return { success: true, ideExtensions: result };
@@ -4,7 +4,6 @@
4
4
 
5
5
  import { loadConfig, saveConfig } from '../config/config.js';
6
6
  import * as W from '../config/workspaces.js';
7
- import { appendWorkspaceActivity, getWorkspaceActivity, removeActivityForPath } from '../config/workspace-activity.js';
8
7
 
9
8
  export type WorkspaceCommandResult = { success: boolean;[key: string]: unknown };
10
9
 
@@ -16,8 +15,6 @@ export function handleWorkspaceList(): WorkspaceCommandResult {
16
15
  workspaces: state.workspaces,
17
16
  defaultWorkspaceId: state.defaultWorkspaceId,
18
17
  defaultWorkspacePath: state.defaultWorkspacePath,
19
- legacyRecentPaths: config.recentCliWorkspaces || [],
20
- activity: getWorkspaceActivity(config, 25),
21
18
  };
22
19
  }
23
20
 
@@ -31,10 +28,9 @@ export function handleWorkspaceAdd(args: any): WorkspaceCommandResult {
31
28
  const result = W.addWorkspaceEntry(config, rawPath, label, { createIfMissing });
32
29
  if ('error' in result) return { success: false, error: result.error };
33
30
 
34
- let cfg = appendWorkspaceActivity(result.config, result.entry.path, {});
35
- saveConfig(cfg);
36
- const state = W.getWorkspaceState(cfg);
37
- return { success: true, entry: result.entry, ...state, activity: getWorkspaceActivity(cfg, 25) };
31
+ saveConfig(result.config);
32
+ const state = W.getWorkspaceState(result.config);
33
+ return { success: true, entry: result.entry, ...state };
38
34
  }
39
35
 
40
36
  export function handleWorkspaceRemove(args: any): WorkspaceCommandResult {
@@ -46,13 +42,9 @@ export function handleWorkspaceRemove(args: any): WorkspaceCommandResult {
46
42
  const result = W.removeWorkspaceEntry(config, id);
47
43
  if ('error' in result) return { success: false, error: result.error };
48
44
 
49
- let cfg = result.config;
50
- if (removed) {
51
- cfg = removeActivityForPath(cfg, removed.path);
52
- }
53
- saveConfig(cfg);
54
- const state = W.getWorkspaceState(cfg);
55
- return { success: true, removedId: id, ...state, activity: getWorkspaceActivity(cfg, 25) };
45
+ saveConfig(result.config);
46
+ const state = W.getWorkspaceState(result.config);
47
+ return { success: true, removedId: id, ...state };
56
48
  }
57
49
 
58
50
  export function handleWorkspaceSetDefault(args: any): WorkspaceCommandResult {
@@ -66,7 +58,6 @@ export function handleWorkspaceSetDefault(args: any): WorkspaceCommandResult {
66
58
  return {
67
59
  success: true,
68
60
  ...state,
69
- activity: getWorkspaceActivity(result.config, 25),
70
61
  };
71
62
  }
72
63
 
@@ -98,12 +89,7 @@ export function handleWorkspaceSetDefault(args: any): WorkspaceCommandResult {
98
89
  const result = W.setDefaultWorkspaceId(config, nextId);
99
90
  if ('error' in result) return { success: false, error: result.error };
100
91
 
101
- let out = result.config;
102
- const ap = W.getDefaultWorkspacePath(out);
103
- if (ap) {
104
- out = appendWorkspaceActivity(out, ap, { kind: 'default' });
105
- }
106
- saveConfig(out);
107
- const state = W.getWorkspaceState(out);
108
- return { success: true, ...state, activity: getWorkspaceActivity(out, 25) };
92
+ saveConfig(result.config);
93
+ const state = W.getWorkspaceState(result.config);
94
+ return { success: true, ...state };
109
95
  }
@@ -8,12 +8,9 @@ import { homedir } from 'os';
8
8
  import { join } from 'path';
9
9
  import { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync } from 'fs';
10
10
  import { randomUUID } from 'crypto';
11
- import { migrateWorkspacesFromRecent } from './workspaces.js';
12
11
  import type { WorkspaceEntry } from './workspaces.js';
13
- import type { WorkspaceActivityEntry } from './workspace-activity.js';
14
12
  import type { RecentActivityEntry } from './recent-activity.js';
15
13
  export type { WorkspaceEntry } from './workspaces.js';
16
- export type { WorkspaceActivityEntry } from './workspace-activity.js';
17
14
  export type { RecentActivityEntry } from './recent-activity.js';
18
15
 
19
16
  export interface ADHDevConfig {
@@ -54,15 +51,12 @@ export interface ADHDevConfig {
54
51
 
55
52
  // Daemon: which IDEs to connect (empty = all)
56
53
  enabledIdes: string[];
57
- recentCliWorkspaces: string[];
58
54
 
59
55
  /** Saved workspaces for IDE/CLI/ACP launch (daemon-local) */
60
56
  workspaces?: WorkspaceEntry[];
61
57
  /** Default workspace id (from workspaces[]) — never used implicitly for launch */
62
58
  defaultWorkspaceId?: string | null;
63
59
 
64
- /** Recently used workspaces (IDE / CLI / ACP / default) for quick resume */
65
- recentWorkspaceActivity?: WorkspaceActivityEntry[];
66
60
  /** Unified recent activity across IDE / CLI / ACP launch flows */
67
61
  recentActivity?: RecentActivityEntry[];
68
62
  /** Last seen timestamps for machine-facing recent/session entries */
@@ -94,9 +88,6 @@ export interface ADHDevConfig {
94
88
  */
95
89
  registeredMachineId?: string;
96
90
 
97
- // CLI launch history
98
- cliHistory: CliHistoryEntry[];
99
-
100
91
  // Per-provider user config (public setting values)
101
92
  providerSettings: Record<string, Record<string, any>>;
102
93
 
@@ -113,18 +104,6 @@ export interface ADHDevConfig {
113
104
  providerDir?: string;
114
105
  }
115
106
 
116
- export interface CliHistoryEntry {
117
- category?: 'ide' | 'cli' | 'acp';
118
- cliType: string;
119
- dir: string;
120
- cliArgs?: string[];
121
- workspace?: string;
122
- newWindow?: boolean;
123
- model?: string;
124
- timestamp: number;
125
- label?: string;
126
- }
127
-
128
107
  const DEFAULT_CONFIG: ADHDevConfig = {
129
108
  serverUrl: 'https://api.adhf.dev',
130
109
  apiToken: null,
@@ -140,17 +119,14 @@ const DEFAULT_CONFIG: ADHDevConfig = {
140
119
  setupDate: null,
141
120
  configuredCLIs: [],
142
121
  enabledIdes: [],
143
- recentCliWorkspaces: [],
144
122
  workspaces: [],
145
123
  defaultWorkspaceId: null,
146
- recentWorkspaceActivity: [],
147
124
  recentActivity: [],
148
125
  recentSessionReads: {},
149
126
  machineNickname: null,
150
127
  machineId: undefined,
151
128
  machineSecret: null,
152
129
  registeredMachineId: undefined,
153
- cliHistory: [],
154
130
  providerSettings: {},
155
131
  ideSettings: {},
156
132
  disableUpstream: false,
@@ -227,18 +203,9 @@ export function loadConfig(): ADHDevConfig {
227
203
  (merged as ADHDevConfig).defaultWorkspaceId = merged.activeWorkspaceId;
228
204
  }
229
205
  delete (merged as any).activeWorkspaceId;
230
- const hadStoredWorkspaces = Array.isArray(parsed.workspaces) && parsed.workspaces.length > 0;
231
206
  const ensured = ensureMachineId(merged);
232
207
  const normalized = ensured.config as ADHDevConfig & { activeWorkspaceId?: string | null };
233
- migrateWorkspacesFromRecent(normalized);
234
-
235
- let configChanged = ensured.changed;
236
-
237
- if (!hadStoredWorkspaces && (normalized.workspaces?.length || 0) > 0) {
238
- configChanged = true;
239
- }
240
-
241
- if (configChanged) {
208
+ if (ensured.changed) {
242
209
  try {
243
210
  saveConfig(normalized);
244
211
  } catch { /* ignore */ }
@@ -318,47 +285,3 @@ export function generateConnectionToken(): string {
318
285
  }
319
286
  return token;
320
287
  }
321
- /**
322
- * Add launch to history (max 20, dedup by category+type+dir+args+workspace+model)
323
- */
324
- export function addCliHistory(entry: Omit<CliHistoryEntry, 'timestamp'>): void {
325
- const config = loadConfig();
326
- const history = config.cliHistory || [];
327
- const argsKey = (entry.cliArgs || []).join(' ');
328
- const category = entry.category || 'cli';
329
- const workspaceKey = entry.workspace || '';
330
- const modelKey = entry.model || '';
331
-
332
- // Remove duplicate (same category + type + dir + args + workspace + model)
333
- const filtered = history.filter(h => {
334
- const hArgsKey = (h.cliArgs || []).join(' ');
335
- return !(
336
- (h.category || 'cli') === category &&
337
- h.cliType === entry.cliType &&
338
- h.dir === entry.dir &&
339
- hArgsKey === argsKey &&
340
- (h.workspace || '') === workspaceKey &&
341
- (h.model || '') === modelKey
342
- );
343
- });
344
-
345
- // Add to front
346
- filtered.unshift({
347
- ...entry,
348
- category,
349
- timestamp: Date.now(),
350
- label: entry.label || (() => {
351
- const base = `${entry.cliType} · ${entry.dir.split('/').filter(Boolean).pop() || 'root'}`;
352
- const suffix: string[] = [];
353
- if (entry.workspace && entry.workspace !== entry.dir) suffix.push(entry.workspace.split('/').filter(Boolean).pop() || entry.workspace);
354
- if (entry.model) suffix.push(`model=${entry.model}`);
355
- if (argsKey) suffix.push(argsKey);
356
- if (entry.newWindow) suffix.push('new window');
357
- return suffix.length > 0 ? `${base} (${suffix.join(' · ')})` : base;
358
- })(),
359
- });
360
-
361
- // Keep max 20
362
- config.cliHistory = filtered.slice(0, 20);
363
- saveConfig(config);
364
- }
@@ -42,30 +42,6 @@ export function defaultWorkspaceLabel(absPath: string): string {
42
42
  return base;
43
43
  }
44
44
 
45
- /**
46
- * Ensure config.workspaces exists; seed from recentCliWorkspaces once (same paths).
47
- */
48
- export function migrateWorkspacesFromRecent(config: ADHDevConfig): ADHDevConfig {
49
- if (!config.workspaces) config.workspaces = [];
50
- if (config.workspaces.length > 0) return config;
51
-
52
- const recent = config.recentCliWorkspaces || [];
53
- const now = Date.now();
54
- for (const raw of recent) {
55
- const abs = expandPath(raw);
56
- if (!abs || validateWorkspacePath(abs).ok !== true) continue;
57
- if (config.workspaces.some(w => path.resolve(w.path) === abs)) continue;
58
- config.workspaces.push({
59
- id: randomUUID(),
60
- path: abs,
61
- label: defaultWorkspaceLabel(abs),
62
- addedAt: now,
63
- });
64
- if (config.workspaces.length >= MAX_WORKSPACES) break;
65
- }
66
- return config;
67
- }
68
-
69
45
  export function getDefaultWorkspacePath(config: ADHDevConfig): string | null {
70
46
  const id = config.defaultWorkspaceId;
71
47
  if (!id) return null;
package/src/index.ts CHANGED
@@ -33,7 +33,6 @@ export type {
33
33
  MachineInfo,
34
34
  DetectedIdeInfo,
35
35
  WorkspaceEntry,
36
- WorkspaceActivity,
37
36
  ProviderStatus,
38
37
  ProviderErrorReason,
39
38
  ActiveChatData,
@@ -43,26 +42,28 @@ export type {
43
42
  ExtensionProviderState,
44
43
  } from './shared-types.js';
45
44
 
46
- export interface RecentSessionEntry {
47
- id: string;
48
- sessionId?: string | null;
49
- providerType: string;
50
- providerName: string;
51
- kind: 'ide' | 'cli' | 'acp';
52
- title: string;
53
- workspace?: string | null;
54
- currentModel?: string;
55
- status?: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
56
- lastUsedAt: number;
57
- }
45
+ // These types live in shared-types-extra.ts — imported directly because
46
+ // rollup-dts cannot resolve re-exports from shared-types.ts for them.
47
+ import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
48
+ import type { RuntimeAttachedClient as _RuntimeAttachedClient } from './shared-types-extra.js';
49
+ import type { RecentSessionEntry as _RecentSessionEntry } from './shared-types.js';
50
+ import type { TerminalBackendStatus as _TerminalBackendStatus } from './shared-types-extra.js';
51
+ export type RuntimeWriteOwner = _RuntimeWriteOwner;
52
+ export type RuntimeAttachedClient = _RuntimeAttachedClient;
53
+ export type RecentSessionEntry = _RecentSessionEntry;
54
+ export type TerminalBackendStatus = _TerminalBackendStatus;
55
+
56
+ // Type aliases — rollup-dts cannot bundle re-exported type aliases at all.
57
+ // Canonical definition lives in shared-types-extra.ts — keep these in sync.
58
+ export type SessionStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
59
+ export type RecentSessionBucket = 'needs_attention' | 'working' | 'task_complete' | 'idle';
58
60
 
59
61
  // ── Core Interface ──
60
62
  export type { IDaemonCore, DaemonCoreOptions } from './daemon-core.js';
61
63
 
62
64
  // ── Config ──
63
- export { loadConfig, saveConfig, resetConfig, isSetupComplete, addCliHistory, markSetupComplete, updateConfig } from './config/config.js';
65
+ export { loadConfig, saveConfig, resetConfig, isSetupComplete, markSetupComplete, updateConfig } from './config/config.js';
64
66
  export { getWorkspaceState } from './config/workspaces.js';
65
- export { getWorkspaceActivity } from './config/workspace-activity.js';
66
67
  export { appendRecentActivity, getRecentActivity } from './config/recent-activity.js';
67
68
  export type { RecentActivityEntry } from './config/recent-activity.js';
68
69
 
@@ -284,16 +284,24 @@ export class ProviderLoader {
284
284
  isEnabled(type: string, ideType?: string): boolean {
285
285
  if (!ideType) return true;
286
286
  try {
287
- const { loadConfig } = require('../config/config.js');
288
- const config = loadConfig();
289
- const baseIdeType = ideType.split('_')[0];
290
- const val = config.ideSettings?.[baseIdeType]?.extensions?.[type]?.enabled;
291
- return val === true; // undefined → false (default inactive)
287
+ return this.getIdeExtensionEnabledState(ideType, type);
292
288
  } catch {
293
289
  return false;
294
290
  }
295
291
  }
296
292
 
293
+ /**
294
+ * Resolve per-IDE extension enabled state using the same normalization
295
+ * that runtime attach/remove uses.
296
+ */
297
+ getIdeExtensionEnabledState(ideType: string, extensionType: string): boolean {
298
+ const { loadConfig } = require('../config/config.js');
299
+ const config = loadConfig();
300
+ const baseIdeType = ideType.split('_')[0];
301
+ const val = config.ideSettings?.[baseIdeType]?.extensions?.[extensionType]?.enabled;
302
+ return val === true;
303
+ }
304
+
297
305
  /**
298
306
  * Save IDE extension enabled setting
299
307
  */
@@ -0,0 +1,34 @@
1
+ /**
2
+ * ADHDev Shared Types — Additional cross-package type definitions
3
+ *
4
+ * Extracted common sub-types previously inlined across multiple packages.
5
+ * Separated from shared-types.ts due to rollup-dts bundling constraints.
6
+ *
7
+ * IMPORTANT: This file must remain runtime-free (types only).
8
+ */
9
+
10
+ /** Runtime terminal write-owner descriptor */
11
+ export interface RuntimeWriteOwner {
12
+ clientId: string;
13
+ ownerType: 'agent' | 'user';
14
+ }
15
+
16
+ /** Runtime attached client descriptor */
17
+ export interface RuntimeAttachedClient {
18
+ clientId: string;
19
+ type: 'daemon' | 'web' | 'local-terminal';
20
+ readOnly: boolean;
21
+ }
22
+
23
+ /** Session status union (used by SessionEntry.status, RecentSessionEntry.status, etc.) */
24
+ export type SessionStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
25
+
26
+ /** Inbox bucket categories for recent sessions */
27
+ export type RecentSessionBucket = 'needs_attention' | 'working' | 'task_complete' | 'idle';
28
+
29
+ /** Terminal backend status */
30
+ export interface TerminalBackendStatus {
31
+ backend: 'xterm' | 'ghostty-vt';
32
+ preference: 'auto' | 'xterm' | 'ghostty-vt';
33
+ ghosttyAvailable: boolean;
34
+ }
@@ -86,6 +86,9 @@ export type SessionCapability =
86
86
  | 'set_mode'
87
87
  | 'set_thought_level';
88
88
 
89
+ import type { RuntimeWriteOwner, RuntimeAttachedClient, SessionStatus } from './shared-types-extra.js';
90
+ export type { RuntimeWriteOwner, RuntimeAttachedClient, SessionStatus } from './shared-types-extra.js';
91
+
89
92
  export interface SessionEntry {
90
93
  id: string;
91
94
  parentId: string | null;
@@ -93,21 +96,14 @@ export interface SessionEntry {
93
96
  providerName: string;
94
97
  kind: SessionKind;
95
98
  transport: SessionTransport;
96
- status: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
99
+ status: SessionStatus;
97
100
  title: string;
98
101
  workspace: string | null;
99
102
  runtimeKey?: string;
100
103
  runtimeDisplayName?: string;
101
104
  runtimeWorkspaceLabel?: string;
102
- runtimeWriteOwner?: {
103
- clientId: string;
104
- ownerType: 'agent' | 'user';
105
- } | null;
106
- runtimeAttachedClients?: {
107
- clientId: string;
108
- type: 'daemon' | 'web' | 'local-terminal';
109
- readOnly: boolean;
110
- }[];
105
+ runtimeWriteOwner?: RuntimeWriteOwner | null;
106
+ runtimeAttachedClients?: RuntimeAttachedClient[];
111
107
  resume?: ProviderResumeCapability;
112
108
  activeChat: _ActiveChatData | null;
113
109
  capabilities: SessionCapability[];
@@ -128,6 +124,7 @@ export interface SessionEntry {
128
124
  unread?: boolean;
129
125
  lastSeenAt?: number;
130
126
  inboxBucket?: RecentSessionBucket;
127
+ surfaceHidden?: boolean;
131
128
  }
132
129
 
133
130
  /** Available provider information */
@@ -214,13 +211,9 @@ export interface DetectedIdeInfo {
214
211
  path?: string;
215
212
  }
216
213
 
217
- /** Workspace recent activity */
218
- export interface WorkspaceActivity {
219
- path: string;
220
- lastUsedAt: number;
221
- kind?: string;
222
- agentType?: string;
223
- }
214
+ export type { RecentSessionBucket, TerminalBackendStatus } from './shared-types-extra.js';
215
+ import type { RecentSessionBucket } from './shared-types-extra.js';
216
+ import type { TerminalBackendStatus } from './shared-types-extra.js';
224
217
 
225
218
  export interface RecentSessionEntry {
226
219
  id: string;
@@ -237,21 +230,14 @@ export interface RecentSessionEntry {
237
230
  unread?: boolean;
238
231
  lastSeenAt?: number;
239
232
  inboxBucket?: RecentSessionBucket;
240
- }
241
-
242
- export type RecentSessionBucket = 'needs_attention' | 'working' | 'task_complete' | 'idle';
243
-
244
- export interface TerminalBackendStatus {
245
- backend: 'xterm' | 'ghostty-vt';
246
- preference: 'auto' | 'xterm' | 'ghostty-vt';
247
- ghosttyAvailable: boolean;
233
+ surfaceHidden?: boolean;
248
234
  }
249
235
 
250
236
  // ─── Status Report Payload (daemon → server) ────────────────────────
251
237
  // Full payload shape sent via WebSocket status_report
252
238
 
253
239
  export interface StatusReportPayload {
254
- /** Daemon instance ID */
240
+ /** Unique daemon instance identifier */
255
241
  instanceId: string;
256
242
  /** Daemon version */
257
243
  version: string;
@@ -273,7 +259,8 @@ export interface StatusReportPayload {
273
259
  workspaces?: WorkspaceEntry[];
274
260
  defaultWorkspaceId?: string | null;
275
261
  defaultWorkspacePath?: string | null;
276
- workspaceActivity?: WorkspaceActivity[];
277
262
  recentSessions?: RecentSessionEntry[];
278
263
  terminalBackend?: TerminalBackendStatus;
264
+ /** Available providers (present in StatusSnapshot, optional in raw payload) */
265
+ availableProviders?: AvailableProviderInfo[];
279
266
  }
@@ -337,5 +337,17 @@ export function buildSessionEntries(
337
337
  sessions.push(buildAcpSession(state));
338
338
  }
339
339
 
340
+ // Hide native IDE parent rows from inbox/recent surfaces when extension tabs exist.
341
+ const extensionParentIds = new Set(
342
+ sessions
343
+ .filter((session) => session.transport === 'cdp-webview' && !!session.parentId)
344
+ .map((session) => session.parentId as string)
345
+ );
346
+ for (const session of sessions) {
347
+ if (session.transport === 'cdp-page' && extensionParentIds.has(session.id)) {
348
+ session.surfaceHidden = true;
349
+ }
350
+ }
351
+
340
352
  return sessions;
341
353
  }
@@ -207,6 +207,7 @@ export class DaemonStatusReporter {
207
207
  unread: (session as any).unread,
208
208
  lastSeenAt: (session as any).lastSeenAt,
209
209
  inboxBucket: (session as any).inboxBucket,
210
+ surfaceHidden: (session as any).surfaceHidden,
210
211
  controlValues: session.controlValues,
211
212
  providerControls: session.providerControls,
212
213
  acpConfigOptions: session.acpConfigOptions,
@@ -10,7 +10,6 @@ import * as os from 'os';
10
10
  import { loadConfig } from '../config/config.js';
11
11
  import { buildRecentActivityKey, getRecentActivity, getRecentSessionSeenAt } from '../config/recent-activity.js';
12
12
  import { getWorkspaceState } from '../config/workspaces.js';
13
- import { getWorkspaceActivity } from '../config/workspace-activity.js';
14
13
  import { getHostMemorySnapshot } from '../system/host-memory.js';
15
14
  import { getTerminalBackendRuntimeStatus } from '../cli-adapters/terminal-screen.js';
16
15
  import { buildSessionEntries, isCdpConnected } from './builders.js';
@@ -149,8 +148,10 @@ function buildRecentSessions(
149
148
  recentActivity: ReturnType<typeof getRecentActivity>,
150
149
  readState: Record<string, number>,
151
150
  ): RecentSessionEntry[] {
151
+ const visibleKeys = new Set<string>();
152
+ const hiddenKeys = new Set<string>();
152
153
  const live = sessions
153
- .filter((session) => !session.parentId && session.status !== 'stopped')
154
+ .filter((session) => !session.surfaceHidden && session.status !== 'stopped')
154
155
  .map((session) => {
155
156
  const kind = getSessionKind(session);
156
157
  const recentKey = buildRecentActivityKey({
@@ -182,11 +183,21 @@ function buildRecentSessions(
182
183
  unread,
183
184
  lastSeenAt,
184
185
  inboxBucket,
186
+ surfaceHidden: false,
185
187
  };
186
- })
187
- const seen = new Set(live.map((item) => `${item.kind}:${item.providerType}:${item.workspace || ''}`));
188
+ });
189
+ for (const item of live) {
190
+ visibleKeys.add(`${item.kind}:${item.providerType}:${item.workspace || ''}`);
191
+ }
192
+ for (const session of sessions) {
193
+ if (!session.surfaceHidden) continue;
194
+ hiddenKeys.add(`${getSessionKind(session)}:${session.providerType}:${session.workspace || ''}`);
195
+ }
188
196
  const persisted = recentActivity
189
- .filter((item) => !seen.has(`${item.kind}:${item.providerType}:${item.workspace || ''}`))
197
+ .filter((item) => {
198
+ const key = `${item.kind}:${item.providerType}:${item.workspace || ''}`;
199
+ return !visibleKeys.has(key) && !hiddenKeys.has(key);
200
+ })
190
201
  .map((item) => {
191
202
  const lastSeenAt = readState[item.id] || 0;
192
203
  const unread = item.lastUsedAt > lastSeenAt;
@@ -204,6 +215,7 @@ function buildRecentSessions(
204
215
  unread,
205
216
  lastSeenAt,
206
217
  inboxBucket: unread ? 'task_complete' : 'idle' as RecentSessionBucket,
218
+ surfaceHidden: false,
207
219
  };
208
220
  });
209
221
 
@@ -231,13 +243,15 @@ export function buildStatusSnapshot(options: StatusSnapshotOptions): StatusSnaps
231
243
  });
232
244
  const lastSeenAt = getRecentSessionSeenAt(cfg, recentKey);
233
245
  const lastUsedAt = getSessionLastUsedAt(session);
234
- const { unread, inboxBucket } = getUnreadState(
235
- getSessionMessageUpdatedAt(session) > 0,
236
- session.status,
237
- lastUsedAt,
238
- lastSeenAt,
239
- getLastMessageRole(session),
240
- );
246
+ const { unread, inboxBucket } = session.surfaceHidden
247
+ ? { unread: false, inboxBucket: 'idle' as RecentSessionBucket }
248
+ : getUnreadState(
249
+ getSessionMessageUpdatedAt(session) > 0,
250
+ session.status,
251
+ lastUsedAt,
252
+ lastSeenAt,
253
+ getLastMessageRole(session),
254
+ );
241
255
  session.recentKey = recentKey;
242
256
  session.lastSeenAt = lastSeenAt;
243
257
  session.unread = unread;
@@ -269,7 +283,6 @@ export function buildStatusSnapshot(options: StatusSnapshotOptions): StatusSnaps
269
283
  workspaces: wsState.workspaces,
270
284
  defaultWorkspaceId: wsState.defaultWorkspaceId,
271
285
  defaultWorkspacePath: wsState.defaultWorkspacePath,
272
- workspaceActivity: getWorkspaceActivity(cfg, 15),
273
286
  recentSessions: buildRecentSessions(sessions, recentActivity, readState),
274
287
  terminalBackend,
275
288
  availableProviders: buildAvailableProviders(options.providerLoader),