@adhdev/daemon-core 0.6.77 → 0.7.0

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
@@ -1,851 +1,5 @@
1
- /**
2
- * ProviderInstance Provider runtime lifecycle
3
- *
4
- * provider.js = static config/scripts
5
- * ProviderInstance = runtime status management + lifecycle
6
- *
7
- * Daemon only collects via ProviderInstance.getState(),
8
- * Each Instance manages its own status.
9
- */
10
-
11
- type ProviderStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
12
- interface ActiveChatData {
13
- id: string;
14
- title: string;
15
- status: string;
16
- messages: ChatMessage[];
17
- activeModal: {
18
- message: string;
19
- buttons: string[];
20
- } | null;
21
- terminalHistory?: string;
22
- inputContent?: string;
23
- }
24
- /** Standardized error reasons across all provider categories */
25
- type ProviderErrorReason = 'not_installed' | 'auth_failed' | 'spawn_error' | 'init_failed' | 'crash' | 'timeout' | 'cdp_error' | 'disconnected';
26
- /** Common fields shared by all provider categories */
27
- interface ProviderStateBase {
28
- /** Provider type (e.g. 'gemini-cli', 'cursor', 'cline') */
29
- type: string;
30
- /** Provider Display name */
31
- name: string;
32
- /** current status */
33
- status: ProviderStatus;
34
- /** chat data */
35
- activeChat: ActiveChatData | null;
36
- /** Workspace — project path or name (all categories) */
37
- workspace?: string | null;
38
- /** Runtime info (real-time detection) */
39
- currentModel?: string;
40
- currentPlan?: string;
41
- /** Error details (when status === 'error') */
42
- errorMessage?: string;
43
- errorReason?: ProviderErrorReason;
44
- /** meta */
45
- instanceId: string;
46
- lastUpdated: number;
47
- settings: Record<string, any>;
48
- /** Event queue (cleared after daemon collects) */
49
- pendingEvents: ProviderEvent[];
50
- }
51
- /** IDE provider state */
52
- interface IdeProviderState extends ProviderStateBase {
53
- category: 'ide';
54
- cdpConnected: boolean;
55
- /** IDE child Extension Instance status */
56
- extensions: ProviderState[];
57
- currentAutoApprove?: string;
58
- }
59
- /** CLI provider state */
60
- interface CliProviderState extends ProviderStateBase {
61
- category: 'cli';
62
- /** terminal = PTY stream, chat = parsed conversation */
63
- mode: 'terminal' | 'chat';
64
- }
65
- /** ACP provider state */
66
- interface AcpProviderState extends ProviderStateBase {
67
- category: 'acp';
68
- mode: 'chat';
69
- /** ACP config options (model/mode selection) */
70
- acpConfigOptions?: AcpConfigOption[];
71
- /** ACP available modes */
72
- acpModes?: AcpMode[];
73
- }
74
- /** Extension provider state */
75
- interface ExtensionProviderState extends ProviderStateBase {
76
- category: 'extension';
77
- agentStreams?: any[];
78
- }
79
- /** Discriminated union — switch on `.category` */
80
- type ProviderState = IdeProviderState | CliProviderState | AcpProviderState | ExtensionProviderState;
81
- interface ProviderEvent {
82
- event: string;
83
- timestamp: number;
84
- [key: string]: any;
85
- }
86
- interface InstanceContext {
87
- /** CDP connection (IDE/Extension) */
88
- cdp?: {
89
- isConnected: boolean;
90
- evaluate(script: string, timeout?: number): Promise<unknown>;
91
- evaluateInWebviewFrame?(expression: string, matchFn?: (bodyPreview: string) => boolean): Promise<string | null>;
92
- discoverAgentWebviews?(): Promise<any[]>;
93
- };
94
- /** Server log transmit */
95
- serverConn?: {
96
- sendMessage(type: string, data: any): void;
97
- };
98
- /** P2P PTY output transmit */
99
- onPtyData?: (data: string) => void;
100
- /** Provider configvalue (resolved) */
101
- settings: Record<string, any>;
102
- }
103
- interface ProviderInstance {
104
- /** Provider type */
105
- readonly type: string;
106
- /** Provider category */
107
- readonly category: 'cli' | 'ide' | 'extension' | 'acp';
108
- /** initialize */
109
- init(context: InstanceContext): Promise<void>;
110
- /** Tick — periodic status refresh (IDE: readChat, Extension: stream collection) */
111
- onTick(): Promise<void>;
112
- /** Return current status */
113
- getState(): ProviderState;
114
- /** Receive event (external → Instance) */
115
- onEvent(event: string, data?: any): void;
116
- /** Update settings at runtime (called when user changes settings from dashboard) */
117
- updateSettings?(newSettings: Record<string, any>): void;
118
- /** cleanup */
119
- dispose(): void;
120
- }
121
-
122
- /**
123
- * Recent workspace activity — quick "pick up where you left off" (daemon-local).
124
- */
125
-
126
- interface WorkspaceActivityEntry {
127
- path: string;
128
- lastUsedAt: number;
129
- /** `active` legacy — same meaning as default */
130
- kind?: 'ide' | 'cli' | 'acp' | 'default' | 'active';
131
- /** IDE id or CLI/ACP provider type */
132
- agentType?: string;
133
- }
134
- declare function getWorkspaceActivity(config: ADHDevConfig, limit?: number): WorkspaceActivityEntry[];
135
-
136
- /**
137
- * ADHDev Launcher — Configuration
138
- *
139
- * Manages launcher config, server connection tokens, and user preferences.
140
- */
141
-
142
- interface ADHDevConfig {
143
- serverUrl: string;
144
- apiToken: string | null;
145
- connectionToken: string | null;
146
- selectedIde: string | null;
147
- configuredIdes: string[];
148
- installedExtensions: string[];
149
- autoConnect: boolean;
150
- /**
151
- * @deprecated Not read at runtime. Notification preferences are now managed by:
152
- * - Web UI layer: useNotificationPrefs (localStorage)
153
- * - Daemon layer: per-provider settings (approvalAlert, longGeneratingAlert)
154
- * Kept for backward config compat — will be removed in v0.7+.
155
- */
156
- notifications: boolean;
157
- userEmail: string | null;
158
- userName: string | null;
159
- setupCompleted: boolean;
160
- setupDate: string | null;
161
- configuredCLIs: string[];
162
- enabledIdes: string[];
163
- recentCliWorkspaces: string[];
164
- /** Saved workspaces for IDE/CLI/ACP launch (daemon-local) */
165
- workspaces?: WorkspaceEntry[];
166
- /** Default workspace id (from workspaces[]) — never used implicitly for launch */
167
- defaultWorkspaceId?: string | null;
168
- /** Recently used workspaces (IDE / CLI / ACP / default) for quick resume */
169
- recentWorkspaceActivity?: WorkspaceActivityEntry[];
170
- machineNickname: string | null;
171
- /**
172
- * Stable local machine ID (prefix: `mach_`) — generated locally on first run.
173
- * Used as daemon instance key (`daemon_<machineId>`) and in status reports.
174
- * NOT the same as the server-side D1 `machines.id` — see `registeredMachineId`.
175
- */
176
- machineId?: string;
177
- machineSecret?: string | null;
178
- /**
179
- * Server-side D1 `machines.id` — the row ID assigned when daemon registers via
180
- * `POST /cli/complete`. Corresponds to `machineId` in server DO context
181
- * (`DaemonConnection.machineId`, `StatusContext.machineId`).
182
- *
183
- * Naming differs from server-side `machineId` to avoid confusion with the local
184
- * `config.machineId` (mach_ prefix) which is a different value.
185
- *
186
- * @deprecated Legacy bridge field — will be removed after 2026-04-06.
187
- * Modern auth flow uses `machineSecret` (adm_) to identify machines.
188
- */
189
- registeredMachineId?: string;
190
- cliHistory: CliHistoryEntry[];
191
- providerSettings: Record<string, Record<string, any>>;
192
- ideSettings: Record<string, {
193
- extensions?: Record<string, {
194
- enabled: boolean;
195
- }>;
196
- }>;
197
- disableUpstream?: boolean;
198
- providerDir?: string;
199
- }
200
- interface CliHistoryEntry {
201
- category?: 'ide' | 'cli' | 'acp';
202
- cliType: string;
203
- dir: string;
204
- cliArgs?: string[];
205
- workspace?: string;
206
- newWindow?: boolean;
207
- model?: string;
208
- timestamp: number;
209
- label?: string;
210
- }
211
- /**
212
- * Load configuration from disk
213
- */
214
- declare function loadConfig(): ADHDevConfig;
215
- /**
216
- * Save configuration to disk
217
- */
218
- declare function saveConfig(config: ADHDevConfig): void;
219
- /**
220
- * Update specific config fields
221
- */
222
- declare function updateConfig(updates: Partial<ADHDevConfig>): ADHDevConfig;
223
- /**
224
- * Mark setup as completed
225
- */
226
- declare function markSetupComplete(ideId: string | string[], extensions: string[]): ADHDevConfig;
227
- /**
228
- * Check if setup has been completed before
229
- */
230
- declare function isSetupComplete(): boolean;
231
- /**
232
- * Reset configuration
233
- */
234
- declare function resetConfig(): void;
235
- /**
236
- * Add launch to history (max 20, dedup by category+type+dir+args+workspace+model)
237
- */
238
- declare function addCliHistory(entry: Omit<CliHistoryEntry, 'timestamp'>): void;
239
-
240
- /**
241
- * Saved workspaces — shared by IDE launch, CLI, ACP (daemon-local).
242
- */
243
-
244
- interface WorkspaceEntry {
245
- id: string;
246
- path: string;
247
- label?: string;
248
- addedAt: number;
249
- }
250
- declare function getWorkspaceState(config: ADHDevConfig): {
251
- workspaces: WorkspaceEntry[];
252
- defaultWorkspaceId: string | null;
253
- defaultWorkspacePath: string | null;
254
- };
255
-
256
- /**
257
- * ADHDev Shared Types — Cross-package type definitions
258
- *
259
- * Types used across daemon-core, web-core, and downstream consumers.
260
- * Import via: import type { ... } from '@adhdev/daemon-core/types'
261
- *
262
- * IMPORTANT: This file must remain runtime-free (types only).
263
- */
264
-
265
- /** IDE entry as reported by daemon to dashboard */
266
- interface ManagedIdeEntry {
267
- ideType: string;
268
- ideVersion: string;
269
- instanceId: string;
270
- workspace: string | null;
271
- terminals: number;
272
- aiAgents: unknown[];
273
- activeChat: ActiveChatData | null;
274
- chats: unknown[];
275
- agentStreams: ManagedAgentStream[];
276
- cdpConnected: boolean;
277
- currentModel?: string;
278
- currentPlan?: string;
279
- currentAutoApprove?: string;
280
- }
281
- /** CLI entry as reported by daemon to dashboard */
282
- interface ManagedCliEntry {
283
- id: string;
284
- instanceId: string;
285
- cliType: string;
286
- cliName: string;
287
- status: string;
288
- mode: 'terminal';
289
- workspace: string;
290
- activeChat: ActiveChatData | null;
291
- }
292
- /** ACP entry as reported by daemon to dashboard */
293
- interface ManagedAcpEntry {
294
- id: string;
295
- acpType: string;
296
- acpName: string;
297
- status: string;
298
- mode: 'chat';
299
- workspace: string;
300
- activeChat: ActiveChatData | null;
301
- currentModel?: string;
302
- currentPlan?: string;
303
- acpConfigOptions?: AcpConfigOption[];
304
- acpModes?: AcpMode[];
305
- /** Error details */
306
- errorMessage?: string;
307
- errorReason?: 'not_installed' | 'auth_failed' | 'spawn_error' | 'init_failed' | 'crash' | 'timeout' | 'cdp_error' | 'disconnected';
308
- }
309
- /** Agent stream within an IDE (extension status) */
310
- interface ManagedAgentStream {
311
- agentType: string;
312
- agentName: string;
313
- extensionId: string;
314
- status: string;
315
- messages: ChatMessage[];
316
- inputContent: string;
317
- model?: string;
318
- activeModal: {
319
- message: string;
320
- buttons: string[];
321
- } | null;
322
- }
323
- /** Available provider information */
324
- interface AvailableProviderInfo {
325
- type: string;
326
- name: string;
327
- category: 'ide' | 'extension' | 'cli' | 'acp';
328
- displayName: string;
329
- icon: string;
330
- }
331
- /** ACP config option (model/mode/thought_level selection) */
332
- interface AcpConfigOption {
333
- category: 'model' | 'mode' | 'thought_level' | 'other';
334
- configId: string;
335
- currentValue?: string;
336
- options: {
337
- value: string;
338
- name: string;
339
- description?: string;
340
- group?: string;
341
- }[];
342
- }
343
- /** ACP mode */
344
- interface AcpMode {
345
- id: string;
346
- name: string;
347
- description?: string;
348
- }
349
- /** Machine hardware/OS info (reported by daemon, displayed by web) */
350
- interface MachineInfo {
351
- hostname: string;
352
- platform: string;
353
- arch: string;
354
- cpus: number;
355
- totalMem: number;
356
- freeMem: number;
357
- /** macOS: reclaimable-inclusive; prefer for UI used% */
358
- availableMem?: number;
359
- loadavg: number[];
360
- uptime: number;
361
- release: string;
362
- }
363
- /** Detected IDE on a machine */
364
- interface DetectedIdeInfo {
365
- type: string;
366
- id?: string;
367
- name: string;
368
- running: boolean;
369
- path?: string;
370
- }
371
- /** Workspace recent activity */
372
- interface WorkspaceActivity {
373
- path: string;
374
- lastUsedAt: number;
375
- kind?: string;
376
- agentType?: string;
377
- }
378
- interface StatusReportPayload {
379
- /** Daemon instance ID */
380
- instanceId: string;
381
- /** Daemon version */
382
- version: string;
383
- /** Daemon mode flag */
384
- daemonMode: boolean;
385
- /** Machine info */
386
- machine: MachineInfo;
387
- /** Machine nickname (user-set) */
388
- machineNickname?: string | null;
389
- /** Timestamp */
390
- timestamp: number;
391
- /** Detected IDEs on this machine */
392
- detectedIdes: DetectedIdeInfo[];
393
- /** P2P state */
394
- p2p?: {
395
- available: boolean;
396
- state: string;
397
- peers: number;
398
- screenshotActive?: boolean;
399
- };
400
- /** Managed IDE instances */
401
- managedIdes: ManagedIdeEntry[];
402
- /** Managed CLI instances */
403
- managedClis: ManagedCliEntry[];
404
- /** Managed ACP instances */
405
- managedAcps: ManagedAcpEntry[];
406
- /** Saved workspaces */
407
- workspaces?: WorkspaceEntry[];
408
- defaultWorkspaceId?: string | null;
409
- defaultWorkspacePath?: string | null;
410
- workspaceActivity?: WorkspaceActivity[];
411
- }
412
-
413
- /**
414
- * ContentBlock — ACP ContentBlock union type
415
- * Represents displayable content in messages, tool call results, etc.
416
- */
417
- type ContentBlock = TextBlock | ImageBlock | AudioBlock | ResourceLinkBlock | ResourceBlock;
418
- /** Text content — ACP TextContent */
419
- interface TextBlock {
420
- type: 'text';
421
- text: string;
422
- annotations?: ContentAnnotations;
423
- }
424
- /** Image content — ACP ImageContent */
425
- interface ImageBlock {
426
- type: 'image';
427
- data: string;
428
- mimeType: string;
429
- uri?: string;
430
- annotations?: ContentAnnotations;
431
- }
432
- /** Audio content — ACP AudioContent */
433
- interface AudioBlock {
434
- type: 'audio';
435
- data: string;
436
- mimeType: string;
437
- annotations?: ContentAnnotations;
438
- }
439
- /** Resource link (file reference) — ACP ResourceLink */
440
- interface ResourceLinkBlock {
441
- type: 'resource_link';
442
- uri: string;
443
- name: string;
444
- title?: string;
445
- description?: string;
446
- mimeType?: string;
447
- size?: number;
448
- annotations?: ContentAnnotations;
449
- }
450
- /** Embedded resource (inline file) — ACP EmbeddedResource */
451
- interface ResourceBlock {
452
- type: 'resource';
453
- resource: TextResourceContents | BlobResourceContents;
454
- annotations?: ContentAnnotations;
455
- }
456
- interface TextResourceContents {
457
- uri: string;
458
- text: string;
459
- mimeType?: string | null;
460
- }
461
- interface BlobResourceContents {
462
- uri: string;
463
- blob: string;
464
- mimeType?: string | null;
465
- }
466
- interface ContentAnnotations {
467
- audience?: ('user' | 'assistant')[];
468
- priority?: number;
469
- }
470
- /** Tool call info — ACP ToolCall */
471
- interface ToolCallInfo {
472
- toolCallId: string;
473
- title: string;
474
- kind?: ToolKind;
475
- status?: ToolCallStatus;
476
- rawInput?: unknown;
477
- rawOutput?: unknown;
478
- content?: ToolCallContent[];
479
- locations?: ToolCallLocation[];
480
- }
481
- type ToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'switch_mode' | 'other';
482
- type ToolCallStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
483
- /** Content produced by a tool call — ACP ToolCallContent */
484
- type ToolCallContent = {
485
- type: 'content';
486
- content: ContentBlock;
487
- } | {
488
- type: 'diff';
489
- path: string;
490
- oldText?: string;
491
- newText: string;
492
- } | {
493
- type: 'terminal';
494
- terminalId: string;
495
- };
496
- interface ToolCallLocation {
497
- path: string;
498
- line?: number | null;
499
- }
500
- type ProviderCategory = 'cli' | 'ide' | 'extension' | 'acp';
501
- /**
502
- * Type of object exported by module.exports in provider.js.
503
- *
504
- * Each provider.js is fully independent and does not import other providers.
505
- * Helpers (_helpers/) can be optionally used.
506
- */
507
- /**
508
- * Provider-configurable CDP target filter.
509
- * Used by DaemonCdpManager to select the correct page/tab to connect to.
510
- * Without this, the manager uses a hardcoded default filter.
511
- */
512
- interface CdpTargetFilter {
513
- /** URL must include this string (e.g. 'workbench.html') */
514
- urlIncludes?: string;
515
- /** URL must NOT include any of these strings */
516
- urlExcludes?: string[];
517
- /** Page title regex pattern for titles to EXCLUDE (e.g. 'Debug Console|Output') */
518
- titleExcludes?: string;
519
- }
520
- interface ProviderModule {
521
- /** Unique identifier (e.g. 'cline', 'cursor', 'gemini-cli') */
522
- type: string;
523
- /** Display name (e.g. 'Cline', 'Cursor') */
524
- name: string;
525
- /** Category: determines execution method */
526
- category: ProviderCategory;
527
- /** Alias list — allows users to invoke by alternate names (e.g. ['claude', 'claude-code']) */
528
- aliases?: string[];
529
- /** CDP ports [primary, secondary] (IDE category only) */
530
- cdpPorts?: [number, number];
531
- /** CDP target filter — controls which page/tab to connect to (IDE category only) */
532
- targetFilter?: CdpTargetFilter;
533
- /** CLI command (e.g. 'cursor', 'code') */
534
- cli?: string;
535
- /** Display icon */
536
- icon?: string;
537
- /** Display name (short name) */
538
- displayName?: string;
539
- /** Install instructions (shown when command is missing) */
540
- install?: string;
541
- /** Custom version detection command (e.g. 'cursor --version', 'claude -v') */
542
- versionCommand?: string;
543
- /** Versions tested by provider maintainer (informational) */
544
- testedVersions?: string[];
545
- /** Per-OS process names — used by launch.ts to detect/kill IDE processes */
546
- processNames?: {
547
- darwin?: string;
548
- win32?: string[];
549
- linux?: string[];
550
- [key: string]: string | string[] | undefined;
551
- };
552
- /** Per-OS install paths — used by detector.ts to detect IDE installation */
553
- paths?: {
554
- darwin?: string[];
555
- win32?: string[];
556
- linux?: string[];
557
- [key: string]: string[] | undefined;
558
- };
559
- extensionId?: string;
560
- extensionIdPattern?: RegExp;
561
- binary?: string;
562
- spawn?: {
563
- command: string;
564
- args?: string[];
565
- shell?: boolean;
566
- env?: Record<string, string>;
567
- };
568
- patterns?: {
569
- prompt?: RegExp[];
570
- generating?: RegExp[];
571
- approval?: RegExp[];
572
- ready?: RegExp[];
573
- };
574
- cleanOutput?: (raw: string, lastUserInput?: string) => string;
575
- scripts?: ProviderScripts;
576
- vscodeCommands?: {
577
- focusPanel?: string;
578
- openPanel?: string;
579
- [key: string]: string | undefined;
580
- };
581
- inputMethod?: 'cdp-type-and-send' | 'script';
582
- inputSelector?: string;
583
- /** webview iframe match text (must be contained in body) */
584
- webviewMatchText?: string;
585
- os?: {
586
- [platform: string]: Partial<Pick<ProviderModule, 'scripts' | 'inputMethod' | 'inputSelector'>>;
587
- };
588
- /** Key: semver range string (e.g. '< 1.107.0', '>= 2.0.0') */
589
- versions?: {
590
- [versionRange: string]: Partial<Pick<ProviderModule, 'scripts'>> & {
591
- /**
592
- * Load scripts from a subdirectory instead of scripts.js root.
593
- * Path is relative to the provider directory (e.g. 'scripts/legacy').
594
- * The subdirectory should contain its own scripts.js or individual .js files.
595
- */
596
- __dir?: string;
597
- };
598
- };
599
- overrides?: Array<{
600
- when: {
601
- os?: string;
602
- version?: string;
603
- };
604
- scripts?: Partial<ProviderScripts>;
605
- /** Load scripts from a subdirectory for this OS+version combination */
606
- __dir?: string;
607
- }>;
608
- settings?: Record<string, ProviderSettingDef>;
609
- /** Static options used when agent does not provide configOptions */
610
- staticConfigOptions?: Array<{
611
- category: 'model' | 'mode' | 'thought_level' | 'other';
612
- configId: string;
613
- defaultValue?: string;
614
- options: Array<{
615
- value: string;
616
- name: string;
617
- description?: string;
618
- group?: string;
619
- }>;
620
- }>;
621
- /** Function to convert selected config values to spawn args (applied via process restart when config/* not supported) */
622
- spawnArgBuilder?: (config: Record<string, string>) => string[];
623
- /** ACP agent auth methods (multiple supported — in priority order) */
624
- auth?: AcpAuthMethod[];
625
- }
626
- /** ACP auth method — based on ACP official spec */
627
- type AcpAuthMethod = AcpAuthEnvVar | AcpAuthAgent | AcpAuthTerminal;
628
- /** Environment variable-based auth (API keys etc) */
629
- interface AcpAuthEnvVar {
630
- type: 'env_var';
631
- id: string;
632
- name: string;
633
- vars: Array<{
634
- name: string;
635
- label?: string;
636
- secret?: boolean;
637
- optional?: boolean;
638
- }>;
639
- link?: string;
640
- }
641
- /** Agent self-auth (OAuth, browser-based etc) */
642
- interface AcpAuthAgent {
643
- type: 'agent';
644
- id: string;
645
- name: string;
646
- description?: string;
647
- }
648
- /** Terminal command-based auth (runs setup command) */
649
- interface AcpAuthTerminal {
650
- type: 'terminal';
651
- id: string;
652
- name: string;
653
- description?: string;
654
- args?: string[];
655
- env?: Record<string, string>;
656
- }
657
- /**
658
- * CDP script functions.
659
- * Each function takes a params object and returns a JS code string for CDP evaluate.
660
- * The JS execution result must conform to the Output Contract.
661
- *
662
- * Custom scripts can be added via index signature in addition to built-in scripts.
663
- * All scripts can receive params: Record<string, any>,
664
- * backward compatible with legacy single-argument style (e.g. sendMessage(text)).
665
- */
666
- interface ProviderScripts {
667
- readChat?: (params?: Record<string, any>) => string;
668
- sendMessage?: (params?: Record<string, any>) => string;
669
- listSessions?: (params?: Record<string, any>) => string;
670
- switchSession?: (params?: Record<string, any>) => string;
671
- newSession?: (params?: Record<string, any>) => string;
672
- focusEditor?: (params?: Record<string, any>) => string;
673
- openPanel?: (params?: Record<string, any>) => string;
674
- /** List available models → { models: string[], current: string } */
675
- listModels?: (params?: Record<string, any>) => string;
676
- /** Change model → { success: boolean } */
677
- setModel?: (params?: Record<string, any>) => string;
678
- /** List available modes → { modes: string[], current: string } */
679
- listModes?: (params?: Record<string, any>) => string;
680
- /** Change mode → { success: boolean } */
681
- setMode?: (params?: Record<string, any>) => string;
682
- /** params: { action: 'approve'|'reject'|'custom', button?: string } */
683
- resolveAction?: (params?: Record<string, any>) => string;
684
- webviewResolveAction?: (params?: Record<string, any>) => string;
685
- listNotifications?: (params?: Record<string, any>) => string;
686
- dismissNotification?: (params?: Record<string, any>) => string;
687
- [scriptName: string]: ((params?: Record<string, any>) => string) | undefined;
688
- }
689
- /**
690
- * ProviderLoader.resolve() result: Final provider with OS/version overrides applied
691
- */
692
- interface ResolvedProvider extends ProviderModule {
693
- /** OS applied during resolve */
694
- _resolvedOs?: string;
695
- /** Version applied during resolve */
696
- _resolvedVersion?: string;
697
- /** Warning when detected version is not in compatibility matrix */
698
- _versionWarning?: string;
699
- }
700
- /** Setting variable definition declared by provider */
701
- interface ProviderSettingDef {
702
- type: 'boolean' | 'number' | 'string' | 'select';
703
- default: any;
704
- /** true = controllable from dashboard UI */
705
- public: boolean;
706
- /** UI label */
707
- label?: string;
708
- /** UI description */
709
- description?: string;
710
- /** Minimum value for number type */
711
- min?: number;
712
- /** Maximum value for number type */
713
- max?: number;
714
- /** Options for select type */
715
- options?: string[];
716
- }
717
- /** Public settings schema (for dashboard transmission) */
718
- interface ProviderSettingSchema extends ProviderSettingDef {
719
- key: string;
720
- }
721
-
722
- /**
723
- * ADHDev Daemon Core — Shared Types
724
- *
725
- * Shared types referenced by daemon-core, daemon-standalone, and web-core.
726
- * When modifying this file, also update interface contracts in AGENT_PROTOCOL.md.
727
- */
728
-
729
- /** Full status response from /api/v1/status and WS events */
730
- interface StatusResponse extends StatusReportPayload {
731
- /** For standalone API compat */
732
- id: string;
733
- type: string;
734
- platform: string;
735
- hostname: string;
736
- /** User display name from config */
737
- userName?: string;
738
- /** Available providers */
739
- availableProviders: ProviderInfo[];
740
- /** System info (legacy compat) */
741
- system?: SystemInfo;
742
- }
743
- interface ChatMessage {
744
- role: string;
745
- /** Plain text (legacy) or rich content blocks (ACP standard) */
746
- content: string | ContentBlock[];
747
- kind?: string;
748
- id?: string;
749
- index?: number;
750
- timestamp?: number;
751
- receivedAt?: number;
752
- /** Tool calls associated with this message */
753
- toolCalls?: ToolCallInfo[];
754
- /** Optional: fiber metadata */
755
- _type?: string;
756
- _sub?: string;
757
- /** Meta information for thought/terminal logs etc */
758
- meta?: {
759
- label?: string;
760
- isRunning?: boolean;
761
- } | Record<string, any>;
762
- /** Sender name for shared sessions */
763
- senderName?: string;
764
- }
765
-
766
- interface ExtensionInfo$1 {
767
- id: string;
768
- type: string;
769
- name: string;
770
- isMonitored?: boolean;
771
- agentStatus?: string;
772
- }
773
- interface CommandResult$2 {
774
- success: boolean;
775
- data?: any;
776
- error?: string;
777
- }
778
- interface ProviderConfig {
779
- id: string;
780
- type: 'ide' | 'extension' | 'cli' | 'acp';
781
- name: string;
782
- /** CDP port detection */
783
- cdpDetect?: {
784
- processName?: string;
785
- portFlag?: string;
786
- };
787
- /** Capabilities */
788
- capabilities?: string[];
789
- }
790
- type DaemonEvent = {
791
- type: 'status';
792
- data: StatusResponse;
793
- } | {
794
- type: 'chat_update';
795
- data: {
796
- ideId: string;
797
- messages: ChatMessage[];
798
- };
799
- } | {
800
- type: 'screenshot';
801
- data: {
802
- ideId: string;
803
- base64: string;
804
- };
805
- } | {
806
- type: 'action_log';
807
- data: {
808
- ideId: string;
809
- text: string;
810
- timestamp: number;
811
- };
812
- } | {
813
- type: 'error';
814
- data: {
815
- message: string;
816
- };
817
- };
818
- interface SystemInfo {
819
- cpus: number;
820
- totalMem: number;
821
- freeMem: number;
822
- /** macOS: reclaimable-inclusive; prefer for UI used% (see host-memory.ts) */
823
- availableMem?: number;
824
- loadavg: number[];
825
- uptime: number;
826
- arch: string;
827
- }
828
- interface DetectedIde {
829
- id: string;
830
- type: string;
831
- name: string;
832
- installed: boolean;
833
- running: boolean;
834
- }
835
- interface ProviderInfo {
836
- type: string;
837
- icon: string;
838
- displayName: string;
839
- category: string;
840
- }
841
- /** Flattened agent entry from /api/v1/agents */
842
- interface AgentEntry {
843
- ideId: string;
844
- type: string;
845
- name: string;
846
- status: string;
847
- source: 'native' | 'extension';
848
- }
1
+ import { S as StatusResponse, D as DaemonEvent, C as CommandResult$2, a as SessionEntry, P as ProviderCategory, b as ProviderModule, R as ResolvedProvider, c as ProviderSettingSchema, d as CdpTargetFilter, e as ProviderInstance, I as InstanceContext, f as ProviderState, g as ProviderEvent, h as SessionTransport, i as StatusReportPayload, A as AvailableProviderInfo, j as AcpProviderState, k as ContentBlock } from './normalize-S2PmiRgB.js';
2
+ export { l as AcpConfigOption, m as AcpMode, n as ActiveChatData, o as AgentEntry, p as AgentSessionStream, q as ChatMessage, r as CliProviderState, s as DetectedIde, t as DetectedIdeInfo, E as ExtensionInfo, u as ExtensionProviderState, v as IdeProviderState, M as MachineInfo, w as ManagedStatus, x as ProviderConfig, y as ProviderErrorReason, z as ProviderInfo, B as ProviderStatus, F as SessionCapability, G as SessionKind, H as SystemInfo, W as WorkspaceActivity, J as WorkspaceEntry, K as addCliHistory, L as getWorkspaceActivity, N as getWorkspaceState, O as isManagedStatusWaiting, Q as isManagedStatusWorking, T as isSetupComplete, U as loadConfig, V as markSetupComplete, X as normalizeActiveChatData, Y as normalizeManagedStatus, Z as resetConfig, _ as saveConfig, $ as updateConfig } from './normalize-S2PmiRgB.js';
849
3
 
