@adhdev/daemon-core 0.8.30 → 0.8.31

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 (57) hide show
  1. package/dist/agent-stream/manager.d.ts +1 -0
  2. package/dist/agent-stream/provider-adapter.d.ts +1 -0
  3. package/dist/agent-stream/types.d.ts +3 -0
  4. package/dist/boot/daemon-lifecycle.d.ts +2 -1
  5. package/dist/cdp/manager.d.ts +2 -0
  6. package/dist/cli-adapter-types.d.ts +34 -5
  7. package/dist/cli-adapters/provider-cli-adapter.d.ts +4 -158
  8. package/dist/cli-adapters/provider-cli-config.d.ts +30 -0
  9. package/dist/cli-adapters/provider-cli-parse.d.ts +42 -0
  10. package/dist/cli-adapters/provider-cli-runtime.d.ts +29 -0
  11. package/dist/cli-adapters/provider-cli-shared.d.ts +158 -0
  12. package/dist/commands/handler.d.ts +4 -3
  13. package/dist/config/config.d.ts +4 -3
  14. package/dist/index.js +866 -592
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +868 -595
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/providers/contracts.d.ts +10 -1
  19. package/dist/providers/provider-loader.d.ts +3 -0
  20. package/dist/status/reporter.d.ts +2 -3
  21. package/dist/status/snapshot.d.ts +2 -1
  22. package/node_modules/@adhdev/session-host-core/package.json +1 -1
  23. package/package.json +3 -1
  24. package/src/agent-stream/manager.ts +8 -2
  25. package/src/agent-stream/poller.ts +19 -5
  26. package/src/agent-stream/provider-adapter.ts +11 -7
  27. package/src/agent-stream/types.ts +3 -0
  28. package/src/boot/daemon-lifecycle.ts +7 -6
  29. package/src/cdp/initializer.ts +2 -2
  30. package/src/cdp/manager.ts +5 -0
  31. package/src/cdp/setup.ts +1 -1
  32. package/src/cli-adapter-types.ts +37 -5
  33. package/src/cli-adapters/provider-cli-adapter.ts +212 -795
  34. package/src/cli-adapters/provider-cli-config.ts +66 -0
  35. package/src/cli-adapters/provider-cli-parse.ts +202 -0
  36. package/src/cli-adapters/provider-cli-runtime.ts +142 -0
  37. package/src/cli-adapters/provider-cli-shared.ts +439 -0
  38. package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +1 -1
  39. package/src/commands/cdp-commands.ts +6 -1
  40. package/src/commands/chat-commands.ts +45 -29
  41. package/src/commands/cli-manager.ts +28 -9
  42. package/src/commands/handler.ts +14 -10
  43. package/src/commands/router.ts +23 -10
  44. package/src/commands/stream-commands.ts +11 -5
  45. package/src/config/config.ts +4 -10
  46. package/src/daemon/dev-auto-implement.ts +22 -18
  47. package/src/daemon/dev-cli-debug.ts +59 -16
  48. package/src/daemon/dev-server.ts +67 -43
  49. package/src/providers/acp-provider-instance.ts +1 -1
  50. package/src/providers/cli-provider-instance.ts +2 -2
  51. package/src/providers/contracts.ts +12 -1
  52. package/src/providers/extension-provider-instance.ts +1 -1
  53. package/src/providers/ide-provider-instance.ts +39 -18
  54. package/src/providers/provider-loader.ts +85 -54
  55. package/src/providers/version-archive.ts +23 -5
  56. package/src/status/reporter.ts +18 -14
  57. package/src/status/snapshot.ts +5 -4
