@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
@@ -0,0 +1,483 @@
1
+ /**
2
+ * Provider Output Contracts — Output contracts all providers must conform to
3
+ *
4
+ * Design principles:
5
+ * - Only output format is standardized; implementation is free
6
+ * - Common across all categories (cli, ide, extension)
7
+ * - User custom providers use the same contracts
8
+ */
9
+ export interface ReadChatResult {
10
+ messages: ChatMessage[];
11
+ status: AgentStatus;
12
+ activeModal?: ModalInfo | null;
13
+ /** IDE/Extension only: session info */
14
+ id?: string;
15
+ title?: string;
16
+ /** Extension only: additional metadata */
17
+ agentType?: string;
18
+ agentName?: string;
19
+ extensionId?: string;
20
+ /** Status metadata */
21
+ isVisible?: boolean;
22
+ isWelcomeScreen?: boolean;
23
+ inputContent?: string;
24
+ model?: string;
25
+ autoApprove?: string;
26
+ }
27
+ import type { ChatMessage } from '../types.js';
28
+ export type { ChatMessage };
29
+ export type AgentStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'panel_hidden' | 'streaming';
30
+ export interface ModalInfo {
31
+ message: string;
32
+ buttons: string[];
33
+ width?: number;
34
+ height?: number;
35
+ }
36
+ /**
37
+ * ContentBlock — ACP ContentBlock union type
38
+ * Represents displayable content in messages, tool call results, etc.
39
+ */
40
+ export type ContentBlock = TextBlock | ImageBlock | AudioBlock | ResourceLinkBlock | ResourceBlock;
41
+ /** Text content — ACP TextContent */
42
+ export interface TextBlock {
43
+ type: 'text';
44
+ text: string;
45
+ annotations?: ContentAnnotations;
46
+ }
47
+ /** Image content — ACP ImageContent */
48
+ export interface ImageBlock {
49
+ type: 'image';
50
+ data: string;
51
+ mimeType: string;
52
+ uri?: string;
53
+ annotations?: ContentAnnotations;
54
+ }
55
+ /** Audio content — ACP AudioContent */
56
+ export interface AudioBlock {
57
+ type: 'audio';
58
+ data: string;
59
+ mimeType: string;
60
+ annotations?: ContentAnnotations;
61
+ }
62
+ /** Resource link (file reference) — ACP ResourceLink */
63
+ export interface ResourceLinkBlock {
64
+ type: 'resource_link';
65
+ uri: string;
66
+ name: string;
67
+ title?: string;
68
+ description?: string;
69
+ mimeType?: string;
70
+ size?: number;
71
+ annotations?: ContentAnnotations;
72
+ }
73
+ /** Embedded resource (inline file) — ACP EmbeddedResource */
74
+ export interface ResourceBlock {
75
+ type: 'resource';
76
+ resource: TextResourceContents | BlobResourceContents;
77
+ annotations?: ContentAnnotations;
78
+ }
79
+ export interface TextResourceContents {
80
+ uri: string;
81
+ text: string;
82
+ mimeType?: string | null;
83
+ }
84
+ export interface BlobResourceContents {
85
+ uri: string;
86
+ blob: string;
87
+ mimeType?: string | null;
88
+ }
89
+ export interface ContentAnnotations {
90
+ audience?: ('user' | 'assistant')[];
91
+ priority?: number;
92
+ }
93
+ /** Tool call info — ACP ToolCall */
94
+ export interface ToolCallInfo {
95
+ toolCallId: string;
96
+ title: string;
97
+ kind?: ToolKind;
98
+ status?: ToolCallStatus;
99
+ rawInput?: unknown;
100
+ rawOutput?: unknown;
101
+ content?: ToolCallContent[];
102
+ locations?: ToolCallLocation[];
103
+ }
104
+ export type ToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'switch_mode' | 'other';
105
+ export type ToolCallStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
106
+ /** Content produced by a tool call — ACP ToolCallContent */
107
+ export type ToolCallContent = {
108
+ type: 'content';
109
+ content: ContentBlock;
110
+ } | {
111
+ type: 'diff';
112
+ path: string;
113
+ oldText?: string;
114
+ newText: string;
115
+ } | {
116
+ type: 'terminal';
117
+ terminalId: string;
118
+ };
119
+ export interface ToolCallLocation {
120
+ path: string;
121
+ line?: number | null;
122
+ }
123
+ /** Normalize content: string → ContentBlock[] */
124
+ export declare function normalizeContent(content: string | ContentBlock[]): ContentBlock[];
125
+ /** Flatten ContentBlock[] → string (backward compat / plain-text extraction) */
126
+ export declare function flattenContent(content: string | ContentBlock[]): string;
127
+ /** SendMessage params — supports rich content (ACP PromptRequest compatible) */
128
+ export interface SendMessageParams {
129
+ /** Shortcut: text-only message */
130
+ text?: string;
131
+ /** Rich content blocks (ACP ContentBlock[]) */
132
+ prompt?: ContentBlock[];
133
+ }
134
+ export interface SendMessageResult {
135
+ sent: boolean;
136
+ error?: string;
137
+ /** When CDP Input API is needed (Lexical editor etc) */
138
+ needsTypeAndSend?: boolean;
139
+ selector?: string;
140
+ }
141
+ export interface ListSessionsResult {
142
+ sessions: SessionInfo[];
143
+ }
144
+ export interface SessionInfo {
145
+ id: string;
146
+ title: string;
147
+ time?: string;
148
+ }
149
+ export interface SwitchSessionResult {
150
+ switched: boolean;
151
+ /** When CDP click coordinates are needed (Antigravity QuickInput etc) */
152
+ action?: 'click';
153
+ clickX?: number;
154
+ clickY?: number;
155
+ error?: string;
156
+ }
157
+ /**
158
+ * Method 1: Script-Click — script calls el.click() directly
159
+ * Cursor Suitable for IDEs using div.cursor-pointer elements.
160
+ */
161
+ export interface ResolveActionScriptClick {
162
+ resolved: boolean;
163
+ clicked?: string;
164
+ available?: string[];
165
+ error?: string;
166
+ }
167
+ /**
168
+ * Method 2: Coordinate-Click — returns coordinates, daemon performs CDP mouse click
169
+ * Antigravity Suitable for IDEs where el.click() does not work.
170
+ */
171
+ export interface ResolveActionCoordinateClick {
172
+ found: boolean;
173
+ text?: string;
174
+ x?: number;
175
+ y?: number;
176
+ w?: number;
177
+ h?: number;
178
+ }
179
+ export type ResolveActionResult = ResolveActionScriptClick | ResolveActionCoordinateClick;
180
+ export type ProviderCategory = 'cli' | 'ide' | 'extension' | 'acp';
181
+ /**
182
+ * Type of object exported by module.exports in provider.js.
183
+ *
184
+ * Each provider.js is fully independent and does not import other providers.
185
+ * Helpers (_helpers/) can be optionally used.
186
+ */
187
+ /**
188
+ * Provider-configurable CDP target filter.
189
+ * Used by DaemonCdpManager to select the correct page/tab to connect to.
190
+ * Without this, the manager uses a hardcoded default filter.
191
+ */
192
+ export interface CdpTargetFilter {
193
+ /** URL must include this string (e.g. 'workbench.html') */
194
+ urlIncludes?: string;
195
+ /** URL must NOT include any of these strings */
196
+ urlExcludes?: string[];
197
+ /** Page title regex pattern for titles to EXCLUDE (e.g. 'Debug Console|Output') */
198
+ titleExcludes?: string;
199
+ }
200
+ export interface ProviderModule {
201
+ /** Unique identifier (e.g. 'cline', 'cursor', 'gemini-cli') */
202
+ type: string;
203
+ /** Display name (e.g. 'Cline', 'Cursor') */
204
+ name: string;
205
+ /** Category: determines execution method */
206
+ category: ProviderCategory;
207
+ /** Alias list — allows users to invoke by alternate names (e.g. ['claude', 'claude-code']) */
208
+ aliases?: string[];
209
+ /** CDP ports [primary, secondary] (IDE category only) */
210
+ cdpPorts?: [number, number];
211
+ /** CDP target filter — controls which page/tab to connect to (IDE category only) */
212
+ targetFilter?: CdpTargetFilter;
213
+ /** CLI command (e.g. 'cursor', 'code') */
214
+ cli?: string;
215
+ /** Display icon */
216
+ icon?: string;
217
+ /** Display name (short name) */
218
+ displayName?: string;
219
+ /** Install instructions (shown when command is missing) */
220
+ install?: string;
221
+ /** Custom version detection command (e.g. 'cursor --version', 'claude -v') */
222
+ versionCommand?: string;
223
+ /** Versions tested by provider maintainer (informational) */
224
+ testedVersions?: string[];
225
+ /** Per-OS process names — used by launch.ts to detect/kill IDE processes */
226
+ processNames?: {
227
+ darwin?: string;
228
+ win32?: string[];
229
+ linux?: string[];
230
+ [key: string]: string | string[] | undefined;
231
+ };
232
+ /** Per-OS install paths — used by detector.ts to detect IDE installation */
233
+ paths?: {
234
+ darwin?: string[];
235
+ win32?: string[];
236
+ linux?: string[];
237
+ [key: string]: string[] | undefined;
238
+ };
239
+ extensionId?: string;
240
+ extensionIdPattern?: RegExp;
241
+ binary?: string;
242
+ spawn?: {
243
+ command: string;
244
+ args?: string[];
245
+ shell?: boolean;
246
+ env?: Record<string, string>;
247
+ };
248
+ patterns?: {
249
+ prompt?: RegExp[];
250
+ generating?: RegExp[];
251
+ approval?: RegExp[];
252
+ ready?: RegExp[];
253
+ };
254
+ cleanOutput?: (raw: string, lastUserInput?: string) => string;
255
+ resume?: ProviderResumeCapability;
256
+ scripts?: ProviderScripts;
257
+ vscodeCommands?: {
258
+ focusPanel?: string;
259
+ openPanel?: string;
260
+ [key: string]: string | undefined;
261
+ };
262
+ inputMethod?: 'cdp-type-and-send' | 'script';
263
+ inputSelector?: string;
264
+ /** webview iframe match text (must be contained in body) */
265
+ webviewMatchText?: string;
266
+ os?: {
267
+ [platform: string]: Partial<Pick<ProviderModule, 'scripts' | 'inputMethod' | 'inputSelector'>>;
268
+ };
269
+ /** Key: semver range string (e.g. '< 1.107.0', '>= 2.0.0') */
270
+ versions?: {
271
+ [versionRange: string]: Partial<Pick<ProviderModule, 'scripts'>> & {
272
+ /**
273
+ * Load scripts from a subdirectory instead of scripts.js root.
274
+ * Path is relative to the provider directory (e.g. 'scripts/legacy').
275
+ * The subdirectory should contain its own scripts.js or individual .js files.
276
+ */
277
+ __dir?: string;
278
+ };
279
+ };
280
+ overrides?: Array<{
281
+ when: {
282
+ os?: string;
283
+ version?: string;
284
+ };
285
+ scripts?: Partial<ProviderScripts>;
286
+ /** Load scripts from a subdirectory for this OS+version combination */
287
+ __dir?: string;
288
+ }>;
289
+ settings?: Record<string, ProviderSettingDef>;
290
+ /** Dynamic controls declared by provider — rendered in chat panel bar/header */
291
+ controls?: ProviderControlDef[];
292
+ /** Static options used when agent does not provide configOptions */
293
+ staticConfigOptions?: Array<{
294
+ category: 'model' | 'mode' | 'thought_level' | 'other';
295
+ configId: string;
296
+ defaultValue?: string;
297
+ options: Array<{
298
+ value: string;
299
+ name: string;
300
+ description?: string;
301
+ group?: string;
302
+ }>;
303
+ }>;
304
+ /** Function to convert selected config values to spawn args (applied via process restart when config/* not supported) */
305
+ spawnArgBuilder?: (config: Record<string, string>) => string[];
306
+ /** ACP agent auth methods (multiple supported — in priority order) */
307
+ auth?: AcpAuthMethod[];
308
+ }
309
+ export interface ProviderResumeCapability {
310
+ supported: boolean;
311
+ stopStrategy?: 'command' | 'ctrl_c';
312
+ stopCommand?: string;
313
+ shutdownGraceMs?: number;
314
+ resumeArgs?: string[];
315
+ }
316
+ /** ACP auth method — based on ACP official spec */
317
+ export type AcpAuthMethod = AcpAuthEnvVar | AcpAuthAgent | AcpAuthTerminal;
318
+ /** Environment variable-based auth (API keys etc) */
319
+ export interface AcpAuthEnvVar {
320
+ type: 'env_var';
321
+ id: string;
322
+ name: string;
323
+ vars: Array<{
324
+ name: string;
325
+ label?: string;
326
+ secret?: boolean;
327
+ optional?: boolean;
328
+ }>;
329
+ link?: string;
330
+ }
331
+ /** Agent self-auth (OAuth, browser-based etc) */
332
+ export interface AcpAuthAgent {
333
+ type: 'agent';
334
+ id: string;
335
+ name: string;
336
+ description?: string;
337
+ }
338
+ /** Terminal command-based auth (runs setup command) */
339
+ export interface AcpAuthTerminal {
340
+ type: 'terminal';
341
+ id: string;
342
+ name: string;
343
+ description?: string;
344
+ args?: string[];
345
+ env?: Record<string, string>;
346
+ }
347
+ /**
348
+ * CDP script functions.
349
+ * Each function takes a params object and returns a JS code string for CDP evaluate.
350
+ * The JS execution result must conform to the Output Contract.
351
+ *
352
+ * Custom scripts can be added via index signature in addition to built-in scripts.
353
+ * All scripts can receive params: Record<string, any>,
354
+ * backward compatible with legacy single-argument style (e.g. sendMessage(text)).
355
+ */
356
+ export interface ProviderScripts {
357
+ readChat?: (params?: Record<string, any>) => string;
358
+ sendMessage?: (params?: Record<string, any>) => string;
359
+ listSessions?: (params?: Record<string, any>) => string;
360
+ switchSession?: (params?: Record<string, any>) => string;
361
+ newSession?: (params?: Record<string, any>) => string;
362
+ focusEditor?: (params?: Record<string, any>) => string;
363
+ openPanel?: (params?: Record<string, any>) => string;
364
+ /** List available models → { models: string[], current: string } */
365
+ listModels?: (params?: Record<string, any>) => string;
366
+ /** Change model → { success: boolean } */
367
+ setModel?: (params?: Record<string, any>) => string;
368
+ /** List available modes → { modes: string[], current: string } */
369
+ listModes?: (params?: Record<string, any>) => string;
370
+ /** Change mode → { success: boolean } */
371
+ setMode?: (params?: Record<string, any>) => string;
372
+ /** params: { action: 'approve'|'reject'|'custom', button?: string } */
373
+ resolveAction?: (params?: Record<string, any>) => string;
374
+ webviewResolveAction?: (params?: Record<string, any>) => string;
375
+ listNotifications?: (params?: Record<string, any>) => string;
376
+ dismissNotification?: (params?: Record<string, any>) => string;
377
+ [scriptName: string]: ((params?: Record<string, any>) => string) | undefined;
378
+ }
379
+ /**
380
+ * ProviderLoader.resolve() result: Final provider with OS/version overrides applied
381
+ */
382
+ export interface ResolvedProvider extends ProviderModule {
383
+ /** OS applied during resolve */
384
+ _resolvedOs?: string;
385
+ /** Version applied during resolve */
386
+ _resolvedVersion?: string;
387
+ /** Warning when detected version is not in compatibility matrix */
388
+ _versionWarning?: string;
389
+ }
390
+ /** Setting variable definition declared by provider */
391
+ export interface ProviderSettingDef {
392
+ type: 'boolean' | 'number' | 'string' | 'select';
393
+ default: any;
394
+ /** true = controllable from dashboard UI */
395
+ public: boolean;
396
+ /** UI label */
397
+ label?: string;
398
+ /** UI description */
399
+ description?: string;
400
+ /** Minimum value for number type */
401
+ min?: number;
402
+ /** Maximum value for number type */
403
+ max?: number;
404
+ /** Options for select type */
405
+ options?: string[];
406
+ }
407
+ /** Public settings schema (for dashboard transmission) */
408
+ export interface ProviderSettingSchema extends ProviderSettingDef {
409
+ key: string;
410
+ }
411
+ /**
412
+ * Control types:
413
+ * - 'select' — dropdown list (model picker, mode picker)
414
+ * - 'toggle' — on/off switch (compact mode, auto-approve)
415
+ * - 'cycle' — click-to-cycle through options (thinking level: low→med→high)
416
+ * - 'slider' — numeric range (temperature: 0–2)
417
+ * - 'action' — one-shot button (show usage, restart, clear context)
418
+ */
419
+ export type ProviderControlType = 'select' | 'toggle' | 'cycle' | 'slider' | 'action';
420
+ /**
421
+ * Where the control appears in the chat UI:
422
+ * - 'bar' — thin strip below/above the chat input (always visible)
423
+ * - 'header' — in the agent header area
424
+ * - 'menu' — inside a ⋯ overflow menu
425
+ */
426
+ export type ProviderControlPlacement = 'bar' | 'header' | 'menu';
427
+ /** Static option for select/cycle controls */
428
+ export interface ProviderControlOption {
429
+ value: string;
430
+ label: string;
431
+ description?: string;
432
+ group?: string;
433
+ }
434
+ /**
435
+ * ProviderControlDef — A single interactive control declared by a provider.
436
+ *
437
+ * Controls are different from Settings:
438
+ * - Settings: background config, infrequently changed, managed in settings page
439
+ * - Controls: interactive, changed during chat, rendered inside chat panel
440
+ *
441
+ * Each control maps to provider scripts for get/set operations.
442
+ * The frontend renders controls automatically based on this schema —
443
+ * no hardcoded model/mode assumptions needed.
444
+ *
445
+ * For 'action' type:
446
+ * - Renders as a button. On click → calls invokeScript.
447
+ * - No value state. Optionally shows result via toast/inline.
448
+ */
449
+ export interface ProviderControlDef {
450
+ /** Unique identifier (e.g. 'model', 'mode', 'thinking', 'usage') */
451
+ id: string;
452
+ /** Control type */
453
+ type: ProviderControlType;
454
+ /** Display label */
455
+ label: string;
456
+ /** Icon (emoji or icon name) */
457
+ icon?: string;
458
+ /** Where to show this control in the UI */
459
+ placement: ProviderControlPlacement;
460
+ /** Static options — used when the list is known at definition time */
461
+ options?: ProviderControlOption[];
462
+ /** Dynamic options — load via script at runtime */
463
+ dynamic?: boolean;
464
+ /** Script name to list options (e.g. 'listModels') — required when dynamic=true */
465
+ listScript?: string;
466
+ /** Script name to change value (e.g. 'setModel') — required for value-based controls */
467
+ setScript?: string;
468
+ /** Field name in readChat() result to read current value (e.g. 'model', 'mode') */
469
+ readFrom?: string;
470
+ /** Default value */
471
+ defaultValue?: string | number | boolean;
472
+ /** Script name to invoke (one-shot call, no value) */
473
+ invokeScript?: string;
474
+ /** How to display action result: 'toast' = notification, 'inline' = show in bar, 'none' = silent */
475
+ resultDisplay?: 'toast' | 'inline' | 'none';
476
+ min?: number;
477
+ max?: number;
478
+ step?: number;
479
+ /** Sort order within placement group (lower = first) */
480
+ order?: number;
481
+ /** Hide this control when condition not met */
482
+ hidden?: boolean;
483
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * ExtensionProviderInstance — Runtime instance for Extension Provider
3
+ *
4
+ * Manages IDE extensions (Cline, Roo Code, etc).
5
+ * CDP webview discovery + agent stream collection moved here.
6
+ */
7
+ import type { ProviderModule } from './contracts.js';
8
+ import type { ProviderInstance, ProviderState, InstanceContext } from './provider-instance.js';
9
+ export declare class ExtensionProviderInstance implements ProviderInstance {
10
+ readonly type: string;
11
+ readonly category: "extension";
12
+ private provider;
13
+ private context;
14
+ private settings;
15
+ private events;
16
+ private currentStatus;
17
+ private agentStreams;
18
+ private messages;
19
+ private activeModal;
20
+ private currentModel;
21
+ private currentMode;
22
+ private controlValues;
23
+ private lastAgentStatus;
24
+ private generatingStartedAt;
25
+ private monitor;
26
+ private instanceId;
27
+ private ideType;
28
+ private chatId;
29
+ private chatTitle;
30
+ private agentName;
31
+ private extensionId;
32
+ constructor(provider: ProviderModule);
33
+ init(context: InstanceContext): Promise<void>;
34
+ onTick(): Promise<void>;
35
+ getState(): ProviderState;
36
+ onEvent(event: string, data?: any): void;
37
+ dispose(): void;
38
+ /** Query UUID instanceId */
39
+ getInstanceId(): string;
40
+ private detectTransition;
41
+ private pushEvent;
42
+ private flushEvents;
43
+ private resolveChatTitle;
44
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * IdeProviderInstance — Runtime instance for IDE Provider
3
+ *
4
+ * Within a single IDE:
5
+ * 1. Native chat (readChat via CDP)
6
+ * 2. Extension agents (Cline, Roo Code etc)
7
+ *
8
+ * IDE Instance manages child Extension Instances.
9
+ * Daemon collects all via a single IDE Instance.getState() call.
10
+ */
11
+ import type { ProviderModule } from './contracts.js';
12
+ import type { ProviderInstance, ProviderState, InstanceContext } from './provider-instance.js';
13
+ import { ExtensionProviderInstance } from './extension-provider-instance.js';
14
+ export declare class IdeProviderInstance implements ProviderInstance {
15
+ readonly type: string;
16
+ readonly category: "ide";
17
+ private provider;
18
+ private context;
19
+ private settings;
20
+ private events;
21
+ private tickErrorCount;
22
+ private cachedChat;
23
+ private currentStatus;
24
+ private lastAgentStatuses;
25
+ private generatingStartedAt;
26
+ private tickBusy;
27
+ private monitor;
28
+ private historyWriter;
29
+ private autoApproveBusy;
30
+ private ideVersion;
31
+ private instanceId;
32
+ private workspace;
33
+ private extensions;
34
+ constructor(provider: ProviderModule, instanceKey?: string);
35
+ init(context: InstanceContext): Promise<void>;
36
+ onTick(): Promise<void>;
37
+ getState(): ProviderState;
38
+ onEvent(event: string, data?: any): void;
39
+ dispose(): void;
40
+ /** Extension Instance add */
41
+ addExtension(provider: ProviderModule, settings?: Record<string, any>): Promise<void>;
42
+ /** Extension Instance remove */
43
+ removeExtension(type: string): void;
44
+ /** Extension Instance Import */
45
+ getExtension(type: string): ExtensionProviderInstance | undefined;
46
+ /** Child Extension list */
47
+ getExtensionTypes(): string[];
48
+ /** Query UUID instanceId */
49
+ getInstanceId(): string;
50
+ /** all Extension Instance list */
51
+ getExtensionInstances(): ExtensionProviderInstance[];
52
+ /** Set workspace from daemon launch context */
53
+ setWorkspace(workspace: string): void;
54
+ private readChat;
55
+ private getReadChatScript;
56
+ private detectAgentTransitions;
57
+ private pushEvent;
58
+ private flushEvents;
59
+ updateCdp(cdp: InstanceContext['cdp']): void;
60
+ private autoApproveViaScript;
61
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Provider System — Public API
3
+ */
4
+ export { ProviderLoader } from './provider-loader.js';
5
+ export type { ProviderModule, ProviderCategory, ProviderScripts, ResolvedProvider, ReadChatResult, ChatMessage, AgentStatus, ModalInfo, SendMessageResult, ListSessionsResult, SessionInfo, SwitchSessionResult, } from './contracts.js';
@@ -0,0 +1,84 @@
1
+ /**
2
+ * ProviderInstanceManager — lifecycle management for all ProviderInstances
3
+ *
4
+ * Role:
5
+ * 1. Instance create/delete
6
+ * 2. Tick engine (periodic onTick calls)
7
+ * 3. Collect overall state
8
+ * 4. Event collection and propagation
9
+ */
10
+ import type { ProviderInstance, ProviderState, ProviderEvent, InstanceContext } from './provider-instance.js';
11
+ export declare class ProviderInstanceManager {
12
+ private instances;
13
+ private tickTimer;
14
+ private tickInterval;
15
+ private eventListeners;
16
+ /**
17
+ * Instance add and initialize
18
+ */
19
+ addInstance(id: string, instance: ProviderInstance, context: InstanceContext): Promise<void>;
20
+ /**
21
+ * Instance remove
22
+ */
23
+ removeInstance(id: string): void;
24
+ removeByCategory(category: 'cli' | 'ide' | 'extension' | 'acp', options?: {
25
+ dispose?: boolean;
26
+ }): number;
27
+ /**
28
+ * Import by Instance ID
29
+ */
30
+ getInstance(id: string): ProviderInstance | undefined;
31
+ /**
32
+ * Per-category Instance list
33
+ */
34
+ getByCategory(category: 'cli' | 'ide' | 'extension' | 'acp'): ProviderInstance[];
35
+ /**
36
+ * All Instance count
37
+ */
38
+ get size(): number;
39
+ /**
40
+ * All Instance IDs (for iteration without exposing the private Map)
41
+ */
42
+ listInstanceIds(): string[];
43
+ /**
44
+ * all Instance's current status collect
45
+ * + Propagate pending events to event listeners
46
+ */
47
+ collectAllStates(): ProviderState[];
48
+ /**
49
+ * Per-category status collect
50
+ */
51
+ collectStatesByCategory(category: 'cli' | 'ide' | 'extension' | 'acp'): ProviderState[];
52
+ /**
53
+ * Start tick — periodically call all Instance.onTick() call
54
+ */
55
+ startTicking(intervalMs?: number): void;
56
+ /**
57
+ * Stop tick
58
+ */
59
+ stopTicking(): void;
60
+ /**
61
+ * Register event listener (used for daemon status_event transmission)
62
+ */
63
+ onEvent(listener: (event: ProviderEvent & {
64
+ providerType: string;
65
+ }) => void): void;
66
+ private emitPendingEvents;
67
+ /**
68
+ * Forward event to specific Instance
69
+ */
70
+ sendEvent(id: string, event: string, data?: any): void;
71
+ /**
72
+ * Broadcast event to all Instances
73
+ */
74
+ broadcast(event: string, data?: any): void;
75
+ /**
76
+ * Update settings for all instances of a given provider type.
77
+ * Called when user changes settings from dashboard.
78
+ */
79
+ updateInstanceSettings(providerType: string, settings: Record<string, any>): number;
80
+ /**
81
+ * All terminate
82
+ */
83
+ disposeAll(): void;
84
+ }