850
4
  /**
851
5
  * DaemonCore — Core daemon orchestrator interface
@@ -879,12 +33,8 @@ interface IDaemonCore {
879
33
  onEvent(callback: (event: DaemonEvent) => void): () => void;
880
34
  /** Execute a command (send_chat, new_session, etc.) */
881
35
  executeCommand(type: string, payload: any, target?: string): Promise<CommandResult$2>;
882
- /** Get currently detected/managed IDEs */
883
- getManagedIdes(): ManagedIdeEntry[];
884
- /** Get currently detected/managed CLIs */
885
- getManagedClis(): ManagedCliEntry[];
886
- /** Get currently detected/managed ACP agents */
887
- getManagedAcps(): ManagedAcpEntry[];
36
+ /** Get current canonical runtime sessions */
37
+ getSessions(): SessionEntry[];
888
38
  }
889
39
 
890
40
  /**
@@ -1417,6 +567,7 @@ declare class DaemonCdpManager {
1417
567
  detachAgent(sessionId: string): Promise<void>;
1418
568
  detachAllAgents(): Promise<void>;
1419
569
  getAgentSessions(): Map<string, AgentWebviewTarget>;
570
+ private getCurrentPageWebviewUrls;
1420
571
  captureScreenshot(opts?: {
1421
572
  quality?: number;
1422
573
  }): Promise<Buffer | null>;
@@ -1499,6 +650,31 @@ declare class ProviderInstanceManager {
1499
650
  disposeAll(): void;
1500
651
  }
1501
652
 
653
+ interface SessionRuntimeTarget {
654
+ sessionId: string;
655
+ parentSessionId: string | null;
656
+ providerType: string;
657
+ providerCategory: 'ide' | 'extension' | 'cli' | 'acp';
658
+ transport: SessionTransport;
659
+ cdpManagerKey?: string;
660
+ adapterKey?: string;
661
+ instanceKey?: string;
662
+ }
663
+ declare class SessionRegistry {
664
+ private readonly bySessionId;
665
+ private readonly byManagerKey;
666
+ private readonly byInstanceKey;
667
+ private readonly byParentSessionId;
668
+ register(target: SessionRuntimeTarget): void;
669
+ get(sessionId: string | undefined | null): SessionRuntimeTarget | undefined;
670
+ unregister(sessionId: string | undefined | null): void;
671
+ unregisterByManagerKey(managerKey: string): void;
672
+ unregisterByInstanceKey(instanceKey: string): void;
673
+ listChildren(parentSessionId: string): SessionRuntimeTarget[];
674
+ private addIndex;
675
+ private removeIndex;
676
+ }
677
+
1502
678
  /**
1503
679
  * Agent Stream Types — ported for Daemon (identical to original)
1504
680
  *
@@ -1563,40 +739,48 @@ type AgentEvaluateFn = (expression: string, timeoutMs?: number) => Promise<unkno
1563
739
 
1564
740
  interface ManagedAgent {
1565
741
  adapter: IAgentStreamAdapter;
1566
- sessionId: string;
742
+ runtimeSessionId: string;
743
+ parentSessionId: string;
744
+ cdpSessionId: string;
1567
745
  target: AgentWebviewTarget;
1568
746
  lastState: AgentStreamState | null;
1569
747
  lastError: string | null;
1570
748
  lastHiddenCheckTime: number;
1571
749
  }
1572
750
  declare class DaemonAgentStreamManager {
1573
- private allAdapters;
1574
- private managed;
751
+ private readonly sessionRegistry?;
752
+ private adaptersByType;
753
+ private managedBySessionId;
1575
754
  private enabled;
1576
755
  private logFn;
1577
- private lastDiscoveryTime;
1578
- private discoveryIntervalMs;
1579
- private _activeAgentType;
1580
- constructor(logFn?: (msg: string) => void, providerLoader?: ProviderLoader);
756
+ private lastDiscoveryTimeByParent;
757
+ private discoveryIntervalMsByParent;
758
+ private activeSessionIdByParent;
759
+ constructor(logFn?: (msg: string) => void, providerLoader?: ProviderLoader, sessionRegistry?: SessionRegistry | undefined);
1581
760
  setEnabled(enabled: boolean): void;
1582
761
  get isEnabled(): boolean;
1583
- get activeAgentType(): string | null;
762
+ getActiveSessionId(parentSessionId: string): string | null;
763
+ private getSessionTarget;
764
+ resetParentSession(parentSessionId: string): void;
1584
765
  /** Panel focus based on provider.js focusPanel or extensionId (currently no-op) */
