@adhdev/daemon-core 0.7.6 → 0.7.9
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.mts +158 -38
- package/dist/index.d.ts +158 -38
- package/dist/index.js +3965 -2521
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3455 -2011
- package/dist/index.mjs.map +1 -1
- package/dist/{normalize-tKg8IiDk.d.mts → normalize-auJAPmKy.d.mts} +669 -629
- package/dist/{normalize-tKg8IiDk.d.ts → normalize-auJAPmKy.d.ts} +669 -629
- package/dist/status/normalize.d.mts +1 -1
- package/dist/status/normalize.d.ts +1 -1
- package/package.json +5 -1
- package/src/boot/daemon-lifecycle.ts +7 -4
- package/src/cli-adapter-types.ts +2 -0
- package/src/cli-adapters/provider-cli-adapter.ts +148 -11
- package/src/cli-adapters/pty-transport.ts +100 -0
- package/src/cli-adapters/session-host-transport.ts +392 -0
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +126 -0
- package/src/cli-adapters/terminal-backends/types.ts +17 -0
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +87 -0
- package/src/cli-adapters/terminal-screen.ts +40 -53
- package/src/commands/cli-manager.ts +184 -55
- package/src/config/config.d.ts +116 -0
- package/src/config/workspace-activity.d.ts +22 -0
- package/src/config/workspaces.d.ts +84 -0
- package/src/daemon/dev-auto-implement.ts +1087 -0
- package/src/daemon/dev-cdp-handlers.ts +1003 -0
- package/src/daemon/dev-cli-debug.ts +288 -0
- package/src/daemon/dev-server-types.ts +45 -0
- package/src/daemon/dev-server.ts +121 -1698
- package/src/index.ts +5 -1
- package/src/providers/cli-provider-instance.ts +13 -1
- package/src/providers/contracts.d.ts +408 -0
- package/src/providers/contracts.ts +9 -0
- package/src/providers/provider-instance-manager.ts +21 -0
- package/src/providers/provider-instance.d.ts +142 -0
- package/src/providers/provider-instance.ts +23 -1
- package/src/shared-types.d.ts +157 -0
- package/src/shared-types.ts +14 -0
- package/src/status/builders.ts +6 -0
- package/src/status/normalize.d.ts +14 -0
- package/src/types.d.ts +127 -0
|
@@ -1,703 +1,743 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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.
|
|
2
|
+
* ContentBlock — ACP ContentBlock union type
|
|
3
|
+
* Represents displayable content in messages, tool call results, etc.
|
|
9
4
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
messages: ChatMessage[];
|
|
17
|
-
activeModal: {
|
|
18
|
-
message: string;
|
|
19
|
-
buttons: string[];
|
|
20
|
-
} | null;
|
|
21
|
-
terminalHistory?: string;
|
|
22
|
-
inputContent?: string;
|
|
5
|
+
type ContentBlock = TextBlock | ImageBlock | AudioBlock | ResourceLinkBlock | ResourceBlock;
|
|
6
|
+
/** Text content — ACP TextContent */
|
|
7
|
+
interface TextBlock {
|
|
8
|
+
type: 'text';
|
|
9
|
+
text: string;
|
|
10
|
+
annotations?: ContentAnnotations;
|
|
23
11
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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[];
|
|
12
|
+
/** Image content — ACP ImageContent */
|
|
13
|
+
interface ImageBlock {
|
|
14
|
+
type: 'image';
|
|
15
|
+
data: string;
|
|
16
|
+
mimeType: string;
|
|
17
|
+
uri?: string;
|
|
18
|
+
annotations?: ContentAnnotations;
|
|
50
19
|
}
|
|
51
|
-
/**
|
|
52
|
-
interface
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
currentAutoApprove?: string;
|
|
20
|
+
/** Audio content — ACP AudioContent */
|
|
21
|
+
interface AudioBlock {
|
|
22
|
+
type: 'audio';
|
|
23
|
+
data: string;
|
|
24
|
+
mimeType: string;
|
|
25
|
+
annotations?: ContentAnnotations;
|
|
58
26
|
}
|
|
59
|
-
/**
|
|
60
|
-
interface
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
27
|
+
/** Resource link (file reference) — ACP ResourceLink */
|
|
28
|
+
interface ResourceLinkBlock {
|
|
29
|
+
type: 'resource_link';
|
|
30
|
+
uri: string;
|
|
31
|
+
name: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
mimeType?: string;
|
|
35
|
+
size?: number;
|
|
36
|
+
annotations?: ContentAnnotations;
|
|
64
37
|
}
|
|
65
|
-
/** ACP
|
|
66
|
-
interface
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
acpConfigOptions?: AcpConfigOption[];
|
|
71
|
-
/** ACP available modes */
|
|
72
|
-
acpModes?: AcpMode[];
|
|
38
|
+
/** Embedded resource (inline file) — ACP EmbeddedResource */
|
|
39
|
+
interface ResourceBlock {
|
|
40
|
+
type: 'resource';
|
|
41
|
+
resource: TextResourceContents | BlobResourceContents;
|
|
42
|
+
annotations?: ContentAnnotations;
|
|
73
43
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
44
|
+
interface TextResourceContents {
|
|
45
|
+
uri: string;
|
|
46
|
+
text: string;
|
|
47
|
+
mimeType?: string | null;
|
|
78
48
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
timestamp: number;
|
|
84
|
-
[key: string]: any;
|
|
49
|
+
interface BlobResourceContents {
|
|
50
|
+
uri: string;
|
|
51
|
+
blob: string;
|
|
52
|
+
mimeType?: string | null;
|
|
85
53
|
}
|
|
86
|
-
interface
|
|
87
|
-
|
|
88
|
-
|
|
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>;
|
|
54
|
+
interface ContentAnnotations {
|
|
55
|
+
audience?: ('user' | 'assistant')[];
|
|
56
|
+
priority?: number;
|
|
102
57
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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;
|
|
58
|
+
/** Tool call info — ACP ToolCall */
|
|
59
|
+
interface ToolCallInfo {
|
|
60
|
+
toolCallId: string;
|
|
61
|
+
title: string;
|
|
62
|
+
kind?: ToolKind;
|
|
63
|
+
status?: ToolCallStatus;
|
|
64
|
+
rawInput?: unknown;
|
|
65
|
+
rawOutput?: unknown;
|
|
66
|
+
content?: ToolCallContent[];
|
|
67
|
+
locations?: ToolCallLocation[];
|
|
120
68
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
69
|
+
type ToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'switch_mode' | 'other';
|
|
70
|
+
type ToolCallStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
71
|
+
/** Content produced by a tool call — ACP ToolCallContent */
|
|
72
|
+
type ToolCallContent = {
|
|
73
|
+
type: 'content';
|
|
74
|
+
content: ContentBlock;
|
|
75
|
+
} | {
|
|
76
|
+
type: 'diff';
|
|
127
77
|
path: string;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
78
|
+
oldText?: string;
|
|
79
|
+
newText: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'terminal';
|
|
82
|
+
terminalId: string;
|
|
83
|
+
};
|
|
84
|
+
interface ToolCallLocation {
|
|
85
|
+
path: string;
|
|
86
|
+
line?: number | null;
|
|
133
87
|
}
|
|
134
|
-
|
|
135
|
-
|
|
88
|
+
type ProviderCategory = 'cli' | 'ide' | 'extension' | 'acp';
|
|
136
89
|
/**
|
|
137
|
-
*
|
|
90
|
+
* Type of object exported by module.exports in provider.js.
|
|
138
91
|
*
|
|
139
|
-
*
|
|
92
|
+
* Each provider.js is fully independent and does not import other providers.
|
|
93
|
+
* Helpers (_helpers/) can be optionally used.
|
|
140
94
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Provider-configurable CDP target filter.
|
|
97
|
+
* Used by DaemonCdpManager to select the correct page/tab to connect to.
|
|
98
|
+
* Without this, the manager uses a hardcoded default filter.
|
|
99
|
+
*/
|
|
100
|
+
interface CdpTargetFilter {
|
|
101
|
+
/** URL must include this string (e.g. 'workbench.html') */
|
|
102
|
+
urlIncludes?: string;
|
|
103
|
+
/** URL must NOT include any of these strings */
|
|
104
|
+
urlExcludes?: string[];
|
|
105
|
+
/** Page title regex pattern for titles to EXCLUDE (e.g. 'Debug Console|Output') */
|
|
106
|
+
titleExcludes?: string;
|
|
107
|
+
}
|
|
108
|
+
interface ProviderModule {
|
|
109
|
+
/** Unique identifier (e.g. 'cline', 'cursor', 'gemini-cli') */
|
|
110
|
+
type: string;
|
|
111
|
+
/** Display name (e.g. 'Cline', 'Cursor') */
|
|
112
|
+
name: string;
|
|
113
|
+
/** Category: determines execution method */
|
|
114
|
+
category: ProviderCategory;
|
|
115
|
+
/** Alias list — allows users to invoke by alternate names (e.g. ['claude', 'claude-code']) */
|
|
116
|
+
aliases?: string[];
|
|
117
|
+
/** CDP ports [primary, secondary] (IDE category only) */
|
|
118
|
+
cdpPorts?: [number, number];
|
|
119
|
+
/** CDP target filter — controls which page/tab to connect to (IDE category only) */
|
|
120
|
+
targetFilter?: CdpTargetFilter;
|
|
121
|
+
/** CLI command (e.g. 'cursor', 'code') */
|
|
122
|
+
cli?: string;
|
|
123
|
+
/** Display icon */
|
|
124
|
+
icon?: string;
|
|
125
|
+
/** Display name (short name) */
|
|
126
|
+
displayName?: string;
|
|
127
|
+
/** Install instructions (shown when command is missing) */
|
|
128
|
+
install?: string;
|
|
129
|
+
/** Custom version detection command (e.g. 'cursor --version', 'claude -v') */
|
|
130
|
+
versionCommand?: string;
|
|
131
|
+
/** Versions tested by provider maintainer (informational) */
|
|
132
|
+
testedVersions?: string[];
|
|
133
|
+
/** Per-OS process names — used by launch.ts to detect/kill IDE processes */
|
|
134
|
+
processNames?: {
|
|
135
|
+
darwin?: string;
|
|
136
|
+
win32?: string[];
|
|
137
|
+
linux?: string[];
|
|
138
|
+
[key: string]: string | string[] | undefined;
|
|
139
|
+
};
|
|
140
|
+
/** Per-OS install paths — used by detector.ts to detect IDE installation */
|
|
141
|
+
paths?: {
|
|
142
|
+
darwin?: string[];
|
|
143
|
+
win32?: string[];
|
|
144
|
+
linux?: string[];
|
|
145
|
+
[key: string]: string[] | undefined;
|
|
146
|
+
};
|
|
147
|
+
extensionId?: string;
|
|
148
|
+
extensionIdPattern?: RegExp;
|
|
149
|
+
binary?: string;
|
|
150
|
+
spawn?: {
|
|
151
|
+
command: string;
|
|
152
|
+
args?: string[];
|
|
153
|
+
shell?: boolean;
|
|
154
|
+
env?: Record<string, string>;
|
|
155
|
+
};
|
|
156
|
+
patterns?: {
|
|
157
|
+
prompt?: RegExp[];
|
|
158
|
+
generating?: RegExp[];
|
|
159
|
+
approval?: RegExp[];
|
|
160
|
+
ready?: RegExp[];
|
|
161
|
+
};
|
|
162
|
+
cleanOutput?: (raw: string, lastUserInput?: string) => string;
|
|
163
|
+
resume?: ProviderResumeCapability;
|
|
164
|
+
scripts?: ProviderScripts;
|
|
165
|
+
vscodeCommands?: {
|
|
166
|
+
focusPanel?: string;
|
|
167
|
+
openPanel?: string;
|
|
168
|
+
[key: string]: string | undefined;
|
|
169
|
+
};
|
|
170
|
+
inputMethod?: 'cdp-type-and-send' | 'script';
|
|
171
|
+
inputSelector?: string;
|
|
172
|
+
/** webview iframe match text (must be contained in body) */
|
|
173
|
+
webviewMatchText?: string;
|
|
174
|
+
os?: {
|
|
175
|
+
[platform: string]: Partial<Pick<ProviderModule, 'scripts' | 'inputMethod' | 'inputSelector'>>;
|
|
176
|
+
};
|
|
177
|
+
/** Key: semver range string (e.g. '< 1.107.0', '>= 2.0.0') */
|
|
178
|
+
versions?: {
|
|
179
|
+
[versionRange: string]: Partial<Pick<ProviderModule, 'scripts'>> & {
|
|
180
|
+
/**
|
|
181
|
+
* Load scripts from a subdirectory instead of scripts.js root.
|
|
182
|
+
* Path is relative to the provider directory (e.g. 'scripts/legacy').
|
|
183
|
+
* The subdirectory should contain its own scripts.js or individual .js files.
|
|
184
|
+
*/
|
|
185
|
+
__dir?: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
overrides?: Array<{
|
|
189
|
+
when: {
|
|
190
|
+
os?: string;
|
|
191
|
+
version?: string;
|
|
192
|
+
};
|
|
193
|
+
scripts?: Partial<ProviderScripts>;
|
|
194
|
+
/** Load scripts from a subdirectory for this OS+version combination */
|
|
195
|
+
__dir?: string;
|
|
196
|
+
}>;
|
|
197
|
+
settings?: Record<string, ProviderSettingDef>;
|
|
198
|
+
/** Static options used when agent does not provide configOptions */
|
|
199
|
+
staticConfigOptions?: Array<{
|
|
200
|
+
category: 'model' | 'mode' | 'thought_level' | 'other';
|
|
201
|
+
configId: string;
|
|
202
|
+
defaultValue?: string;
|
|
203
|
+
options: Array<{
|
|
204
|
+
value: string;
|
|
205
|
+
name: string;
|
|
206
|
+
description?: string;
|
|
207
|
+
group?: string;
|
|
195
208
|
}>;
|
|
196
209
|
}>;
|
|
197
|
-
|
|
198
|
-
|
|
210
|
+
/** Function to convert selected config values to spawn args (applied via process restart when config/* not supported) */
|
|
211
|
+
spawnArgBuilder?: (config: Record<string, string>) => string[];
|
|
212
|
+
/** ACP agent auth methods (multiple supported — in priority order) */
|
|
213
|
+
auth?: AcpAuthMethod[];
|
|
199
214
|
}
|
|
200
|
-
interface
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
215
|
+
interface ProviderResumeCapability {
|
|
216
|
+
supported: boolean;
|
|
217
|
+
stopStrategy?: 'command' | 'ctrl_c';
|
|
218
|
+
stopCommand?: string;
|
|
219
|
+
shutdownGraceMs?: number;
|
|
220
|
+
resumeArgs?: string[];
|
|
221
|
+
}
|
|
222
|
+
/** ACP auth method — based on ACP official spec */
|
|
223
|
+
type AcpAuthMethod = AcpAuthEnvVar | AcpAuthAgent | AcpAuthTerminal;
|
|
224
|
+
/** Environment variable-based auth (API keys etc) */
|
|
225
|
+
interface AcpAuthEnvVar {
|
|
226
|
+
type: 'env_var';
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
vars: Array<{
|
|
230
|
+
name: string;
|
|
231
|
+
label?: string;
|
|
232
|
+
secret?: boolean;
|
|
233
|
+
optional?: boolean;
|
|
234
|
+
}>;
|
|
235
|
+
link?: string;
|
|
236
|
+
}
|
|
237
|
+
/** Agent self-auth (OAuth, browser-based etc) */
|
|
238
|
+
interface AcpAuthAgent {
|
|
239
|
+
type: 'agent';
|
|
240
|
+
id: string;
|
|
241
|
+
name: string;
|
|
242
|
+
description?: string;
|
|
243
|
+
}
|
|
244
|
+
/** Terminal command-based auth (runs setup command) */
|
|
245
|
+
interface AcpAuthTerminal {
|
|
246
|
+
type: 'terminal';
|
|
247
|
+
id: string;
|
|
248
|
+
name: string;
|
|
249
|
+
description?: string;
|
|
250
|
+
args?: string[];
|
|
251
|
+
env?: Record<string, string>;
|
|
210
252
|
}
|
|
211
253
|
/**
|
|
212
|
-
*
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
|
|
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
|
|
254
|
+
* CDP script functions.
|
|
255
|
+
* Each function takes a params object and returns a JS code string for CDP evaluate.
|
|
256
|
+
* The JS execution result must conform to the Output Contract.
|
|
257
|
+
*
|
|
258
|
+
* Custom scripts can be added via index signature in addition to built-in scripts.
|
|
259
|
+
* All scripts can receive params: Record<string, any>,
|
|
260
|
+
* backward compatible with legacy single-argument style (e.g. sendMessage(text)).
|
|
233
261
|
*/
|
|
234
|
-
|
|
262
|
+
interface ProviderScripts {
|
|
263
|
+
readChat?: (params?: Record<string, any>) => string;
|
|
264
|
+
sendMessage?: (params?: Record<string, any>) => string;
|
|
265
|
+
listSessions?: (params?: Record<string, any>) => string;
|
|
266
|
+
switchSession?: (params?: Record<string, any>) => string;
|
|
267
|
+
newSession?: (params?: Record<string, any>) => string;
|
|
268
|
+
focusEditor?: (params?: Record<string, any>) => string;
|
|
269
|
+
openPanel?: (params?: Record<string, any>) => string;
|
|
270
|
+
/** List available models → { models: string[], current: string } */
|
|
271
|
+
listModels?: (params?: Record<string, any>) => string;
|
|
272
|
+
/** Change model → { success: boolean } */
|
|
273
|
+
setModel?: (params?: Record<string, any>) => string;
|
|
274
|
+
/** List available modes → { modes: string[], current: string } */
|
|
275
|
+
listModes?: (params?: Record<string, any>) => string;
|
|
276
|
+
/** Change mode → { success: boolean } */
|
|
277
|
+
setMode?: (params?: Record<string, any>) => string;
|
|
278
|
+
/** params: { action: 'approve'|'reject'|'custom', button?: string } */
|
|
279
|
+
resolveAction?: (params?: Record<string, any>) => string;
|
|
280
|
+
webviewResolveAction?: (params?: Record<string, any>) => string;
|
|
281
|
+
listNotifications?: (params?: Record<string, any>) => string;
|
|
282
|
+
dismissNotification?: (params?: Record<string, any>) => string;
|
|
283
|
+
[scriptName: string]: ((params?: Record<string, any>) => string) | undefined;
|
|
284
|
+
}
|
|
235
285
|
/**
|
|
236
|
-
*
|
|
286
|
+
* ProviderLoader.resolve() result: Final provider with OS/version overrides applied
|
|
237
287
|
*/
|
|
238
|
-
|
|
288
|
+
interface ResolvedProvider extends ProviderModule {
|
|
289
|
+
/** OS applied during resolve */
|
|
290
|
+
_resolvedOs?: string;
|
|
291
|
+
/** Version applied during resolve */
|
|
292
|
+
_resolvedVersion?: string;
|
|
293
|
+
/** Warning when detected version is not in compatibility matrix */
|
|
294
|
+
_versionWarning?: string;
|
|
295
|
+
}
|
|
296
|
+
/** Setting variable definition declared by provider */
|
|
297
|
+
interface ProviderSettingDef {
|
|
298
|
+
type: 'boolean' | 'number' | 'string' | 'select';
|
|
299
|
+
default: any;
|
|
300
|
+
/** true = controllable from dashboard UI */
|
|
301
|
+
public: boolean;
|
|
302
|
+
/** UI label */
|
|
303
|
+
label?: string;
|
|
304
|
+
/** UI description */
|
|
305
|
+
description?: string;
|
|
306
|
+
/** Minimum value for number type */
|
|
307
|
+
min?: number;
|
|
308
|
+
/** Maximum value for number type */
|
|
309
|
+
max?: number;
|
|
310
|
+
/** Options for select type */
|
|
311
|
+
options?: string[];
|
|
312
|
+
}
|
|
313
|
+
/** Public settings schema (for dashboard transmission) */
|
|
314
|
+
interface ProviderSettingSchema extends ProviderSettingDef {
|
|
315
|
+
key: string;
|
|
316
|
+
}
|
|
239
317
|
|
|
240
318
|
/**
|
|
241
|
-
*
|
|
319
|
+
* ProviderInstance — Provider runtime lifecycle
|
|
320
|
+
*
|
|
321
|
+
* provider.js = static config/scripts
|
|
322
|
+
* ProviderInstance = runtime status management + lifecycle
|
|
323
|
+
*
|
|
324
|
+
* Daemon only collects via ProviderInstance.getState(),
|
|
325
|
+
* Each Instance manages its own status.
|
|
242
326
|
*/
|
|
243
327
|
|
|
244
|
-
|
|
328
|
+
type ProviderStatus = 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
|
|
329
|
+
interface ProviderRuntimeWriteOwner {
|
|
330
|
+
clientId: string;
|
|
331
|
+
ownerType: 'agent' | 'user';
|
|
332
|
+
}
|
|
333
|
+
interface ProviderRuntimeClient {
|
|
334
|
+
clientId: string;
|
|
335
|
+
type: 'daemon' | 'web' | 'local-terminal';
|
|
336
|
+
readOnly: boolean;
|
|
337
|
+
}
|
|
338
|
+
interface ProviderRuntimeInfo {
|
|
339
|
+
runtimeId: string;
|
|
340
|
+
runtimeKey?: string;
|
|
341
|
+
displayName?: string;
|
|
342
|
+
workspaceLabel?: string;
|
|
343
|
+
writeOwner?: ProviderRuntimeWriteOwner | null;
|
|
344
|
+
attachedClients?: ProviderRuntimeClient[];
|
|
345
|
+
}
|
|
346
|
+
interface ActiveChatData {
|
|
245
347
|
id: string;
|
|
246
|
-
|
|
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
|
-
/** Agent stream snapshot carried by flattened UI entries. */
|
|
266
|
-
interface AgentSessionStream {
|
|
267
|
-
sessionId?: string;
|
|
268
|
-
instanceId?: string;
|
|
269
|
-
parentSessionId?: string | null;
|
|
270
|
-
agentType: string;
|
|
271
|
-
agentName: string;
|
|
272
|
-
extensionId: string;
|
|
273
|
-
transport?: SessionTransport;
|
|
348
|
+
title: string;
|
|
274
349
|
status: string;
|
|
275
|
-
title?: string;
|
|
276
350
|
messages: ChatMessage[];
|
|
277
|
-
inputContent: string;
|
|
278
|
-
model?: string;
|
|
279
351
|
activeModal: {
|
|
280
352
|
message: string;
|
|
281
353
|
buttons: string[];
|
|
282
354
|
} | null;
|
|
355
|
+
terminalHistory?: string;
|
|
356
|
+
inputContent?: string;
|
|
283
357
|
}
|
|
284
|
-
|
|
285
|
-
type
|
|
286
|
-
|
|
287
|
-
interface
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
title: string;
|
|
296
|
-
workspace: string | null;
|
|
358
|
+
/** Standardized error reasons across all provider categories */
|
|
359
|
+
type ProviderErrorReason = 'not_installed' | 'auth_failed' | 'spawn_error' | 'init_failed' | 'crash' | 'timeout' | 'cdp_error' | 'disconnected';
|
|
360
|
+
/** Common fields shared by all provider categories */
|
|
361
|
+
interface ProviderStateBase {
|
|
362
|
+
/** Provider type (e.g. 'gemini-cli', 'cursor', 'cline') */
|
|
363
|
+
type: string;
|
|
364
|
+
/** Provider Display name */
|
|
365
|
+
name: string;
|
|
366
|
+
/** current status */
|
|
367
|
+
status: ProviderStatus;
|
|
368
|
+
/** chat data */
|
|
297
369
|
activeChat: ActiveChatData | null;
|
|
298
|
-
|
|
299
|
-
|
|
370
|
+
/** Workspace — project path or name (all categories) */
|
|
371
|
+
workspace?: string | null;
|
|
372
|
+
/** Runtime info (real-time detection) */
|
|
300
373
|
currentModel?: string;
|
|
301
374
|
currentPlan?: string;
|
|
302
|
-
|
|
303
|
-
acpConfigOptions?: AcpConfigOption[];
|
|
304
|
-
acpModes?: AcpMode[];
|
|
375
|
+
/** Error details (when status === 'error') */
|
|
305
376
|
errorMessage?: string;
|
|
306
377
|
errorReason?: ProviderErrorReason;
|
|
378
|
+
/** meta */
|
|
379
|
+
instanceId: string;
|
|
380
|
+
lastUpdated: number;
|
|
381
|
+
settings: Record<string, any>;
|
|
382
|
+
/** Event queue (cleared after daemon collects) */
|
|
383
|
+
pendingEvents: ProviderEvent[];
|
|
384
|
+
runtime?: ProviderRuntimeInfo;
|
|
385
|
+
resume?: ProviderResumeCapability;
|
|
307
386
|
}
|
|
308
|
-
/**
|
|
309
|
-
interface
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
/** ACP config option (model/mode/thought_level selection) */
|
|
317
|
-
interface AcpConfigOption {
|
|
318
|
-
category: 'model' | 'mode' | 'thought_level' | 'other';
|
|
319
|
-
configId: string;
|
|
320
|
-
currentValue?: string;
|
|
321
|
-
options: {
|
|
322
|
-
value: string;
|
|
323
|
-
name: string;
|
|
324
|
-
description?: string;
|
|
325
|
-
group?: string;
|
|
326
|
-
}[];
|
|
327
|
-
}
|
|
328
|
-
/** ACP mode */
|
|
329
|
-
interface AcpMode {
|
|
330
|
-
id: string;
|
|
331
|
-
name: string;
|
|
332
|
-
description?: string;
|
|
387
|
+
/** IDE provider state */
|
|
388
|
+
interface IdeProviderState extends ProviderStateBase {
|
|
389
|
+
category: 'ide';
|
|
390
|
+
cdpConnected: boolean;
|
|
391
|
+
/** IDE child Extension Instance status */
|
|
392
|
+
extensions: ProviderState[];
|
|
393
|
+
currentAutoApprove?: string;
|
|
333
394
|
}
|
|
334
|
-
/**
|
|
335
|
-
interface
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
cpus: number;
|
|
340
|
-
totalMem: number;
|
|
341
|
-
freeMem: number;
|
|
342
|
-
/** macOS: reclaimable-inclusive; prefer for UI used% */
|
|
343
|
-
availableMem?: number;
|
|
344
|
-
loadavg: number[];
|
|
345
|
-
uptime: number;
|
|
346
|
-
release: string;
|
|
395
|
+
/** CLI provider state */
|
|
396
|
+
interface CliProviderState extends ProviderStateBase {
|
|
397
|
+
category: 'cli';
|
|
398
|
+
/** terminal = PTY stream, chat = parsed conversation */
|
|
399
|
+
mode: 'terminal' | 'chat';
|
|
347
400
|
}
|
|
348
|
-
/**
|
|
349
|
-
interface
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
401
|
+
/** ACP provider state */
|
|
402
|
+
interface AcpProviderState extends ProviderStateBase {
|
|
403
|
+
category: 'acp';
|
|
404
|
+
mode: 'chat';
|
|
405
|
+
/** ACP config options (model/mode selection) */
|
|
406
|
+
acpConfigOptions?: AcpConfigOption[];
|
|
407
|
+
/** ACP available modes */
|
|
408
|
+
acpModes?: AcpMode[];
|
|
355
409
|
}
|
|
356
|
-
/**
|
|
357
|
-
interface
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
kind?: string;
|
|
361
|
-
agentType?: string;
|
|
410
|
+
/** Extension provider state */
|
|
411
|
+
interface ExtensionProviderState extends ProviderStateBase {
|
|
412
|
+
category: 'extension';
|
|
413
|
+
agentStreams?: any[];
|
|
362
414
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
version: string;
|
|
368
|
-
/** Daemon mode flag */
|
|
369
|
-
daemonMode: boolean;
|
|
370
|
-
/** Machine info */
|
|
371
|
-
machine: MachineInfo;
|
|
372
|
-
/** Machine nickname (user-set) */
|
|
373
|
-
machineNickname?: string | null;
|
|
374
|
-
/** Timestamp */
|
|
415
|
+
/** Discriminated union — switch on `.category` */
|
|
416
|
+
type ProviderState = IdeProviderState | CliProviderState | AcpProviderState | ExtensionProviderState;
|
|
417
|
+
interface ProviderEvent {
|
|
418
|
+
event: string;
|
|
375
419
|
timestamp: number;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
420
|
+
[key: string]: any;
|
|
421
|
+
}
|
|
422
|
+
interface InstanceContext {
|
|
423
|
+
/** CDP connection (IDE/Extension) */
|
|
424
|
+
cdp?: {
|
|
425
|
+
isConnected: boolean;
|
|
426
|
+
evaluate(script: string, timeout?: number): Promise<unknown>;
|
|
427
|
+
evaluateInWebviewFrame?(expression: string, matchFn?: (bodyPreview: string) => boolean): Promise<string | null>;
|
|
428
|
+
discoverAgentWebviews?(): Promise<any[]>;
|
|
384
429
|
};
|
|
385
|
-
/**
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
430
|
+
/** Server log transmit */
|
|
431
|
+
serverConn?: {
|
|
432
|
+
sendMessage(type: string, data: any): void;
|
|
433
|
+
};
|
|
434
|
+
/** P2P PTY output transmit */
|
|
435
|
+
onPtyData?: (data: string) => void;
|
|
436
|
+
/** Provider configvalue (resolved) */
|
|
437
|
+
settings: Record<string, any>;
|
|
438
|
+
}
|
|
439
|
+
interface ProviderInstance {
|
|
440
|
+
/** Provider type */
|
|
441
|
+
readonly type: string;
|
|
442
|
+
/** Provider category */
|
|
443
|
+
readonly category: 'cli' | 'ide' | 'extension' | 'acp';
|
|
444
|
+
/** initialize */
|
|
445
|
+
init(context: InstanceContext): Promise<void>;
|
|
446
|
+
/** Tick — periodic status refresh (IDE: readChat, Extension: stream collection) */
|
|
447
|
+
onTick(): Promise<void>;
|
|
448
|
+
/** Return current status */
|
|
449
|
+
getState(): ProviderState;
|
|
450
|
+
/** Receive event (external → Instance) */
|
|
451
|
+
onEvent(event: string, data?: any): void;
|
|
452
|
+
/** Update settings at runtime (called when user changes settings from dashboard) */
|
|
453
|
+
updateSettings?(newSettings: Record<string, any>): void;
|
|
454
|
+
/** cleanup */
|
|
455
|
+
dispose(): void;
|
|
392
456
|
}
|
|
393
457
|
|
|
394
458
|
/**
|
|
395
|
-
*
|
|
396
|
-
* Represents displayable content in messages, tool call results, etc.
|
|
459
|
+
* Recent workspace activity — quick "pick up where you left off" (daemon-local).
|
|
397
460
|
*/
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
interface TextBlock {
|
|
401
|
-
type: 'text';
|
|
402
|
-
text: string;
|
|
403
|
-
annotations?: ContentAnnotations;
|
|
404
|
-
}
|
|
405
|
-
/** Image content — ACP ImageContent */
|
|
406
|
-
interface ImageBlock {
|
|
407
|
-
type: 'image';
|
|
408
|
-
data: string;
|
|
409
|
-
mimeType: string;
|
|
410
|
-
uri?: string;
|
|
411
|
-
annotations?: ContentAnnotations;
|
|
412
|
-
}
|
|
413
|
-
/** Audio content — ACP AudioContent */
|
|
414
|
-
interface AudioBlock {
|
|
415
|
-
type: 'audio';
|
|
416
|
-
data: string;
|
|
417
|
-
mimeType: string;
|
|
418
|
-
annotations?: ContentAnnotations;
|
|
419
|
-
}
|
|
420
|
-
/** Resource link (file reference) — ACP ResourceLink */
|
|
421
|
-
interface ResourceLinkBlock {
|
|
422
|
-
type: 'resource_link';
|
|
423
|
-
uri: string;
|
|
424
|
-
name: string;
|
|
425
|
-
title?: string;
|
|
426
|
-
description?: string;
|
|
427
|
-
mimeType?: string;
|
|
428
|
-
size?: number;
|
|
429
|
-
annotations?: ContentAnnotations;
|
|
430
|
-
}
|
|
431
|
-
/** Embedded resource (inline file) — ACP EmbeddedResource */
|
|
432
|
-
interface ResourceBlock {
|
|
433
|
-
type: 'resource';
|
|
434
|
-
resource: TextResourceContents | BlobResourceContents;
|
|
435
|
-
annotations?: ContentAnnotations;
|
|
436
|
-
}
|
|
437
|
-
interface TextResourceContents {
|
|
438
|
-
uri: string;
|
|
439
|
-
text: string;
|
|
440
|
-
mimeType?: string | null;
|
|
441
|
-
}
|
|
442
|
-
interface BlobResourceContents {
|
|
443
|
-
uri: string;
|
|
444
|
-
blob: string;
|
|
445
|
-
mimeType?: string | null;
|
|
446
|
-
}
|
|
447
|
-
interface ContentAnnotations {
|
|
448
|
-
audience?: ('user' | 'assistant')[];
|
|
449
|
-
priority?: number;
|
|
450
|
-
}
|
|
451
|
-
/** Tool call info — ACP ToolCall */
|
|
452
|
-
interface ToolCallInfo {
|
|
453
|
-
toolCallId: string;
|
|
454
|
-
title: string;
|
|
455
|
-
kind?: ToolKind;
|
|
456
|
-
status?: ToolCallStatus;
|
|
457
|
-
rawInput?: unknown;
|
|
458
|
-
rawOutput?: unknown;
|
|
459
|
-
content?: ToolCallContent[];
|
|
460
|
-
locations?: ToolCallLocation[];
|
|
461
|
-
}
|
|
462
|
-
type ToolKind = 'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'switch_mode' | 'other';
|
|
463
|
-
type ToolCallStatus = 'pending' | 'in_progress' | 'completed' | 'failed';
|
|
464
|
-
/** Content produced by a tool call — ACP ToolCallContent */
|
|
465
|
-
type ToolCallContent = {
|
|
466
|
-
type: 'content';
|
|
467
|
-
content: ContentBlock;
|
|
468
|
-
} | {
|
|
469
|
-
type: 'diff';
|
|
470
|
-
path: string;
|
|
471
|
-
oldText?: string;
|
|
472
|
-
newText: string;
|
|
473
|
-
} | {
|
|
474
|
-
type: 'terminal';
|
|
475
|
-
terminalId: string;
|
|
476
|
-
};
|
|
477
|
-
interface ToolCallLocation {
|
|
461
|
+
|
|
462
|
+
interface WorkspaceActivityEntry {
|
|
478
463
|
path: string;
|
|
479
|
-
|
|
464
|
+
lastUsedAt: number;
|
|
465
|
+
/** `active` legacy — same meaning as default */
|
|
466
|
+
kind?: 'ide' | 'cli' | 'acp' | 'default' | 'active';
|
|
467
|
+
/** IDE id or CLI/ACP provider type */
|
|
468
|
+
agentType?: string;
|
|
480
469
|
}
|
|
481
|
-
|
|
470
|
+
declare function getWorkspaceActivity(config: ADHDevConfig, limit?: number): WorkspaceActivityEntry[];
|
|
471
|
+
|
|
482
472
|
/**
|
|
483
|
-
*
|
|
473
|
+
* ADHDev Launcher — Configuration
|
|
484
474
|
*
|
|
485
|
-
*
|
|
486
|
-
* Helpers (_helpers/) can be optionally used.
|
|
487
|
-
*/
|
|
488
|
-
/**
|
|
489
|
-
* Provider-configurable CDP target filter.
|
|
490
|
-
* Used by DaemonCdpManager to select the correct page/tab to connect to.
|
|
491
|
-
* Without this, the manager uses a hardcoded default filter.
|
|
475
|
+
* Manages launcher config, server connection tokens, and user preferences.
|
|
492
476
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
env?: Record<string, string>;
|
|
548
|
-
};
|
|
549
|
-
patterns?: {
|
|
550
|
-
prompt?: RegExp[];
|
|
551
|
-
generating?: RegExp[];
|
|
552
|
-
approval?: RegExp[];
|
|
553
|
-
ready?: RegExp[];
|
|
554
|
-
};
|
|
555
|
-
cleanOutput?: (raw: string, lastUserInput?: string) => string;
|
|
556
|
-
scripts?: ProviderScripts;
|
|
557
|
-
vscodeCommands?: {
|
|
558
|
-
focusPanel?: string;
|
|
559
|
-
openPanel?: string;
|
|
560
|
-
[key: string]: string | undefined;
|
|
561
|
-
};
|
|
562
|
-
inputMethod?: 'cdp-type-and-send' | 'script';
|
|
563
|
-
inputSelector?: string;
|
|
564
|
-
/** webview iframe match text (must be contained in body) */
|
|
565
|
-
webviewMatchText?: string;
|
|
566
|
-
os?: {
|
|
567
|
-
[platform: string]: Partial<Pick<ProviderModule, 'scripts' | 'inputMethod' | 'inputSelector'>>;
|
|
568
|
-
};
|
|
569
|
-
/** Key: semver range string (e.g. '< 1.107.0', '>= 2.0.0') */
|
|
570
|
-
versions?: {
|
|
571
|
-
[versionRange: string]: Partial<Pick<ProviderModule, 'scripts'>> & {
|
|
572
|
-
/**
|
|
573
|
-
* Load scripts from a subdirectory instead of scripts.js root.
|
|
574
|
-
* Path is relative to the provider directory (e.g. 'scripts/legacy').
|
|
575
|
-
* The subdirectory should contain its own scripts.js or individual .js files.
|
|
576
|
-
*/
|
|
577
|
-
__dir?: string;
|
|
578
|
-
};
|
|
579
|
-
};
|
|
580
|
-
overrides?: Array<{
|
|
581
|
-
when: {
|
|
582
|
-
os?: string;
|
|
583
|
-
version?: string;
|
|
584
|
-
};
|
|
585
|
-
scripts?: Partial<ProviderScripts>;
|
|
586
|
-
/** Load scripts from a subdirectory for this OS+version combination */
|
|
587
|
-
__dir?: string;
|
|
588
|
-
}>;
|
|
589
|
-
settings?: Record<string, ProviderSettingDef>;
|
|
590
|
-
/** Static options used when agent does not provide configOptions */
|
|
591
|
-
staticConfigOptions?: Array<{
|
|
592
|
-
category: 'model' | 'mode' | 'thought_level' | 'other';
|
|
593
|
-
configId: string;
|
|
594
|
-
defaultValue?: string;
|
|
595
|
-
options: Array<{
|
|
596
|
-
value: string;
|
|
597
|
-
name: string;
|
|
598
|
-
description?: string;
|
|
599
|
-
group?: string;
|
|
477
|
+
|
|
478
|
+
interface ADHDevConfig {
|
|
479
|
+
serverUrl: string;
|
|
480
|
+
apiToken: string | null;
|
|
481
|
+
connectionToken: string | null;
|
|
482
|
+
selectedIde: string | null;
|
|
483
|
+
configuredIdes: string[];
|
|
484
|
+
installedExtensions: string[];
|
|
485
|
+
autoConnect: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* @deprecated Not read at runtime. Notification preferences are now managed by:
|
|
488
|
+
* - Web UI layer: useNotificationPrefs (localStorage)
|
|
489
|
+
* - Daemon layer: per-provider settings (approvalAlert, longGeneratingAlert)
|
|
490
|
+
* Kept for backward config compat — will be removed in v0.7+.
|
|
491
|
+
*/
|
|
492
|
+
notifications: boolean;
|
|
493
|
+
userEmail: string | null;
|
|
494
|
+
userName: string | null;
|
|
495
|
+
setupCompleted: boolean;
|
|
496
|
+
setupDate: string | null;
|
|
497
|
+
configuredCLIs: string[];
|
|
498
|
+
enabledIdes: string[];
|
|
499
|
+
recentCliWorkspaces: string[];
|
|
500
|
+
/** Saved workspaces for IDE/CLI/ACP launch (daemon-local) */
|
|
501
|
+
workspaces?: WorkspaceEntry[];
|
|
502
|
+
/** Default workspace id (from workspaces[]) — never used implicitly for launch */
|
|
503
|
+
defaultWorkspaceId?: string | null;
|
|
504
|
+
/** Recently used workspaces (IDE / CLI / ACP / default) for quick resume */
|
|
505
|
+
recentWorkspaceActivity?: WorkspaceActivityEntry[];
|
|
506
|
+
machineNickname: string | null;
|
|
507
|
+
/**
|
|
508
|
+
* Stable local machine ID (prefix: `mach_`) — generated locally on first run.
|
|
509
|
+
* Used as daemon instance key (`daemon_<machineId>`) and in status reports.
|
|
510
|
+
* NOT the same as the server-side D1 `machines.id` — see `registeredMachineId`.
|
|
511
|
+
*/
|
|
512
|
+
machineId?: string;
|
|
513
|
+
machineSecret?: string | null;
|
|
514
|
+
/**
|
|
515
|
+
* Server-side D1 `machines.id` — the row ID assigned when daemon registers via
|
|
516
|
+
* `POST /cli/complete`. Corresponds to `machineId` in server DO context
|
|
517
|
+
* (`DaemonConnection.machineId`, `StatusContext.machineId`).
|
|
518
|
+
*
|
|
519
|
+
* Naming differs from server-side `machineId` to avoid confusion with the local
|
|
520
|
+
* `config.machineId` (mach_ prefix) which is a different value.
|
|
521
|
+
*
|
|
522
|
+
* @deprecated Legacy bridge field — will be removed after 2026-04-06.
|
|
523
|
+
* Modern auth flow uses `machineSecret` (adm_) to identify machines.
|
|
524
|
+
*/
|
|
525
|
+
registeredMachineId?: string;
|
|
526
|
+
cliHistory: CliHistoryEntry[];
|
|
527
|
+
providerSettings: Record<string, Record<string, any>>;
|
|
528
|
+
ideSettings: Record<string, {
|
|
529
|
+
extensions?: Record<string, {
|
|
530
|
+
enabled: boolean;
|
|
600
531
|
}>;
|
|
601
532
|
}>;
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
533
|
+
disableUpstream?: boolean;
|
|
534
|
+
providerDir?: string;
|
|
535
|
+
}
|
|
536
|
+
interface CliHistoryEntry {
|
|
537
|
+
category?: 'ide' | 'cli' | 'acp';
|
|
538
|
+
cliType: string;
|
|
539
|
+
dir: string;
|
|
540
|
+
cliArgs?: string[];
|
|
541
|
+
workspace?: string;
|
|
542
|
+
newWindow?: boolean;
|
|
543
|
+
model?: string;
|
|
544
|
+
timestamp: number;
|
|
545
|
+
label?: string;
|
|
606
546
|
}
|
|
607
|
-
/**
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
547
|
+
/**
|
|
548
|
+
* Load configuration from disk
|
|
549
|
+
*/
|
|
550
|
+
declare function loadConfig(): ADHDevConfig;
|
|
551
|
+
/**
|
|
552
|
+
* Save configuration to disk
|
|
553
|
+
*/
|
|
554
|
+
declare function saveConfig(config: ADHDevConfig): void;
|
|
555
|
+
/**
|
|
556
|
+
* Update specific config fields
|
|
557
|
+
*/
|
|
558
|
+
declare function updateConfig(updates: Partial<ADHDevConfig>): ADHDevConfig;
|
|
559
|
+
/**
|
|
560
|
+
* Mark setup as completed
|
|
561
|
+
*/
|
|
562
|
+
declare function markSetupComplete(ideId: string | string[], extensions: string[]): ADHDevConfig;
|
|
563
|
+
/**
|
|
564
|
+
* Check if setup has been completed before
|
|
565
|
+
*/
|
|
566
|
+
declare function isSetupComplete(): boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Reset configuration
|
|
569
|
+
*/
|
|
570
|
+
declare function resetConfig(): void;
|
|
571
|
+
/**
|
|
572
|
+
* Add launch to history (max 20, dedup by category+type+dir+args+workspace+model)
|
|
573
|
+
*/
|
|
574
|
+
declare function addCliHistory(entry: Omit<CliHistoryEntry, 'timestamp'>): void;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Saved workspaces — shared by IDE launch, CLI, ACP (daemon-local).
|
|
578
|
+
*/
|
|
579
|
+
|
|
580
|
+
interface WorkspaceEntry {
|
|
612
581
|
id: string;
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
label?: string;
|
|
617
|
-
secret?: boolean;
|
|
618
|
-
optional?: boolean;
|
|
619
|
-
}>;
|
|
620
|
-
link?: string;
|
|
582
|
+
path: string;
|
|
583
|
+
label?: string;
|
|
584
|
+
addedAt: number;
|
|
621
585
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
586
|
+
declare function getWorkspaceState(config: ADHDevConfig): {
|
|
587
|
+
workspaces: WorkspaceEntry[];
|
|
588
|
+
defaultWorkspaceId: string | null;
|
|
589
|
+
defaultWorkspacePath: string | null;
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* ADHDev Shared Types — Cross-package type definitions
|
|
594
|
+
*
|
|
595
|
+
* Types used across daemon-core, web-core, and downstream consumers.
|
|
596
|
+
* Import via: import type { ... } from '@adhdev/daemon-core/types'
|
|
597
|
+
*
|
|
598
|
+
* IMPORTANT: This file must remain runtime-free (types only).
|
|
599
|
+
*/
|
|
600
|
+
|
|
601
|
+
/** Agent stream snapshot carried by flattened UI entries. */
|
|
602
|
+
interface AgentSessionStream {
|
|
603
|
+
sessionId?: string;
|
|
604
|
+
instanceId?: string;
|
|
605
|
+
parentSessionId?: string | null;
|
|
606
|
+
agentType: string;
|
|
607
|
+
agentName: string;
|
|
608
|
+
extensionId: string;
|
|
609
|
+
transport?: SessionTransport;
|
|
610
|
+
status: string;
|
|
611
|
+
title?: string;
|
|
612
|
+
messages: ChatMessage[];
|
|
613
|
+
inputContent: string;
|
|
614
|
+
model?: string;
|
|
615
|
+
activeModal: {
|
|
616
|
+
message: string;
|
|
617
|
+
buttons: string[];
|
|
618
|
+
} | null;
|
|
619
|
+
}
|
|
620
|
+
type SessionTransport = 'cdp-page' | 'cdp-webview' | 'pty' | 'acp';
|
|
621
|
+
type SessionKind = 'workspace' | 'agent';
|
|
622
|
+
type SessionCapability = 'read_chat' | 'send_message' | 'new_session' | 'list_sessions' | 'switch_session' | 'resolve_action' | 'terminal_io' | 'resize_terminal' | 'change_model' | 'set_mode' | 'set_thought_level';
|
|
623
|
+
interface SessionEntry {
|
|
625
624
|
id: string;
|
|
625
|
+
parentId: string | null;
|
|
626
|
+
providerType: string;
|
|
627
|
+
providerName: string;
|
|
628
|
+
kind: SessionKind;
|
|
629
|
+
transport: SessionTransport;
|
|
630
|
+
status: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting' | 'panel_hidden' | 'not_monitored' | 'disconnected';
|
|
631
|
+
title: string;
|
|
632
|
+
workspace: string | null;
|
|
633
|
+
runtimeKey?: string;
|
|
634
|
+
runtimeDisplayName?: string;
|
|
635
|
+
runtimeWorkspaceLabel?: string;
|
|
636
|
+
runtimeWriteOwner?: {
|
|
637
|
+
clientId: string;
|
|
638
|
+
ownerType: 'agent' | 'user';
|
|
639
|
+
} | null;
|
|
640
|
+
runtimeAttachedClients?: {
|
|
641
|
+
clientId: string;
|
|
642
|
+
type: 'daemon' | 'web' | 'local-terminal';
|
|
643
|
+
readOnly: boolean;
|
|
644
|
+
}[];
|
|
645
|
+
resume?: ProviderResumeCapability;
|
|
646
|
+
activeChat: ActiveChatData | null;
|
|
647
|
+
capabilities: SessionCapability[];
|
|
648
|
+
cdpConnected?: boolean;
|
|
649
|
+
currentModel?: string;
|
|
650
|
+
currentPlan?: string;
|
|
651
|
+
currentAutoApprove?: string;
|
|
652
|
+
acpConfigOptions?: AcpConfigOption[];
|
|
653
|
+
acpModes?: AcpMode[];
|
|
654
|
+
errorMessage?: string;
|
|
655
|
+
errorReason?: ProviderErrorReason;
|
|
656
|
+
}
|
|
657
|
+
/** Available provider information */
|
|
658
|
+
interface AvailableProviderInfo {
|
|
659
|
+
type: string;
|
|
626
660
|
name: string;
|
|
627
|
-
|
|
661
|
+
category: 'ide' | 'extension' | 'cli' | 'acp';
|
|
662
|
+
displayName: string;
|
|
663
|
+
icon: string;
|
|
628
664
|
}
|
|
629
|
-
/**
|
|
630
|
-
interface
|
|
631
|
-
|
|
665
|
+
/** ACP config option (model/mode/thought_level selection) */
|
|
666
|
+
interface AcpConfigOption {
|
|
667
|
+
category: 'model' | 'mode' | 'thought_level' | 'other';
|
|
668
|
+
configId: string;
|
|
669
|
+
currentValue?: string;
|
|
670
|
+
options: {
|
|
671
|
+
value: string;
|
|
672
|
+
name: string;
|
|
673
|
+
description?: string;
|
|
674
|
+
group?: string;
|
|
675
|
+
}[];
|
|
676
|
+
}
|
|
677
|
+
/** ACP mode */
|
|
678
|
+
interface AcpMode {
|
|
632
679
|
id: string;
|
|
633
680
|
name: string;
|
|
634
681
|
description?: string;
|
|
635
|
-
args?: string[];
|
|
636
|
-
env?: Record<string, string>;
|
|
637
682
|
}
|
|
638
|
-
/**
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
*/
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
switchSession?: (params?: Record<string, any>) => string;
|
|
652
|
-
newSession?: (params?: Record<string, any>) => string;
|
|
653
|
-
focusEditor?: (params?: Record<string, any>) => string;
|
|
654
|
-
openPanel?: (params?: Record<string, any>) => string;
|
|
655
|
-
/** List available models → { models: string[], current: string } */
|
|
656
|
-
listModels?: (params?: Record<string, any>) => string;
|
|
657
|
-
/** Change model → { success: boolean } */
|
|
658
|
-
setModel?: (params?: Record<string, any>) => string;
|
|
659
|
-
/** List available modes → { modes: string[], current: string } */
|
|
660
|
-
listModes?: (params?: Record<string, any>) => string;
|
|
661
|
-
/** Change mode → { success: boolean } */
|
|
662
|
-
setMode?: (params?: Record<string, any>) => string;
|
|
663
|
-
/** params: { action: 'approve'|'reject'|'custom', button?: string } */
|
|
664
|
-
resolveAction?: (params?: Record<string, any>) => string;
|
|
665
|
-
webviewResolveAction?: (params?: Record<string, any>) => string;
|
|
666
|
-
listNotifications?: (params?: Record<string, any>) => string;
|
|
667
|
-
dismissNotification?: (params?: Record<string, any>) => string;
|
|
668
|
-
[scriptName: string]: ((params?: Record<string, any>) => string) | undefined;
|
|
683
|
+
/** Machine hardware/OS info (reported by daemon, displayed by web) */
|
|
684
|
+
interface MachineInfo {
|
|
685
|
+
hostname: string;
|
|
686
|
+
platform: string;
|
|
687
|
+
arch: string;
|
|
688
|
+
cpus: number;
|
|
689
|
+
totalMem: number;
|
|
690
|
+
freeMem: number;
|
|
691
|
+
/** macOS: reclaimable-inclusive; prefer for UI used% */
|
|
692
|
+
availableMem?: number;
|
|
693
|
+
loadavg: number[];
|
|
694
|
+
uptime: number;
|
|
695
|
+
release: string;
|
|
669
696
|
}
|
|
670
|
-
/**
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
_resolvedVersion?: string;
|
|
678
|
-
/** Warning when detected version is not in compatibility matrix */
|
|
679
|
-
_versionWarning?: string;
|
|
697
|
+
/** Detected IDE on a machine */
|
|
698
|
+
interface DetectedIdeInfo {
|
|
699
|
+
type: string;
|
|
700
|
+
id?: string;
|
|
701
|
+
name: string;
|
|
702
|
+
running: boolean;
|
|
703
|
+
path?: string;
|
|
680
704
|
}
|
|
681
|
-
/**
|
|
682
|
-
interface
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
/** UI label */
|
|
688
|
-
label?: string;
|
|
689
|
-
/** UI description */
|
|
690
|
-
description?: string;
|
|
691
|
-
/** Minimum value for number type */
|
|
692
|
-
min?: number;
|
|
693
|
-
/** Maximum value for number type */
|
|
694
|
-
max?: number;
|
|
695
|
-
/** Options for select type */
|
|
696
|
-
options?: string[];
|
|
705
|
+
/** Workspace recent activity */
|
|
706
|
+
interface WorkspaceActivity {
|
|
707
|
+
path: string;
|
|
708
|
+
lastUsedAt: number;
|
|
709
|
+
kind?: string;
|
|
710
|
+
agentType?: string;
|
|
697
711
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
712
|
+
interface StatusReportPayload {
|
|
713
|
+
/** Daemon instance ID */
|
|
714
|
+
instanceId: string;
|
|
715
|
+
/** Daemon version */
|
|
716
|
+
version: string;
|
|
717
|
+
/** Daemon mode flag */
|
|
718
|
+
daemonMode: boolean;
|
|
719
|
+
/** Machine info */
|
|
720
|
+
machine: MachineInfo;
|
|
721
|
+
/** Machine nickname (user-set) */
|
|
722
|
+
machineNickname?: string | null;
|
|
723
|
+
/** Timestamp */
|
|
724
|
+
timestamp: number;
|
|
725
|
+
/** Detected IDEs on this machine */
|
|
726
|
+
detectedIdes: DetectedIdeInfo[];
|
|
727
|
+
/** P2P state */
|
|
728
|
+
p2p?: {
|
|
729
|
+
available: boolean;
|
|
730
|
+
state: string;
|
|
731
|
+
peers: number;
|
|
732
|
+
screenshotActive?: boolean;
|
|
733
|
+
};
|
|
734
|
+
/** Canonical daemon runtime sessions */
|
|
735
|
+
sessions: SessionEntry[];
|
|
736
|
+
/** Saved workspaces */
|
|
737
|
+
workspaces?: WorkspaceEntry[];
|
|
738
|
+
defaultWorkspaceId?: string | null;
|
|
739
|
+
defaultWorkspacePath?: string | null;
|
|
740
|
+
workspaceActivity?: WorkspaceActivity[];
|
|
701
741
|
}
|
|
702
742
|
|
|
703
743
|
/**
|
|
@@ -842,4 +882,4 @@ declare function isManagedStatusWaiting(status?: string | null, opts?: {
|
|
|
842
882
|
}): boolean;
|
|
843
883
|
declare function normalizeActiveChatData<T extends ActiveChatData | null | undefined>(activeChat: T): T;
|
|
844
884
|
|
|
845
|
-
export {
|
|
885
|
+
export { saveConfig as $, type AvailableProviderInfo as A, type ProviderInfo as B, type CommandResult as C, type DaemonEvent as D, type ExtensionInfo as E, type ProviderStatus as F, type SessionCapability as G, type SessionKind as H, type InstanceContext as I, type SystemInfo as J, type WorkspaceEntry as K, addCliHistory as L, type MachineInfo as M, getWorkspaceActivity as N, getWorkspaceState as O, type ProviderCategory as P, isManagedStatusWaiting as Q, type ResolvedProvider as R, type StatusResponse as S, isManagedStatusWorking as T, isSetupComplete as U, loadConfig as V, type WorkspaceActivity as W, markSetupComplete as X, normalizeActiveChatData as Y, normalizeManagedStatus as Z, resetConfig as _, type SessionEntry as a, updateConfig as a0, type ProviderModule as b, type ProviderSettingSchema as c, type CdpTargetFilter as d, type ProviderInstance as e, type ProviderState as f, type ProviderEvent as g, type SessionTransport as h, type StatusReportPayload as i, type ProviderResumeCapability as j, type AcpProviderState as k, type ContentBlock as l, type AcpConfigOption as m, type AcpMode as n, type ActiveChatData as o, type AgentEntry as p, type AgentSessionStream as q, type ChatMessage as r, type CliProviderState as s, type DetectedIde as t, type DetectedIdeInfo as u, type ExtensionProviderState as v, type IdeProviderState as w, type ManagedStatus as x, type ProviderConfig as y, type ProviderErrorReason as z };
|