@adhdev/daemon-core 0.8.22 → 0.8.23
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
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Agent stream types.
|
|
5
5
|
* No vscode dependency — can be used as-is.
|
|
6
6
|
*/
|
|
7
|
+
import type { ProviderEffect } from '../providers/contracts.js';
|
|
7
8
|
/** Agent chat message */
|
|
8
9
|
export interface AgentChatMessage {
|
|
9
10
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -36,6 +37,8 @@ export interface AgentStreamState {
|
|
|
36
37
|
};
|
|
37
38
|
/** Dynamic control current values (populated from readChat + provider controls schema) */
|
|
38
39
|
controlValues?: Record<string, string | number | boolean>;
|
|
40
|
+
/** Provider-driven UI effects from readChat */
|
|
41
|
+
effects?: ProviderEffect[];
|
|
39
42
|
}
|
|
40
43
|
/** Agent webview target info */
|
|
41
44
|
export interface AgentWebviewTarget {
|
|
@@ -10,6 +10,8 @@ export interface CliAdapter {
|
|
|
10
10
|
spawn(): Promise<void>;
|
|
11
11
|
sendMessage(text: string): Promise<void>;
|
|
12
12
|
getStatus(): any;
|
|
13
|
+
getScriptParsedStatus?(): any;
|
|
14
|
+
invokeScript?(scriptName: string, args?: any): Promise<any>;
|
|
13
15
|
getPartialResponse(): string;
|
|
14
16
|
saveAndStop?(): Promise<void>;
|
|
15
17
|
shutdown(): void;
|
|
@@ -18,6 +20,7 @@ export interface CliAdapter {
|
|
|
18
20
|
isProcessing(): boolean;
|
|
19
21
|
isReady(): boolean;
|
|
20
22
|
setOnStatusChange(callback: () => void): void;
|
|
23
|
+
updateRuntimeSettings?(settings: Record<string, any>): void;
|
|
21
24
|
setServerConn?(serverConn: any): void;
|
|
22
25
|
setOnPtyData?(callback: (data: string) => void): void;
|
|
23
26
|
writeRaw?(data: string): void;
|
|
@@ -20,7 +20,17 @@ export interface CliChatMessage {
|
|
|
20
20
|
role: 'user' | 'assistant';
|
|
21
21
|
content: string;
|
|
22
22
|
timestamp?: number;
|
|
23
|
+
receivedAt?: number;
|
|
24
|
+
kind?: string;
|
|
25
|
+
id?: string;
|
|
26
|
+
index?: number;
|
|
27
|
+
meta?: Record<string, any>;
|
|
28
|
+
senderName?: string;
|
|
23
29
|
}
|
|
30
|
+
type SeedCliChatMessage = Omit<Partial<CliChatMessage>, 'role'> & {
|
|
31
|
+
role?: string;
|
|
32
|
+
content?: string;
|
|
33
|
+
};
|
|
24
34
|
export interface CliSessionStatus {
|
|
25
35
|
status: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
|
|
26
36
|
messages: CliChatMessage[];
|
|
@@ -39,18 +49,9 @@ export interface CliScripts {
|
|
|
39
49
|
/** Full PTY buffer → ReadChatResult (messages, status, activeModal) */
|
|
40
50
|
parseOutput?: (input: CliScriptInput) => any;
|
|
41
51
|
/** Lightweight status detection (high-frequency polling) → AgentStatus string */
|
|
42
|
-
detectStatus?: (input:
|
|
43
|
-
tail: string;
|
|
44
|
-
screenText?: string;
|
|
45
|
-
rawBuffer?: string;
|
|
46
|
-
}) => string | null;
|
|
52
|
+
detectStatus?: (input: CliStatusInput) => string | null;
|
|
47
53
|
/** Parse approval modal from PTY output → ModalInfo | null */
|
|
48
|
-
parseApproval?: (input: {
|
|
49
|
-
buffer: string;
|
|
50
|
-
screenText?: string;
|
|
51
|
-
rawBuffer?: string;
|
|
52
|
-
tail: string;
|
|
53
|
-
}) => {
|
|
54
|
+
parseApproval?: (input: CliApprovalInput) => {
|
|
54
55
|
message: string;
|
|
55
56
|
buttons: string[];
|
|
56
57
|
} | null;
|
|
@@ -59,14 +60,57 @@ export interface CliScripts {
|
|
|
59
60
|
/** Custom scripts */
|
|
60
61
|
[name: string]: ((input: any) => any) | undefined;
|
|
61
62
|
}
|
|
63
|
+
export interface CliScreenLine {
|
|
64
|
+
index: number;
|
|
65
|
+
fromTop: number;
|
|
66
|
+
fromBottom: number;
|
|
67
|
+
text: string;
|
|
68
|
+
trimmed: string;
|
|
69
|
+
isEmpty: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface CliScreenSnapshot {
|
|
72
|
+
text: string;
|
|
73
|
+
lineCount: number;
|
|
74
|
+
lines: CliScreenLine[];
|
|
75
|
+
nonEmptyLines: CliScreenLine[];
|
|
76
|
+
firstNonEmptyLineIndex: number;
|
|
77
|
+
lastNonEmptyLineIndex: number;
|
|
78
|
+
firstNonEmptyLine: CliScreenLine | null;
|
|
79
|
+
lastNonEmptyLine: CliScreenLine | null;
|
|
80
|
+
promptLineIndex: number;
|
|
81
|
+
promptLine: CliScreenLine | null;
|
|
82
|
+
linesAbovePrompt: CliScreenLine[];
|
|
83
|
+
linesBelowPrompt: CliScreenLine[];
|
|
84
|
+
}
|
|
62
85
|
export interface CliScriptInput {
|
|
63
86
|
buffer: string;
|
|
64
87
|
rawBuffer: string;
|
|
65
88
|
recentBuffer: string;
|
|
66
89
|
screenText: string;
|
|
90
|
+
screen: CliScreenSnapshot;
|
|
91
|
+
bufferScreen: CliScreenSnapshot;
|
|
92
|
+
recentScreen: CliScreenSnapshot;
|
|
67
93
|
messages: CliChatMessage[];
|
|
68
94
|
partialResponse: string;
|
|
69
95
|
promptText?: string;
|
|
96
|
+
settings?: Record<string, any>;
|
|
97
|
+
args?: Record<string, any>;
|
|
98
|
+
}
|
|
99
|
+
export interface CliStatusInput {
|
|
100
|
+
tail: string;
|
|
101
|
+
screenText?: string;
|
|
102
|
+
rawBuffer?: string;
|
|
103
|
+
screen: CliScreenSnapshot;
|
|
104
|
+
tailScreen: CliScreenSnapshot;
|
|
105
|
+
}
|
|
106
|
+
export interface CliApprovalInput {
|
|
107
|
+
buffer: string;
|
|
108
|
+
screenText?: string;
|
|
109
|
+
rawBuffer?: string;
|
|
110
|
+
tail: string;
|
|
111
|
+
screen: CliScreenSnapshot;
|
|
112
|
+
bufferScreen: CliScreenSnapshot;
|
|
113
|
+
tailScreen: CliScreenSnapshot;
|
|
70
114
|
}
|
|
71
115
|
export interface CliTraceEntry {
|
|
72
116
|
id: number;
|
|
@@ -145,7 +189,9 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
145
189
|
private ready;
|
|
146
190
|
private startupBuffer;
|
|
147
191
|
private startupParseGate;
|
|
192
|
+
private startupSettleTimer;
|
|
148
193
|
private spawnAt;
|
|
194
|
+
private startupFirstOutputAt;
|
|
149
195
|
private onPtyDataCallback;
|
|
150
196
|
private pendingOutputParseBuffer;
|
|
151
197
|
private pendingOutputParseTimer;
|
|
@@ -178,6 +224,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
178
224
|
private resizeSuppressUntil;
|
|
179
225
|
private statusHistory;
|
|
180
226
|
private cliScripts;
|
|
227
|
+
private runtimeSettings;
|
|
181
228
|
/** Full accumulated ANSI-stripped PTY output */
|
|
182
229
|
private accumulatedBuffer;
|
|
183
230
|
/** Full accumulated raw PTY output (with ANSI) */
|
|
@@ -193,9 +240,11 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
193
240
|
private static readonly MAX_TRACE_ENTRIES;
|
|
194
241
|
private readonly providerResolutionMeta;
|
|
195
242
|
private static readonly IDLE_FINISH_CONFIRM_MS;
|
|
243
|
+
private static readonly STATUS_ACTIVITY_HOLD_MS;
|
|
196
244
|
private static readonly FINISH_RETRY_DELAY_MS;
|
|
197
245
|
private static readonly MAX_FINISH_RETRIES;
|
|
198
246
|
private syncMessageViews;
|
|
247
|
+
private hydrateParsedMessages;
|
|
199
248
|
private normalizeParsedMessages;
|
|
200
249
|
private sliceFromOffset;
|
|
201
250
|
private buildParseInput;
|
|
@@ -216,17 +265,25 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
216
265
|
constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], transportFactory?: PtyTransportFactory);
|
|
217
266
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
218
267
|
setCliScripts(scripts: CliScripts): void;
|
|
268
|
+
updateRuntimeSettings(settings: Record<string, any>): void;
|
|
219
269
|
setServerConn(serverConn: any): void;
|
|
220
270
|
setOnStatusChange(callback: () => void): void;
|
|
221
271
|
setOnPtyData(callback: (data: string) => void): void;
|
|
222
272
|
private flushPendingOutputParse;
|
|
223
273
|
spawn(): Promise<void>;
|
|
224
274
|
private handleOutput;
|
|
275
|
+
private resolveStartupState;
|
|
276
|
+
private scheduleStartupSettleCheck;
|
|
225
277
|
private scheduleSettle;
|
|
226
278
|
private armApprovalExitTimeout;
|
|
227
279
|
private looksLikeVisibleIdlePrompt;
|
|
280
|
+
private findLastMatchingLineIndex;
|
|
281
|
+
private looksLikeClaudeGeneratingLine;
|
|
282
|
+
private detectClaudeGeneratingOverride;
|
|
283
|
+
private refineDetectedStatus;
|
|
228
284
|
private looksLikeVisibleAssistantCandidate;
|
|
229
285
|
private shouldRetryFinishResponse;
|
|
286
|
+
private hasRecentInteractiveActivity;
|
|
230
287
|
private getStartupConfirmationModal;
|
|
231
288
|
private shouldResolveModalWithEnter;
|
|
232
289
|
private waitForInteractivePrompt;
|
|
@@ -236,11 +293,13 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
236
293
|
private runDetectStatus;
|
|
237
294
|
private runParseApproval;
|
|
238
295
|
getStatus(): CliSessionStatus;
|
|
296
|
+
seedCommittedMessages(messages: SeedCliChatMessage[]): void;
|
|
239
297
|
/**
|
|
240
298
|
* Script-based full parse — returns ReadChatResult.
|
|
241
299
|
* Called by command handler / dashboard for rich content rendering.
|
|
242
300
|
*/
|
|
243
301
|
getScriptParsedStatus(): any;
|
|
302
|
+
invokeScript(scriptName: string, args?: Record<string, any>): Promise<any>;
|
|
244
303
|
private parseCurrentTranscript;
|
|
245
304
|
/** Whether this adapter has CLI scripts loaded */
|
|
246
305
|
hasCliScripts(): boolean;
|
|
@@ -269,3 +328,4 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
269
328
|
getProviderResolutionMeta(): Record<string, any>;
|
|
270
329
|
private respondToTerminalQueries;
|
|
271
330
|
}
|
|
331
|
+
export {};
|
|
@@ -9,5 +9,6 @@ export declare function handlePtyResize(h: CommandHelpers, args: any): CommandRe
|
|
|
9
9
|
export declare function handleGetProviderSettings(h: CommandHelpers, args: any): CommandResult;
|
|
10
10
|
export declare function handleSetProviderSetting(h: CommandHelpers, args: any): CommandResult;
|
|
11
11
|
export declare function handleExtensionScript(h: CommandHelpers, args: any, scriptName: string): Promise<CommandResult>;
|
|
12
|
+
export declare function handleProviderScript(h: CommandHelpers, args: any): Promise<CommandResult>;
|
|
12
13
|
export declare function handleGetIdeExtensions(h: CommandHelpers, args: any): CommandResult;
|
|
13
14
|
export declare function handleSetIdeExtension(h: CommandHelpers, args: any): CommandResult;
|
package/dist/config/config.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ export interface ADHDevConfig {
|
|
|
45
45
|
}>;
|
|
46
46
|
disableUpstream?: boolean;
|
|
47
47
|
providerDir?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Browser terminal sizing behavior for dashboard CLI panes.
|
|
50
|
+
* Default `measured` keeps terminal size daemon-authoritative.
|
|
51
|
+
* `fit` opt-in restores xterm fit-based sizing for advanced users.
|
|
52
|
+
*/
|
|
53
|
+
terminalSizingMode?: 'measured' | 'fit';
|
|
48
54
|
}
|
|
49
55
|
export declare function generateMachineId(): string;
|
|
50
56
|
export declare function isStableMachineId(machineId?: string | null): boolean;
|