1585
- ensureAgentPanelOpen(agentType: string, targetIdeType?: string): Promise<void>;
1586
- switchActiveAgent(cdp: DaemonCdpManager, agentType: string | null): Promise<void>;
766
+ ensureSessionPanelOpen(_sessionId: string): Promise<void>;
767
+ setActiveSession(cdp: DaemonCdpManager, parentSessionId: string, sessionId: string | null): Promise<void>;
768
+ private resolveSessionIdForTarget;
769
+ private connectManagedSession;
1587
770
  /** Agent webview discovery + session connection */
1588
- syncAgentSessions(cdp: DaemonCdpManager): Promise<void>;
1589
- /** Collect active agent status */
1590
- collectAgentStreams(cdp: DaemonCdpManager): Promise<AgentStreamState[]>;
1591
- sendToAgent(cdp: DaemonCdpManager, agentType: string, text: string, targetIdeType?: string): Promise<boolean>;
1592
- resolveAgentAction(cdp: DaemonCdpManager, agentType: string, action: 'approve' | 'reject', targetIdeType?: string): Promise<boolean>;
1593
- newAgentSession(cdp: DaemonCdpManager, agentType: string, targetIdeType?: string): Promise<boolean>;
1594
- listAgentChats(cdp: DaemonCdpManager, agentType: string): Promise<AgentChatListItem[]>;
1595
- switchAgentSession(cdp: DaemonCdpManager, agentType: string, sessionId: string): Promise<boolean>;
1596
- focusAgentEditor(cdp: DaemonCdpManager, agentType: string): Promise<boolean>;
1597
- getConnectedAgents(): string[];
1598
- getManagedAgent(agentType: string): ManagedAgent | undefined;
1599
- dispose(cdp: DaemonCdpManager): Promise<void>;
771
+ syncActiveSession(cdp: DaemonCdpManager, parentSessionId: string): Promise<void>;
772
+ /** Collect active extension session state */
773
+ collectActiveSession(cdp: DaemonCdpManager, parentSessionId: string): Promise<AgentStreamState | null>;
774
+ sendToSession(cdp: DaemonCdpManager, sessionId: string, text: string): Promise<boolean>;
775
+ resolveSessionAction(cdp: DaemonCdpManager, sessionId: string, action: 'approve' | 'reject'): Promise<boolean>;
776
+ newSession(cdp: DaemonCdpManager, sessionId: string): Promise<boolean>;
777
+ listSessionChats(cdp: DaemonCdpManager, sessionId: string): Promise<AgentChatListItem[]>;
778
+ switchConversation(cdp: DaemonCdpManager, sessionId: string, conversationId: string): Promise<boolean>;
779
+ focusSession(cdp: DaemonCdpManager, sessionId: string): Promise<boolean>;
780
+ getConnectedSessions(parentSessionId?: string): string[];
781
+ getManagedSession(sessionId: string): ManagedAgent | undefined;
782
+ dispose(cdpManagers: Map<string, DaemonCdpManager>): Promise<void>;
783
+ resolveSessionForAgent(parentSessionId: string, agentType: string): string | null;
1600
784
  }