@@ -41,6 +41,7 @@ export declare class DaemonAgentStreamManager {
41
41
  ensureSessionPanelOpen(_sessionId: string): Promise<void>;
42
42
  setActiveSession(cdp: DaemonCdpManager, parentSessionId: string, sessionId: string | null): Promise<void>;
43
43
  private resolveSessionIdForTarget;
44
+ private getStateError;
44
45
  private connectManagedSession;
45
46
  /** Agent webview discovery + session connection */
46
47
  syncActiveSession(cdp: DaemonCdpManager, parentSessionId: string): Promise<void>;
@@ -16,6 +16,7 @@ export declare class ProviderStreamAdapter implements IAgentStreamAdapter {
16
16
  constructor(provider: ProviderModule);
17
17
  private callScript;
18
18
  private hasScript;
19
+ private getStateTitle;
19
20
  private parseMaybeJson;
20
21
  private summarizeRaw;
21
22
  private isTransportError;
@@ -27,6 +27,7 @@ export interface AgentStreamState {
27
27
  status: 'idle' | 'streaming' | 'waiting_approval' | 'error' | 'disconnected' | 'panel_hidden' | 'not_monitored';
28
28
  messages: AgentChatMessage[];
29
29
  inputContent: string;
30
+ title?: string;
30
31
  /** @deprecated Use controlValues['model'] — kept for backward compatibility */
31
32
  model?: string;
32
33
  /** @deprecated Use controlValues['mode'] — kept for backward compatibility */
@@ -35,6 +36,8 @@ export interface AgentStreamState {
35
36
  message: string;
36
37
  buttons: string[];
37
38
  };
39
+ error?: string;
40
+ _error?: string;
38
41
  /** Dynamic control current values (populated from readChat + provider controls schema) */
39
42
  controlValues?: Record<string, string | number | boolean>;
40
43
  /** Provider-driven UI effects from readChat */
@@ -17,6 +17,7 @@ import { AgentStreamPoller } from '../agent-stream/poller.js';
17
17
  import { ProviderLoader } from '../providers/provider-loader.js';
18
18
  import { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
19
19
  import { DevServer } from '../daemon/dev-server.js';
20
+ import { type IDEInfo } from '../detection/ide-detector.js';
20
21
  import { SessionRegistry } from '../sessions/registry.js';
21
22
  import type { PtyTransportFactory } from '../cli-adapters/pty-transport.js';
22
23
  export interface DaemonInitConfig {
@@ -59,7 +60,7 @@ export interface DaemonComponents {
59
60
  cdpManagers: Map<string, DaemonCdpManager>;
60
61
  sessionRegistry: SessionRegistry;
61
62
  detectedIdes: {
62
- value: any[];
63
+ value: IDEInfo[];
63
64
  };
64
65
  }
65
66
  export interface DaemonDevSupportOptions {
@@ -50,6 +50,8 @@ export declare class DaemonCdpManager {
50
50
  constructor(port?: number, logFn?: (msg: string) => void, targetId?: string, targetFilter?: CdpTargetFilter);
51
51
  /** Set target filter (can be updated after construction) */
52
52
  setTargetFilter(filter: CdpTargetFilter): void;
53
+ /** Clear a previously pinned target so the next connect can reselect a page. */
54
+ clearTargetId(): void;
53
55
  /**
54
56
  * Check if a page title should be excluded (non-main page).
55
57
  * Uses provider-configured titleExcludes, falls back to default pattern.
@@ -3,15 +3,41 @@
3
3
  *
4
4
  * Contract implemented by all CLI adapters (ProviderCliAdapter etc).
5
5
  */
6
+ import type { ChatMessage } from './types.js';
7
+ export interface CliAdapterStatus {
8
+ status?: string;
9
+ messages?: ChatMessage[];
10
+ activeModal?: {
11
+ message: string;
12
+ buttons: string[];
13
+ } | null;
14
+ }
15
+ export interface AcpAdapterHandle {
16
+ onEvent(event: string, data?: unknown): void;
17
+ getState(): {
18
+ status: string;
19
+ activeChat?: {
20
+ messages?: ChatMessage[];
21
+ activeModal?: {
22
+ message: string;
23
+ buttons: string[];
24
+ } | null;
25
+ } | null;
26
+ };
27
+ setMode?(mode: string): Promise<void>;
28
+ setConfigOption?(configId: string, value: string): Promise<void>;
29
+ resolvePermission?(approved: boolean): Promise<void>;
30
+ }
6
31
  export interface CliAdapter {
7
32
  cliType: string;
8
33
  cliName: string;
9
34
  workingDir: string;
35
+ _acpInstance?: AcpAdapterHandle;
10
36
  spawn(): Promise<void>;
11
37
  sendMessage(text: string): Promise<void>;
12
- getStatus(): any;
13
- getScriptParsedStatus?(): any;
14
- invokeScript?(scriptName: string, args?: any): Promise<any>;
38
+ getStatus(): CliAdapterStatus;
39
+ getScriptParsedStatus?(): unknown;
40
+ invokeScript?(scriptName: string, args?: Record<string, unknown>): Promise<unknown>;
15
41
  getPartialResponse(): string;
16
42
  saveAndStop?(): Promise<void>;
17
43
  shutdown(): void;
@@ -20,8 +46,11 @@ export interface CliAdapter {
20
46
  isProcessing(): boolean;
21
47
  isReady(): boolean;
22
48
  setOnStatusChange(callback: () => void): void;
23
- updateRuntimeSettings?(settings: Record<string, any>): void;
24
- setServerConn?(serverConn: any): void;
49
+ updateRuntimeSettings?(settings: Record<string, unknown>): void;
50
+ setServerConn?(serverConn: unknown): void;
51
+ clearHistory?(): void;
52
+ resolveAction?(data: unknown): Promise<void>;
53
+ resolveModal?(buttonIndex: number): void;
25
54
  setOnPtyData?(callback: (data: string) => void): void;
26
55
  writeRaw?(data: string): void;
27
56
  resize?(cols: number, rows: number): void;
@@ -14,159 +14,14 @@
14
14
  * compatibility: [{ ideVersion, scriptDir }] ← versioned scripts
15
15
  */
16
16
  import type { CliAdapter } from '../cli-adapter-types.js';
17
- import type { ProviderResumeCapability } from '../providers/contracts.js';
18
17
  import { type PtyRuntimeMetadata, type PtyTransportFactory } from './pty-transport.js';
19
- export interface CliChatMessage {
20
- role: 'user' | 'assistant';
21
- content: string;
22
- timestamp?: number;
23
- receivedAt?: number;
24
- kind?: string;
25
- id?: string;
26
- index?: number;
27
- meta?: Record<string, any>;
28
- senderName?: string;
29
- }
18
+ import { type CliChatMessage, type CliProviderModule, type CliScripts, type CliSessionStatus } from './provider-cli-shared.js';
19
+ import { type ProviderResolutionMeta } from './provider-cli-config.js';
20
+ export { normalizeCliProviderForRuntime, type CliApprovalInput, type CliChatMessage, type CliProviderModule, type CliScreenLine, type CliScreenSnapshot, type CliScriptInput, type CliScripts, type CliSessionStatus, type CliStatusInput, type CliTraceEntry, } from './provider-cli-shared.js';
30
21
  type SeedCliChatMessage = Omit<Partial<CliChatMessage>, 'role'> & {
31
22
  role?: string;
32
23
  content?: string;
33
24
  };
34
- export interface CliSessionStatus {
35
- status: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
36
- messages: CliChatMessage[];
37
- workingDir: string;
38
- activeModal: {
39
- message: string;
40
- buttons: string[];
41
- } | null;
42
- }
43
- /**
44
- * CLI Script Functions.
45
- * Unlike IDE scripts (which return JS code strings for CDP evaluate),
46
- * CLI scripts are Node.js functions that receive PTY buffer data and return structured results.
47
- */
48
- export interface CliScripts {
49
- /** Full PTY buffer → ReadChatResult (messages, status, activeModal) */
50
- parseOutput?: (input: CliScriptInput) => any;
51
- /** Lightweight status detection (high-frequency polling) → AgentStatus string */
52
- detectStatus?: (input: CliStatusInput) => string | null;
53
- /** Parse approval modal from PTY output → ModalInfo | null */
54
- parseApproval?: (input: CliApprovalInput) => {
55
- message: string;
56
- buttons: string[];
57
- } | null;
58
- /** Produce a cli-specific prompt from a dashboard action payload */
59
- resolveAction?: (data: any) => string;
60
- /** Custom scripts */
61
- [name: string]: ((input: any) => any) | undefined;
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
- }
85
- export interface CliScriptInput {
86
- buffer: string;
87
- rawBuffer: string;
88
- recentBuffer: string;
89
- screenText: string;
90
- screen: CliScreenSnapshot;
91
- bufferScreen: CliScreenSnapshot;
92
- recentScreen: CliScreenSnapshot;
93
- messages: CliChatMessage[];
94
- partialResponse: string;
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;
114
- }
115
- export interface CliTraceEntry {
116
- id: number;
117
- at: number;
118
- type: string;
119
- status: CliSessionStatus['status'];
120
- isWaitingForResponse: boolean;
121
- activeModal: {
122
- message: string;
123
- buttons: string[];
124
- } | null;
125
- payload: Record<string, any>;
126
- }
127
- export interface CliProviderModule {
128
- type: string;
129
- name: string;
130
- category: 'cli';
131
- binary: string;
132
- sendDelayMs?: number;
133
- sendKey?: string;
134
- submitStrategy?: 'wait_for_echo' | 'immediate';
135
- spawn: {
136
- command: string;
137
- args: string[];
138
- shell: boolean;
139
- env: Record<string, string>;
140
- };
141
- timeouts?: {
142
- /** PTY output batch transmit interval (default 50ms) */
143
- ptyFlush?: number;
144
- /** Wait for startup dialog auto-proceed (default 300ms) */
145
- dialogAccept?: number;
146
- /** Approval detect cooldown (default 2000ms) */
147
- approvalCooldown?: number;
148
- /** Check for completion on no-response during generating (default 6000ms) */
149
- generatingIdle?: number;
150
- /** Check for completion on no-response (default 5000ms) */
151
- idleFinish?: number;
152
- /** Max response wait (default 300000ms = 5min) */
153
- maxResponse?: number;
154
- /** shutdown after kill wait (default 1000ms) */
155
- shutdownGrace?: number;
156
- /** Output settle debounce before evaluating status (default 300ms) */
157
- outputSettle?: number;
158
- };
159
- resume?: ProviderResumeCapability;
160
- }
161
- /**
162
- * Normalize raw provider JSON for auto-implement approval patterns.
163
- * Used by dev-server only — ProviderCliAdapter itself uses scripts.
164
- */
165
- export declare function normalizeCliProviderForRuntime(raw: any): {
166
- patterns: {
167
- approval: RegExp[];
168
- };
169
- };
170
25
  export declare class ProviderCliAdapter implements CliAdapter {
171
26
  private extraArgs;
172
27
  readonly cliType: string;
@@ -244,16 +99,9 @@ export declare class ProviderCliAdapter implements CliAdapter {
244
99
  private static readonly FINISH_RETRY_DELAY_MS;
245
100
  private static readonly MAX_FINISH_RETRIES;
246
101
  private syncMessageViews;
247
- private hydrateParsedMessages;
248
- private normalizeParsedMessages;
249
- private sliceFromOffset;
250
- private buildParseInput;
251
102
  private setStatus;
252
103
  private clearIdleFinishCandidate;
253
104
  private armIdleFinishCandidate;
254
- private summarizeTraceText;
255
- private summarizeTraceMessages;
256
- private buildTraceParseSnapshot;
257
105
  private recordTrace;
258
106
  private resetTraceSession;
259
107
  private readonly timeouts;
@@ -325,7 +173,5 @@ export declare class ProviderCliAdapter implements CliAdapter {
325
173
  resize(cols: number, rows: number): void;
326
174
  getDebugState(): Record<string, any>;
327
175
  getTraceState(limit?: number): Record<string, any>;
328
- getProviderResolutionMeta(): Record<string, any>;
329
- private respondToTerminalQueries;
176
+ getProviderResolutionMeta(): ProviderResolutionMeta;
330
177
  }
331
- export {};
@@ -0,0 +1,30 @@
1
+ import type { CliProviderModule } from './provider-cli-shared.js';
2
+ export interface ProviderResolutionMeta {
3
+ type: string;
4
+ name: string;
5
+ resolvedVersion: string | null;
6
+ resolvedOs: string | null;
7
+ providerDir: string | null;
8
+ scriptDir: string | null;
9
+ scriptsPath: string | null;
10
+ scriptsSource: string | null;
11
+ versionWarning: string | null;
12
+ }
13
+ export interface ResolvedCliAdapterConfig {
14
+ timeouts: {
15
+ ptyFlush: number;
16
+ dialogAccept: number;
17
+ approvalCooldown: number;
18
+ generatingIdle: number;
19
+ idleFinish: number;
20
+ maxResponse: number;
21
+ shutdownGrace: number;
22
+ outputSettle: number;
23
+ };
24
+ approvalKeys: Record<number, string>;
25
+ sendDelayMs: number;
26
+ sendKey: string;
27
+ submitStrategy: 'wait_for_echo' | 'immediate';
28
+ providerResolutionMeta: ProviderResolutionMeta;
29
+ }
30
+ export declare function resolveCliAdapterConfig(provider: CliProviderModule): ResolvedCliAdapterConfig;
@@ -0,0 +1,42 @@
1
+ import { type CliChatMessage, type CliScriptInput } from './provider-cli-shared.js';
2
+ export interface TurnParseScope {
3
+ prompt: string;
4
+ startedAt: number;
5
+ bufferStart: number;
6
+ rawBufferStart: number;
7
+ }
8
+ export declare function hydrateCliParsedMessages(parsedMessages: any[], options: {
9
+ committedMessages: CliChatMessage[];
10
+ scope?: TurnParseScope | null;
11
+ lastOutputAt: number;
12
+ now?: number;
13
+ }): any[];
14
+ export declare function normalizeCliParsedMessages(parsedMessages: any[], options: {
15
+ committedMessages: CliChatMessage[];
16
+ scope?: TurnParseScope | null;
17
+ lastOutputAt: number;
18
+ now?: number;
19
+ }): CliChatMessage[];
20
+ export declare function buildCliParseInput(options: {
21
+ accumulatedBuffer: string;
22
+ accumulatedRawBuffer: string;
23
+ recentOutputBuffer: string;
24
+ terminalScreenText: string;
25
+ baseMessages: CliChatMessage[];
26
+ partialResponse: string;
27
+ scope?: TurnParseScope | null;
28
+ runtimeSettings: Record<string, any>;
29
+ }): CliScriptInput;
30
+ export declare function summarizeCliTraceText(text: string, max?: number): string;
31
+ export declare function summarizeCliTraceMessages(messages: CliChatMessage[], limit?: number): {
32
+ role: string;
33
+ content: string;
34
+ timestamp?: number;
35
+ }[];
36
+ export declare function buildCliTraceParseSnapshot(options: {
37
+ accumulatedBuffer: string;
38
+ accumulatedRawBuffer: string;
39
+ responseBuffer: string;
40
+ partialResponse?: string;
41
+ scope?: TurnParseScope | null;
42
+ }): Record<string, any>;
@@ -0,0 +1,29 @@
1
+ import type { PtySpawnOptions, PtyRuntimeTransport } from './pty-transport.js';
2
+ import type { TerminalScreen } from './terminal-screen.js';
3
+ import { type CliProviderModule } from './provider-cli-shared.js';
4
+ export interface CliSpawnPlan {
5
+ binaryPath: string;
6
+ allArgs: string[];
7
+ shellCmd: string;
8
+ shellArgs: string[];
9
+ ptyOptions: PtySpawnOptions;
10
+ isWin: boolean;
11
+ useShell: boolean;
12
+ }
13
+ export declare function resolveCliSpawnPlan(options: {
14
+ provider: CliProviderModule;
15
+ runtimeSettings: Record<string, any>;
16
+ workingDir: string;
17
+ extraArgs: string[];
18
+ }): CliSpawnPlan;
19
+ export declare function buildCliLoginShellRetry(plan: Pick<CliSpawnPlan, 'binaryPath' | 'allArgs'>): {
20
+ shellCmd: string;
21
+ shellArgs: string[];
22
+ };
23
+ export declare function getCliSpawnErrorHint(message: string, shellCmd: string, isWin: boolean): string | null;
24
+ export declare function respondToCliTerminalQueries(options: {
25
+ ptyProcess: PtyRuntimeTransport | null;
26
+ pendingTail: string;
27
+ data: string;
28
+ terminalScreen: TerminalScreen;
29
+ }): string;
@@ -0,0 +1,158 @@
1
+ import type { ProviderResumeCapability } from '../providers/contracts.js';
2
+ import { sanitizeSpawnEnv } from './spawn-env.js';
3
+ export interface CliChatMessage {
4
+ role: 'user' | 'assistant';
5
+ content: string;
6
+ timestamp?: number;
7
+ receivedAt?: number;
8
+ kind?: string;
9
+ id?: string;
10
+ index?: number;
11
+ meta?: Record<string, any>;
12
+ senderName?: string;
13
+ }
14
+ export interface CliSessionStatus {
15
+ status: 'idle' | 'generating' | 'waiting_approval' | 'error' | 'stopped' | 'starting';
16
+ messages: CliChatMessage[];
17
+ workingDir: string;
18
+ activeModal: {
19
+ message: string;
20
+ buttons: string[];
21
+ } | null;
22
+ }
23
+ export interface CliScripts {
24
+ parseOutput?: (input: CliScriptInput) => any;
25
+ detectStatus?: (input: CliStatusInput) => string | null;
26
+ parseApproval?: (input: CliApprovalInput) => {
27
+ message: string;
28
+ buttons: string[];
29
+ } | null;
30
+ resolveAction?: (data: any) => string;
31
+ [name: string]: ((input: any) => any) | undefined;
32
+ }
33
+ export interface CliScreenLine {
34
+ index: number;
35
+ fromTop: number;
36
+ fromBottom: number;
37
+ text: string;
38
+ trimmed: string;
39
+ isEmpty: boolean;
40
+ }
41
+ export interface CliScreenSnapshot {
42
+ text: string;
43
+ lineCount: number;
44
+ lines: CliScreenLine[];
45
+ nonEmptyLines: CliScreenLine[];
46
+ firstNonEmptyLineIndex: number;
47
+ lastNonEmptyLineIndex: number;
48
+ firstNonEmptyLine: CliScreenLine | null;
49
+ lastNonEmptyLine: CliScreenLine | null;
50
+ promptLineIndex: number;
51
+ promptLine: CliScreenLine | null;
52
+ linesAbovePrompt: CliScreenLine[];
53
+ linesBelowPrompt: CliScreenLine[];
54
+ }
55
+ export interface CliScriptInput {
56
+ buffer: string;
57
+ rawBuffer: string;
58
+ recentBuffer: string;
59
+ screenText: string;
60
+ screen: CliScreenSnapshot;
61
+ bufferScreen: CliScreenSnapshot;
62
+ recentScreen: CliScreenSnapshot;
63
+ messages: CliChatMessage[];
64
+ partialResponse: string;
65
+ promptText?: string;
66
+ settings?: Record<string, any>;
67
+ args?: Record<string, any>;
68
+ }
69
+ export interface CliStatusInput {
70
+ tail: string;
71
+ screenText?: string;
72
+ rawBuffer?: string;
73
+ screen: CliScreenSnapshot;
74
+ tailScreen: CliScreenSnapshot;
75
+ }
76
+ export interface CliApprovalInput {
77
+ buffer: string;
78
+ screenText?: string;
79
+ rawBuffer?: string;
80
+ tail: string;
81
+ screen: CliScreenSnapshot;
82
+ bufferScreen: CliScreenSnapshot;
83
+ tailScreen: CliScreenSnapshot;
84
+ }
85
+ export interface CliTraceEntry {
86
+ id: number;
87
+ at: number;
88
+ type: string;
89
+ status: CliSessionStatus['status'];
90
+ isWaitingForResponse: boolean;
91
+ activeModal: {
92
+ message: string;
93
+ buttons: string[];
94
+ } | null;
95
+ payload: Record<string, any>;
96
+ }
97
+ export interface CliProviderModule {
98
+ type: string;
99
+ name: string;
100
+ category: 'cli';
101
+ binary: string;
102
+ approvalKeys?: Record<number, string>;
103
+ sendDelayMs?: number;
104
+ sendKey?: string;
105
+ submitStrategy?: 'wait_for_echo' | 'immediate';
106
+ scripts?: CliScripts;
107
+ spawn: {
108
+ command: string;
109
+ args: string[];
110
+ shell: boolean;
111
+ env: Record<string, string>;
112
+ };
113
+ timeouts?: {
114
+ ptyFlush?: number;
115
+ dialogAccept?: number;
116
+ approvalCooldown?: number;
117
+ generatingIdle?: number;
118
+ idleFinish?: number;
119
+ maxResponse?: number;
120
+ shutdownGrace?: number;
121
+ outputSettle?: number;
122
+ };
123
+ resume?: ProviderResumeCapability;
124
+ _resolvedVersion?: string | null;
125
+ _resolvedOs?: string | null;
126
+ _resolvedProviderDir?: string | null;
127
+ _resolvedScriptDir?: string | null;
128
+ _resolvedScriptsPath?: string | null;
129
+ _resolvedScriptsSource?: string | null;
130
+ _versionWarning?: string | null;
131
+ }
132
+ export declare function sanitizeTerminalText(str: string): string;
133
+ export declare function listCliScriptNames(scripts: CliScripts | undefined): string[];
134
+ export declare function buildCliScreenSnapshot(text: string): CliScreenSnapshot;
135
+ export declare const buildCliSpawnEnv: typeof sanitizeSpawnEnv;
136
+ export declare function computeTerminalQueryTail(buffer: string): string;
137
+ export declare function findBinary(name: string): string;
138
+ export declare function isScriptBinary(binaryPath: string): boolean;
139
+ export declare function looksLikeMachOOrElf(filePath: string): boolean;
140
+ export declare function shSingleQuote(arg: string): string;
141
+ export declare function estimatePromptDisplayLines(text: string, cols?: number): number;
142
+ export declare function extractPromptRetrySnippet(text: string): string;
143
+ export declare function normalizePromptText(text: string): string;
144
+ export declare function compactPromptText(text: string): string;
145
+ export declare function promptLikelyVisible(screenText: string, promptSnippet: string): boolean;
146
+ export declare function normalizeScreenSnapshot(text: string): string;
147
+ export declare function normalizeComparableMessageContent(text: string): string;
148
+ export declare function trimPromptEchoPrefix(text: string, promptText?: string | null): string;
149
+ export declare function getLastUserPromptText(messages: Array<{
150
+ role?: string;
151
+ content?: string;
152
+ }> | null | undefined): string;
153
+ export declare function looksLikeConfirmOnlyLabel(label: string): boolean;
154
+ export declare function normalizeCliProviderForRuntime(raw: unknown): {
155
+ patterns: {
156
+ approval: RegExp[];
157
+ };
158
+ };
@@ -15,6 +15,7 @@ import { ProviderLoader } from '../providers/provider-loader.js';
15
15
  import type { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
16
16
  import type { ProviderModule } from '../providers/contracts.js';
17
17
  import type { DaemonAgentStreamManager } from '../agent-stream/index.js';
18
+ import type { CliAdapter } from '../cli-adapter-types.js';
18
19
  import { ChatHistoryWriter } from '../config/chat-history.js';
19
20
  import type { SessionRegistry, SessionRuntimeTarget } from '../sessions/registry.js';
20
21
  export interface CommandResult {
@@ -24,7 +25,7 @@ export interface CommandResult {
24
25
  export interface CommandContext {
25
26
  cdpManagers: Map<string, DaemonCdpManager>;
26
27
  ideType: string;
27
- adapters: Map<string, any>;
28
+ adapters: Map<string, CliAdapter>;
28
29
  providerLoader?: ProviderLoader;
29
30
  /** ProviderInstanceManager — for runtime settings propagation */
30
31
  instanceManager?: ProviderInstanceManager;
@@ -43,7 +44,7 @@ export interface CommandHelpers {
43
44
  result: any;
44
45
  category: string;
45
46
  } | null>;
46
- getCliAdapter(type?: string): any | null;
47
+ getCliAdapter(type?: string): CliAdapter | null;
47
48
  readonly currentManagerKey: string | undefined;
48
49
  readonly currentIdeType: string | undefined;
49
50
  readonly currentProviderType: string | undefined;
@@ -85,7 +86,7 @@ export declare class DaemonCommandHandler implements CommandHelpers {
85
86
  category: string;
86
87
  } | null>;
87
88
  /** CLI adapter search */
88
- getCliAdapter(type?: string): any | null;
89
+ getCliAdapter(type?: string): CliAdapter | null;
89
90
  private inferProviderType;
90
91
  private resolveRoute;
91
92
  /** Extract CDP scope key from target session or explicit ideType */
@@ -31,10 +31,11 @@ export interface ADHDevConfig {
31
31
  machineSecret?: string | null;
32
32
  /**
33
33
  * Server-side D1 `machines.id` — the row ID assigned when daemon registers via
34
- * `POST /cli/complete`. Used as fallback for machine lookup on re-auth.
34
+ * `POST /cli/complete`. This remains useful for account-side machine actions
35
+ * that target the registered machine row directly (for example cloud rename).
35
36
  *
36
- * @deprecated Legacy bridge field will be removed after 2026-05-01.
37
- * Modern auth flow uses `machineSecret` (adm_) to identify machines.
37
+ * Machine auth itself uses `machineSecret` (adm_) and no longer falls back
38
+ * to `registeredMachineId`.
38
39
  */
39
40
  registeredMachineId?: string;
40
41
  providerSettings: Record<string, Record<string, any>>;