@adhdev/daemon-core 0.7.45 → 0.8.0
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/cli-adapters/provider-cli-adapter.d.ts +34 -0
- package/dist/cli-adapters/pty-transport.d.ts +1 -0
- package/dist/cli-adapters/session-host-transport.d.ts +1 -0
- package/dist/commands/cli-manager.d.ts +11 -2
- package/dist/config/chat-history.d.ts +32 -2
- package/dist/config/config.d.ts +5 -1
- package/dist/config/recent-activity.d.ts +3 -1
- package/dist/config/saved-sessions.d.ts +22 -0
- package/dist/daemon/dev-auto-implement.d.ts +18 -2
- package/dist/daemon/dev-cli-debug.d.ts +82 -0
- package/dist/daemon/dev-server.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6122 -4038
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6114 -4032
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +29 -1
- package/dist/providers/contracts.d.ts +11 -0
- package/dist/providers/provider-instance.d.ts +1 -0
- package/dist/shared-types.d.ts +2 -0
- package/node_modules/@adhdev/session-host-core/dist/index.d.mts +12 -1
- package/node_modules/@adhdev/session-host-core/dist/index.d.ts +12 -1
- package/node_modules/@adhdev/session-host-core/dist/index.js +9 -0
- package/node_modules/@adhdev/session-host-core/dist/index.js.map +1 -1
- package/node_modules/@adhdev/session-host-core/dist/index.mjs +9 -0
- package/node_modules/@adhdev/session-host-core/dist/index.mjs.map +1 -1
- package/node_modules/@adhdev/session-host-core/package.json +1 -1
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +19 -15
- package/src/cli-adapters/provider-cli-adapter.ts +424 -7
- package/src/cli-adapters/pty-transport.ts +1 -0
- package/src/cli-adapters/session-host-transport.ts +32 -1
- package/src/commands/chat-commands.ts +36 -8
- package/src/commands/cli-manager.ts +259 -22
- package/src/commands/router.ts +52 -1
- package/src/config/chat-history.ts +197 -10
- package/src/config/config.d.ts +4 -0
- package/src/config/config.ts +8 -2
- package/src/config/recent-activity.ts +13 -2
- package/src/config/saved-sessions.ts +73 -0
- package/src/daemon/dev-auto-implement.ts +394 -43
- package/src/daemon/dev-cli-debug.ts +839 -0
- package/src/daemon/dev-server.ts +51 -5
- package/src/index.ts +2 -0
- package/src/providers/cli-provider-instance.ts +283 -4
- package/src/providers/contracts.ts +11 -0
- package/src/providers/provider-instance.d.ts +1 -0
- package/src/providers/provider-instance.ts +1 -0
- package/src/providers/provider-loader.ts +39 -0
- package/src/session-host/runtime-support.ts +1 -0
- package/src/shared-types.d.ts +2 -0
- package/src/shared-types.ts +2 -0
- package/src/status/builders.ts +1 -0
- package/src/status/snapshot.ts +1 -0
|
@@ -67,6 +67,18 @@ export interface CliScriptInput {
|
|
|
67
67
|
messages: CliChatMessage[];
|
|
68
68
|
partialResponse: string;
|
|
69
69
|
}
|
|
70
|
+
export interface CliTraceEntry {
|
|
71
|
+
id: number;
|
|
72
|
+
at: number;
|
|
73
|
+
type: string;
|
|
74
|
+
status: CliSessionStatus['status'];
|
|
75
|
+
isWaitingForResponse: boolean;
|
|
76
|
+
activeModal: {
|
|
77
|
+
message: string;
|
|
78
|
+
buttons: string[];
|
|
79
|
+
} | null;
|
|
80
|
+
payload: Record<string, any>;
|
|
81
|
+
}
|
|
70
82
|
export interface CliProviderModule {
|
|
71
83
|
type: string;
|
|
72
84
|
name: string;
|
|
@@ -139,6 +151,10 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
139
151
|
private ptyOutputBuffer;
|
|
140
152
|
private ptyOutputFlushTimer;
|
|
141
153
|
private pendingTerminalQueryTail;
|
|
154
|
+
private lastOutputAt;
|
|
155
|
+
private lastNonEmptyOutputAt;
|
|
156
|
+
private lastScreenChangeAt;
|
|
157
|
+
private lastScreenSnapshot;
|
|
142
158
|
private serverConn;
|
|
143
159
|
private logBuffer;
|
|
144
160
|
private lastApprovalResolvedAt;
|
|
@@ -155,6 +171,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
155
171
|
private submitRetryTimer;
|
|
156
172
|
private submitRetryUsed;
|
|
157
173
|
private submitRetryPromptSnippet;
|
|
174
|
+
private idleFinishCandidate;
|
|
158
175
|
private resizeSuppressUntil;
|
|
159
176
|
private statusHistory;
|
|
160
177
|
private cliScripts;
|
|
@@ -167,11 +184,24 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
167
184
|
/** Max accumulated buffer size (last 50KB) */
|
|
168
185
|
private static readonly MAX_ACCUMULATED_BUFFER;
|
|
169
186
|
private currentTurnScope;
|
|
187
|
+
private traceEntries;
|
|
188
|
+
private traceSeq;
|
|
189
|
+
private traceSessionId;
|
|
190
|
+
private static readonly MAX_TRACE_ENTRIES;
|
|
191
|
+
private readonly providerResolutionMeta;
|
|
192
|
+
private static readonly IDLE_FINISH_CONFIRM_MS;
|
|
170
193
|
private syncMessageViews;
|
|
171
194
|
private normalizeParsedMessages;
|
|
172
195
|
private sliceFromOffset;
|
|
173
196
|
private buildParseInput;
|
|
174
197
|
private setStatus;
|
|
198
|
+
private clearIdleFinishCandidate;
|
|
199
|
+
private armIdleFinishCandidate;
|
|
200
|
+
private summarizeTraceText;
|
|
201
|
+
private summarizeTraceMessages;
|
|
202
|
+
private buildTraceParseSnapshot;
|
|
203
|
+
private recordTrace;
|
|
204
|
+
private resetTraceSession;
|
|
175
205
|
private readonly timeouts;
|
|
176
206
|
private readonly approvalKeys;
|
|
177
207
|
private readonly sendDelayMs;
|
|
@@ -190,6 +220,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
190
220
|
private scheduleSettle;
|
|
191
221
|
private armApprovalExitTimeout;
|
|
192
222
|
private looksLikeVisibleIdlePrompt;
|
|
223
|
+
private waitForInteractivePrompt;
|
|
193
224
|
private evaluateSettled;
|
|
194
225
|
private finishResponse;
|
|
195
226
|
private commitCurrentTranscript;
|
|
@@ -212,6 +243,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
212
243
|
sendMessage(text: string): Promise<void>;
|
|
213
244
|
getPartialResponse(): string;
|
|
214
245
|
getRuntimeMetadata(): PtyRuntimeMetadata | null;
|
|
246
|
+
updateRuntimeMeta(meta: Record<string, unknown>, replace?: boolean): void;
|
|
215
247
|
cancel(): void;
|
|
216
248
|
saveAndStop(): Promise<void>;
|
|
217
249
|
private waitForStopped;
|
|
@@ -224,5 +256,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
224
256
|
resolveModal(buttonIndex: number): void;
|
|
225
257
|
resize(cols: number, rows: number): void;
|
|
226
258
|
getDebugState(): Record<string, any>;
|
|
259
|
+
getTraceState(limit?: number): Record<string, any>;
|
|
260
|
+
getProviderResolutionMeta(): Record<string, any>;
|
|
227
261
|
private respondToTerminalQueries;
|
|
228
262
|
}
|
|
@@ -30,6 +30,7 @@ export interface PtyRuntimeTransport {
|
|
|
30
30
|
kill(): void;
|
|
31
31
|
clearBuffer?(): void;
|
|
32
32
|
detach?(): void;
|
|
33
|
+
updateMeta?(meta: Record<string, unknown>, replace?: boolean): void;
|
|
33
34
|
getMetadata?(): PtyRuntimeMetadata | null;
|
|
34
35
|
onData(callback: (data: string) => void): void;
|
|
35
36
|
onExit(callback: (info: {
|
|
@@ -3,6 +3,7 @@ import type { PtyRuntimeTransport, PtySpawnOptions, PtyTransportFactory } from '
|
|
|
3
3
|
interface SessionHostPtyTransportFactoryOptions {
|
|
4
4
|
endpoint?: SessionHostEndpoint;
|
|
5
5
|
appName?: string;
|
|
6
|
+
ensureReady?: () => Promise<void>;
|
|
6
7
|
clientId: string;
|
|
7
8
|
runtimeId: string;
|
|
8
9
|
providerType: string;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
|
|
8
8
|
import { ProviderLoader } from '../providers/provider-loader.js';
|
|
9
|
+
import type { ProviderResumeCapability } from '../providers/contracts.js';
|
|
9
10
|
import type { CliAdapter } from '../cli-adapter-types.js';
|
|
10
11
|
import type { PtyTransportFactory } from '../cli-adapters/pty-transport.js';
|
|
11
12
|
import type { SessionRegistry } from '../sessions/registry.js';
|
|
@@ -14,7 +15,7 @@ export interface CliManagerDeps {
|
|
|
14
15
|
getServerConn(): any | null;
|
|
15
16
|
/** P2P — PTY output transmit */
|
|
16
17
|
getP2p(): {
|
|
17
|
-
|
|
18
|
+
broadcastSessionOutput(key: string, data: string): void;
|
|
18
19
|
} | null;
|
|
19
20
|
/** StatusReporter callback */
|
|
20
21
|
onStatusChange(): void;
|
|
@@ -34,6 +35,7 @@ export interface CliTransportFactoryParams {
|
|
|
34
35
|
providerType: string;
|
|
35
36
|
workspace: string;
|
|
36
37
|
cliArgs?: string[];
|
|
38
|
+
providerSessionId?: string;
|
|
37
39
|
attachExisting?: boolean;
|
|
38
40
|
}
|
|
39
41
|
export interface HostedCliRuntimeDescriptor {
|
|
@@ -46,7 +48,9 @@ export interface HostedCliRuntimeDescriptor {
|
|
|
46
48
|
cliType: string;
|
|
47
49
|
workspace: string;
|
|
48
50
|
cliArgs?: string[];
|
|
51
|
+
providerSessionId?: string;
|
|
49
52
|
}
|
|
53
|
+
export declare function supportsExplicitSessionResume(resume?: ProviderResumeCapability): boolean;
|
|
50
54
|
export declare class DaemonCliManager {
|
|
51
55
|
readonly adapters: Map<string, CliAdapter>;
|
|
52
56
|
private deps;
|
|
@@ -60,7 +64,12 @@ export declare class DaemonCliManager {
|
|
|
60
64
|
private createAdapter;
|
|
61
65
|
private startCliExitMonitor;
|
|
62
66
|
private registerCliInstance;
|
|
63
|
-
startSession(cliType: string, workingDir: string, cliArgs?: string[], initialModel?: string
|
|
67
|
+
startSession(cliType: string, workingDir: string, cliArgs?: string[], initialModel?: string, options?: {
|
|
68
|
+
resumeSessionId?: string;
|
|
69
|
+
}): Promise<{
|
|
70
|
+
runtimeSessionId: string;
|
|
71
|
+
providerSessionId?: string;
|
|
72
|
+
}>;
|
|
64
73
|
stopSession(key: string): Promise<void>;
|
|
65
74
|
stopSessionWithMode(key: string, mode: 'hard' | 'save'): Promise<void>;
|
|
66
75
|
shutdownAll(): void;
|
|
@@ -13,10 +13,21 @@ interface HistoryMessage {
|
|
|
13
13
|
receivedAt: number;
|
|
14
14
|
role: 'user' | 'assistant' | 'system';
|
|
15
15
|
content: string;
|
|
16
|
+
kind?: string;
|
|
17
|
+
senderName?: string;
|
|
16
18
|
agent: string;
|
|
17
19
|
instanceId?: string;
|
|
20
|
+
historySessionId?: string;
|
|
18
21
|
sessionTitle?: string;
|
|
19
22
|
}
|
|
23
|
+
export interface SavedHistorySessionSummary {
|
|
24
|
+
historySessionId: string;
|
|
25
|
+
sessionTitle?: string;
|
|
26
|
+
messageCount: number;
|
|
27
|
+
firstMessageAt: number;
|
|
28
|
+
lastMessageAt: number;
|
|
29
|
+
preview?: string;
|
|
30
|
+
}
|
|
20
31
|
export declare class ChatHistoryWriter {
|
|
21
32
|
/** Last seen message count per agent (deduplication) */
|
|
22
33
|
private lastSeenCounts;
|
|
@@ -35,7 +46,19 @@ export declare class ChatHistoryWriter {
|
|
|
35
46
|
role: string;
|
|
36
47
|
content: string;
|
|
37
48
|
receivedAt?: number;
|
|
38
|
-
|
|
49
|
+
kind?: string;
|
|
50
|
+
senderName?: string;
|
|
51
|
+
historyDedupKey?: string;
|
|
52
|
+
}>, sessionTitle?: string, instanceId?: string, historySessionId?: string): void;
|
|
53
|
+
appendSystemMarker(agentType: string, content: string, options?: {
|
|
54
|
+
sessionTitle?: string;
|
|
55
|
+
instanceId?: string;
|
|
56
|
+
historySessionId?: string;
|
|
57
|
+
dedupKey?: string;
|
|
58
|
+
receivedAt?: number;
|
|
59
|
+
senderName?: string;
|
|
60
|
+
}): void;
|
|
61
|
+
promoteHistorySession(agentType: string, previousHistorySessionId: string, nextHistorySessionId: string): void;
|
|
39
62
|
/** Called when agent session is explicitly changed */
|
|
40
63
|
onSessionChange(agentType: string): void;
|
|
41
64
|
/** Delete history files older than 30 days */
|
|
@@ -50,8 +73,15 @@ export declare class ChatHistoryWriter {
|
|
|
50
73
|
* When instanceId is specified, reads only that instance file.
|
|
51
74
|
* Offset/limit-based paging.
|
|
52
75
|
*/
|
|
53
|
-
export declare function readChatHistory(agentType: string, offset?: number, limit?: number,
|
|
76
|
+
export declare function readChatHistory(agentType: string, offset?: number, limit?: number, historySessionId?: string): {
|
|
54
77
|
messages: HistoryMessage[];
|
|
55
78
|
hasMore: boolean;
|
|
56
79
|
};
|
|
80
|
+
export declare function listSavedHistorySessions(agentType: string, options?: {
|
|
81
|
+
offset?: number;
|
|
82
|
+
limit?: number;
|
|
83
|
+
}): {
|
|
84
|
+
sessions: SavedHistorySessionSummary[];
|
|
85
|
+
hasMore: boolean;
|
|
86
|
+
};
|
|
57
87
|
export {};
|
package/dist/config/config.d.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { WorkspaceEntry } from './workspaces.js';
|
|
7
7
|
import type { RecentActivityEntry } from './recent-activity.js';
|
|
8
|
+
import type { SavedProviderSessionEntry } from './saved-sessions.js';
|
|
8
9
|
export type { WorkspaceEntry } from './workspaces.js';
|
|
9
10
|
export type { RecentActivityEntry } from './recent-activity.js';
|
|
11
|
+
export type { SavedProviderSessionEntry } from './saved-sessions.js';
|
|
10
12
|
export interface ADHDevConfig {
|
|
11
13
|
serverUrl: string;
|
|
12
14
|
selectedIde: string | null;
|
|
@@ -23,6 +25,8 @@ export interface ADHDevConfig {
|
|
|
23
25
|
defaultWorkspaceId?: string | null;
|
|
24
26
|
/** Unified recent activity across IDE / CLI / ACP launch flows */
|
|
25
27
|
recentActivity?: RecentActivityEntry[];
|
|
28
|
+
/** Persistent resume-capable provider sessions keyed by providerSessionId */
|
|
29
|
+
savedProviderSessions?: SavedProviderSessionEntry[];
|
|
26
30
|
/** Last seen timestamps for live sessions, keyed by sessionId */
|
|
27
31
|
sessionReads?: Record<string, number>;
|
|
28
32
|
/** Last seen completion marker for live sessions, keyed by sessionId */
|
|
@@ -38,7 +42,7 @@ export interface ADHDevConfig {
|
|
|
38
42
|
* Server-side D1 `machines.id` — the row ID assigned when daemon registers via
|
|
39
43
|
* `POST /cli/complete`. Used as fallback for machine lookup on re-auth.
|
|
40
44
|
*
|
|
41
|
-
* @deprecated Legacy bridge field — will be removed after 2026-
|
|
45
|
+
* @deprecated Legacy bridge field — will be removed after 2026-05-01.
|
|
42
46
|
* Modern auth flow uses `machineSecret` (adm_) to identify machines.
|
|
43
47
|
*/
|
|
44
48
|
registeredMachineId?: string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Unlike live session state, this is launch oriented:
|
|
5
5
|
* - one normalized row shape for IDE / CLI / ACP
|
|
6
|
-
* - deduped by kind + providerType + workspace
|
|
6
|
+
* - deduped by provider session when available, else by kind + providerType + workspace
|
|
7
7
|
* - used only for quick-launch shortcuts
|
|
8
8
|
*/
|
|
9
9
|
import type { ADHDevConfig } from './config.js';
|
|
@@ -12,12 +12,14 @@ export interface RecentActivityEntry {
|
|
|
12
12
|
kind: 'ide' | 'cli' | 'acp';
|
|
13
13
|
providerType: string;
|
|
14
14
|
providerName: string;
|
|
15
|
+
providerSessionId?: string;
|
|
15
16
|
workspace?: string | null;
|
|
16
17
|
currentModel?: string;
|
|
17
18
|
title?: string;
|
|
18
19
|
lastUsedAt: number;
|
|
19
20
|
}
|
|
20
21
|
export declare function buildRecentActivityKey(entry: Pick<RecentActivityEntry, 'kind' | 'providerType' | 'workspace'>): string;
|
|
22
|
+
export declare function buildRecentActivityKeyForEntry(entry: Pick<RecentActivityEntry, 'kind' | 'providerType' | 'workspace' | 'providerSessionId'>): string;
|
|
21
23
|
export declare function appendRecentActivity(config: ADHDevConfig, entry: Omit<RecentActivityEntry, 'id' | 'lastUsedAt'> & {
|
|
22
24
|
lastUsedAt?: number;
|
|
23
25
|
}): ADHDevConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ADHDevConfig } from './config.js';
|
|
2
|
+
export interface SavedProviderSessionEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: 'cli' | 'acp';
|
|
5
|
+
providerType: string;
|
|
6
|
+
providerName: string;
|
|
7
|
+
providerSessionId: string;
|
|
8
|
+
workspace?: string | null;
|
|
9
|
+
currentModel?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
lastUsedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function buildSavedProviderSessionKey(providerSessionId: string): string;
|
|
15
|
+
export declare function upsertSavedProviderSession(config: ADHDevConfig, entry: Omit<SavedProviderSessionEntry, 'id' | 'createdAt' | 'lastUsedAt'> & {
|
|
16
|
+
createdAt?: number;
|
|
17
|
+
lastUsedAt?: number;
|
|
18
|
+
}): ADHDevConfig;
|
|
19
|
+
export declare function getSavedProviderSessions(config: ADHDevConfig, filters?: {
|
|
20
|
+
providerType?: string;
|
|
21
|
+
kind?: SavedProviderSessionEntry['kind'];
|
|
22
|
+
}): SavedProviderSessionEntry[];
|
|
@@ -7,6 +7,21 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type * as http from 'http';
|
|
9
9
|
import type { DevServerContext, ProviderCategory } from './dev-server-types.js';
|
|
10
|
+
type CliExerciseVerification = {
|
|
11
|
+
request?: Record<string, any>;
|
|
12
|
+
mustContainAny?: string[];
|
|
13
|
+
mustNotContainAny?: string[];
|
|
14
|
+
mustMatchAny?: string[];
|
|
15
|
+
mustNotMatchAny?: string[];
|
|
16
|
+
lastAssistantMustContainAny?: string[];
|
|
17
|
+
lastAssistantMustNotContainAny?: string[];
|
|
18
|
+
lastAssistantMustMatchAny?: string[];
|
|
19
|
+
lastAssistantMustNotMatchAny?: string[];
|
|
20
|
+
inspectFields?: string[];
|
|
21
|
+
description?: string;
|
|
22
|
+
fixtureName?: string;
|
|
23
|
+
fixtureNames?: string[];
|
|
24
|
+
};
|
|
10
25
|
export declare function getDefaultAutoImplReference(ctx: DevServerContext, category: string, type: string): string;
|
|
11
26
|
export declare function resolveAutoImplReference(ctx: DevServerContext, category: string, requestedReference: string | undefined, targetType: string): string | null;
|
|
12
27
|
export declare function getLatestScriptVersionDir(scriptsDir: string): string | null;
|
|
@@ -16,11 +31,12 @@ export declare function resolveAutoImplWritableProviderDir(ctx: DevServerContext
|
|
|
16
31
|
};
|
|
17
32
|
export declare function loadAutoImplReferenceScripts(ctx: DevServerContext, referenceType: string | null): Record<string, string>;
|
|
18
33
|
export declare function handleAutoImplement(ctx: DevServerContext, type: string, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
19
|
-
export declare function buildAutoImplPrompt(ctx: DevServerContext, type: string, provider: any, providerDir: string, functions: string[], domContext: any, referenceScripts: Record<string, string>, userComment?: string, referenceType?: string | null): string;
|
|
20
|
-
export declare function buildCliAutoImplPrompt(ctx: DevServerContext, type: string, provider: any, providerDir: string, functions: string[], referenceScripts: Record<string, string>, userComment?: string, referenceType?: string | null): string;
|
|
34
|
+
export declare function buildAutoImplPrompt(ctx: DevServerContext, type: string, provider: any, providerDir: string, functions: string[], domContext: any, referenceScripts: Record<string, string>, userComment?: string, referenceType?: string | null, verification?: CliExerciseVerification): string;
|
|
35
|
+
export declare function buildCliAutoImplPrompt(ctx: DevServerContext, type: string, provider: any, providerDir: string, functions: string[], referenceScripts: Record<string, string>, userComment?: string, referenceType?: string | null, verification?: CliExerciseVerification): string;
|
|
21
36
|
export declare function handleAutoImplSSE(ctx: DevServerContext, type: string, req: http.IncomingMessage, res: http.ServerResponse): void;
|
|
22
37
|
export declare function handleAutoImplCancel(ctx: DevServerContext, _type: string, _req: http.IncomingMessage, res: http.ServerResponse): void;
|
|
23
38
|
export declare function sendAutoImplSSE(ctx: DevServerContext, msg: {
|
|
24
39
|
event: string;
|
|
25
40
|
data: any;
|
|
26
41
|
}): void;
|
|
42
|
+
export {};
|
|
@@ -6,6 +6,77 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type * as http from 'http';
|
|
8
8
|
import type { DevServerContext } from './dev-server-types.js';
|
|
9
|
+
type CliExerciseRequest = {
|
|
10
|
+
type?: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
instanceId?: string;
|
|
13
|
+
workingDir?: string;
|
|
14
|
+
args?: string[];
|
|
15
|
+
autoLaunch?: boolean;
|
|
16
|
+
freshSession?: boolean;
|
|
17
|
+
autoResolveApprovals?: boolean;
|
|
18
|
+
approvalButtonIndex?: number;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
readyTimeoutMs?: number;
|
|
21
|
+
idleSettledMs?: number;
|
|
22
|
+
traceLimit?: number;
|
|
23
|
+
stopWhenDone?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type CliFixtureAssertions = {
|
|
26
|
+
mustContainAny?: string[];
|
|
27
|
+
mustNotContainAny?: string[];
|
|
28
|
+
mustMatchAny?: string[];
|
|
29
|
+
mustNotMatchAny?: string[];
|
|
30
|
+
lastAssistantMustContainAny?: string[];
|
|
31
|
+
lastAssistantMustNotContainAny?: string[];
|
|
32
|
+
lastAssistantMustMatchAny?: string[];
|
|
33
|
+
lastAssistantMustNotMatchAny?: string[];
|
|
34
|
+
statusesSeen?: string[];
|
|
35
|
+
requireNotTimedOut?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type CliExerciseFixture = {
|
|
38
|
+
version: 1;
|
|
39
|
+
kind: 'cli-exercise-fixture';
|
|
40
|
+
name: string;
|
|
41
|
+
type: string;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
providerDir: string | null;
|
|
44
|
+
providerResolution: Record<string, any> | null;
|
|
45
|
+
request: CliExerciseRequest;
|
|
46
|
+
result: Record<string, any>;
|
|
47
|
+
assertions: CliFixtureAssertions;
|
|
48
|
+
notes?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare function validateCliFixtureResult(result: any, assertions: CliFixtureAssertions): string[];
|
|
51
|
+
export declare function runCliExerciseInternal(ctx: DevServerContext, body: CliExerciseRequest): Promise<Record<string, any>>;
|
|
52
|
+
export declare function runCliAutoImplVerification(ctx: DevServerContext, type: string, verification?: {
|
|
53
|
+
request?: Record<string, any>;
|
|
54
|
+
mustContainAny?: string[];
|
|
55
|
+
mustNotContainAny?: string[];
|
|
56
|
+
mustMatchAny?: string[];
|
|
57
|
+
mustNotMatchAny?: string[];
|
|
58
|
+
lastAssistantMustContainAny?: string[];
|
|
59
|
+
lastAssistantMustNotContainAny?: string[];
|
|
60
|
+
lastAssistantMustMatchAny?: string[];
|
|
61
|
+
lastAssistantMustNotMatchAny?: string[];
|
|
62
|
+
fixtureName?: string;
|
|
63
|
+
fixtureNames?: string[];
|
|
64
|
+
}): Promise<{
|
|
65
|
+
mode: 'fixture_replay' | 'fixture_replay_suite' | 'exercise';
|
|
66
|
+
pass: boolean;
|
|
67
|
+
failures: string[];
|
|
68
|
+
result: Record<string, any>;
|
|
69
|
+
assertions: CliFixtureAssertions;
|
|
70
|
+
fixture?: CliExerciseFixture;
|
|
71
|
+
results?: Array<{
|
|
72
|
+
fixtureName: string;
|
|
73
|
+
pass: boolean;
|
|
74
|
+
failures: string[];
|
|
75
|
+
result: Record<string, any>;
|
|
76
|
+
assertions: CliFixtureAssertions;
|
|
77
|
+
fixture: CliExerciseFixture;
|
|
78
|
+
}>;
|
|
79
|
+
}>;
|
|
9
80
|
/** GET /api/cli/status — list all running CLI/ACP instances with state */
|
|
10
81
|
export declare function handleCliStatus(ctx: DevServerContext, _req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
11
82
|
/** POST /api/cli/launch — launch a CLI agent { type, workingDir?, args? } */
|
|
@@ -18,7 +89,18 @@ export declare function handleCliStop(ctx: DevServerContext, req: http.IncomingM
|
|
|
18
89
|
export declare function handleCliSSE(ctx: DevServerContext, cliSSEClients: http.ServerResponse[], _req: http.IncomingMessage, res: http.ServerResponse): void;
|
|
19
90
|
/** GET /api/cli/debug/:type — full internal debug state of a CLI adapter */
|
|
20
91
|
export declare function handleCliDebug(ctx: DevServerContext, type: string, _req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
92
|
+
/** GET /api/cli/trace/:type — recent CLI trace timeline plus current debug snapshot */
|
|
93
|
+
export declare function handleCliTrace(ctx: DevServerContext, type: string, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
94
|
+
/** POST /api/cli/exercise — autonomously run a CLI repro and wait for final settled trace */
|
|
95
|
+
export declare function handleCliExercise(ctx: DevServerContext, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
96
|
+
/** POST /api/cli/fixture/capture — run exact exercise once and persist it as a reusable fixture */
|
|
97
|
+
export declare function handleCliFixtureCapture(ctx: DevServerContext, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
98
|
+
/** GET /api/cli/fixtures/:type — list saved exercise fixtures for a provider */
|
|
99
|
+
export declare function handleCliFixtureList(ctx: DevServerContext, type: string, _req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
100
|
+
/** POST /api/cli/fixture/replay — rerun a saved exact exercise and validate against saved assertions */
|
|
101
|
+
export declare function handleCliFixtureReplay(ctx: DevServerContext, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
21
102
|
/** POST /api/cli/resolve — resolve an approval modal { type, buttonIndex } */
|
|
22
103
|
export declare function handleCliResolve(ctx: DevServerContext, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
23
104
|
/** POST /api/cli/raw — send raw keystrokes to PTY { type, keys } */
|
|
24
105
|
export declare function handleCliRaw(ctx: DevServerContext, req: http.IncomingMessage, res: http.ServerResponse): Promise<void>;
|
|
106
|
+
export {};
|
|
@@ -119,6 +119,10 @@ export declare class DevServer implements DevServerContext {
|
|
|
119
119
|
private handleCliLaunch;
|
|
120
120
|
/** POST /api/cli/send — send message to a running CLI { type, text } */
|
|
121
121
|
private handleCliSend;
|
|
122
|
+
/** POST /api/cli/exercise — launch/send/approve/wait helper for provider-fix loops */
|
|
123
|
+
private handleCliExercise;
|
|
124
|
+
private handleCliFixtureCapture;
|
|
125
|
+
private handleCliFixtureReplay;
|
|
122
126
|
/** POST /api/cli/stop — stop a running CLI { type } */
|
|
123
127
|
private handleCliStop;
|
|
124
128
|
/** GET /api/cli/events — SSE stream of CLI status events */
|
|
@@ -126,6 +130,9 @@ export declare class DevServer implements DevServerContext {
|
|
|
126
130
|
sendCliSSE(data: any): void;
|
|
127
131
|
/** GET /api/cli/debug/:type — full internal debug state of a CLI adapter */
|
|
128
132
|
private handleCliDebug;
|
|
133
|
+
/** GET /api/cli/trace/:type — recent CLI trace timeline plus current debug snapshot */
|
|
134
|
+
private handleCliTrace;
|
|
135
|
+
private handleCliFixtureList;
|
|
129
136
|
/** POST /api/cli/resolve — resolve an approval modal { type, buttonIndex } */
|
|
130
137
|
private handleCliResolve;
|
|
131
138
|
/** POST /api/cli/raw — send raw keystrokes to PTY { type, keys } */
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export { loadConfig, saveConfig, resetConfig, isSetupComplete, markSetupComplete
|
|
|
20
20
|
export { getWorkspaceState } from './config/workspaces.js';
|
|
21
21
|
export { appendRecentActivity, getRecentActivity } from './config/recent-activity.js';
|
|
22
22
|
export type { RecentActivityEntry } from './config/recent-activity.js';
|
|
23
|
+
export { getSavedProviderSessions, upsertSavedProviderSession } from './config/saved-sessions.js';
|
|
24
|
+
export type { SavedProviderSessionEntry } from './config/saved-sessions.js';
|
|
23
25
|
export { detectIDEs } from './detection/ide-detector.js';
|
|
24
26
|
export type { IDEInfo } from './detection/ide-detector.js';
|
|
25
27
|
export { detectCLIs } from './detection/cli-detector.js';
|