1601
785
 
1602
786
  /**
@@ -1616,18 +800,18 @@ interface AgentStreamPollerDeps {
1616
800
  providerLoader: ProviderLoader;
1617
801
  instanceManager: ProviderInstanceManager;
1618
802
  cdpManagers: Map<string, DaemonCdpManager>;
803
+ sessionRegistry: SessionRegistry;
1619
804
  /** Callback when agent streams are updated */
1620
805
  onStreamsUpdated?: (ideType: string, streams: AgentStreamState[]) => void;
1621
806
  }
1622
807
  declare class AgentStreamPoller {
1623
808
  private deps;
1624
- private _activeIdeType;
1625
809
  private timer;
1626
810
  constructor(deps: AgentStreamPollerDeps);
1627
811
  /** Currently active IDE type for agent streaming */
1628
812
  get activeIde(): string | null;
1629
813
  /** Reset active IDE tracking (e.g., when IDE is stopped) */
1630
- resetActiveIde(ideType: string): void;
814
+ resetActiveIde(parentSessionId: string): void;
1631
815
  /** Start polling (idempotent — ignored if already started) */
1632
816
  start(intervalMs?: number): void;
1633
817
  /** Stop polling */
@@ -1703,7 +887,7 @@ declare function readChatHistory(agentType: string, offset?: number, limit?: num
1703
887
  * the correct CDP manager or CLI adapter.
1704
888
  *
1705
889
  * Key concepts:
1706
- * - extractIdeType(): determines target IDE from _targetInstance
890
+ * - extractIdeType(): determines target IDE from targetSessionId or ideType
1707
891
  * - getCdp(): returns the DaemonCdpManager for current command
1708
892
  * - getProvider(): returns the ProviderModule for current command
1709
893
  * - handle(): main entry point, sets context then dispatches
@@ -1720,8 +904,7 @@ interface CommandContext {
1720
904
  providerLoader?: ProviderLoader;
1721
905
  /** ProviderInstanceManager — for runtime settings propagation */
1722
906
  instanceManager?: ProviderInstanceManager;
1723
- /** UUID instanceId → CDP manager key (ideType) mapping */
1724
- instanceIdMap?: Map<string, string>;
907
+ sessionRegistry?: SessionRegistry;
1725
908
  }
1726
909
  /**
1727
910
  * Shared helpers interface — passed to sub-module command functions
@@ -1736,8 +919,10 @@ interface CommandHelpers {
1736
919
  category: string;
1737
920
  } | null>;
1738
921
  getCliAdapter(type?: string): any | null;
922
+ readonly currentManagerKey: string | undefined;
1739
923
  readonly currentIdeType: string | undefined;
1740
924
  readonly currentProviderType: string | undefined;
925
+ readonly currentSession: SessionRuntimeTarget | undefined;
1741
926
  readonly agentStream: DaemonAgentStreamManager | null;
1742
927
  readonly ctx: CommandContext;
1743
928
  readonly historyWriter: ChatHistoryWriter;
@@ -1747,19 +932,17 @@ declare class DaemonCommandHandler implements CommandHelpers {
1747
932
  private _agentStream;
1748
933
  private domHandlers;
1749
934
  private _historyWriter;
1750
- /** Current IDE type extracted from command args (per-request) */
1751
- private _currentIdeType;
1752
- /** Current provider type — agentType priority, ideType use */
1753
- private _currentProviderType;
935
+ /** Current request route context */
936
+ private _currentRoute;
1754
937
  constructor(ctx: CommandContext);
1755
938
  get ctx(): CommandContext;
1756
939
  get agentStream(): DaemonAgentStreamManager | null;
1757
940
  get historyWriter(): ChatHistoryWriter;
941
+ get currentManagerKey(): string | undefined;
1758
942
  get currentIdeType(): string | undefined;
1759
943
  get currentProviderType(): string | undefined;
1760
- /** Get CDP manager for a specific ideType or managerKey.
1761
- * Supports exact match, multi-window prefix match, and instanceIdMap UUID lookup.
1762
- * Returns null if no match — never falls back to another IDE. */
944
+ get currentSession(): SessionRuntimeTarget | undefined;
945
+ /** Get CDP manager for a specific session or manager key. */
1763
946
  getCdp(ideType?: string): DaemonCdpManager | null;
1764
947
  /**
1765
948
  * Get provider module — _currentProviderType (agentType priority) use.
@@ -1778,8 +961,9 @@ declare class DaemonCommandHandler implements CommandHelpers {
1778
961
  } | null>;
1779
962
  /** CLI adapter search */
1780
963
  getCliAdapter(type?: string): any | null;
1781
- private getExtensionSessionId;
1782
- /** Extract ideType from _targetInstance or explicit ideType */
964
+ private inferProviderType;
965
+ private resolveRoute;
966
+ /** Extract CDP scope key from target session or explicit ideType */
1783
967
  private extractIdeType;
1784
968
  setAgentStreamManager(manager: DaemonAgentStreamManager): void;
1785
969
  handle(cmd: string, args: any): Promise<CommandResult$1>;
@@ -1950,8 +1134,7 @@ interface CdpSetupContext {
1950
1134
  providerLoader: ProviderLoader;
1951
1135
  instanceManager: ProviderInstanceManager;
1952
1136
  cdpManagers: Map<string, DaemonCdpManager>;
1953
- /** UUID instanceId → CDP manager key mapping */
1954
- instanceIdMap: Map<string, string>;
1137
+ sessionRegistry: SessionRegistry;
1955
1138
  /** Server connection (optional) */
1956
1139
  serverConn?: any;
1957
1140
  }
@@ -1978,7 +1161,7 @@ declare function registerExtensionProviders(providerLoader: ProviderLoader, mana
1978
1161
  * 2. Create IdeProviderInstance
1979
1162
  * 3. Register in InstanceManager
1980
1163
  * 4. Register enabled extensions
1981
- * 5. Update instanceIdMap (IDE + extension UUIDs)
1164
+ * 5. Register runtime sessions (workspace + extension children)
1982
1165
  *
1983
1166
  * @returns The created IdeProviderInstance, or null if provider not found
1984
1167
  */
@@ -2071,6 +1254,8 @@ interface CdpInitializerConfig {
2071
1254
  enabledIdes?: string[];
2072
1255
  /** Callback when a new CDP manager is connected */
2073
1256
  onConnected?: (ideType: string, manager: DaemonCdpManager, managerKey: string) => void | Promise<void>;
1257
+ /** Callback when a stale/disconnected CDP manager is removed */
1258
+ onDisconnected?: (ideType: string, manager: DaemonCdpManager, managerKey: string, reason: 'ide_closed' | 'target_closed' | 'target_rekeyed') => void | Promise<void>;
2074
1259
  }
2075
1260
  declare class DaemonCdpInitializer {
2076
1261
  private config;
@@ -2087,6 +1272,7 @@ declare class DaemonCdpInitializer {
2087
1272
  * Tries multi-window first (listAllTargets), falls back to direct connect.
2088
1273
  */
2089
1274
  private connectIdePort;
1275
+ private pruneStaleManagers;
2090
1276
  /**
2091
1277
  * Start periodic scanning for newly opened IDEs.
2092
1278
  * Idempotent — ignored if already started.
@@ -2143,6 +1329,7 @@ interface CliManagerDeps {
2143
1329
  removeAgentTracking(key: string): void;
2144
1330
  /** InstanceManager — register in CLI unified status */
2145
1331
  getInstanceManager(): ProviderInstanceManager | null;
1332
+ getSessionRegistry?(): SessionRegistry | null;
2146
1333
  }
2147
1334
  type CommandResult = {
2148
1335
  success: boolean;
@@ -2161,7 +1348,7 @@ declare class DaemonCliManager {
2161
1348
  shutdownAll(): void;
2162
1349
  /**
2163
1350
  * Search for CLI adapter. Priority order:
2164
- * 0. instanceKey (UUID direct match) — extracted from _targetInstance / composite ID
1351
+ * 0. sessionId (UUID direct match)
2165
1352
  * 1. agentType + dir (iteration match)
2166
1353
  * 2. agentType fuzzy match (⚠ returns first match when multiple sessions exist)
2167
1354
  */
@@ -2196,8 +1383,7 @@ interface CommandRouterDeps {
2196
1383
  detectedIdes: {
2197
1384
  value: any[];
2198
1385
  };
2199
- /** UUID instanceId → CDP manager key mapping */
2200
- instanceIdMap: Map<string, string>;
1386
+ sessionRegistry: SessionRegistry;
2201
1387
  /** Callback for CDP manager creation after launch_ide */
2202
1388
  onCdpManagerCreated?: (ideType: string, manager: DaemonCdpManager) => void;
2203
1389
  /** Callback after IDE connected (e.g., startAgentStreamPolling) */
@@ -2341,40 +1527,7 @@ declare function hasCdpManager(cdpManagers: Map<string, DaemonCdpManager>, key:
2341
1527
  * Check if any CDP manager matching the key is connected.
2342
1528
  */
2343
1529
  declare function isCdpConnected(cdpManagers: Map<string, DaemonCdpManager>, key: string): boolean;
2344
- /**
2345
- * Convert IdeProviderState[] → ManagedIdeEntry[]
2346
- *
2347
- * @param ideStates - from instanceManager.collectAllStates() filtered to ide
2348
- * @param cdpManagers - for cdpConnected lookup
2349
- * @param opts.detectedIdes - include CDPs that have no instance yet
2350
- */
2351
- declare function buildManagedIdes(ideStates: IdeProviderState[], cdpManagers: Map<string, DaemonCdpManager>, opts?: {
2352
- detectedIdes?: {
2353
- id: string;
2354
- installed: boolean;
2355
- }[];
2356
- }): ManagedIdeEntry[];
2357
- /**
2358
- * Convert CliProviderState[] → ManagedCliEntry[]
2359
- */
2360
- declare function buildManagedClis(cliStates: CliProviderState[]): ManagedCliEntry[];
2361
- /**
2362
- * Convert AcpProviderState[] → ManagedAcpEntry[]
2363
- */
2364
- declare function buildManagedAcps(acpStates: AcpProviderState[]): ManagedAcpEntry[];
2365
- /**
2366
- * Convenience: collect & build all managed entries from instanceManager
2367
- */
2368
- declare function buildAllManagedEntries(allStates: ProviderState[], cdpManagers: Map<string, DaemonCdpManager>, opts?: {
2369
- detectedIdes?: {
2370
- id: string;
2371
- installed: boolean;
2372
- }[];
2373
- }): {
2374
- managedIdes: ManagedIdeEntry[];
2375
- managedClis: ManagedCliEntry[];
2376
- managedAcps: ManagedAcpEntry[];
2377
- };
1530
+ declare function buildSessionEntries(allStates: ProviderState[], cdpManagers: Map<string, DaemonCdpManager>): SessionEntry[];
2378
1531
 
2379
1532
  /**
2380
1533
  * Shared status snapshot builders.
@@ -2892,6 +2045,7 @@ declare class AcpProviderInstance implements ProviderInstance {
2892
2045
  onTick(): Promise<void>;
2893
2046
  getState(): AcpProviderState;
2894
2047
  onEvent(event: string, data?: any): void;
2048
+ getInstanceId(): string;
2895
2049
  private parseConfigOptions;
2896
2050
  private parseModes;
2897
2051
  setConfigOption(category: string, value: string): Promise<void>;
@@ -3144,7 +2298,7 @@ interface DaemonComponents {
3144
2298
  poller: AgentStreamPoller;
3145
2299
  cdpInitializer: DaemonCdpInitializer;
3146
2300
  cdpManagers: Map<string, DaemonCdpManager>;
3147
- instanceIdMap: Map<string, string>;
2301
+ sessionRegistry: SessionRegistry;
3148
2302
  detectedIdes: {
3149
2303
  value: any[];
3150
2304
  };
@@ -3185,4 +2339,4 @@ declare function startDaemonDevSupport(options: DaemonDevSupportOptions): Promis
3185
2339
  */
3186
2340
  declare function shutdownDaemonComponents(components: DaemonComponents): Promise<void>;
3187
2341
 
3188
- export { type AcpConfigOption, type AcpMode, AcpProviderInstance, type AcpProviderState, type ActiveChatData, type AgentEntry, AgentStreamPoller, type AgentStreamPollerDeps, type AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, type CdpTargetFilter, type ChatMessage, type CliAdapter, CliProviderInstance, type CliProviderState, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, type CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonDevSupportOptions, type DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, type DetectedIde, type DetectedIdeInfo, DevServer, type ExtensionInfo$1 as ExtensionInfo, type ExtensionProviderState, type HostMemorySnapshot, type IDEInfo, type IDaemonCore, IdeProviderInstance, type IdeProviderState, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, type MachineInfo, type ManagedAcpEntry, type ManagedAgentStream, type ManagedCliEntry, type ManagedIdeEntry, ProviderCliAdapter, type ProviderConfig, type ProviderErrorReason, type ProviderInfo, ProviderInstanceManager, ProviderLoader, type ProviderModule, type ProviderStatus, type ProviderVersionInfo, type ScopedLogger, type SetupIdeInstanceOptions, type StatusReportPayload, type StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, type SystemInfo, VersionArchive, type VersionHistory, type WorkspaceActivity, type WorkspaceEntry, addCliHistory, buildAllManagedEntries, buildManagedAcps, buildManagedClis, buildManagedIdes, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, getWorkspaceActivity, getWorkspaceState, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, isSetupComplete, killIdeProcess, launchIDE, launchWithCdp, loadConfig, logCommand, markSetupComplete, probeCdpPort, readChatHistory, registerExtensionProviders, resetConfig, saveConfig, setLogLevel, setupIdeInstance, shutdownDaemonComponents, startDaemonDevSupport, updateConfig };
2342
+ export { AcpProviderInstance, AcpProviderState, AgentStreamPoller, type AgentStreamPollerDeps, AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, CdpTargetFilter, type CliAdapter, CliProviderInstance, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonDevSupportOptions, DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, DevServer, type HostMemorySnapshot, type IDEInfo, type IDaemonCore, IdeProviderInstance, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, ProviderCliAdapter, ProviderInstanceManager, ProviderLoader, ProviderModule, type ProviderVersionInfo, type ScopedLogger, SessionEntry, SessionTransport, type SetupIdeInstanceOptions, StatusReportPayload, StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, VersionArchive, type VersionHistory, buildSessionEntries, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, killIdeProcess, launchIDE, launchWithCdp, logCommand, probeCdpPort, readChatHistory, registerExtensionProviders, setLogLevel, setupIdeInstance, shutdownDaemonComponents, startDaemonDevSupport };