@adhdev/daemon-core 0.8.22 → 0.8.24
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/agent-stream/types.d.ts +3 -0
- package/dist/cli-adapter-types.d.ts +3 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +71 -11
- package/dist/commands/stream-commands.d.ts +1 -0
- package/dist/config/config.d.ts +6 -0
- package/dist/index.js +1162 -307
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1162 -307
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +6 -0
- package/dist/providers/contracts.d.ts +59 -1
- package/dist/providers/control-effects.d.ts +4 -0
- package/dist/providers/extension-provider-instance.d.ts +9 -0
- package/dist/providers/ide-provider-instance.d.ts +8 -0
- package/dist/shared-types.d.ts +2 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +3 -2
- package/src/agent-stream/forward.ts +2 -0
- package/src/agent-stream/provider-adapter.ts +5 -15
- package/src/agent-stream/types.ts +4 -0
- package/src/cli-adapter-types.ts +3 -0
- package/src/cli-adapters/provider-cli-adapter.ts +399 -49
- package/src/commands/handler.ts +1 -0
- package/src/commands/stream-commands.ts +99 -8
- package/src/config/config.d.ts +1 -0
- package/src/config/config.ts +9 -0
- package/src/launch.ts +57 -11
- package/src/providers/cli-provider-instance.ts +148 -2
- package/src/providers/contracts.ts +65 -2
- package/src/providers/control-effects.ts +114 -0
- package/src/providers/extension-provider-instance.ts +163 -3
- package/src/providers/ide-provider-instance.ts +181 -2
- package/src/shared-types.d.ts +1 -0
- package/src/shared-types.ts +2 -1
- package/src/status/snapshot.ts +1 -0
|
@@ -24,6 +24,8 @@ export declare class CliProviderInstance implements ProviderInstance {
|
|
|
24
24
|
private generatingDebounceTimer;
|
|
25
25
|
private generatingDebouncePending;
|
|
26
26
|
private lastApprovalEventAt;
|
|
27
|
+
private controlValues;
|
|
28
|
+
private appliedEffectKeys;
|
|
27
29
|
private historyWriter;
|
|
28
30
|
private runtimeMessages;
|
|
29
31
|
readonly instanceId: string;
|
|
@@ -54,6 +56,7 @@ export declare class CliProviderInstance implements ProviderInstance {
|
|
|
54
56
|
getState(): ProviderState;
|
|
55
57
|
setPresentationMode(mode: 'terminal' | 'chat'): void;
|
|
56
58
|
getPresentationMode(): 'terminal' | 'chat';
|
|
59
|
+
updateSettings(newSettings: Record<string, any>): void;
|
|
57
60
|
onEvent(event: string, data?: any): void;
|
|
58
61
|
dispose(): void;
|
|
59
62
|
private completedDebounceTimer;
|
|
@@ -61,6 +64,9 @@ export declare class CliProviderInstance implements ProviderInstance {
|
|
|
61
64
|
private detectStatusTransition;
|
|
62
65
|
private pushEvent;
|
|
63
66
|
private flushEvents;
|
|
67
|
+
private applyProviderResponse;
|
|
68
|
+
private getEffectDedupKey;
|
|
69
|
+
private getPersistedEffectContent;
|
|
64
70
|
getAdapter(): ProviderCliAdapter;
|
|
65
71
|
get cliType(): string;
|
|
66
72
|
get cliName(): string;
|
|
@@ -23,6 +23,10 @@ export interface ReadChatResult {
|
|
|
23
23
|
inputContent?: string;
|
|
24
24
|
model?: string;
|
|
25
25
|
autoApprove?: string;
|
|
26
|
+
/** Explicit dynamic control values returned by the provider */
|
|
27
|
+
controlValues?: Record<string, string | number | boolean>;
|
|
28
|
+
/** Provider-driven UI effects derived from chat state */
|
|
29
|
+
effects?: ProviderEffect[];
|
|
26
30
|
}
|
|
27
31
|
import type { ChatMessage } from '../types.js';
|
|
28
32
|
export type { ChatMessage };
|
|
@@ -33,6 +37,38 @@ export interface ModalInfo {
|
|
|
33
37
|
width?: number;
|
|
34
38
|
height?: number;
|
|
35
39
|
}
|
|
40
|
+
export interface ProviderEffectMessage {
|
|
41
|
+
role?: 'system' | 'assistant' | 'user';
|
|
42
|
+
content: string | ContentBlock[];
|
|
43
|
+
kind?: string;
|
|
44
|
+
senderName?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ProviderEffectToast {
|
|
47
|
+
level?: 'info' | 'success' | 'warning';
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
|
50
|
+
export type ProviderNotificationPreferenceKey = 'disconnect' | 'completion' | 'approval' | 'browser';
|
|
51
|
+
export type ProviderNotificationChannel = 'bubble' | 'toast' | 'browser';
|
|
52
|
+
export interface ProviderEffectNotification {
|
|
53
|
+
title?: string;
|
|
54
|
+
body: string;
|
|
55
|
+
level?: 'info' | 'success' | 'warning';
|
|
56
|
+
channels?: ProviderNotificationChannel[];
|
|
57
|
+
preferenceKey?: ProviderNotificationPreferenceKey;
|
|
58
|
+
bubbleContent?: string | ContentBlock[];
|
|
59
|
+
}
|
|
60
|
+
export interface ProviderEffect {
|
|
61
|
+
type: 'message' | 'toast' | 'notification';
|
|
62
|
+
/** Stable dedup key; falls back to a content hash when omitted */
|
|
63
|
+
id?: string;
|
|
64
|
+
/** Default immediate. turn_completed fires only on generating/waiting -> idle transitions. */
|
|
65
|
+
when?: 'immediate' | 'turn_completed';
|
|
66
|
+
/** Default true. False keeps the effect UI-only. */
|
|
67
|
+
persist?: boolean;
|
|
68
|
+
message?: ProviderEffectMessage;
|
|
69
|
+
toast?: ProviderEffectToast;
|
|
70
|
+
notification?: ProviderEffectNotification;
|
|
71
|
+
}
|
|
36
72
|
/**
|
|
37
73
|
* ContentBlock — ACP ContentBlock union type
|
|
38
74
|
* Represents displayable content in messages, tool call results, etc.
|
|
@@ -229,6 +265,28 @@ export interface ProviderModule {
|
|
|
229
265
|
linux?: string[];
|
|
230
266
|
[key: string]: string | string[] | undefined;
|
|
231
267
|
};
|
|
268
|
+
/**
|
|
269
|
+
* IDE launch preferences.
|
|
270
|
+
* Lets each provider choose how its GUI app should be started per platform.
|
|
271
|
+
*/
|
|
272
|
+
launch?: {
|
|
273
|
+
/**
|
|
274
|
+
* Preferred launch method by platform.
|
|
275
|
+
* - 'cli': use the IDE CLI wrapper/binary
|
|
276
|
+
* - 'app': use platform app launcher (e.g. `open -a` on macOS)
|
|
277
|
+
* - 'auto': let core choose a sensible default
|
|
278
|
+
*/
|
|
279
|
+
prefer?: {
|
|
280
|
+
darwin?: 'auto' | 'cli' | 'app';
|
|
281
|
+
win32?: 'auto' | 'cli' | 'app';
|
|
282
|
+
linux?: 'auto' | 'cli' | 'app';
|
|
283
|
+
[key: string]: 'auto' | 'cli' | 'app' | undefined;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Override how long core waits for CDP to come up after launch.
|
|
287
|
+
*/
|
|
288
|
+
cdpStartupTimeoutMs?: number;
|
|
289
|
+
};
|
|
232
290
|
/** Per-OS install paths — used by detector.ts to detect IDE installation */
|
|
233
291
|
paths?: {
|
|
234
292
|
darwin?: string[];
|
|
@@ -465,7 +523,7 @@ export interface ProviderSettingSchema extends ProviderSettingDef {
|
|
|
465
523
|
* - 'slider' — numeric range (temperature: 0–2)
|
|
466
524
|
* - 'action' — one-shot button (show usage, restart, clear context)
|
|
467
525
|
*/
|
|
468
|
-
export type ProviderControlType = 'select' | 'toggle' | 'cycle' | 'slider' | 'action';
|
|
526
|
+
export type ProviderControlType = 'select' | 'toggle' | 'cycle' | 'slider' | 'action' | 'display';
|
|
469
527
|
/**
|
|
470
528
|
* Where the control appears in the chat UI:
|
|
471
529
|
* - 'bar' — thin strip below/above the chat input (always visible)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ProviderControlDef, ProviderEffect } from './contracts.js';
|
|
2
|
+
export type ProviderControlValue = string | number | boolean;
|
|
3
|
+
export declare function extractProviderControlValues(controls: ProviderControlDef[] | undefined, data: any): Record<string, ProviderControlValue> | undefined;
|
|
4
|
+
export declare function normalizeProviderEffects(data: any): ProviderEffect[];
|
|
@@ -20,9 +20,12 @@ export declare class ExtensionProviderInstance implements ProviderInstance {
|
|
|
20
20
|
private currentModel;
|
|
21
21
|
private currentMode;
|
|
22
22
|
private controlValues;
|
|
23
|
+
private appliedEffectKeys;
|
|
24
|
+
private runtimeMessages;
|
|
23
25
|
private lastAgentStatus;
|
|
24
26
|
private generatingStartedAt;
|
|
25
27
|
private monitor;
|
|
28
|
+
private historyWriter;
|
|
26
29
|
private instanceId;
|
|
27
30
|
private ideType;
|
|
28
31
|
private chatId;
|
|
@@ -35,10 +38,16 @@ export declare class ExtensionProviderInstance implements ProviderInstance {
|
|
|
35
38
|
getState(): ProviderState;
|
|
36
39
|
onEvent(event: string, data?: any): void;
|
|
37
40
|
dispose(): void;
|
|
41
|
+
updateSettings(newSettings: Record<string, any>): void;
|
|
38
42
|
/** Query UUID instanceId */
|
|
39
43
|
getInstanceId(): string;
|
|
40
44
|
private detectTransition;
|
|
41
45
|
private pushEvent;
|
|
46
|
+
private applyProviderResponse;
|
|
47
|
+
private appendRuntimeSystemMessage;
|
|
48
|
+
private mergeConversationMessages;
|
|
49
|
+
private getPersistedEffectContent;
|
|
50
|
+
private getEffectDedupKey;
|
|
42
51
|
private flushEvents;
|
|
43
52
|
private resolveChatTitle;
|
|
44
53
|
private resetStreamState;
|
|
@@ -27,6 +27,8 @@ export declare class IdeProviderInstance implements ProviderInstance {
|
|
|
27
27
|
private monitor;
|
|
28
28
|
private historyWriter;
|
|
29
29
|
private autoApproveBusy;
|
|
30
|
+
private appliedEffectKeys;
|
|
31
|
+
private runtimeMessages;
|
|
30
32
|
private ideVersion;
|
|
31
33
|
private instanceId;
|
|
32
34
|
private workspace;
|
|
@@ -37,6 +39,7 @@ export declare class IdeProviderInstance implements ProviderInstance {
|
|
|
37
39
|
getState(): ProviderState;
|
|
38
40
|
onEvent(event: string, data?: any): void;
|
|
39
41
|
dispose(): void;
|
|
42
|
+
updateSettings(newSettings: Record<string, any>): void;
|
|
40
43
|
/** Extension Instance add */
|
|
41
44
|
addExtension(provider: ProviderModule, settings?: Record<string, any>): Promise<void>;
|
|
42
45
|
/** Extension Instance remove */
|
|
@@ -55,6 +58,11 @@ export declare class IdeProviderInstance implements ProviderInstance {
|
|
|
55
58
|
private getReadChatScript;
|
|
56
59
|
private detectAgentTransitions;
|
|
57
60
|
private pushEvent;
|
|
61
|
+
private applyProviderResponse;
|
|
62
|
+
private appendRuntimeSystemMessage;
|
|
63
|
+
private mergeConversationMessages;
|
|
64
|
+
private getPersistedEffectContent;
|
|
65
|
+
private getEffectDedupKey;
|
|
58
66
|
private flushEvents;
|
|
59
67
|
updateCdp(cdp: InstanceContext['cdp']): void;
|
|
60
68
|
private autoApproveViaScript;
|
package/dist/shared-types.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export interface AcpMode {
|
|
|
106
106
|
/** Provider control schema transmitted to frontend */
|
|
107
107
|
export interface ProviderControlSchema {
|
|
108
108
|
id: string;
|
|
109
|
-
type: 'select' | 'toggle' | 'cycle' | 'slider' | 'action';
|
|
109
|
+
type: 'select' | 'toggle' | 'cycle' | 'slider' | 'action' | 'display';
|
|
110
110
|
label: string;
|
|
111
111
|
icon?: string;
|
|
112
112
|
placement: 'bar' | 'header' | 'menu';
|
|
@@ -202,6 +202,7 @@ export interface StatusReportPayload {
|
|
|
202
202
|
workspaces?: WorkspaceEntry[];
|
|
203
203
|
defaultWorkspaceId?: string | null;
|
|
204
204
|
defaultWorkspacePath?: string | null;
|
|
205
|
+
terminalSizingMode?: 'measured' | 'fit';
|
|
205
206
|
recentLaunches?: RecentLaunchEntry[];
|
|
206
207
|
terminalBackend?: TerminalBackendStatus;
|
|
207
208
|
/** Available providers (present in StatusSnapshot, optional in raw payload) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhdev/daemon-core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.24",
|
|
4
4
|
"description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"@types/node": "^22.0.0",
|
|
58
58
|
"@types/ws": "^8.18.1",
|
|
59
59
|
"tsup": "^8.2.0",
|
|
60
|
-
"typescript": "^5.5.0"
|
|
60
|
+
"typescript": "^5.5.0",
|
|
61
|
+
"vitest": "^4.1.3"
|
|
61
62
|
},
|
|
62
63
|
"repository": {
|
|
63
64
|
"type": "git",
|
|
@@ -32,6 +32,8 @@ export function forwardAgentStreamsToIdeInstance(
|
|
|
32
32
|
activeModal: stream.activeModal || null,
|
|
33
33
|
model: stream.model || undefined,
|
|
34
34
|
mode: stream.mode || undefined,
|
|
35
|
+
controlValues: stream.controlValues || undefined,
|
|
36
|
+
effects: stream.effects || undefined,
|
|
35
37
|
sessionId: stream.sessionId || stream.instanceId || undefined,
|
|
36
38
|
title: stream.title || stream.agentName || undefined,
|
|
37
39
|
agentType: stream.agentType || undefined,
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
AgentEvaluateFn,
|
|
13
13
|
} from './types.js';
|
|
14
14
|
import type { ProviderModule } from '../providers/contracts.js';
|
|
15
|
+
import { extractProviderControlValues, normalizeProviderEffects } from '../providers/control-effects.js';
|
|
15
16
|
|
|
16
17
|
export class ProviderStreamAdapter implements IAgentStreamAdapter {
|
|
17
18
|
readonly agentType: string;
|
|
@@ -86,21 +87,10 @@ export class ProviderStreamAdapter implements IAgentStreamAdapter {
|
|
|
86
87
|
mode: data.mode,
|
|
87
88
|
activeModal: data.activeModal,
|
|
88
89
|
};
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (!ctrl.readFrom) continue; // action type — no value
|
|
94
|
-
const val = data[ctrl.readFrom];
|
|
95
|
-
if (val !== undefined && val !== null) {
|
|
96
|
-
cv[ctrl.id] = typeof val === 'object' ? (val.name || val.id || String(val)) : val;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
// Also include model/mode as fallback controls
|
|
100
|
-
if (data.model && !cv['model']) cv['model'] = data.model;
|
|
101
|
-
if (data.mode && !cv['mode']) cv['mode'] = data.mode;
|
|
102
|
-
if (Object.keys(cv).length > 0) state.controlValues = cv;
|
|
103
|
-
}
|
|
90
|
+
const controlValues = extractProviderControlValues(this.provider.controls, data);
|
|
91
|
+
if (controlValues) state.controlValues = controlValues;
|
|
92
|
+
const effects = normalizeProviderEffects(data);
|
|
93
|
+
if (effects.length > 0) state.effects = effects;
|
|
104
94
|
if (state.messages.length > 0) {
|
|
105
95
|
this.lastSuccessState = state;
|
|
106
96
|
}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* No vscode dependency — can be used as-is.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import type { ProviderEffect } from '../providers/contracts.js';
|
|
9
|
+
|
|
8
10
|
/** Agent chat message */
|
|
9
11
|
export interface AgentChatMessage {
|
|
10
12
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -36,6 +38,8 @@ export interface AgentStreamState {
|
|
|
36
38
|
activeModal?: { message: string; buttons: string[] };
|
|
37
39
|
/** Dynamic control current values (populated from readChat + provider controls schema) */
|
|
38
40
|
controlValues?: Record<string, string | number | boolean>;
|
|
41
|
+
/** Provider-driven UI effects from readChat */
|
|
42
|
+
effects?: ProviderEffect[];
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
/** Agent webview target info */
|
package/src/cli-adapter-types.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface CliAdapter {
|
|
|
11
11
|
spawn(): Promise<void>;
|
|
12
12
|
sendMessage(text: string): Promise<void>;
|
|
13
13
|
getStatus(): any;
|
|
14
|
+
getScriptParsedStatus?(): any;
|
|
15
|
+
invokeScript?(scriptName: string, args?: any): Promise<any>;
|
|
14
16
|
getPartialResponse(): string;
|
|
15
17
|
saveAndStop?(): Promise<void>;
|
|
16
18
|
shutdown(): void;
|
|
@@ -19,6 +21,7 @@ export interface CliAdapter {
|
|
|
19
21
|
isProcessing(): boolean;
|
|
20
22
|
isReady(): boolean;
|
|
21
23
|
setOnStatusChange(callback: () => void): void;
|
|
24
|
+
updateRuntimeSettings?(settings: Record<string, any>): void;
|
|
22
25
|
setServerConn?(serverConn: any): void;
|
|
23
26
|
// Raw PTY I/O (for terminal view)
|
|
24
27
|
setOnPtyData?(callback: (data: string) => void): void;
|